diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignable.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/InDetAlignable.py
similarity index 100%
rename from InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignable.py
rename to InnerDetector/InDetConditions/PixelConditionsTools/share/InDetAlignable.py
diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py
index d6856b680591bc2d9bd694788a6e03f461ebb14d..da2714279c02b4c0bf105a77fc7b57652d273a71 100755
--- a/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py
+++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py
@@ -66,7 +66,7 @@ DetDescrVersion = "ATLAS-DC3-05"
 # This job option fragment needs to included before
 # AtlasGeoModel/GeoModelInit.py is included.
 # Block the defaults.
-include.block("InDetAlignExample/InDetAlignable.py") 
+include.block("PixelConditionsTools/InDetAlignable.py") 
 ##
 include ("AtlasGeoModel/SetGeometryVersion.py")
 include ("AtlasGeoModel/GeoModelInit.py")
diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py
index 53edef679088c5741f5d32bfc4002aab7e906dbb..4c6e28f0fbc1316c299abacd8b2b93f91d353fc4 100755
--- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py
+++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py
@@ -66,7 +66,7 @@ DetDescrVersion = "ATLAS-DC3-05"
 # This job option fragment needs to included before
 # AtlasGeoModel/GeoModelInit.py is included.
 # Block the defaults.
-include.block("InDetAlignExample/InDetAlignable.py") 
+include.block("PixelConditionsTools/InDetAlignable.py") 
 ##
 include ("AtlasGeoModel/SetGeometryVersion.py")
 include ("AtlasGeoModel/GeoModelInit.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/BowingDB/BowingNULL.db b/InnerDetector/InDetExample/InDetAlignExample/BowingDB/BowingNULL.db
deleted file mode 100644
index ba0ac50810c4699afd5aa7aa8d8d17820c4bd1f5..0000000000000000000000000000000000000000
Binary files a/InnerDetector/InDetExample/InDetAlignExample/BowingDB/BowingNULL.db and /dev/null differ
diff --git a/InnerDetector/InDetExample/InDetAlignExample/BowingDB/dummy.txt b/InnerDetector/InDetExample/InDetAlignExample/BowingDB/dummy.txt
deleted file mode 100644
index b30f084c0ba6b52a709a26275507f95915406959..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/BowingDB/dummy.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# dummy file for IBLDist upload
-# stave eta mag base free
-#
-0 0 0 0 0
-1 0 0 0 0
-2 0 0 0 0
-3 0 0 0 0
-4 0 0 0 0
-5 0 0 0 0
-6 0 0 0 0
-7 0 0 0 0
-8 0 0 0 0
-9 0 0 0 0
-10 0 0 0 0
-11 0 0 0 0
-12 0 0 0 0
-13 0 0 0 0
diff --git a/InnerDetector/InDetExample/InDetAlignExample/BowingDB/set_ibldist.py b/InnerDetector/InDetExample/InDetAlignExample/BowingDB/set_ibldist.py
deleted file mode 100755
index 5f88f52b84f3d4b1f67d94b519e9601dfe26e3a8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/BowingDB/set_ibldist.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# set_ibldist.py - tool to generate COOL sqlite DB fragment for IBL distortion
-# Richard Hawkings, 21/5/15
-# execute without arguments for help
-
-## Matthias:
-# Use the script:
-# ./set_ibldist.py  CONDBR2 IndetIBLDist dummy.txt 0 100
-# The last 2 numbers are the LB range, this needs to be enabled below; 
-# Otherwise the IOV will be set form firt to last run for the full LB range
-
-import os,sys
-from PyCool import cool
-from CoolConvUtilities import AtlCoolLib
-
-class setIBLDist(AtlCoolLib.coolTool):
-    def setup(self,args):
-        "Setup routine called from initialisation"
-        # set value of non-optional parameters
-        self.tag=str(args[0])
-        self.txtfile=str(args[1])
-        #self.runmin=281411            # Set here the RunNr. min
-        #self.runmax=281411            # Set here the RunNr. max
-        #self.lumimin=int(args[2])     # Set here the LB min
-        #self.lumimax=int(args[3])     # Set here the LB max
-
-    def usage(self):
-        "Define the additional syntax for options"
-        self._usage1()
-        print "COOL_tag txtfile"
-        self._usage2()
-
-
-    def execute(self):
-        "Execute the database creation/update"
-        # setup specification 
-        spec=cool.RecordSpecification()
-        spec.extend("stave",cool.StorageType.Int32)
-        spec.extend("eta",cool.StorageType.Int32)
-        spec.extend("mag",cool.StorageType.Float)
-        spec.extend("base",cool.StorageType.Float)
-        spec.extend("free",cool.StorageType.Float)
-
-        # create folder if it does not exist
-        folder='/Indet/IBLDist'
-        cfolder=AtlCoolLib.ensureFolder(self.db,folder,spec,AtlCoolLib.athenaDesc(self.runLumi,'CondAttrListCollection'),cool.FolderVersioning.MULTI_VERSION)
-        if (cfolder is None): sys.exit(1)
-
-        # read data from the text file
-        print "Reading input data from %s" % self.txtfile
-        bowdata=[]
-        staves=[]
-        for iline in open(self.txtfile).readlines():
-            # split line into space-separated tokens, ignoring newline
-            tokens=iline[:-1].split()
-            # skip lines starting with #
-            if tokens[0]=='#': continue
-            # expect format '<stave> <eta> <mag> <base> <free>'
-            if len(tokens)!=5:
-                print "Skipping malformed line with %i tokens: " % len(tokens), iline 
-            else:
-                stave=int(tokens[0])
-                eta=int(tokens[1])
-                mag=float(tokens[2])
-                base=float(tokens[3])
-                free=float(tokens[4])
-                if stave not in staves:
-                    bowdata+=[(stave,eta,mag,base,free)]
-                    staves+=[stave]
-                else:
-                    print "ERROR: read multiple lines for stave %i" % stave
-        print "Ready to add data for %i staves" % len(bowdata)
-        
-        # now print data and write to COOL folder
-        print "Channel Stave  eta    mag   base   free"
-        for idata in bowdata:
-            (stave,eta,mag,base,free)=idata
-            # determine channel number from stave and eta
-            # have 14 staves 0-13, and eta -10 to +9
-            channel=100*(1+stave)+eta
-            print "%7i" % channel, "%3i %6i %6.3f %6.3f %6.3f" % idata
-            payload=cool.Record(spec)
-            payload['stave']=stave
-            payload['eta']=eta
-            payload['mag']=mag #*.001
-            payload['base']=base  #*.001
-            payload['free']=free
-            try:
-                cfolder.storeObject(self.since,self.until,payload,channel,self.tag)
-            except Exception,e:
-                print e
-                print "Store to COOL failed for channel %i" % channel
-                sys.exit(-1)
-
-
-smytool=setIBLDist('set_ibldist.py',False,5,5,[])
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CMakeLists.txt b/InnerDetector/InDetExample/InDetAlignExample/CMakeLists.txt
deleted file mode 100644
index b9e8eee27f5887b4cf87b26735d9bfd3ec1ae382..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-################################################################################
-# Package: InDetAlignExample
-################################################################################
-
-# Declare the package name:
-atlas_subdir( InDetAlignExample )
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          TestPolicy )
-
-# Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py share/InDetAlignExampleFlags/*.py share/Data/*.txt )
-atlas_install_runtime( test/InDetAlignExample_TestConfiguration.xml macros/*.cc html/*.html )
-atlas_install_scripts( share/RunIterator_Run2Rel19.py )
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Accumulate_trf.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Accumulate_trf.py
deleted file mode 100644
index e326ed4345ecf1558b1ce5a6feb011e67bfa40ee..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Accumulate_trf.py
+++ /dev/null
@@ -1,527 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-### last change by $Vicente Lacuesta$
-### $09-03-2011$
-### $0.9$
-
-#########################################################################
-##
-## Accumulate trf for Tier-0: 
-##
-##  - input parameter: file containing a pickled dictionary consisting of the key/value pairs
-##
-##     1) 'inputRAWFiles': python list 
-##          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) 
-##        or list of file dictionaries 
-##          [{'lfn':'fname1', 'checksum':'cks1', 'dsn':'dsn1', 'size':sz1, 'guid':'guid1', 'events':nevts1, ...},  
-##           {'lfn':'fname2', 'checksum':'cks2', 'dsn':'dsn2', 'size':sz2, 'guid':'guid2', 'events':nevts2, ...}, ...] 
-##     2) 'outputTFile': string 'datasetname#filename' 
-##        (output TFile containing the matrix, vector...) 
-##     3) 'outputMonitoringFile': string 'datasetname#filename' 
-##        (output monitoring file) 
-##     4) 'iteration': integer 
-##        (number of current iteration)
-##     5) 'events': integer 
-##        (number of events to process, -1 for all)
-##
-##  - assembles custom jobOptions file, runs athena
-##  - generates an outputTFile and a monitoring.root file
-##
-##########################################################################
-
-import sys, string, commands, os.path, os, pickle, time, pprint, xmlrpclib
-
-#########################################################################
-
-# Utility function
-
-def getFileMap(fname, dsname, nevts=0) :
-    if os.path.isfile(fname) :
-        sz = os.path.getsize(fname)
-        map = { 'lfn': fname,
-                'dataset': dsname,
-                'size': sz,
-                'events': nevts
-              }
-    else : 
-        map = {}
-    return map
-
-#########################################################################
-
-        
-def accumData(picklefile) :
-    t0 = time.time()
-    
-    print "\n##################################################################"
-    print   "##             ATLAS Tier-0 Alignment Processing                ##"
-    print   "##################################################################\n"
-
-    # extract parameters from pickle file
-    print "Using pickled file ", picklefile, " for input parameters"
-    f = open(picklefile, 'r')
-    parmap = pickle.load(f)
-    f.close()
-
-    print "\nAlignment Processing run options:\n"
-    pprint.pprint(parmap)
-      
-    inputfilelist = parmap.get('inputRAWFiles', [])
-    nfiles = len(inputfilelist) 
-    if not nfiles :   # problem with job definition or reading pickle file
-        dt = int(time.time() - t0) 
-        retcode = 1
-        acronym = 'TRF_NOINPUT'
-        txt = 'empty input file list'  
-        outmap = { 'prodsys': { 'trfCode': retcode,
-                                'trfAcronym': acronym,  
-                                'jobOutputs': [],
-                                'jobInputs': [],
-                                'nevents': 0,
-                                'more': { 'num1': 0, 'num2': dt, 'txt1': txt }
-                              }
-                 }
-    else : 
-        # assemble list of ['filename1', 'filename2', ...]  
-        inputdsname = ''
-        inputfilenames = []
-        svcclass = ''
-        if isinstance(inputfilelist[0], str) :  
-            inputdsname = (inputfilelist[0]).split('#')[0]
-            for val in inputfilelist :
-                inputfilenames.append(val.split('#')[1])
-        elif isinstance(inputfilelist[0], dict) :
-            inputdsname = inputfilelist[0]['dsn']
-            svcclass = inputfilelist[0].get('svcclass', '')
-            for fdict in inputfilelist :
-                if fdict.has_key('pfn') : 
-                    # full remote path, for direct access on storage
-                    if fdict['pfn'].startswith('/castor') :
-                        inputfilenames.append('root://castoratlas/' + fdict['pfn'])
-                        #inputfilenames.append('rfio:' + fdict['pfn'])
-                    else :
-                        inputfilenames.append(fdict['pfn'])
-                else :
-                    inputfilenames.append(fdict['lfn'])    
-
-        #alignmentLevel = int(parmap['alignmentLevel']) 
-         
-        runnr = int(inputdsname.split('.')[1])
-        project = inputdsname.split('.')[0] 
-        events = parmap['events']
-        iteration = parmap['iteration']  
-
-        tfiledsname = (parmap['outputTFile']).split('#')[0]
-        tfile = (parmap['outputTFile']).split('#')[1]
-              
-        mondsname = (parmap['outputMonitoringFile']).split('#')[0]
-        monfile = (parmap['outputMonitoringFile']).split('#')[1]
-
-        # get beamspot tag
-        #from InDetBeamSpotExample import COOLUtils
-        #beamspottag = COOLUtils.resolveCurrentBeamSpotFolder()
-
-        if iteration >= 1 :
-            inputAlignmentConstants = "/afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/tmpconstants/%d/%d_AlignmentConstants_Iter%d.root" % (project, runnr, runnr, iteration-1)
-        else :
-            inputAlignmentConstants = ""
-
-        (s,o) = commands.getstatusoutput('rm -f myJobOptions.py')
-        jOFile = open('myJobOptions.py', 'w')
-        if iteration <= 1 :
-            cont = '''
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputFiles = %s
-inputAlignmentConstants = "%s"
-numberOfEvents = %d
-
-##-------- Alignment Configuration --------------------
-
-if len(inputAlignmentConstants) != 0 :
-    readConstantsFromPool = True
-    inputPoolFiles = [inputAlignmentConstants]
-else :
-    readConstantsFromPool = False
-
-WriteTFile    = True
-runAccumulate = True
-runSolving    = False
-
-##-------- Extra Configuration --------------------
-#from InDetBeamSpotExample import COOLUtils
-#beamSpotTag = COOLUtils.resolveCurrentBeamSpotFolder()
-#beamSpotTag = "IndetBeampos-ES1-UPD2-03"
-
-#print beamSpotTag
-
-doReadBS       = False
-doBSConstraint = False
-doPVConstraint = False
-doTrkNtuple    = False
-doMonitoring   = True
-
-Cosmics     = True
-realData    = True
-useTRT      = True
-BField      = True
-dataSource  = 'data' 
-projectName = '%s'
-PtCut       = 2000
-
-#Alignment Method is GX2
-runLocal      = False
-solveLocal    = False
-solvingOption =	1
-
-# Temp configuration
-ModCut = 0
-detectorDescription = "ATLAS-R2-2015-02-00-00"
-globalTag = "CONDBR2-ES1PA-2014-03"
-
-#siAlignmentTag = "InDetAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-siAlignmentTag = ""
-
-#trtAlignmentTag   = "TRTAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-#trtAlignmentTagL3 = "TRTCalibDX_EoverP_189598_189845v1"
-
-## Pixel Alignment Levels 
-pixelAlignmentLevel = 11
-pixelAlignmentLevelBarrel = -1
-pixelAlignmentLevelEndcaps = -1
-
-## Pixel alignment DoFs
-alignPixel = True
-pixelAlignBarrel = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = False
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = False
-pixelAlignEndcapRotY = False
-pixelAlignEndcapRotZ = True
-
-## SCT Alignment Levels 
-sctAlignmentLevel = 1
-sctAlignmentLevelBarrel = -1
-sctAlignmentLevelEndcaps = -1
-
-## SCT alignment DoFs
-alignSCT = True
-sctAlignBarrel = True
-sctAlignEndcaps = False
-
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = False
-sctAlignBarrelZ = False
-sctAlignBarrelRotX = False
-sctAlignBarrelRotY = True
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = True
-sctAlignEndcapRotX = True
-sctAlignEndcapRotY = True
-sctAlignEndcapRotZ = True
-
-## TRT Alignment Levels 
-alignTRT = False
-trtAlignmentLevel = 1
-trtAlignBarrel = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = False
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = False
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-##-------- End of custom options -------------
-
-##-------- Loading the Alignment Levels --------------------
-include("InDetAlignExample/NewInDetAlignLevels.py") 
-
-##-------- Reconstruction Configuration --------------------
-
-##-------- Load Reconstruction -----------------------------
-include("InDetAlignExample/jobOption_RecExCommon.py") 
-include("InDetAlignExample/jobOption_ConditionsOverrider.py") 
-
-##-------- Load Alignment ----------------------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-###############################################################
-            ''' % (str(inputfilenames), inputAlignmentConstants, events, project)
-        else :
-            cont = '''
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputFiles = %s
-inputAlignmentConstants = "%s"
-numberOfEvents = %d
-
-##-------- Alignment Configuration --------------------
-
-if len(inputAlignmentConstants) != 0 :
-    readConstantsFromPool = True
-    inputPoolFiles = [inputAlignmentConstants]
-else :
-    readConstantsFromPool = False
-
-WriteTFile    = True
-runAccumulate = True
-runSolving    = False
-
-##-------- Extra Configuration --------------------
-#from InDetBeamSpotExample import COOLUtils
-#beamSpotTag = COOLUtils.resolveCurrentBeamSpotFolder()
-#beamSpotTag = "IndetBeampos-ES1-UPD2-03"
-
-#print beamSpotTag
-
-doReadBS       = False
-doBSConstraint = False
-doPVConstraint = False
-doTrkNtuple    = False
-doMonitoring   = True
-
-Cosmics     = True
-realData    = True
-useTRT      = True
-BField      = True
-dataSource  = 'data' 
-projectName = '%s'
-PtCut       = 2000
-
-#Alignment Method is GX2
-runLocal      = False
-solveLocal    = False
-solvingOption =	1
-
-# Temp configuration
-ModCut = 0
-detectorDescription = "ATLAS-R2-2015-02-00-00"
-globalTag = "CONDBR2-ES1PA-2014-03"
-
-#siAlignmentTag = "InDetAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-siAlignmentTag = ""
-
-#trtAlignmentTag   = "TRTAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-#trtAlignmentTagL3 = "TRTCalibDX_EoverP_189598_189845v1"
-
-## Pixel Alignment Levels 
-pixelAlignmentLevel = 2
-pixelAlignmentLevelBarrel = -1
-pixelAlignmentLevelEndcaps = -1
-
-## Pixel alignment DoFs
-alignPixel = True
-pixelAlignBarrel = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = False
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = False
-pixelAlignEndcapRotY = False
-pixelAlignEndcapRotZ = True
-
-## SCT Alignment Levels 
-sctAlignmentLevel = 2
-sctAlignmentLevelBarrel = -1
-sctAlignmentLevelEndcaps = 1
-
-## SCT alignment DoFs
-alignSCT = True
-sctAlignBarrel = True
-sctAlignEndcaps = True
-
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = False
-sctAlignBarrelZ = False
-sctAlignBarrelRotX = False
-sctAlignBarrelRotY = True
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = False
-sctAlignEndcapRotX = False
-sctAlignEndcapRotY = False
-sctAlignEndcapRotZ = True
-
-## TRT Alignment Levels 
-alignTRT = False
-trtAlignmentLevel = 1
-trtAlignBarrel = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = False
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = False
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-##-------- End of custom options -------------
-
-##-------- Loading the Alignment Levels --------------------
-include("InDetAlignExample/NewInDetAlignLevels.py") 
-
-##-------- Reconstruction Configuration --------------------
-
-##-------- Load Reconstruction -----------------------------
-include("InDetAlignExample/jobOption_RecExCommon.py") 
-include("InDetAlignExample/jobOption_ConditionsOverrider.py") 
-
-##-------- Load Alignment ----------------------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-###############################################################
-            ''' % (str(inputfilenames), inputAlignmentConstants, events, project)
-
-        jOFile.write(cont)
-        jOFile.close()
-        
-        # run athena
-        cmd = ""
-        if svcclass : 
-            cmd += "export STAGE_SVCCLASS=%s ; " % svcclass
-        cmd += "python -u `which athena.py` myJobOptions.py"
-        
-        print "\nRun command:"
-        print cmd
-        print "\nLogfile:"
-        print "------------------------------------------------------------------"
-        retcode = os.system(cmd)
-        print "------------------------------------------------------------------"
-        dt = int(time.time() - t0)
-        print "\n## athena.py finished with retcode = %s" % retcode
-        print   "## ... elapsed time: ", dt, " sec"
-        
-        if iteration == 0 :
-            if not os.path.isfile("/afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/FileLists/%d/Run%d.txt" % (project, runnr, runnr)) : 
-                os.system("mkdir -p /afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/FileLists/%d" % (project, runnr))
-                os.system("touch /afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/FileLists/%d/Run%d.txt" % (project, runnr, runnr))
-            for fn in inputfilenames : 
-                os.system("echo \"%s\" >> /afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/FileLists/%d/Run%d.txt" % (fn, project, runnr, runnr))
-        
-        # rename output files
-        try :
-            os.system("mv monitoring.root %s" % monfile)
-            os.system("mv AlignmentTFile.root %s" % tfile)
-        except :
-            pass
-        
-        # assemble report pickle file
-        outfiles = []
-        infiles = []
-        nevts = 0
-        acronym = 'OK'
-        txt = 'trf finished OK'  
-        
-        # get info for report gpickle file
-        if retcode == 0 :
-            # one could determine the number of processed events here, e.g. by grep'ping in the logfile
-            tfilemap = getFileMap(tfile, tfiledsname)
-            if tfilemap : 
-                outfiles.append(tfilemap)
-            monmap = getFileMap(monfile, mondsname)   
-            if monmap : 
-                outfiles.append(monmap)
-            infiles = inputfilelist
-        else :
-            print "ERROR: athena.py execution problem!"
-            acronym = 'TRF_ATHENA_EXE'
-            txt = "athena.py execution problem"
-
-        # assemble job report map
-        outmap = { 'prodsys': { 'trfCode': retcode,
-                                'trfAcronym': acronym,
-                                'jobOutputs': outfiles,
-                                'jobInputs': infiles,
-                                'more': { 'num1': int(nevts), 'num2': int(dt), 'txt1': txt }
-                              }
-                 }
-    
-    # pickle report map
-    f = open('jobReport.gpickle', 'w')
-    pickle.dump(outmap, f)
-    f.close()
-    
-    print "\n##################################################################"
-    print   "## End of job."
-    print   "##################################################################\n"
-    
-
-########################################
-## main()
-########################################
-
-if __name__ == "__main__" :
-
-    if (len(sys.argv) != 2) and (not sys.argv[1].startswith('--argdict=')) :
-        print "Input format wrong --- use "
-        print "   --argdict=<pickled dictionary containing input info> "
-        print "   with key/value pairs: "
-        print "     1) 'inputRAWFiles': python list "
-        print "          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) "
-        print "        or list of file dictionaries "
-        print "          [{'lfn':'fname1', 'checksum':'cks1', 'dsn':'dsn1', 'size':sz1, 'guid':'guid1', 'events':nevts1, ...}, " 
-        print "           {'lfn':'fname2', 'checksum':'cks2', 'dsn':'dsn2', 'size':sz2, 'guid':'guid2', 'events':nevts2, ...}, ...] "
-        print "     2) 'outputTFile': string 'datasetname#filename' "
-        print "        (output TFile containing the matrix, vector...) "
-        print "     3) 'outputMonitoringFile': string 'datasetname#filename' "
-        print "        (output monitoring file) "
-        print "     4) 'iteration': integer "
-        print "        (number of current iteration)"
-        print "     5) 'events': integer "
-        print "        (number of events to process, -1 for all)"
-        print " "    
-        sys.exit(-1)
-  
-    else :
-        picklefile = sys.argv[1][len('--argdict='):]
-        accumData(picklefile)
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/MergeMon_trf.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/MergeMon_trf.py
deleted file mode 100644
index 2dcf0284ddc0a46acd6ec84da20c7c34fc0bc7b2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/MergeMon_trf.py
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#########################################################################
-##
-## MergeMon trf for Tier-0: 
-##
-##  - input parameter: file containing a pickled dictionary consisting of the key/value pairs
-##
-##     1) 'inputMonitoringFiles': python list
-##          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names)
-##        or list of file dictionaries
-##          [{'lfn':'fname1', 'checksum':'cks1', 'dsn':'dsn1', 'size':sz1, 'guid':'guid1', 'events':nevts1, ...},  
-##           {'lfn':'fname2', 'checksum':'cks2', 'dsn':'dsn2', 'size':sz2, 'guid':'guid2', 'events':nevts2, ...}, ...]
-##     2) 'outputMonitoringMergeFile': string 'datasetname#filename'
-##        (merged output dataset name + file)
-##
-##  - assembles custom jobOptions file, runs athena
-##
-##########################################################################
-
-import sys, string, commands, os.path, os, pickle, time, pprint, xmlrpclib
-
-#########################################################################
-
-# Utility function
-
-def getFileMap(fname, dsname, nevts=0) :
-    if os.path.isfile(fname) :
-        sz = os.path.getsize(fname)
-        map = { 'lfn': fname,
-                'dataset': dsname,
-                'size': sz,
-                'events': nevts
-              }
-    else : 
-        map = {}
-    return map
-
-#########################################################################
-
-        
-def runAthena(picklefile) :
-    t0 = time.time()
-  
-    print "\n##################################################################"
-    print   "##             ATLAS Tier-0 Alignment Processing                ##"
-    print   "##################################################################\n"
-
-    # extract parameters from pickle file
-    print "Using pickled file ", picklefile, " for input parameters"
-    f = open(picklefile, 'r')
-    parmap = pickle.load(f)
-    f.close()
-
-    print "\nAlignment Processing run options:\n"
-    pprint.pprint(parmap)
-
-    inputfilelist = parmap.get('inputMonitoringFiles', [])
-    nfiles = len(inputfilelist) 
-    if not nfiles :   # problem with job definition or reading pickle file
-        dt = int(time.time() - t0) 
-        retcode = 1
-        acronym = 'TRF_NOINPUT'
-        txt = 'empty input file list'  
-        outmap = { 'prodsys': { 'trfCode': retcode,
-                                'trfAcronym': acronym,  
-                                'jobOutputs': [],
-                                'jobInputs': [],
-                                'nevents': 0,
-                                'more': { 'num1': 0, 'num2': dt, 'txt1': txt }
-                              }
-                 }
-    else : 
-        # assemble list of ['filename1', 'filename2', ...]
-        inputdsname = ''
-        inputfilenames = []
-        svcclass = ''
-        if isinstance(inputfilelist[0], str) :
-            inputdsname = (inputfilelist[0]).split('#')[0]
-            for val in inputfilelist :
-                inputfilenames.append(val.split('#')[1])
-        elif isinstance(inputfilelist[0], dict) :
-            inputdsname = inputfilelist[0]['dsn']
-            svcclass = inputfilelist[0].get('svcclass', '')        
-            for fdict in inputfilelist :
-                if fdict.has_key('pfn') :
-                    # full remote path, for direct access on storage
-                    if fdict['pfn'].startswith('/castor') :
-                        inputfilenames.append('root://castoratlas/' + fdict['pfn'])                        
-                        #inputfilenames.append('rfio:' + fdict['pfn'])
-                    else :
-                        inputfilenames.append(fdict['pfn'])
-                else :
-                    inputfilenames.append(fdict['lfn'])  
-    
-        # output merged Monitoring file                                                                                           
-        outputdsname = (parmap['outputMonitoringMergedFile']).split('#')[0]
-        outputfilename = (parmap['outputMonitoringMergedFile']).split('#')[1]
-
-        # assemble jobOptions fragment
-        (s,o) = commands.getstatusoutput('rm -f filelist.txt')
-        fileList = open('filelist.txt', 'w')
-        for fname in inputfilenames :
-    	    fileList.write(fname + '\n')
-        fileList.close()
-
-        # run athena
-        cmd = ""
-        if svcclass :
-            cmd += "export STAGE_SVCCLASS=%s ; " % svcclass
-        cmd += "DQHistogramMerge.py filelist.txt %s True" % outputfilename
-        
-        print "\nRun command:"
-        print cmd
-        print "\nLogfile:"
-        print "------------------------------------------------------------------"
-        retcode = os.system(cmd)
-        print "------------------------------------------------------------------"
-        dt = int(time.time() - t0)
-        print "\n## DQHistogramMerge.py finished with retcode = %s" % retcode
-        print   "## ... elapsed time: ", dt, " sec"
-
-        # assemble report pickle file
-        outfiles = []
-        infiles = []
-        nevts = 0
-        acronym = 'OK'
-        txt = 'trf finished OK'  
-
-        # get info for report gpickle file
-        if retcode == 0 :
-            # one could determine the number of processed events here, e.g. by grep'ping in the logfile
-            fmap = getFileMap(outputfilename, outputdsname, nevts=nevts)
-            outfiles = [fmap]
-        else :
-            print "ERROR: DQHistogramMerge execution problem!"
-            acronym = 'TRF_DQMERGE_EXE'
-            txt = "DQHistogramMerge.py execution problem"
-
-        # assemble job report map
-        outmap = { 'prodsys': { 'trfCode': retcode,
-                                'trfAcronym': acronym,
-                                'jobOutputs': outfiles,
-                                'jobInputs': infiles,
-                                'more': { 'num1': int(nevts), 'num2': int(dt), 'txt1': txt }
-                              }
-                 }
-  
-    # pickle report map
-    f = open('jobReport.gpickle', 'w')
-    pickle.dump(outmap, f)
-    f.close()
-
-    print "\n##################################################################"
-    print   "## End of job."
-    print   "##################################################################\n"
-
-
-########################################
-## main()
-########################################
-
-if __name__ == "__main__" :
-
-    if (len(sys.argv) != 2) and (not sys.argv[1].startswith('--argdict=')) :
-        print "Input format wrong --- use "
-        print "   --argdict=<pickled dictionary containing input info> "
-        print "   with key/value pairs: "
-        print "     1) 'inputMonitoringFiles': python list "
-        print "          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) "
-        print "        or list of file dictionaries "
-        print "          [{'lfn':'fname1', 'checksum':'cks1', 'dsn':'dsn1', 'size':sz1, 'guid':'guid1', 'events':nevts1, ...}, "  
-        print "           {'lfn':'fname2', 'checksum':'cks2', 'dsn':'dsn2', 'size':sz2, 'guid':'guid2', 'events':nevts2, ...}, ...] "
-        print "     2) 'outputMonitoringMergeFile': string 'datasetname#filename' "
-        print "        (merged output dataset name + file) "
-        print " "
-        sys.exit(-1)
-  
-    else :
-      picklefile = sys.argv[1][len('--argdict='):]
-      runAthena(picklefile)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Solve_trf.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Solve_trf.py
deleted file mode 100644
index 970f470275224d8b74cbe2c8ff10e224387cc28c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Solve_trf.py
+++ /dev/null
@@ -1,548 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#########################################################################
-##
-## Solve trf for Tier-0: 
-##
-##  - input parameter: file containing a pickled dictionary consisting of the key/value pairs
-##
-##     1) 'inputTFiles': python list 
-##          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) 
-##        or list of file dictionaries 
-##          [{'lfn':'fname1', 'checksum':'cks1', 'dsn':'dsn1', 'size':sz1, 'guid':'guid1', 'events':nevts1, ...},  
-##           {'lfn':'fname2', 'checksum':'cks2', 'dsn':'dsn2', 'size':sz2, 'guid':'guid2', 'events':nevts2, ...}, ...] 
-##     2) 'inputAlignmentConstants':  string
-##        (full path of input alignment constants file; optional) 
-##     3) 'outputAlignmentConstants': string 'datasetname#filename' 
-##        (output alignment constants, ROOT file) 
-##     4) 'outputAlignmentConstantsdb': string 'datasetname#filename' 
-##        (output alignment constants, DB file) 
-##     5) 'outputAlignFiles': string 'datasetname#filename' 
-##        (output alignment files) 
-##     6) 'iteration': integer 
-##        (number of current iteration)
-##
-##  - assembles custom jobOptions file, runs athena
-##
-##########################################################################
-
-import sys, string, commands, os.path, os, pickle, time, pprint, xmlrpclib
-
-#########################################################################
-
-# Utility function
-
-def getFileMap(fname, dsname, nevts=0) :
-    if os.path.isfile(fname) :
-        sz = os.path.getsize(fname)
-        map = { 'lfn': fname,
-                'dataset': dsname,
-                'size': sz,
-                'events': nevts
-              }
-    else : 
-        map = {}
-    return map
-
-#########################################################################
-
-        
-def runAthena(picklefile) :
-    t0 = time.time()
-    
-    print "\n##################################################################"
-    print   "##             ATLAS Tier-0 Alignment Processing                   ##"
-    print   "##################################################################\n"
-
-    # extract parameters from pickle file
-    print "Using pickled file ", picklefile, " for input parameters"
-    f = open(picklefile, 'r')
-    parmap = pickle.load(f)
-    f.close()
-
-    print "\nAlignment Processing run options:\n"
-    pprint.pprint(parmap)
-      
-    inputfilelist = parmap.get('inputTFiles', [])
-    nfiles = len(inputfilelist) 
-    if not nfiles :   # problem with job definition or reading pickle file
-        dt = int(time.time() - t0) 
-        retcode = 1
-        acronym = 'TRF_NOINPUT'
-        txt = 'empty input file list'  
-        outmap = { 'prodsys': { 'trfCode': retcode,
-                                'trfAcronym': acronym,  
-                                'jobOutputs': [],
-                                'jobInputs': [],
-                                'nevents': 0,
-                                'more': { 'num1': 0, 'num2': dt, 'txt1': txt }
-                              }
-                 }
-    else : 
-        # assemble list of ['filename1', 'filename2', ...]  
-        inputdsname = ''
-        inputfilenames = []
-        svcclass = ''
-        if isinstance(inputfilelist[0], str) :  
-            inputdsname = (inputfilelist[0]).split('#')[0]
-            for val in inputfilelist :
-                inputfilenames.append(val.split('#')[1])
-        elif isinstance(inputfilelist[0], dict) :
-            inputdsname = inputfilelist[0]['dsn']
-            svcclass = inputfilelist[0].get('svcclass', '')
-            for fdict in inputfilelist :
-                if fdict.has_key('pfn') : 
-                    # full remote path, for direct access on storage
-                    if fdict['pfn'].startswith('/castor') :
-                        inputfilenames.append('root://castoratlas/' + fdict['pfn'])                        
-                        #inputfilenames.append('rfio:' + fdict['pfn'])
-                    else :
-                        inputfilenames.append(fdict['pfn'])
-                else :
-                    inputfilenames.append(fdict['lfn'])    
-
-        runnr = int(inputdsname.split('.')[1])
-        print "runnr = ", runnr 
-        project = inputdsname.split('.')[0] 
-
-        # original RAW input files of accumulation step
-        with open ("/afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/FileLists/%d/Run%d.txt"  % (project, runnr, runnr), "r") as myfile :
-            firstfile = myfile.readline().replace('\n', '')
-        inputRAWFileList = [firstfile]
-      
-        # input alignment constants
-        iteration = int(parmap['iteration']) 
-        try :
-            inputAlignmentConstants = (parmap['inputAlignmentConstants']).split('#')[1]
-        except :
-            inputAlignmentConstants = ""
-        if iteration >= 1 :
-            inputAlignmentConstants = "/afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/tmpconstants/%d/%d_AlignmentConstants_Iter%d.root" % (project, runnr, runnr, iteration-1)
-      
-        # output file
-        outputAlignmentConstantsds = (parmap['outputAlignmentConstants']).split('#')[0]
-        outputAlignmentConstants = (parmap['outputAlignmentConstants']).split('#')[1]
-      
-        # output db file
-        outputAlignmentConstantsdbds = (parmap['outputAlignmentConstantsdb']).split('#')[0]
-        outputAlignmentConstantsdb = (parmap['outputAlignmentConstantsdb']).split('#')[1]
-      
-        outputAlignFilesds = (parmap['outputAlignFiles']).split('#')[0]
-        outputAlignFiles = (parmap['outputAlignFiles']).split('#')[1]
-      
-        # get beamspot tag
-        #from InDetBeamSpotExample import COOLUtils
-        #beamspottag = COOLUtils.resolveCurrentBeamSpotFolder()
-      
-        # assemble jobOptions fragment
-        (s,o) = commands.getstatusoutput('rm -f myJobOptions.py')
-        jOFile = open('myJobOptions.py', 'w')
-        if iteration <= 1 :
-            cont = '''
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputFiles  = %s
-inputTFiles = %s
-inputAlignmentConstants = "%s"
-outputPoolFile = "%s"
-numberOfEvents = 1  # Has to be one to get the reconstruction options
-
-##-------- Alignment Configuration --------------------
-
-if len(inputAlignmentConstants) != 0 :
-    readConstantsFromPool = True
-    inputPoolFiles = [inputAlignmentConstants]
-else :
-    readConstantsFromPool = False
-
-WriteTFile    = True
-runAccumulate = False
-runSolving    = True
-
-##-------- Extra Configuration --------------------
-#from InDetBeamSpotExample import COOLUtils
-#beamSpotTag = COOLUtils.resolveCurrentBeamSpotFolder()
-#beamSpotTag = "IndetBeampos-ES1-UPD2-03"
-
-#print beamSpotTag
-
-doReadBS       = False
-doBSConstraint = False
-doPVConstraint = False
-doTrkNtuple    = False
-doMonitoring   = False
-
-Cosmics     = True
-realData    = True
-useTRT      = True
-BField      = True
-dataSource  = 'data' 
-projectName = '%s'
-PtCut       = 2000
-
-#Alignment Method is GX2
-runLocal      = False
-solveLocal    = False
-solvingOption =	1
-
-## solving options
-##   0 - No global solving
-##   1 - Lapack
-##   2 - Eigen
-##   6 - ROOT
-##   7 - CLHEP
-
-# Temp configuration
-ModCut = 0
-detectorDescription = "ATLAS-R2-2015-02-00-00"
-globalTag = "CONDBR2-ES1PA-2014-03"
-
-#siAlignmentTag = "InDetAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-siAlignmentTag = ""
-
-#trtAlignmentTag   = "TRTAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-#trtAlignmentTagL3 = "TRTCalibDX_EoverP_189598_189845v1"
-
-## Pixel Alignment Levels 
-pixelAlignmentLevel = 11
-pixelAlignmentLevelBarrel = -1
-pixelAlignmentLevelEndcaps = -1
-
-## Pixel alignment DoFs
-alignPixel = True
-pixelAlignBarrel = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = False
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = False
-pixelAlignEndcapRotY = False
-pixelAlignEndcapRotZ = True
-
-## SCT Alignment Levels 
-sctAlignmentLevel = 1
-sctAlignmentLevelBarrel = -1
-sctAlignmentLevelEndcaps = -1
-
-## SCT alignment DoFs
-alignSCT = True
-sctAlignBarrel = True
-sctAlignEndcaps = False
-
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = True
-sctAlignBarrelZ = False
-sctAlignBarrelRotX = False
-sctAlignBarrelRotY = False
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = True
-sctAlignEndcapRotX = True
-sctAlignEndcapRotY = True
-sctAlignEndcapRotZ = True
-
-## TRT Alignment Levels 
-alignTRT = False
-trtAlignmentLevel = 1
-trtAlignBarrel = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = False
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = False
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-##-------- Load Reconstruction -----------------------------
-import os
-include("InDetAlignExample/jobOption_RecExCommon.py") 
-include("InDetAlignExample/jobOption_ConditionsOverrider.py") 
-
-##-------- Load Alignment ----------------------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-###############################################################
-            ''' % (str(inputRAWFileList), str(inputfilenames), inputAlignmentConstants, outputAlignmentConstants, project)#,beamspottag)
-        else :
-            cont = '''
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputFiles  = %s
-inputTFiles = %s
-inputAlignmentConstants = "%s"
-outputPoolFile = "%s"
-numberOfEvents = 1  # Has to be one to get the reconstruction options
-
-##-------- Alignment Configuration --------------------
-
-if len(inputAlignmentConstants) != 0 :
-    readConstantsFromPool = True
-    inputPoolFiles = [inputAlignmentConstants]
-else :
-    readConstantsFromPool = False
-
-WriteTFile    = True
-runAccumulate = False
-runSolving    = True
-
-##-------- Extra Configuration --------------------
-#from InDetBeamSpotExample import COOLUtils
-#beamSpotTag = COOLUtils.resolveCurrentBeamSpotFolder()
-#beamSpotTag = "IndetBeampos-ES1-UPD2-03"
-
-#print beamSpotTag
-
-doReadBS       = False
-doBSConstraint = False
-doPVConstraint = False
-doTrkNtuple    = False
-doMonitoring   = False
-
-Cosmics     = True
-realData    = True
-useTRT      = True
-BField      = True
-dataSource  = 'data' 
-projectName = '%s'
-PtCut       = 2000
-
-#Alignment Method is GX2
-runLocal      = False
-solveLocal    = False
-solvingOption =	1
-
-## solving options
-##   0 - No global solving
-##   1 - Lapack
-##   2 - Eigen
-##   6 - ROOT
-##   7 - CLHEP
-
-# Temp configuration
-ModCut = 0
-detectorDescription = "ATLAS-R2-2015-02-00-00"
-globalTag = "CONDBR2-ES1PA-2014-03"
-
-#siAlignmentTag = "InDetAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-siAlignmentTag = ""
-
-#trtAlignmentTag   = "TRTAlign_PeriodD2012_d0z0p_constrained" # changed 11-Oct-12
-#trtAlignmentTagL3 = "TRTCalibDX_EoverP_189598_189845v1"
-
-## Pixel Alignment Levels 
-pixelAlignmentLevel = 2
-pixelAlignmentLevelBarrel = -1
-pixelAlignmentLevelEndcaps = -1
-
-## Pixel alignment DoFs
-alignPixel = True
-pixelAlignBarrel = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = False
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = False
-pixelAlignEndcapRotY = False
-pixelAlignEndcapRotZ = True
-
-## SCT Alignment Levels 
-sctAlignmentLevel = 2
-sctAlignmentLevelBarrel = -1
-sctAlignmentLevelEndcaps = 1
-
-## SCT alignment DoFs
-alignSCT = True
-sctAlignBarrel = True
-sctAlignEndcaps = True
-
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = False
-sctAlignBarrelZ = False
-sctAlignBarrelRotX = False
-sctAlignBarrelRotY = True
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = False
-sctAlignEndcapRotX = False
-sctAlignEndcapRotY = False
-sctAlignEndcapRotZ = True
-
-## TRT Alignment Levels 
-alignTRT = False
-trtAlignmentLevel = 1
-trtAlignBarrel = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = False
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = False
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-##-------- Load Reconstruction -----------------------------
-import os
-include("InDetAlignExample/jobOption_RecExCommon.py") 
-include("InDetAlignExample/jobOption_ConditionsOverrider.py") 
-
-##-------- Load Alignment ----------------------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-###############################################################
-            ''' % (str(inputRAWFileList), str(inputfilenames), inputAlignmentConstants, outputAlignmentConstants, project)#,beamspottag)
-    
-        jOFile.write(cont)
-        jOFile.close()
-
-        # run athena
-        cmd = ""
-        if svcclass : 
-            cmd += "export STAGE_SVCCLASS=%s ; " % svcclass
-        cmd += "python -u `which athena.py` myJobOptions.py"
-
-        print "\nRun command:"
-        print cmd
-        print "\nLogfile:"
-        print "------------------------------------------------------------------"
-        retcode = os.system(cmd)
-        print "------------------------------------------------------------------"
-        dt = int(time.time() - t0)
-        print "\n## athena.py finished with retcode = %s" % retcode
-        print   "## ... elapsed time: ", dt, " sec"
-
-        if retcode == 0 :
-            # Move alignment constants db file
-            os.system("mv mycool.db %s" % outputAlignmentConstantsdb)
-            if iteration >= 0 :
-                os.system("mkdir -p /afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/tmpconstants/%d" % (project, runnr))
-                os.system("cp %s /afs/cern.ch/user/a/atlidali/w0/calibLoop/Tier0/%s/tmpconstants/%d/%d_AlignmentConstants_Iter%d.root" % (outputAlignmentConstants, project, runnr, runnr, iteration))
-                
-                # extract original RAW input dataset name (accumulation step) from PFN 
-                pfn = inputRAWFileList[0]           # e.g. '/castor/cern.ch/grid/atlas/.../data14_cos.00247688.physics_IDCosmic.merge.RAW._lb0552._SFO-ALL._0001.1' 
-                lfn = pfn[pfn.rfind('/')+1:]        # e.g. 'data14_cos.00247688.physics_IDCosmic.merge.RAW._lb0552._SFO-ALL._0001.1' 
-                inputdataset = lfn.split('._')[0]   # e.g. 'data14_cos.00247688.physics_IDCosmic.merge.RAW'
-                # sign off next iteration through passing a message to TOM
-                os.system("touch /afs/cern.ch/atlas/tzero/run/cafTOM/msgbox/idalignTOM.msg")
-                os.system("echo \"call pdb updateDatasetPState %s aligned Iter%d\" >> /afs/cern.ch/atlas/tzero/run/cafTOM/msgbox/idalignTOM.msg" % (inputdataset, iteration))
-            
-            os.system("tar -cf %s *.txt *.root %s %s" % (outputAlignFiles, outputAlignmentConstantsdb, outputAlignmentConstants)) 
-            #os.system("./makeRootFile.py alignlogfile.txt %s\n" % outputCorrectionsTree)
-            # move TFile
-            #os.system("mv AlignmentTFile.root TotalAlignmentTFile.root")
-    
-        # assemble report pickle file
-        outfiles = []
-        infiles = []
-        nevts = 0
-        acronym = 'OK'
-        txt = 'trf finished OK'  
-
-        # get info for report gpickle file
-        if retcode == 0 :
-            # one could determine the number of processed events here, e.g. by grep'ping in the logfile
-            constantsmap = getFileMap(outputAlignmentConstants, outputAlignmentConstantsds, nevts=nevts)
-            outfiles.append(constantsmap)
-            constantsdbmap = getFileMap(outputAlignmentConstantsdb, outputAlignmentConstantsdbds, nevts=nevts)
-            outfiles.append(constantsdbmap)
-            outputAlignFilesmap = getFileMap(outputAlignFiles, outputAlignFilesds, nevts=nevts)
-            outfiles.append(outputAlignFilesmap)
-        else :
-            print "ERROR: athena.py execution problem!"
-            acronym = 'TRF_ATHENA_EXE'
-            txt = "athena.py execution problem"
-
-        # assemble job report map
-        outmap = { 'prodsys': { 'trfCode': retcode,
-                                'trfAcronym': acronym,
-                                'jobOutputs': outfiles,
-                                'jobInputs': infiles,
-                                'more': { 'num1': int(nevts), 'num2': int(dt), 'txt1': txt }
-                              }
-                 }
-    
-    # pickle report map
-    f = open('jobReport.gpickle', 'w')
-    pickle.dump(outmap, f)
-    f.close()
-    
-    print "\n##################################################################"
-    print   "## End of job."
-    print   "##################################################################\n"
-
-
-########################################
-## main()
-########################################
-
-if __name__ == "__main__" :
-
-    if (len(sys.argv) != 2) and (not sys.argv[1].startswith('--argdict=')) :
-        print "Input format wrong --- use "
-        print "   --argdict=<pickled dictionary containing input info> "
-        print "   with key/value pairs: "
-        print "     1) 'inputTFiles': python list "                                                                                   
-        print "          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) " 
-        print "        or list of file dictionaries " 
-        print "          [{'lfn':'fname1', 'checksum':'cks1', 'dsn':'dsn1', 'size':sz1, 'guid':'guid1', 'events':nevts1, ...}, "  
-        print "           {'lfn':'fname2', 'checksum':'cks2', 'dsn':'dsn2', 'size':sz2, 'guid':'guid2', 'events':nevts2, ...}, ...] "
-        print "     2) 'inputAlignmentConstants':  string "
-        print "        (full path of input alignment constants file; optional) " 
-        print "     3) 'outputAlignmentConstants': string 'datasetname#filename' " 
-        print "        (output alignment constants, ROOT file) " 
-        print "     4) 'outputAlignmentConstantsdb': string 'datasetname#filename' "
-        print "        (output alignment constants, DB file) " 
-        print "     5) 'outputAlignFiles': string 'datasetname#filename' " 
-        print "        (output alignment files) " 
-        print "     6) 'iteration': integer " 
-        print "        (number of current iteration) "
-        print " "    
-        sys.exit(-1)
-    
-    else :
-        picklefile = sys.argv[1][len('--argdict='):]
-        runAthena(picklefile)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/create_pickle.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/create_pickle.py
deleted file mode 100644
index b10e10e3ad3f5d6dbec8c82214d1639088f3be8c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/create_pickle.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# STEP 1
-# accumulating step
-
-import pickle
-f=open('reco1_01.pickle', 'w')
-dict={
-'inputRAWFiles': [{'dsn': 'data15_cos.00252404.physics_IDCosmic.merge.RAW','lfn': 'data15_cos.00252404.physics_IDCosmic.merge.RAW._lb0112._SFO-ALL._0001.1','pfn': 'root://castoratlas//castor/cern.ch/grid/atlas/tzero/prod1/perm/data15_cos/physics_IDCosmic/00252404/data15_cos.00252404.physics_IDCosmic.merge.RAW/data15_cos.00252404.physics_IDCosmic.merge.RAW._lb0112._SFO-ALL._0001.1'} ], # has to be a list,
-'inputAlignmentConstants': "inputAlignmentConstants#",
-'events':500,
-'outputTFile': "OutputTFileNumber1#./data15_cos.00252404.physics_IDCosmic.matrix.ROOT.Iter0._lb0112._SFO-ALL._0001.1",
-'outputMonitoringFile': "outputMonitoringFile1#./data15_cos.00252404.physics_IDCosmic.mon.ROOT.Iter0._lb0112._SFO-ALL._0001.1",
-'iteration':0}
-pickle.dump(dict,f)
-f.close()
-
-## f=open('reco1_02.pickle', 'w')
-## dict={
-## 'inputRAWData': [ "first#/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data" ], # has to be a list
-## 'inputAlignmentConstants': "inputAlignmentConstants#",
-## 'outputTFile': "OutputTFileNumber2#/tmp/lacuesta/matrixTFile2.root", 
-## 'outputMonitoringFile': "outputMonitoringFile2#/tmp/lacuesta/monitoringFile2.root"
-## }
-## pickle.dump(dict,f)
-## f.close()
-
-## # STEP2 
-import pickle
-f=open('solve1.pickle', 'w')
-dict={
-'inputTFiles': [{'dsn': 'data15_cos.00252404.physics_IDCosmic.matrix.ROOT.Iter0','lfn': 'data15_cos.00252404.physics_IDCosmic.matrix.ROOT.Iter0._lb0112._SFO-ALL._0001.1','pfn':"data15_cos.00252404.physics_IDCosmic.matrix.ROOT.Iter0._lb0112._SFO-ALL._0001.1"}],#, {'pfn':"matrixTFile2.root"}], 
-'inputAlignmentConstants': "inputAlignmentConstants#",
-'iteration':0,
-'outputAlignmentConstants': "dsname#./outputConstants.root",
-'outputAlignmentConstantsdb': "dsname#./outputConstants.db",
-'outputAlignFiles': "dsname#./outputConstants.txt"}
-pickle.dump(dict,f)
-f.close()
-
-'''dict={
-'inputTFiles': [{'pfn':"matrixTFile1.root"}], 
- 'inputAlignmentConstants': "inputAlignmentConstants#",
- 'outputAlignmentConstants': "dsname#./outputConstants.root",
- 'outputAlignmentConstantsdb': "dsname#./outputConstants.db"
- }
-'''
-## f=open('merge1.pickle', 'w')
-## dict={
-## 'inputMonitoringFiles': [ "OutputTFileNumber1#/tmp/lacuesta/matrixTFile1.root", "OutputTFileNumber2#/tmp/lacuesta/matrixTFile2.root" ], 
-## 'outputMonitoringMergedFile': "monitoringname#TotalMonitoring.root"
-## }
-## pickle.dump(dict,f)
-## f.close()
-
-
-
-f=open('merge1.pickle', 'w')
-dict={
-'inputMonitoringFiles': [{'dsn': 'data15_cos.00252404.physics_IDCosmic.mon.ROOT.Iter0','lfn': 'data15_cos.00252404.physics_IDCosmic.mon.ROOT.Iter0._lb0112._SFO-ALL._0001.1','pfn':"data15_cos.00252404.physics_IDCosmic.mon.ROOT.Iter0._lb0112._SFO-ALL._0001.1"}],#, "OutputTFileNumber2#monitoringFile2.root" ], 
-'outputMonitoringMergedFile': "monitoringname#TotalMonitoring.root"
-}
-pickle.dump(dict,f)
-f.close()
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/idalignTOM.cfg b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/idalignTOM.cfg
deleted file mode 100644
index 8ab1309a6dd23e8a71547eabd3811a5941741f1a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/idalignTOM.cfg
+++ /dev/null
@@ -1,417 +0,0 @@
-### idTOM.cfg
-###
-### last changed by $Author: lgoossen $
-### $Date: 2010-05-25 17:42:57 +0200 (Tue, 25 May 2010) $
-### $Revision: 301075 $
-###
-
-## standard includes 
-
-include standardLogMgr.cfgfrag
-include standardMsgMgr.cfgfrag
-include standardProdDB.cfgfrag
-include standardTOM.cfgfrag
-include standardAMI.cfgfrag
-
-###### STORAGE DEFINITIONS   
-
-sa tom storageinfoDefs "!{ 'PERMIDAFS': \
-                               {'type': 'AFS', \
-                                'basepath': '/afs/cern.ch/user/a/atlidali/w0/calibLoop/'}, \
-                           'TEMPIDCASTOR': \
-                               {'type': 'CASTOR', \
-                                'svcclass': 'atlcal', \
-                                'fileclass': 'temp', \
-                                'stagehost': 'castoratlas', \
-                                'basepath': '/castor/cern.ch/grid/atlas/caf/atlcal/temp/id/IDAlignment/calibLoop'}, \
-                         }"
-
-sa tom datasetToStorage "![\
-    (r'.*\.idalign.*\.log$',               ['TEMPIDCASTOR']), \
-    (r'(?!.*log.*)(.*\.idalignreco\..*)',  ['TEMPIDCASTOR']), \
-    (r'(?!.*log.*)(.*\.idalignsolve\..*)', ['TEMPIDCASTOR',PERMIDAFS]), \
-    (r'(?!.*log.*)(.*\.idalignmerge\..*)', ['TEMPIDCASTOR',PERMIDAFS]), \
-]"
-
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Data Accumulation, iteration 0
-###############################################################################################################################
-spp tom idalignreco00 username  idalign
-
-spp tom idalignreco00 active  True
-
-#spp tom idalignreco00 usebeamspotreadyrunnrfilter  True
-
-spp tom idalignreco00 inputdsspecautomatic  "(type='RAW' AND project='data15_cos' AND streamtype='physics' AND stream='IDCosmic' AND totevents>50000 AND runnr>999999)"
-spp tom idalignreco00 automaticmode  on
-
-spp tom idalignreco00 taskstep  idalignreco
-spp tom idalignreco00 tasktype  idalignreco
-spp tom idalignreco00 tasktag   c0
-
-spp tom idalignreco00 bunchFion  identityBunchFion
-
-spp tom idalignreco00 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignreco00 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Accumulate_trf.py'
-spp tom idalignreco00 trfname  'Accumulate_trf.py'
-
-spp tom idalignreco00 inputs inputRAWFiles "!{}"
-
-spp tom idalignreco00 outputs outputTFile           "!{'dstype': 'ROOT_MATRIX', 'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MATRIX.iter0'}"
-spp tom idalignreco00 outputs outputMonitoringFile  "!{'dstype': 'ROOT_MON',    'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MON.iter0'}"
-
-spp tom idalignreco00 phconfig events          "!{'value': -1,}"
-spp tom idalignreco00 phconfig iteration       "!{'value':  0,}"
-
-spp tom idalignreco00 maxattempt  3
-spp tom idalignreco00 priority    1200
-spp tom idalignreco00 trfcpu      7000
-
-addp1 tom idalignreco00  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Solving, iteration 0
-###############################################################################################################################
-spp tom idalignsolve00 username  idalign
-
-spp tom idalignsolve00 active  True
-
-spp tom idalignsolve00 inputdsspecautomatic "(type='ROOT_MATRIX' AND username='idalign' AND writer1='FILLED' AND datasetname LIKE '%physics_IDCosmic.idalignreco.ROOT_MATRIX.iter0%' AND runnr>999999)"
-spp tom idalignsolve00 automaticmode on
-
-spp tom idalignsolve00 taskstep  idalignsolve
-spp tom idalignsolve00 tasktype  idalignsolve
-spp tom idalignsolve00 tasktag   ''
-
-spp tom idalignsolve00 bunchFion    bunchEverything
-spp tom idalignsolve00 bunchlength  10000
-
-spp tom idalignsolve00 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignsolve00 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Solve_trf.py'
-spp tom idalignsolve00 trfname  'Solve_trf.py'
-
-spp tom idalignsolve00 inputs inputTFiles  "!{'metatype': 'inputLFNlistDA'}"
-
-spp tom idalignsolve00 outputs outputAlignmentConstants    "!{'dstype': 'ROOT_CONSTANTS'}"
-spp tom idalignsolve00 outputs outputAlignmentConstantsdb  "!{'dstype': 'ROOT_DB'}"
-spp tom idalignsolve00 outputs outputAlignFiles            "!{'dstype': 'TAR_ALIGNFILES'}"
-
-spp tom idalignsolve00 phconfig iteration  "!{'value': 0,}"
-
-spp tom idalignsolve00 maxattempt  3
-spp tom idalignsolve00 priority    1300
-spp tom idalignsolve00 trfcpu      360
-
-addp1 tom idalignsolve00  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Data Accumulation, iteration 1
-###############################################################################################################################
-spp tom idalignreco01 username  idalign
-
-spp tom idalignreco01 active  True
-
-#spp tom idalignreco01 usebeamspotreadyrunnrfilter  True
-
-spp tom idalignreco01 inputdsspecautomatic  "(type='RAW' AND project='data15_cos' AND streamtype='physics' AND stream='IDCosmic' AND runnr>999999 AND pstates LIKE '%aligned:Iter0%')"
-spp tom idalignreco01 automaticmode  on
-
-spp tom idalignreco01 taskstep  idalignreco
-spp tom idalignreco01 tasktype  idalignreco
-spp tom idalignreco01 tasktag   c0
-
-spp tom idalignreco01 bunchFion  identityBunchFion
-
-spp tom idalignreco01 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignreco01 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Accumulate_trf.py'
-spp tom idalignreco01 trfname  'Accumulate_trf.py'
-
-spp tom idalignreco01 inputs inputRAWFiles "!{}"
-
-spp tom idalignreco01 outputs outputTFile           "!{'dstype': 'ROOT_MATRIX', 'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MATRIX.iter1'}"
-spp tom idalignreco01 outputs outputMonitoringFile  "!{'dstype': 'ROOT_MON',    'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MON.iter1'}"
-
-spp tom idalignreco01 phconfig events          "!{'value': -1,}"
-spp tom idalignreco01 phconfig iteration       "!{'value':  1,}"
-
-spp tom idalignreco01 maxattempt  3
-spp tom idalignreco01 priority    1200
-spp tom idalignreco01 trfcpu      7000
-
-addp1 tom idalignreco01  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Solving, iteration 1
-###############################################################################################################################
-spp tom idalignsolve01 username  idalign
-
-spp tom idalignsolve01 active  True
-
-spp tom idalignsolve01 inputdsspecautomatic "(type='ROOT_MATRIX' AND username='idalign' AND writer1='FILLED' AND datasetname LIKE '%physics_IDCosmic.idalignreco.ROOT_MATRIX.iter1%' AND runnr>999999)"
-spp tom idalignsolve01 automaticmode on
-
-spp tom idalignsolve01 taskstep  idalignsolve
-spp tom idalignsolve01 tasktype  idalignsolve
-spp tom idalignsolve01 tasktag   ''
-
-spp tom idalignsolve01 bunchFion    bunchEverything
-spp tom idalignsolve01 bunchlength  10000
-
-spp tom idalignsolve01 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignsolve01 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Solve_trf.py'
-spp tom idalignsolve01 trfname  'Solve_trf.py'
-
-spp tom idalignsolve01 inputs inputTFiles  "!{'metatype': 'inputLFNlistDA'}"
-
-spp tom idalignsolve01 outputs outputAlignmentConstants    "!{'dstype': 'ROOT_CONSTANTS'}"
-spp tom idalignsolve01 outputs outputAlignmentConstantsdb  "!{'dstype': 'ROOT_DB'}"
-spp tom idalignsolve01 outputs outputAlignFiles            "!{'dstype': 'TAR_ALIGNFILES'}"
-
-spp tom idalignsolve01 phconfig iteration  "!{'value': 1,}"
-
-spp tom idalignsolve01 maxattempt  3
-spp tom idalignsolve01 priority    1300
-spp tom idalignsolve01 trfcpu      360
-
-addp1 tom idalignsolve01  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Data Accumulation, iteration 2
-###############################################################################################################################
-spp tom idalignreco02 username  idalign
-
-spp tom idalignreco02 active  True
-
-#spp tom idalignreco02 usebeamspotreadyrunnrfilter  True
-
-spp tom idalignreco02 inputdsspecautomatic  "(type='RAW' AND project='data15_cos' AND streamtype='physics' AND stream='IDCosmic' AND runnr>999999 AND pstates LIKE '%aligned:Iter1%')"
-spp tom idalignreco02 automaticmode  on
-
-spp tom idalignreco02 taskstep  idalignreco
-spp tom idalignreco02 tasktype  idalignreco
-spp tom idalignreco02 tasktag   c0
-
-spp tom idalignreco02 bunchFion  identityBunchFion
-
-spp tom idalignreco02 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignreco02 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Accumulate_trf.py'
-spp tom idalignreco02 trfname  'Accumulate_trf.py'
-
-spp tom idalignreco02 inputs inputRAWFiles "!{}"
-
-spp tom idalignreco02 outputs outputTFile           "!{'dstype': 'ROOT_MATRIX', 'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MATRIX.iter2'}"
-spp tom idalignreco02 outputs outputMonitoringFile  "!{'dstype': 'ROOT_MON',    'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MON.iter2'}"
-
-spp tom idalignreco02 phconfig events          "!{'value': -1,}"
-spp tom idalignreco02 phconfig iteration       "!{'value':  2,}"
-
-spp tom idalignreco02 maxattempt  3
-spp tom idalignreco02 priority    1200
-spp tom idalignreco02 trfcpu      7000
-
-addp1 tom idalignreco02  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Solving, iteration 2
-###############################################################################################################################
-spp tom idalignsolve02 username  idalign
-
-spp tom idalignsolve02 active  True
-
-spp tom idalignsolve02 inputdsspecautomatic "(type='ROOT_MATRIX' AND username='idalign' AND writer1='FILLED' AND datasetname LIKE '%physics_IDCosmic.idalignreco.ROOT_MATRIX.iter2%' AND runnr>999999)"
-spp tom idalignsolve02 automaticmode on
-
-spp tom idalignsolve02 taskstep  idalignsolve
-spp tom idalignsolve02 tasktype  idalignsolve
-spp tom idalignsolve02 tasktag   ''
-
-spp tom idalignsolve02 bunchFion    bunchEverything
-spp tom idalignsolve02 bunchlength  10000
-
-spp tom idalignsolve02 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignsolve02 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Solve_trf.py'
-spp tom idalignsolve02 trfname  'Solve_trf.py'
-
-spp tom idalignsolve02 inputs inputTFiles  "!{'metatype': 'inputLFNlistDA'}"
-
-spp tom idalignsolve02 outputs outputAlignmentConstants    "!{'dstype': 'ROOT_CONSTANTS'}"
-spp tom idalignsolve02 outputs outputAlignmentConstantsdb  "!{'dstype': 'ROOT_DB'}"
-spp tom idalignsolve02 outputs outputAlignFiles            "!{'dstype': 'TAR_ALIGNFILES'}"
-
-spp tom idalignsolve02 phconfig iteration  "!{'value': 2,}"
-
-spp tom idalignsolve02 maxattempt  3
-spp tom idalignsolve02 priority    1300
-spp tom idalignsolve02 trfcpu      360
-
-addp1 tom idalignsolve02  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Data Accumulation, iteration 3
-###############################################################################################################################
-spp tom idalignreco03 username  idalign
-
-spp tom idalignreco03 active  True
-
-#spp tom idalignreco03 usebeamspotreadyrunnrfilter  True
-
-spp tom idalignreco03 inputdsspecautomatic  "(type='RAW' AND project='data15_cos' AND streamtype='physics' AND stream='IDCosmic' AND runnr>999999 AND pstates LIKE '%aligned:Iter2%')"
-spp tom idalignreco03 automaticmode  on
-
-spp tom idalignreco03 taskstep  idalignreco
-spp tom idalignreco03 tasktype  idalignreco
-spp tom idalignreco03 tasktag   c0
-
-spp tom idalignreco03 bunchFion  identityBunchFion
-
-spp tom idalignreco03 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignreco03 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Accumulate_trf.py'
-spp tom idalignreco03 trfname  'Accumulate_trf.py'
-
-spp tom idalignreco03 inputs inputRAWFiles "!{}"
-
-spp tom idalignreco03 outputs outputTFile           "!{'dstype': 'ROOT_MATRIX', 'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MATRIX.iter3'}"
-spp tom idalignreco03 outputs outputMonitoringFile  "!{'dstype': 'ROOT_MON',    'dsnamefion': 'replace daq.RAW idalignreco.ROOT_MON.iter3'}"
-
-spp tom idalignreco03 phconfig events          "!{'value': -1,}"
-spp tom idalignreco03 phconfig iteration       "!{'value':  3,}"
-
-spp tom idalignreco03 maxattempt  3
-spp tom idalignreco03 priority    1200
-spp tom idalignreco03 trfcpu      7000
-
-addp1 tom idalignreco03  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Solving, iteration 3
-###############################################################################################################################
-spp tom idalignsolve03 username  idalign
-
-spp tom idalignsolve03 active  True
-
-spp tom idalignsolve03 inputdsspecautomatic "(type='ROOT_MATRIX' AND username='idalign' AND writer1='FILLED' AND datasetname LIKE '%physics_IDCosmic.idalignreco.ROOT_MATRIX.iter3%' AND runnr>999999)"
-spp tom idalignsolve03 automaticmode on
-
-spp tom idalignsolve03 taskstep  idalignsolve
-spp tom idalignsolve03 tasktype  idalignsolve
-spp tom idalignsolve03 tasktag   ''
-
-spp tom idalignsolve03 bunchFion    bunchEverything
-spp tom idalignsolve03 bunchlength  10000
-
-spp tom idalignsolve03 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignsolve03 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/Solve_trf.py'
-spp tom idalignsolve03 trfname  'Solve_trf.py'
-
-spp tom idalignsolve03 inputs inputTFiles  "!{'metatype': 'inputLFNlistDA'}"
-
-spp tom idalignsolve03 outputs outputAlignmentConstants    "!{'dstype': 'ROOT_CONSTANTS'}"
-spp tom idalignsolve03 outputs outputAlignmentConstantsdb  "!{'dstype': 'ROOT_DB'}"
-spp tom idalignsolve03 outputs outputAlignFiles            "!{'dstype': 'TAR_ALIGNFILES'}"
-
-spp tom idalignsolve03 phconfig iteration  "!{'value': 3,}"
-
-spp tom idalignsolve03 maxattempt  3
-spp tom idalignsolve03 priority    1300
-spp tom idalignsolve03 trfcpu      360
-
-addp1 tom idalignsolve03  300
-###############################################################################################################################
-
-
-##################################################     ID ALIGNMENT     #######################################################
-###############################################################################################################################
-## Merging of ROOT_MON files (suitable for all iteration steps)
-###############################################################################################################################
-spp tom idalignmerge00 username  idalign
-
-spp tom idalignmerge00 active  True
-
-spp tom idalignmerge00 inputdsspecautomatic "(type= 'ROOT_MON' AND username='idalign' AND writer1='FILLED' AND datasetname LIKE '%physics_IDCosmic.idalignreco.ROOT_MON.iter%' AND runnr>999999)"
-spp tom idalignmerge00 automaticmode on
-
-spp tom idalignmerge00 taskstep  idalignmerge
-spp tom idalignmerge00 tasktype  idalignmerge
-spp tom idalignmerge00 tasktag   ''
-
-spp tom idalignmerge00 bunchFion    bunchEverything
-spp tom idalignmerge00 bunchlength  10000
-
-spp tom idalignmerge00 tasktransinfo trfsetupcmd  '/afs/cern.ch/user/a/atlidali/public/calibScripts/setupRel.sh'
-spp tom idalignmerge00 tasktransinfo trfpath      '/afs/cern.ch/user/a/atlidali/public/calibScripts/MergeMon_trf.py'
-spp tom idalignmerge00 trfname  'MergeMon_trf.py'
-
-spp tom idalignmerge00 inputs inputMonitoringFiles  "!{'metatype': 'inputLFNlistDA'}"
-
-spp tom idalignmerge00 outputs outputMonitoringMergedFile  "!{'dstype': 'ROOT_MON'}"
-
-spp tom idalignmerge00 maxattempt  3
-spp tom idalignmerge00 priority    1300
-spp tom idalignmerge00 trfcpu      600
-
-addp1 tom idalignmerge00  300
-###############################################################################################################################
-
-
-## customization
-
-sa logmgr logListFile  '*:*:0 *:*:1 *:*:2 *:*:3 *:*:4 *:*:5 TOM:*:*'
-sa logmgr logListDB    '*:*:0 *:*:3 TOM:messageCycle:*'
-sa logmgr mfrom  '${TZPSID}@cern.ch'
-sa logmgr mto    "!['Armin.Nairz@cern.ch']"
-sa logmgr logfilearcdir  ${TZLOG3}/TOM
-
-sa msgmgr msgfilenm  'msgbox/${TZPSID}.msg'
-
-sa pdb usedictlistcompress  True
-
-# switch off default JSON formatting in DB records; XML will be used instead
-#sa pdb usejson  False
-
-# finish only tasks created by the instance itself
-sa tom doFinishActiveTasks  True
-sa tom finishTasksUsername  None
-sa tom finishTasksCreator2  ${TZPSID}
-
-sa tom logmgr ->logmgr
-sa tom msgmgr ->msgmgr
-sa tom pdb ->pdb
-sa tom amiproxy ->ami
-#sa ami dbproxy ->pdbpx         ### 06-11-2014 LG should be redundant 
-
-
-##
-
-#sa tom nextTokenTime 20000000000
-
-master ->tom objdict cfgtxt
-start ->tom start 20000000 
-
-## end of config file
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/info.txt b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/info.txt
deleted file mode 100644
index e29a74be25a77a6091f647284bf6b602370ffdcd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/info.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-#Steps to run the alignment. All configuration is made in create_pickle.py
-
-source setupRel.sh
-python create_pickle.py
-python Accumulate_trf.py --argdict=reco1_01.pickle
-python Solve_trf.py --argdict=solve1.pickle
-python MergeMon_trf.py --argdict=merge1.pickle
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/setupRel.sh b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/setupRel.sh
deleted file mode 100755
index 3f6900c726eda969c42187ed543686842facd0db..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/setupRel.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
-alias asetup='source $AtlasSetup/scripts/asetup.sh'
-cd ../../../..
-asetup 19.3.0.3,AtlasProduction,here,builds
-cd InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts
-export STAGE_SVCCLASS='atlcal'
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py
deleted file mode 100755
index ee5428b469a4cae6b84a25db030eab2ec5989ca7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py
+++ /dev/null
@@ -1,487 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-## set to true in case you would like to write out your own InDetAlignMon.root
-InDetAlignMonDoOutput = True
-
-## Set to True if you want to run the TruthComparison
-InDetAlignMonDoTruth = False
-
-## Set to True if you want to use RefittedTracks collection as opposed to ExtendedTracks (in collisions data)
-## should use this when reading ESDs (ExtendedTracks does not exist, and Tracks is missing TrackParameters for hits)
-## To use RefittedTracks collection requires also that InDetFlags.doRefit=True
-InDetAlignMonReadESD = False
-if datasample.getFormat()=='ESD': 
-    InDetAlignMonReadESD = True
-
-
-# Setup vertexing sequence without beam constraint.
-# NOTE: Include the following BEFORE adding InDetAlignMonManager to topSequence.
-# include('InDetAlignmentMonitoring/InDetAlignmentMonitoring_vertexing.py')
-
-
-from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool           #loading the InDetTrackSelectionTool
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMon__TrackSelectionTool
-#Here are to load the track selection tool.
-#The alignMonTrackSelectionTool is a custom made trackselection tool that interface the monitoring tools to the track selection and make some 
-#high level cuts (if everything passes, comTime, EventPhase, PrimaryVertex ..)
-#It can call the InDetDetailedTrackSelectorTool or the InDetTrackSelectionTool, that actually make the track selection
-
-m_alignMonTrackSelectorTool     =[]
-m_alignMonTrackSelectionTool    =[]
-
-
-
-if not jobproperties.Beam.beamType()=='cosmics': 
-    #
-    # Collisions and single beam running
-    #
-    # Track selector that implement the Tracking CP supported cuts for Run2 using loosePrimary cut
-    m_alignMonTrackSelectorTool.append(InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionTool_LoosePrimary",
-                                                                         UseTrkTrackTools = True,
-                                                                         minPt = 5000,
-                                                                         maxD0 = 100000,
-                                                                         maxZ0SinTheta = 150,
-                                                                         CutLevel = "LoosePrimary",
-                                                                         TrackSummaryTool    = InDetTrackSummaryTool,
-                                                                         Extrapolator        = InDetExtrapolator))
-                                                                         
-    
-    # Track selector that implement the Tracking CP supported cuts for Run2 using tightPrimary cut
-    m_alignMonTrackSelectorTool.append(InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionTool_NoTRT",
-                                                                         UseTrkTrackTools = True,
-                                                                         minPt = 5000,
-                                                                         maxD0 = 100000,
-                                                                         maxZ0SinTheta = 150,
-                                                                         minNTrtHits = 0,
-                                                                         CutLevel = "LoosePrimary",
-                                                                         TrackSummaryTool    = InDetTrackSummaryTool,
-                                                                         Extrapolator        = InDetExtrapolator))
-    
-    if jobproperties.Beam.beamType()=='singlebeam':
-        m_alignMonTrackSelectorTool[0].minPt   = 0.0
-        m_alignMonTrackSelectorTool[0].maxZ0SinTheta = 100000.0
-        m_alignMonTrackSelectorTool[1].minPt   = 0.0
-        m_alignMonTrackSelectorTool[1].maxZ0SinTheta = 100000.0
-    
-    #Adding the tools to the Tool Service
-        
-    ToolSvc += m_alignMonTrackSelectorTool[0]
-    ToolSvc += m_alignMonTrackSelectorTool[1]
-    
-    
-    #Here we start creating the custom Track Selection tools.
-    
-    m_alignMonTrackSelectionTool.append(InDetAlignMon__TrackSelectionTool(name                     = "InDetAlignMonTrackSelectionTool_LoosePrimary",
-#                                                                          PassAllTracks           = True, ## Uncomment this line to bypass track slection
-                                                                          IDTrackSelectionTool     = m_alignMonTrackSelectorTool[0],
-                                                                          UseIDTrackSelectionTool  = True))
-    
-    m_alignMonTrackSelectionTool.append(InDetAlignMon__TrackSelectionTool(name                     = "InDetAlignMonTrackSelectionTool_LoosePrimary_NoTRT",
- #                                                                         PassAllTracks           = True, ## Uncomment this line to bypass track slection
-                                                                          IDTrackSelectionTool     = m_alignMonTrackSelectorTool[1],
-                                                                          UseIDTrackSelectionTool  = True))
-
-    
-    #Adding the TrackSelectionTools to the Tool Service
-    ToolSvc += m_alignMonTrackSelectionTool[0]
-    ToolSvc += m_alignMonTrackSelectionTool[1]
-        
-    #if (InDetFlags.doPrintConfigurables()):
-    print m_alignMonTrackSelectionTool[0]
-    print m_alignMonTrackSelectionTool[1]
-                
-    #Starting the creation of the monitoring tools
-        
-    
-    
-    if not jobproperties.Beam.beamType()=='singlebeam':
-        
-        from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonSivsTRT
-        InDetAlignMonSivsTRT_noTrig = IDAlignMonSivsTRT (name                                = "InDetAlignMonSivsTRT_noTrig",
-                                                         trackSelection                      = m_alignMonTrackSelectionTool[0])
-
-        ToolSvc += InDetAlignMonSivsTRT_noTrig
-        if (InDetFlags.doPrintConfigurables()):
-            print InDetAlignMonSivsTRT_noTrig
-
-
-        from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot
-        InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name                           = "InDetAlignMonBeamSpot_noTrig",
-                                                              extrapolator                   = InDetExtrapolator,
-                                                              vxContainerName                = InDetKeys.PrimaryVertices(),
-                                                              vxContainerWithBeamConstraint  = InDetFlags.useBeamConstraint())
-        
-        ToolSvc += InDetAlignMonBeamSpot_noTrig
-        if (InDetFlags.doPrintConfigurables()):
-            print InDetAlignMonBeamSpot_noTrig
-
-
-        # Note this is not to be included in the tool service
-        from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonNtuple
-        InDetAlignMonNtuple = IDAlignMonNtuple (name                                         = "InDetAlignMonNtuple",
-                                                tracksName                                   = InDetKeys.ExtendedTracks(),
-                                                tracksTruthName                              = InDetKeys.ExtendedTracksTruth())
-        
-else:
-    #
-    # Cosmics Running
-    #
-    
-    # Original set of selectors
-
-    m_trackSelectorToolName          = ["InDetAlignCosmicTrackSelectorTool","InDetAlignCosmicTrackSelector_Half","PixTrackSelectorTool",
-                                        "PixUpLowTrackSelectorTool","SCTTrackSelectorTool","SCTUpLowTrackSelectorTool","SiTrackSelectorTool",
-                                        "SiUpSiLowTrackSelectorTool","TRTonlyTrackSelectorTool","TRTUpTRTLowTrackSelectorTool"]
-
-    
-    
-    m_minNInnermostLayerHits         = [ 0, 1,2,1, 0,0, 2,1, 0, 0]
-    m_minNPixelHits                  = [ 3, 3,5,3, 0,0, 5,3, 0, 0]
-    m_minNSctHits                    = [ 8, 8,0,0,14,8,14,8, 0, 0]
-    m_minNTrtHits                    = [30,25,0,0, 0,0, 0,0,30,30]
-
-    m_alignMonTrackSelectionToolName = ["InDetAlignMonTrackSelectionTool","InDetAlignMonTrackSelectionTool_Half","PixTrackSelectionTool",
-                                        "PixUpLowTrackSelectionTool","SCTTrackSelectionTool","SCTUpLowTrackSelectionTool","SiTrackSelectionTool",
-                                        "SiUpSiLowTrackSelectionTool","TRTonlyTrackSelectionTool","TRTUpTRTLowTrackSelectionTool"]
-
-    
-    
-    for i in range(10):        
-        m_alignMonTrackSelectorTool.append(InDet__InDetTrackSelectionTool(name                   = m_trackSelectorToolName[i],
-                                                                          minPt                  = 1000.0,#1 GeV
-                                                                          maxD0                  = 50.0,#no cut on d0 yet
-                                                                          maxZ0SinTheta          = 1200.0,#actual cut is on sin(theta)*z0
-                                                                          minNInnermostLayerHits = m_minNInnermostLayerHits[i], 
-                                                                          minNPixelHits          = m_minNPixelHits[i], 
-                                                                          minNSctHits            = m_minNSctHits[i], 
-                                                                          minNTrtHits            = m_minNTrtHits[i], 
-                                                                          UseTrkTrackTools       = True,
-                                                                          CutLevel               = "LoosePrimary",
-                                                                          TrackSummaryTool       = InDetTrackSummaryTool,
-                                                                          Extrapolator           = InDetExtrapolator))
-        ToolSvc += m_alignMonTrackSelectorTool[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_alignMonTrackSelectorTool[i]
-            
-        
-    
-            
-        m_alignMonTrackSelectionTool.append(InDetAlignMon__TrackSelectionTool(name                = m_alignMonTrackSelectionToolName[i],
-                                                                              ## Uncomment this line to bypass track selection
-                                                                              #PassAllTracks      = True,
-                                                                              #DoEventPhaseCut    = True,
-                                                                              UseIDTrackSelectionTool  = True,
-                                                                              IDTrackSelectionTool     = m_alignMonTrackSelectorTool[i]))
-        
-        if jobproperties.Beam.beamType()=='singlebeam':
-            m_alignMonTrackSelectionTool[i].PassAllTracks = True
-
-        ToolSvc += m_alignMonTrackSelectionTool[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_alignMonTrackSelectionTool[i]
-    
-
-#
-# Residuals
-#
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonResiduals
-InDetAlignMonResiduals_noTrig = IDAlignMonResiduals (name           = "InDetAlignMonResiduals_noTrig",
-                                                     trackSelection = m_alignMonTrackSelectionTool[1],
-                                                     iUpdator       = InDetUpdator,
-                                                     propagator     = InDetPropagator,
-                                                     Pixel_Manager  = InDetKeys.PixelManager(),
-                                                     SCT_Manager    = InDetKeys.SCT_Manager(),
-                                                     TRT_Manager    = InDetKeys.TRT_Manager())  
-
-if jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam':
-    InDetAlignMonResiduals_noTrig.tracksName = InDetKeys.Tracks()
-else:
-    InDetAlignMonResiduals_noTrig.tracksName = InDetKeys.ExtendedTracks()
-    if InDetAlignMonReadESD and InDetFlags.doRefit: #use refitted tracks if reading ESD
-        InDetAlignMonResiduals_noTrig.tracksName = InDetKeys.RefittedTracks()
-
-ToolSvc += InDetAlignMonResiduals_noTrig
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignMonResiduals_noTrig
-
-#
-# Efficiencies
-#
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonEfficiencies
-InDetAlignMonEfficiencies_noTrig = IDAlignMonEfficiencies (name           = "InDetAlignMonEfficiencies_noTrig",
-                                                           trackSelection = m_alignMonTrackSelectionTool[1],
-                                                           HoleSearch     = InDetHoleSearchTool,
-                                                           Pixel_Manager  = InDetKeys.PixelManager(),
-                                                           SCT_Manager    = InDetKeys.SCT_Manager(),
-                                                           TRT_Manager    = InDetKeys.TRT_Manager())    
-
-if jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam':
-    InDetAlignMonEfficiencies_noTrig.tracksName = InDetKeys.Tracks()
-else:
-    InDetAlignMonEfficiencies_noTrig.tracksName = InDetKeys.ExtendedTracks()
-    if InDetAlignMonReadESD and InDetFlags.doRefit:#use refitted tracks if reading ESD
-        InDetAlignMonEfficiencies_noTrig.tracksName = InDetKeys.RefittedTracks()
-
-ToolSvc += InDetAlignMonEfficiencies_noTrig
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignMonEfficiencies_noTrig
-
-#
-# Generic Tracks
-#
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks
-InDetAlignMonGenericTracks_noTrig = IDAlignMonGenericTracks (name                = "InDetAlignMonGenericTracks_noTrig",
-                                                             trackSelection      = m_alignMonTrackSelectionTool[1],
-                                                             VxPrimContainerName = InDetKeys.PrimaryVertices())   
-
-if jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam':
-    InDetAlignMonGenericTracks_noTrig.tracksName   = InDetKeys.Tracks()
-    #InDetAlignMonGenericTracks_noTrig. tracksName = InDetKeys.PixelTracks()
-else:
-    InDetAlignMonGenericTracks_noTrig.tracksName = InDetKeys.ExtendedTracks()
-    if InDetAlignMonReadESD and InDetFlags.doRefit: #use refitted tracks if reading ESD
-        InDetAlignMonGenericTracks_noTrig.tracksName = InDetKeys.RefittedTracks()
-
-ToolSvc += InDetAlignMonGenericTracks_noTrig
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignMonGenericTracks_noTrig
-
-#
-# Track Segments
-#
-if jobproperties.Beam.beamType()=='cosmics':
-
-    #
-    # Upper Vs Lower
-    #
-    from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool
-    from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonTrackSegments
-
-    m_trackSplitter          = []
-    m_trackSplitterName      = ["TrackSplitterTool_Combined","TrackSplitterTool_Pixel","TrackSplitterTool_SCT","TrackSplitterTool_Si","TrackSplitterTool_TRT"]
-    m_upperTracksName        = ["Combined_Upper","Pixel_Upper","SCT_Upper","Si_Upper","TRT_Upper"]
-    m_lowerTracksName        = ["Combined_Lower","Pixel_Lower","SCT_Lower","Si_Lower","TRT_Lower"]
-
-    m_trackSegmentsUpLow     = []
-    m_trackSegmentsUpLowName = ["InDetAlignMonTrackSegments_Combined","InDetAlignMonTrackSegments_PixUpLow","InDetAlignMonTrackSegments_SCTUpLow",
-                                "InDetAlignMonTrackSegments_SiUpLow","InDetAlignMonTrackSegments_TRTUpLow"]
-
-    m_inputTracksUpLow       = [InDetKeys.Tracks(),InDetKeys.PixelTracks(),InDetKeys.SCTTracks(),"ResolvedTracks",InDetKeys.TRTTracks()]
-
-    m_d0Range                = [   50,   50,   50,   50, 800]
-    m_deltaD0                = [  0.8,  0.8,  0.8,  0.8,   8]
-    m_deltaD02D              = [    5,    5,    5,    5,  10]
-    m_deltaPhi               = [0.005,0.005,0.005,0.005,0.01]
-    m_deltaPhi2D             = [ 0.02, 0.02, 0.02, 0.02,0.05]
-    m_deltaQoverPt           = [ 0.05,  0.2, 0.05, 0.04, 0.1]
-    m_deltaQoverPt2D         = [ 0.05,  0.2, 0.05, 0.04, 0.1]
-
-    for i in range(5):
-        m_trackSplitter.append(InDet__InDetTrackSplitterTool(name                  = m_trackSplitterName[i],
-                                                             TrackFitter           = InDetTrackFitter,
-                                                             OutputUpperTracksName = m_upperTracksName[i],
-                                                             OutputLowerTracksName = m_lowerTracksName[i]))
-        
-        ToolSvc += m_trackSplitter[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_trackSplitter[i]
-
-        m_trackSegmentsUpLow.append(IDAlignMonTrackSegments(name                   = m_trackSegmentsUpLowName[i],
-                                                            InputTracksName        = m_inputTracksUpLow[i],
-                                                            UpperTracksName        = m_upperTracksName[i],
-                                                            LowerTracksName        = m_lowerTracksName[i],
-                                                            UseCTBSplitTracks      = False,
-                                                            TrackSplitter          = m_trackSplitter[i],#Need the even ones
-                                                            trackSelectionUp       = m_alignMonTrackSelectionTool[2*i+1],
-                                                            trackSelectionLow      = m_alignMonTrackSelectionTool[2*i+1],
-                                                            trackSumTool           = InDetTrackSummaryTool,
-                                                            DeltaD0Range           = m_deltaD0[i],
-                                                            DeltaD0Range2D         = m_deltaD02D[i],
-                                                            DeltaPhiRange          = m_deltaPhi[i],
-                                                            DeltaPhiRange2D        = m_deltaPhi2D[i],
-                                                            DeltaQoverPtRange      = m_deltaQoverPt[i],
-                                                            DeltaQoverPtRange2D    = m_deltaQoverPt2D[i],
-                                                            D0Range                = m_d0Range[i]))
-
-        ToolSvc += m_trackSegmentsUpLow[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_trackSegmentsUpLow[i]
-
-    #
-    # Subdetector Vs Subdetector
-    #
-    m_trackSegments_Sub     = []
-    m_trackSegmentsName_Sub = ["InDetAlignMonTrackSegments_PixSCT","InDetAlignMonTrackSegments_SiTRT"]
-    m_inputTracks_Sub       = [InDetKeys.Tracks(),InDetKeys.Tracks()]
-    m_upperTracksName_Sub   = [InDetKeys.PixelTracks(),"ResolvedTracks"]
-    m_trackSelectionUpper   = [2,6]
-    m_lowerTracksName_Sub   = [InDetKeys.SCTTracks(),InDetKeys.TRTTracks()]
-    m_trackSelectionLower   = [4,8]
-    m_d0Range_Sub           = [   50, 800]
-    m_deltaD0_Sub           = [  0.8,   8]
-    m_deltaD02D_Sub         = [    5,  10]
-    m_deltaPhi_Sub          = [0.005,0.01]
-    m_deltaPhi2D_Sub        = [ 0.02,0.05]
-    m_deltaQoverPt_Sub      = [ 0.05, 0.1]
-    m_deltaQoverPt2D_Sub    = [ 0.05, 0.1]
-
-    for i in range(2):
-        m_trackSegments_Sub.append(IDAlignMonTrackSegments(name = m_trackSegmentsName_Sub[i],
-                                                           InputTracksName         = m_inputTracks_Sub[i],
-                                                           UpperTracksName         = m_upperTracksName_Sub[i],
-                                                           LowerTracksName         = m_lowerTracksName_Sub[i],
-                                                           trackSelectionUp        = m_alignMonTrackSelectionTool[m_trackSelectionUpper[i]],
-                                                           trackSelectionLow       = m_alignMonTrackSelectionTool[m_trackSelectionLower[i]],
-                                                           trackSumTool            = InDetTrackSummaryTool,
-                                                           DeltaD0Range            = m_deltaD0_Sub[i],
-                                                           DeltaD0Range2D          = m_deltaD02D_Sub[i],
-                                                           DeltaPhiRange           = m_deltaPhi_Sub[i],
-                                                           DeltaPhiRange2D         = m_deltaPhi2D_Sub[i],
-                                                           DeltaQoverPtRange       = m_deltaQoverPt_Sub[i],
-                                                           DeltaQoverPtRange2D     = m_deltaQoverPt2D_Sub[i],
-                                                           D0Range                 = m_d0Range_Sub[i]))
-
-        ToolSvc += m_trackSegments_Sub[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_trackSegments_Sub[i]
-
-## only do trigger-aware monitoring if monTrigDecTool known by ToolSvc
-#if DQMonFlags.useTrigger():
-#    if not hasattr(ToolSvc, DQMonFlags.nameTrigDecTool()):
-#        print "InDetAlignmentMonitoring_InDetRec_jobOptions.py: trigger decision tool not found, including it now"
-if not hasattr(ToolSvc, 'monTrigDecTool'):
-    print "InDetAlignmentMonitoring_InDetRec_jobOptions.py: trigger decision tool not found: don't run trigger-aware monitoring"  
-elif jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam':
-    print "InDetAlignmentMonitoring_InDetRec_jobOptions.py: cosmics or singlebeam beamType: don't run trigger-aware monitoring"
-else:
-    InDetAlignMonSivsTRT = IDAlignMonSivsTRT (name           = "InDetAlignMonSivsTRT",
-                                              trackSelection = m_alignMonTrackSelectionTool[1])
-
-    InDetAlignMonResiduals = IDAlignMonResiduals (name           = "InDetAlignMonResiduals",
-                                                  trackSelection = m_alignMonTrackSelectionTool[1],
-                                                  tracksName     = InDetKeys.ExtendedTracks(),
-                                                  Pixel_Manager  = InDetKeys.PixelManager(),
-                                                  SCT_Manager    = InDetKeys.SCT_Manager(),
-                                                  TRT_Manager    = InDetKeys.TRT_Manager())   
-
-    InDetAlignMonEfficiencies = IDAlignMonEfficiencies (name           = "InDetAlignMonEfficiencies",
-                                                        trackSelection = m_alignMonTrackSelectionTool[1],
-                                                        tracksName     = InDetKeys.ExtendedTracks(),
-                                                        HoleSearch     = InDetHoleSearchTool,
-                                                        Pixel_Manager  = InDetKeys.PixelManager(),
-                                                        SCT_Manager    = InDetKeys.SCT_Manager(),
-                                                        TRT_Manager    = InDetKeys.TRT_Manager())    
-
-    InDetAlignMonGenericTracks = IDAlignMonGenericTracks (name                = "InDetAlignMonGenericTracks",
-                                                          trackSelection      = m_alignMonTrackSelectionTool[1],
-                                                          tracksName          = InDetKeys.ExtendedTracks(),
-                                                          VxPrimContainerName = InDetKeys.PrimaryVertices())
-
-    InDetAlignMonBeamSpot = InDetAlignMonBeamSpot (name                          = "InDetAlignMonBeamSpot",
-                                                   vxContainerName               = InDetKeys.PrimaryVertices(),
-                                                   vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint())
-
-    if jobproperties.Beam.beamType()=='collisions' and hasattr(ToolSvc, 'DQFilledBunchFilterTool'):
-        InDetAlignMonSivsTRT.FilterTools.append(monFilledBunchFilterTool)
-        InDetAlignMonResiduals.FilterTools.append(monFilledBunchFilterTool)
-        InDetAlignMonEfficiencies.FilterTools.append(monFilledBunchFilterTool)
-        InDetAlignMonGenericTracks.FilterTools.append(monFilledBunchFilterTool)
-        InDetAlignMonBeamSpot.FilterTools.append(monFilledBunchFilterTool)
-
-    InDetAlignMonSivsTRT.TrigDecisionTool         = monTrigDecTool
-    InDetAlignMonResiduals.TrigDecisionTool       = monTrigDecTool
-    InDetAlignMonEfficiencies.TrigDecisionTool    = monTrigDecTool
-    InDetAlignMonGenericTracks.TrigDecisionTool   = monTrigDecTool
-    InDetAlignMonBeamSpot.TrigDecisionTool        = monTrigDecTool
-
-    InDetAlignMonSivsTRT.TriggerChain             = "J_minpt"
-    InDetAlignMonResiduals.TriggerChain           = "J_minpt"
-    InDetAlignMonEfficiencies.TriggerChain        = "J_minpt"
-    InDetAlignMonGenericTracks.TriggerChain       = "J_minpt"
-    InDetAlignMonBeamSpot.TriggerChain            = "J_minpt"
-
-    InDetAlignMonSivsTRT.triggerChainName         = "Jet_MinBias_Trigger"
-    InDetAlignMonResiduals.triggerChainName       = "Jet_MinBias_Trigger"
-    InDetAlignMonEfficiencies.triggerChainName    = "Jet_MinBias_Trigger"
-    InDetAlignMonGenericTracks.triggerChainName   = "Jet_MinBias_Trigger"
-    InDetAlignMonBeamSpot.histFolder              = "IDAlignMon/BeamSpot/Jet_MinBias_Trigger"
-
-    ToolSvc += InDetAlignMonResiduals
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonResiduals
-    ToolSvc += InDetAlignMonEfficiencies
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonEfficiencies
-    ToolSvc += InDetAlignMonGenericTracks
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonGenericTracks
-    ToolSvc += InDetAlignMonBeamSpot
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonBeamSpot
-    ToolSvc += InDetAlignMonSivsTRT
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonSivsTRT
-      
-## add an AthenaMonManager algorithm to the list of algorithms to be ran
-#from DataQualityTools.DQMonFlags import DQMonFlags
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-InDetAlignMonManager = AthenaMonManager( name                = "InDetAlignMonManager",
-                                         FileKey             = DQMonFlags.monManFileKey(),
-                                         ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                         DataType            = DQMonFlags.monManDataType(),
-                                         Environment         = DQMonFlags.monManEnvironment(),
-                                         ManualRunLBSetup    = DQMonFlags.monManManualRunLBSetup(),
-                                         Run                 = DQMonFlags.monManRun(),
-                                         LumiBlock           = DQMonFlags.monManLumiBlock())
-
-if jobproperties.Beam.beamType()=='cosmics':
-    InDetAlignMonManager.DataType = "cosmics"
-
-    for i in range(5):
-        InDetAlignMonManager.AthenaMonTools += [ m_trackSegmentsUpLow[i] ]
-    for i in range(2):
-        InDetAlignMonManager.AthenaMonTools += [ m_trackSegments_Sub[i] ]
-        
-elif jobproperties.Beam.beamType()=='collisions':
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonSivsTRT_noTrig ]
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonBeamSpot_noTrig ]
-
-InDetAlignMonManager.AthenaMonTools         += [ InDetAlignMonResiduals_noTrig ]
-InDetAlignMonManager.AthenaMonTools         += [ InDetAlignMonEfficiencies_noTrig ]
-InDetAlignMonManager.AthenaMonTools         += [ InDetAlignMonGenericTracks_noTrig ]
-
-if jobproperties.Beam.beamType()=='collisions' and hasattr(ToolSvc, 'DQFilledBunchFilterTool'):
-    InDetAlignMonSivsTRT_noTrig.FilterTools.append(monFilledBunchFilterTool)
-    InDetAlignMonResiduals_noTrig.FilterTools.append(monFilledBunchFilterTool)
-    InDetAlignMonEfficiencies_noTrig.FilterTools.append(monFilledBunchFilterTool)
-    InDetAlignMonGenericTracks_noTrig.FilterTools.append(monFilledBunchFilterTool)
-    InDetAlignMonBeamSpot_noTrig.FilterTools.append(monFilledBunchFilterTool)
-
-
-if InDetAlignMonDoTruth:
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonTruthComparison ]
-if not hasattr(ToolSvc, 'monTrigDecTool'):
-    print "InDetAlignmentMonitoring_InDetRec_jobOptions.py: trigger decision tool not found: don't run trigger-aware monitoring" 
-elif jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam':
-    print "singlebeam or cosmics: don't run trigger-aware monitoring"
-else:
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonResiduals ]
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonEfficiencies ]
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonGenericTracks ]
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonBeamSpot ]
-    InDetAlignMonManager.AthenaMonTools     += [ InDetAlignMonSivsTRT ]
-
-## Setup the output histogram file(s):
-if not hasattr(ServiceMgr, 'THistSvc'):
-    from GaudiSvc.GaudiSvcConf import THistSvc
-    ServiceMgr += THistSvc()
-if InDetAlignMonDoOutput:
-    THistSvc         = Service( "THistSvc" )
-    histOutput       = "IDAlignMon DATAFILE='./monitoring.root' OPT='RECREATE'"
-    THistSvc.Output += [histOutput]
-    InDetAlignMonManager.FileKey = "IDAlignMon"
-
-topSequence += InDetAlignMonManager
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignMonManager
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetRecESD.root b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetRecESD.root
deleted file mode 100644
index b43b0919ee544398fe881c698f012fbba0195e4e..0000000000000000000000000000000000000000
Binary files a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetRecESD.root and /dev/null differ
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py
deleted file mode 100755
index f1bc3e56f032ef30b831ecd4cc5226f6d1b6f3ce..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/ReadInDet_jobOptions.py
+++ /dev/null
@@ -1,225 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#--------------------------------------------------------------
-# control input
-#--------------------------------------------------------------
-# --- specify input type
-if not 'readESD' in dir():
-  readESD = True
-readAOD = not readESD
-
-# --- run on the 13.0.30.3 reference ESD or AOD
-read13Reference = False
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-  
-if readESD:
-  athenaCommonFlags.FilesInput = [ "InDetRecESD.root" ]
-  if read13Reference:
-    # 13.0.30.3 reference ESD with DetDescrVersion = "ATLAS-CSC-01-02-00"
-    athenaCommonFlags.FilesInput = [ "/afs/cern.ch/atlas/maxidisk/d33/referencefiles/T1_5200.13.0.30.3.ESD.017284._00001.pool.root" ]
-
-elif readAOD:
-  athenaCommonFlags.FilesInput = [ "InDetRecAOD.root" ]
-  if read13Reference:
-    # 13.0.30.3 reference AOD with DetDescrVersion = "ATLAS-CSC-01-02-00"
-    athenaCommonFlags.FilesInput = [ "/afs/cern.ch/atlas/maxidisk/d33/referencefiles/T1_5200.13.0.30.3.AOD.017284._00001.pool.root" ]
-athenaCommonFlags.FilesInput = [ 'root://eosatlas//eos/atlas/atlasdatadisk/mc10_7TeV/DESD_MBIAS/e574_s932_s946_r2094/mc10_7TeV.105001.pythia_minbias.recon.DESD_MBIAS.e574_s932_s946_r2094_tid280668_00/DESD_MBIAS.280668._016228.pool.root.1']
-
-import AthenaPython.ConfigLib as apcl
-cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput())
-cfg.configure_job()
-
-theApp.EvtMax  = 10
-
-#--------------------------------------------------------------
-# control output (here so RecExCommon via auto-config doesn't delete the global flags)
-#--------------------------------------------------------------
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD = False and readESD
-doWriteAOD = False
-
-#--------------------------------------------------------------
-# control algorithms to be rerun
-#--------------------------------------------------------------
-# --- run InDetRecStatistics (only possible if readESD = True)
-doInDetRecStatistics = True and readESD
-# --- refit the EXISTING tracks in ESD (only possible if readESD = True)
-doRefitTracks = False and readESD
-# --- redo the pattern reco and the tracking (do not use that in conjunction with doRefitTracks above)
-redoPatternRecoAndTracking = True #False and not doRefitTracks and readESD
-# --- redo primary vertexing (will be set to true later automatically if you redid the tracking and want to redo the TrackParticle creation)
-reDoPrimaryVertexing = False
-# --- redo particle creation (recommended after revertexing on ESD, otherwise trackparticles are inconsistent)
-reDoParticleCreation = False and readESD and reDoPrimaryVertexing
-# --- redo conversion finding
-reDoConversions = False
-# --- redo V0 finding
-reDoV0Finder = False
- 
-#--------------------------------------------------------------
-# Control - standard options (as in jobOptions.py)
-#--------------------------------------------------------------
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- do auditors ?
-doAuditors      = True
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-# safety section ... redoing tracking/vertexing is a tricky business to stay consistent ...
-if redoPatternRecoAndTracking and reDoParticleCreation:
-  reDoPrimaryVertexing = True
-
-if not (readESD or readAOD):
-  print "You have to turn on reading of ESD or AOD! That's the purpose of this jobO!"
-if readESD and readAOD:
-  print "I can either read ESD or AOD but not both at the same time! Turn one or the other off!"
-if readESD and reDoPrimaryVertexing and not reDoParticleCreation:
-  print "INFO! You are running on ESD, redoing the vertexing but not recreating the TrackParticles!"
-  print "INFO! To avoid inconsistencies do not use the old track particles in conjunction with the new vertex!"
-  if doWriteESD or doWriteAOD:
-    print "INFO! To avoid inconsistencies the old track particle (truth) container will not be in the new ESD/AOD!"
-if readAOD and reDoPrimaryVertexing:
-  print "INFO! You are running on AOD, and redoing the vertexing. At the moment new track particles cannot be made from old ones."
-  print "INFO! To avoid inconsistencies do not use the old track particles in conjunction with the new vertex!"
-  if doWriteAOD:
-    print "INFO! To avoid inconsistencies the old track particle (truth) container will not be in the new AOD!"
-if doRefitTracks and (reDoPrimaryVertexing or reDoParticleCreation):
-  print "INFO! You are refitting tracks and also revertex and/or recreate track particles"
-  print "INFO! The input for that will be the refitted tracks!"
-
-#--------------------------------------------------------------
-# Additional Detector setup
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning=False
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.SCT_setOff()
-#DetFlags.detdescr.SCT_setOn()
-#DetFlags.TRT_setOff()
-#DetFlags.detdescr.TRT_setOn()
-
-# --- printout
-DetFlags.Print()
-
-#--------------------------------------------------------------
-# Load Reconstruction configuration for tools only
-#--------------------------------------------------------------
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-
-
-from AthenaCommon.GlobalFlags import globalflags
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth            = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-InDetFlags.preProcessing      = redoPatternRecoAndTracking
-InDetFlags.doPRDFormation        = False                       # those two will be (later) automatically false if
-InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking  # preProcessing is false
-InDetFlags.doNewTracking      = redoPatternRecoAndTracking
-InDetFlags.doiPatRec          = False
-InDetFlags.doxKalman          = False
-InDetFlags.doLowPt            = False
-InDetFlags.doCTBTracking      = False
-InDetFlags.doBackTracking     = redoPatternRecoAndTracking
-InDetFlags.doTRTStandalone    = redoPatternRecoAndTracking
-InDetFlags.doTrtSegments      = redoPatternRecoAndTracking
-InDetFlags.postProcessing     = reDoPrimaryVertexing or reDoParticleCreation or reDoConversions or doInDetRecStatistics or reDoV0Finder
-InDetFlags.doTrackSegmentsPixel = False
-InDetFlags.doTrackSegmentsSCT = False
-InDetFlags.doTrackSegmentsTRT = False
-InDetFlags.doSlimming         = False
-InDetFlags.loadTools          = True
-InDetFlags.doVertexFinding    = reDoPrimaryVertexing
-InDetFlags.doParticleCreation = reDoParticleCreation
-InDetFlags.doConversions      = reDoConversions
-InDetFlags.doSecVertexFinder  = False
-InDetFlags.doV0Finder         = reDoV0Finder
-InDetFlags.doTrkNtuple        = False
-InDetFlags.doPixelTrkNtuple   = False
-InDetFlags.doSctTrkNtuple     = False
-InDetFlags.doTrtTrkNtuple     = False
-InDetFlags.doPixelClusterNtuple = False
-InDetFlags.doSctClusterNtuple   = False
-InDetFlags.doTrtDriftCircleNtuple = False
-InDetFlags.doVtxNtuple        = False
-InDetFlags.doConvVtxNtuple    = False
-InDetFlags.doV0VtxNtuple      = False
-InDetFlags.doRefit            = doRefitTracks
-InDetFlags.doLowBetaFinder    = False
-InDetFlags.doPrintConfigurables = True
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = True
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-from InDetRecExample.InDetKeys import InDetKeys
-if InDetFlags.doVertexFinding() and readAOD:
-  InDetKeys.Tracks = InDetKeys.TrackParticles()
-  print "InDetKeys.Tracks = "+InDetKeys.Tracks()
-
-if readESD and not redoPatternRecoAndTracking:
-  InDetKeys.UnslimmedTracks              = 'Tracks'
-  InDetKeys.UnslimmedTracksTruth         = 'TrackTruthCollection'
-
-# Set container names
-if doWriteESD:
-  InDetKeys.OutputESDFileName = "InDetRecESD_new.root"
-
-if doWriteAOD:
-  InDetKeys.OutputAODFileName = "InDetRecAOD_new.root"  
-
-print "Printing InDetKeys"
-InDetKeys.lockAllExceptAlias()
-InDetKeys.print_JobProperties()
-
-#--------------------------------------------------------------
-# enable statistics for reading ESD testing
-#--------------------------------------------------------------
-
-InDetFlags.doStatistics   = doInDetRecStatistics
-TrackCollectionKeys        = [InDetKeys.Tracks()]
-TrackCollectionTruthKeys   = [InDetKeys.TracksTruth()]
-  
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-  
-include("InDetRecExample/InDetRec_all.py")
-
-if doWriteESD: StreamESD.ForceRead = True
-    
-if doWriteAOD: StreamAOD.ForceRead = True
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/fullpage.sty b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/fullpage.sty
deleted file mode 100644
index b0f09c3f73381358567fcb6dd82f800f7bcc7289..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/fullpage.sty
+++ /dev/null
@@ -1,27 +0,0 @@
-% This is FULLPAGE.STY by H.Partl, Version 2 as of 15 Dec 1988.
-% Document Style Option to fill the paper just like Plain TeX.
-     
-\typeout{Style Option FULLPAGE Version 2 as of 15 Dec 1988}
-     
-\topmargin 0pt
-\advance \topmargin by -\headheight
-\advance \topmargin by -\headsep
-     
-\textheight 8.9in
-     
-\oddsidemargin 0pt
-\evensidemargin \oddsidemargin
-\marginparwidth 0.5in
-     
-\textwidth 6.5in
-     
-     
-% For users of A4 paper: The above values are suited for american 8.5x11in
-% paper. If your output driver performs a conversion for A4 paper, keep
-% those values. If your output driver conforms to the TeX standard (1in/1in),
-% then you should add the following commands to center the text on A4 paper:
-     
-% \advance\hoffset by -3mm  % A4 is narrower.
-% \advance\voffset by  8mm  % A4 is taller.
-     
-\endinput
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/pprint b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/pprint
deleted file mode 100755
index 82bc364737a2bda1ae11e71c935d3a940b4eb3e2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/pprint
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-
-if (len(sys.argv) > 1):
-    #remove .py from modulename
-    modulename = '.'.join(sys.argv[1].split('.')[:-1])
-
-    exec('from %s import dataset, tag' % modulename)
-
-    tag = tag.replace('_','\\_') #escape for latex
-
-    print("\\begin{table}")
-    print("\\begin{tabular}[ht]{l|rr}")
-    print("\\hline \\\\ %s & A & C ($\mu m$) \\\\ \\hline" % tag)
-
-    for (detector, A, C) in dataset:
-        print ("%s & %0.3f & %0.1f \\\\" % (detector, A, C*1000))
-    
-    print("\\end{tabular}")
-    print("\\end{table}")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/produceACTable.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/produceACTable.py
deleted file mode 100755
index 6c5c236c32f02c7aafff4a29d053b0e6be7242cc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/produceACTable.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#import matplotlib as mpl
-#mpl.use('pdf')
-#import pylab as pl
-
-#iterations = "A00 A01 A02".split()
-iterations = []
-iterations.extend(['C%02d' % (x) for x in range(10)])
-
-tables = []
-
-for i in iterations:
-    fh = open('results_iter%s.txt' % i)
-
-    table = {}
-
-    for line in fh:
-        
-        if ('Barrel' in line) or ('Endcap' in line):
-            s = (line.strip()).split()
-            if (len(s) == 4):
-                key = ' '.join(s[0:2])
-                table[key] = ' '.join(s[2:4])
-#                print table[key]
-            if (len(s) == 10):
-                key = ' '.join(s[0:2])
-                table[key] += ' ' + ( ' '.join( s[4:8]))
-#                print table[key]
-            
-#    for k in table:
-#        print ( (k, table[k]))
-
-    fh.close()
-
-    tables.append(table)
-
-
-for k in tables[0].keys():
-
-    print("\\begin{table}")
-    print("\\centering")
-
-    print("\\begin{tabular}[ht]{|l|rrrrrr|}")
-    print("%s & & & & & &\\\\" % k)
-    print("Iter & A & C & Pull & PullErr & RMS & RMSErr \\\\")
-    
-
-    lA = []
-    lC = []
-    lPull = []
-    lPullErr = []
-    lRMS = []
-    lRMSErr = []
-    
-    for (table, i) in zip(tables, iterations):
-        (A, C, Pull, PullErr, RMS, RMSErr) = map(float, table[k].split())
-        lA.append(A)
-        lC.append(C)
-        lPull.append(Pull)
-        lPullErr.append(PullErr)
-        lRMS.append(RMS)
-        lRMSErr.append(RMSErr)
-        print("%s & %0.4f & %0.4f & %0.4f & %0.4f & %0.4f & %0.4f \\\\" % (i, A, C, Pull, PullErr, RMS, RMSErr))
-
-            
-    print("\\end{tabular}")
-
-
-    print("\\end{table}")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/report.tex b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/report.tex
deleted file mode 100644
index 58f9a9a22553dcdb1a21b066c7925190fa01b27f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/Report/report.tex
+++ /dev/null
@@ -1,233 +0,0 @@
-\documentclass[10pt]{article}
-\usepackage{fullpage}
-\usepackage{fancyhdr}
-\usepackage{graphicx}
-\usepackage{ifthen}
-
-\pagestyle{fancy}
-\headheight 35pt
-
-\rhead{A. Morley}
-\lhead{Error Scaling Plots}
-
-\begin{document}
-\vspace{10pt}
-\section{Iteration C00}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC00/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC00/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC00/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC00/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC00/sctECA}\\
-\includegraphics[width=\textwidth]{iterC00/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC00/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC00/trtECA}\\
-\includegraphics[width=\textwidth]{iterC00/trtECC}\\
-
-\end{centering}
-\vspace{10pt}
-\section{Iteration C01}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC01/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC01/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC01/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC01/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC01/sctECA}\\
-\includegraphics[width=\textwidth]{iterC01/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC01/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC01/trtECA}\\
-\includegraphics[width=\textwidth]{iterC01/trtECC}\\
-
-\end{centering}
-\vspace{10pt}
-\section{Iteration C02}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC02/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC02/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC02/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC02/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC02/sctECA}\\
-\includegraphics[width=\textwidth]{iterC02/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC02/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC02/trtECA}\\
-\includegraphics[width=\textwidth]{iterC02/trtECC}\\
-
-\end{centering}
-\vspace{10pt}
-\section{Iteration C03}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC03/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC03/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC03/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC03/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC03/sctECA}\\
-\includegraphics[width=\textwidth]{iterC03/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC03/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC03/trtECA}\\
-\includegraphics[width=\textwidth]{iterC03/trtECC}\\
-
-\end{centering}
-\vspace{10pt}
-\section{Iteration C04}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC04/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC04/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC04/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC04/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC04/sctECA}\\
-\includegraphics[width=\textwidth]{iterC04/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC04/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC04/trtECA}\\
-\includegraphics[width=\textwidth]{iterC04/trtECC}\\
-
-\end{centering}
-
-\vspace{10pt}
-\section{Iteration C05}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC05/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC05/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC05/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC05/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC05/sctECA}\\
-\includegraphics[width=\textwidth]{iterC05/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC05/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC05/trtECA}\\
-\includegraphics[width=\textwidth]{iterC05/trtECC}\\
-
-\end{centering}
-
-
-\vspace{10pt}
-\section{Iteration C06}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC06/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC06/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC06/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC06/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC06/sctECA}\\
-\includegraphics[width=\textwidth]{iterC06/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC06/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC06/trtECA}\\
-\includegraphics[width=\textwidth]{iterC06/trtECC}\\
-
-\end{centering}
-
-\vspace{10pt}
-\section{Iteration C07}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC07/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC07/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC07/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC07/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC07/sctECA}\\
-\includegraphics[width=\textwidth]{iterC07/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC07/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC07/trtECA}\\
-\includegraphics[width=\textwidth]{iterC07/trtECC}\\
-
-\end{centering}
-\vspace{10pt}
-\section{Iteration C08}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC08/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC08/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC08/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC08/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC08/sctECA}\\
-\includegraphics[width=\textwidth]{iterC08/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC08/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC08/trtECA}\\
-\includegraphics[width=\textwidth]{iterC08/trtECC}\\
-
-\end{centering}
-
-\vspace{10pt}
-\section{Iteration C09}
-
-\begin{centering}
-
-
-\includegraphics[width=\textwidth]{iterC09/pixelBarrel}\\
-\includegraphics[width=\textwidth]{iterC09/pixelECA}\\
-\includegraphics[width=\textwidth]{iterC09/pixelECC}\\
-
-\includegraphics[width=\textwidth]{iterC09/sctBarrel}\\
-\includegraphics[width=\textwidth]{iterC09/sctECA}\\
-\includegraphics[width=\textwidth]{iterC09/sctECC}\\
-
-\includegraphics[width=\textwidth]{iterC09/trtBarrel}\\
-\includegraphics[width=\textwidth]{iterC09/trtECA}\\
-\includegraphics[width=\textwidth]{iterC09/trtECC}\\
-
-\end{centering}
-%\vspace{10pt}
-%\section{Iteration C10}
-
-%\begin{centering}
-
-
-%\includegraphics[width=\textwidth]{iterC10/pixelBarrel}\\
-%\includegraphics[width=\textwidth]{iterC10/pixelECA}\\
-%\includegraphics[width=\textwidth]{iterC10/pixelECC}\\
-
-%\includegraphics[width=\textwidth]{iterC10/sctBarrel}\\
-%\includegraphics[width=\textwidth]{iterC10/sctECA}\\
-%\includegraphics[width=\textwidth]{iterC10/sctECC}\\
-
-%\includegraphics[width=\textwidth]{iterC10/trtBarrel}\\
-%\includegraphics[width=\textwidth]{iterC10/trtECA}\\
-%\includegraphics[width=\textwidth]{iterC10/trtECC}\\
-
-%\end{centering}
-
-\section{A and C Constants}
-
-\include{ACTable}
-
-\end{document}
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/TrkErrorScalingDB.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/TrkErrorScalingDB.py
deleted file mode 100644
index 839194822a01406276f5e91f6af31d013524d46e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/TrkErrorScalingDB.py
+++ /dev/null
@@ -1,306 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-"""Script to turn scaling parameters into a local SQlite DB.
-   """
-
-#
-# script to turn scaling parameters into a local SQlite DB.
-# does not publish directly to COOL.
-# updated for COOL 2 (RJH 7/6/07)
-# Made into a module (GG 14/11/07)
-#
-
-tag = "IndetTrkErrorScaling_nominal"
-#dataset=[ ("PixPhi Barrel",1.0,0.0),
-#          ("PixEta Barrel",1.0,0.0),
-#          ("PixPhi Endcap",1.0,0.0),
-#          ("PixEta Endcap",1.0,0.0),
-#          ("PixPhi IBL",1.0,0.0),
-#          ("PixEta IBL",1.0,0.0), 
-#          ("SCT Barrel",1.0,0.0),
-#          ("SCT Endcap",1.0,0.0),
-#          ("TRT Barrel",1.0,0.0),
-#          ("TRT Endcap",1.0,0.0)
-#          ]
-
-# PF file for M9 BOFF iter 1
-#dataset=[ ("PixPhi Barrel",1.0,0.010),
-#          ("PixEta Barrel",1.0,0.010),
-#          ("PixPhi Endcap",1.0,0.010),
-#          ("PixEta Endcap",1.0,0.010),
-#          ("PixPhi IBL",1.0,0.25),
-#          ("PixEta IBL",1.0,0.05),
-#          ("SCT Barrel",1.0,0.030),
-#          ("SCT Endcap",1.0,0.060),
-#          ("TRT Barrel",1.0,0.050),
-#          ("TRT Endcap",1.0,0.100)
-#          ]
-# after L1 of M9 BOFF 
-#dataset=[ ("PixPhi Barrel",1.0,0.008), 
-#          ("PixEta Barrel",1.0,0.009), 
-#          ("PixPhi Endcap",1.0,0.009), 
-#          ("PixEta Endcap",1.0,0.009), 
-#          ("PixPhi IBL",   1.0,0.150), 
-#          ("PixEta IBL",   1.0,0.060), 
-#          ("SCT Barrel",   1.0,0.025), 
-#          ("SCT Endcap",   1.0,0.050), 
-#          ("TRT Barrel",   1.0,0.060),
-#          ("TRT Endcap",   1.0,0.100)
-#          ]
-# after L2 of M9 BOFF 
-#dataset=[ ("PixPhi Barrel",1.0,0.007),  
-#          ("PixEta Barrel",1.0,0.008), 
-#          ("PixPhi Endcap",1.0,0.008), 
-#          ("PixEta Endcap",1.0,0.008), 
-#          ("PixPhi IBL",   1.0,0.150), 
-#          ("PixEta IBL",   1.0,0.065), 
-#          ("SCT Barrel",   1.0,0.020), 
-#          ("SCT Endcap",   1.0,0.040), 
-#          ("TRT Barrel",   1.0,0.070),
-#          ("TRT Endcap",   1.0,0.100)
-#          ]
-# after L27 of M9 BOFF 
-#dataset=[ ("PixPhi Barrel",1.0,0.005),   
-#          ("PixEta Barrel",1.0,0.007), 
-#          ("PixPhi Endcap",1.0,0.007), 
-#          ("PixEta Endcap",1.0,0.007), 
-#          ("PixPhi IBL",   1.0,0.100),  
-#          ("PixEta IBL",   1.0,0.050), 
-#          ("SCT Barrel",   1.0,0.018), 
-#          ("SCT Endcap",   1.0,0.035), 
-#          ("TRT Barrel",   1.0,0.070),
-#          ("TRT Endcap",   1.0,0.100)
-#          ]
-# after L11 of M9 BON 
-#dataset=[ ("PixPhi Barrel",1.0,0.005),  
-#          ("PixEta Barrel",1.0,0.007), 
-#          ("PixPhi Endcap",1.0,0.006), 
-#          ("PixEta Endcap",1.0,0.007), 
-#          ("PixPhi IBL",   1.0,0.100),  
-#          ("PixEta IBL",   1.0,0.050), 
-#          ("SCT Barrel",   1.0,0.018), 
-#          ("SCT Endcap",   1.0,0.040), 
-#          ("TRT Barrel",   1.0,0.070),
-#          ("TRT Endcap",   1.0,0.100)
-#          ]
-# after L2 of M9 BON 
-#dataset=[ ("PixPhi Barrel",1.0,0.005),  
-#          ("PixEta Barrel",1.0,0.006), 
-#          ("PixPhi Endcap",1.0,0.005), 
-#          ("PixEta Endcap",1.0,0.006), 
-#          ("PixPhi IBL",   1.0,0.100),  
-#          ("PixEta IBL",   1.0,0.050), 
-#          ("SCT Barrel",   1.0,0.018), 
-#          ("SCT Endcap",   1.0,0.045), 
-#          ("TRT Barrel",   1.0,0.070),
-#          ("TRT Endcap",   1.0,0.110)
-#          ]
-# after L27 of M9 BON 
-#dataset=[ ("PixPhi Barrel",1.0,0.005),  
-#          ("PixEta Barrel",1.0,0.005), 
-#          ("PixPhi Endcap",1.0,0.005), 
-#          ("PixEta Endcap",1.0,0.005), 
-#          ("PixPhi IBL",   1.0,0.095),  
-#          ("PixEta IBL",   1.0,0.050), 
-#          ("SCT Barrel",   1.0,0.018), 
-#          ("SCT Endcap",   1.0,0.050), 
-#          ("TRT Barrel",   1.0,0.070),
-#          ("TRT Endcap",   1.0,0.110)
-#          ]
-# after L3 PIX/IBL of M9 BON 
-#dataset=[ ("PixPhi Barrel",1.0,0.005),  
-#          ("PixEta Barrel",1.0,0.005), 
-#          ("PixPhi Endcap",1.0,0.005), 
-#          ("PixEta Endcap",1.0,0.005), 
-#          ("PixPhi IBL",   1.0,0.030),  
-#          ("PixEta IBL",   1.0,0.030), 
-#          ("SCT Barrel",   1.0,0.018), 
-#          ("SCT Endcap",   1.0,0.050), 
-#          ("TRT Barrel",   1.0,0.070),
-#          ("TRT Endcap",   1.0,0.110)
-#          ]
-# after L3 SCT of M9 BON 
-#dataset=[ ("PixPhi Barrel",1.0,0.005),  
-#          ("PixEta Barrel",1.0,0.005), 
-#          ("PixPhi Endcap",1.0,0.005), 
-#          ("PixEta Endcap",1.0,0.005), 
-#          ("PixPhi IBL",   1.0,0.018),  
-#          ("PixEta IBL",   1.0,0.024), 
-#          ("SCT Barrel",   1.0,0.014), 
-#          ("SCT Endcap",   1.0,0.040), 
-#          ("TRT Barrel",   1.0,0.065),
-#          ("TRT Endcap",   1.0,0.100)
-#          ]
-# WARNING all above pixels in digital clustering
-# after L2 TRT of M9 BON 
-#dataset=[ ("PixPhi Barrel",1.0, 0.010),   
-#          ("PixEta Barrel",1.0, 0.010), 
-#          ("PixPhi Endcap",1.0, 0.010), 
-#          ("PixEta Endcap",1.0, 0.010),  
-#          ("PixPhi IBL",   1.0, 0.025),   
-#          ("PixEta IBL",   1.0, 0.050),  
-#          ("SCT Barrel",   1.0, 0.014), 
-#          ("SCT Endcap",   1.0, 0.025), 
-#          ("TRT Barrel",   1.0, 0.050),
-#          ("TRT Endcap",   1.0, 0.100)
-#          ]
-# after L1 with 13 TeV
-# WARNING now using pixel NN clustering
-
-##50 ns
-#dataset=[ ("PixPhi Barrel",1.0, 0.00519902),   
-#          ("PixEta Barrel",1.0, 0.0285656), 
-#          ("PixPhi Endcap",1.0, 0.00751747), 
-#          ("PixEta Endcap",1.0, 0.00),  
-#          ("PixPhi IBL",   1.0, 0.00636179),   
-#          ("PixEta IBL",   1.0, 0.0435513),  
-#          ("SCT Barrel",   1.0, 0.0108325), 
-#          ("SCT Endcap",   1.0, 0.00860872), 
-#          ("TRT Barrel",   1.01, 0.000,0.0065),
-#          ("TRT Endcap",   1.0, 0.000,0.0061)
-#          ]
-#25ns
-
-#dataset=[ ("PixPhi Barrel",1.0, 0.00519902),   
-#          ("PixEta Barrel",1.0, 0.0285656), 
-#          ("PixPhi Endcap",1.0, 0.00751747), 
-#          ("PixEta Endcap",1.0, 0.00),  
-#          ("PixPhi IBL",   1.0, 0.00636179),   
-#          ("PixEta IBL",   1.0, 0.0435513),  
-#          ("SCT Barrel",   1.0, 0.0108325), 
-#          ("SCT Endcap",   1.0, 0.00860872), 
-#          ("TRT Barrel",   1.02, 0.000,0.0082),
-#          ("TRT Endcap",   1.0, 0.000,0.0085)
-#          ]
-
-## For Jiri 25 ns
-dataset=[ ("PixPhi Barrel",1.0, 0.00519902),   
-          ("PixEta Barrel",1.0, 0.0285656), 
-          ("PixPhi Endcap",1.0, 0.00751747), 
-          ("PixEta Endcap",1.0, 0.00),  
-          ("PixPhi IBL",   1.0, 0.007),   
-          ("PixEta IBL",   1.0, 0.0435513),  
-          ("SCT Barrel",   1.0, 0.0108325), 
-          ("SCT Endcap",   1.0, 0.00860872), 
-          ("TRT Barrel",   1.10, 0.000,0.00),
-          ("TRT Endcap",   1.10, 0.000,0.00)
-          ]
-
-
-
-#For Jiri 10um for IBL
-
-## For Jiri 25 ns
-#dataset=[ ("PixPhi Barrel",1.0, 0.00519902),   
-#          ("PixEta Barrel",1.0, 0.0285656), 
-#          ("PixPhi Endcap",1.0, 0.00751747), 
-#          ("PixEta Endcap",1.0, 0.00),  
-#          ("PixPhi IBL",   1.0, 0.010),   
-#          ("PixEta IBL",   1.0, 0.0435513),  
-#          ("SCT Barrel",   1.0, 0.0108325), 
-#          ("SCT Endcap",   1.0, 0.00860872), 
-#          ("TRT Barrel",   1.10, 0.000,0.00),
-#          ("TRT Endcap",   1.10, 0.000,0.00)
-#          ]
-
-
-#Joany request for 20.7
-#dataset=[ ("PixPhi Barrel",1.0, 0.00519902),   
-#          ("PixEta Barrel",1.0, 0.0285656), 
-#          ("PixPhi Endcap",1.0, 0.00751747), 
-#          ("PixEta Endcap",1.0, 0.00),  
-#          ("PixPhi IBL",   1.0, 0.00636179),   
-#          ("PixEta IBL",   1.0, 0.0435513),  
-#          ("SCT Barrel",   1.0, 0.0108325), 
-#          ("SCT Endcap",   1.0, 0.00860872), 
-#          ("TRT Barrel",   1.0, 0.000,0.00),
-#          ("TRT Endcap",   1.0, 0.000,0.00)
-#          ]
-
-
-##For Nominal Run1
-
-#dataset=[ ("PixPhi Barrel",1.0, 0.01),   
-#          ("PixEta Barrel",1.0, 0.02), 
-#          ("PixPhi Endcap",1.0, 0.02), 
-#          ("PixEta Endcap",1.0, 0.00),  
-#          ("PixPhi IBL",   1.0, 0.1),   
-#          ("PixEta IBL",   1.0, 0.1),  
-#          ("SCT Barrel",   1.0, 0.02), 
-#          ("SCT Endcap",   1.0, 0.02), 
-#          ("TRT Barrel",   1.0, 0.000,0.00),
-#          ("TRT Endcap",   1.0, 0.000,0.00)
-#          ]
-
-# database and folder name
-#connect="sqlite://X;schema=mycool.db;dbname=OFLP200"
-#foldername="/Indet/TrkErrorScaling"
-# database and folder name
-
-
-default_connect="sqlite://X;schema=mycool.db;dbname=OFLP200"
-
-def make(dataset, tag, foldername, connect = default_connect):
-
-    import sys,traceback
-    from PyCool import cool,coral
-
-    dbSvc = cool.DatabaseSvcFactory.databaseService()
-    try:
-        db = dbSvc.openDatabase(connect,False)
-    except Exception, e:
-        print e
-        print "Could not connect to the database"
-        # try to create it
-        try:
-            db=dbSvc.createDatabase(connect)
-        except Exception, e:
-            print e
-            print "Could not create the database either"
-            sys.exit(2)
-
-    # setup folder specification
-    spec = cool.RecordSpecification()
-    spec.extend("Name",cool.StorageType.String4k)
-    spec.extend("Len",cool.StorageType.Int32)
-    # assume we will not have more than 5 parameters
-    maxpar=5
-    spec.extend("par1",cool.StorageType.Double)
-    spec.extend("par2",cool.StorageType.Double)
-    spec.extend("par3",cool.StorageType.Double)
-    spec.extend("par4",cool.StorageType.Double)
-    spec.extend("par5",cool.StorageType.Double)
-    
-    # check if folder exists
-    if (not db.existsFolder(foldername)):
-        print "Attempt to create",foldername
-        desc='<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>'
-        db.createFolder(foldername,spec,desc,cool.FolderVersioning.MULTI_VERSION,True)
-        print 'Folder',foldername,'created OK'
-
-    # now write data
-    folder=db.getFolder(foldername)
-    chan=0
-    print "Writing data to",folder,"with tag",tag
-    for idata in dataset:
-        name=idata[0]
-        nvals=len(idata)-1
-        if (nvals>maxpar):
-            print "Maximum of",maxpar,"parameters allowed - additional ones ignored!"
-            nvals=maxpar
-        print "Write data for name",name,"number of values",nvals,"at channel",chan
-        payload=cool.Record(spec)
-        payload['Name']=name
-        payload['Len']=nvals
-        for i in range(0,nvals):
-            payload['par'+str(1+i)]=idata[1+i]
-        folder.storeObject(cool.ValidityKeyMin,cool.ValidityKeyMax,payload,chan,tag)
-        chan+=1
-    print "All done"
-    db.closeDatabase()
-
-
-###############################################################
-connect="sqlite://X;schema=IBLErrorScaling.db;dbname=CONDBR2"
-foldername="/Indet/TrkErrorScaling"
-make(dataset, tag, foldername, connect) 
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/datasets.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/datasets.py
deleted file mode 100644
index 3f112e263203413bb43c16cf4a404a1ad6f02fa7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/datasets.py
+++ /dev/null
@@ -1,284 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-#example listing from nsls -l
-#-rw-r--r--   1 atlidali zp                 69243745 Sep 07 20:43 Collision_162623_162764_70.ESD.root
-#   -0-      -1-   -2-   -3-                  -4-    -5- -6- -7-  -8-
-
-class CastorDataset(object):
-    '''Just a simple object to hold the information for a castor dataset'''
-    def __init__(self, path, matchPattern='*', blacklist=[]):
-        '''path is castor path with, matchPattern is unix style wildcards (*root for example)'''
-        import os, os.path, fnmatch
-        prefix = 'rfio:'
-        datadir = os.path.normpath(path) + '/'  #adds slash and cleans up path if needed
-
-        print datadir
-    
-        filehandle = os.popen('nsls -l %s' % datadir)
-        fileList = [l.strip() for l in filehandle if len(l) > 0]
-        filehandle.close()
-
-        # crude blacklist at the file level
-        for b in blacklist:
-            for l in fileList:
-                if (b in l):
-                    fileList.remove(l)
-
-        filenames = [l.split()[8] for l in fileList]
-        filesizes = [float(l.split()[4])/(1024.0*1024.0) for l in fileList] #size in MB
-
-        #loop through, form a full list
-        self.filePaths = [ prefix+datadir+line for line in filenames ]
-
-        self.fullpaths = zip(filesizes, self.filePaths)
-
-        # this applies unix style wildcards (see python fnmatch documentation)
-        self.fullpaths = [ p for p in self.fullpaths if fnmatch.fnmatch(p[1], matchPattern) ]
-
-    def activate(self, shuffle=False, seed=0):
-        '''Activates the dataset for use in athena'''
-
-        import copy
-        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-        athenaCommonFlags.FilesInput = copy.deepcopy(self.filePaths)
-
-        #ServiceMgr.EventSelector.InputCollections = copy.deepcopy(self.filePaths)
-        #ServiceMgr.ByteStreamInputSvc.FullFileName = copy.deepcopy(self.filePaths)
-
-        if (shuffle):
-            import random
-            random.seed(seed)
-        #    random.shuffle(athenaCommonFlags.FilesInput)
-
-
-    def activateSegment(self, nSegments, iSegment, shuffle=False, seed=0):
-        '''Activates a segment of the dataset for use in athena'''
-        self.partition(nSegments)
-
-        assert(iSegment < nSegments and iSegment >= 0 ) #zero indexed
-
-        import copy
-        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-        athenaCommonFlags.FilesInput = copy.deepcopy(self.partitionedPaths[iSegment])
-        #ServiceMgr.EventSelector.InputCollections   = copy.deepcopy(self.partitionedPaths[iSegment])
-        
-        print self.partitionedPaths
-        print athenaCommonFlags.FilesInput		
-        if (shuffle):
-            import random
-            random.seed(seed)
-        #    random.shuffle(athenaCommonFlags.FilesInput)
-
-    def partition(self, nBuckets):
-        '''We assume the data we are looping over has an average size per event that
-        is roughly constant. Thus, the fairest way to partition data into a set of
-        segments is by total size of data to loop over.'''
-        import copy
-
-        assert(nBuckets >0 and nBuckets <= 500) #sanity check
-        #indexed as [partition][partitionsize=0,paths=1]
-        self.partitioned = [ [0.0, [] ] for x in range (nBuckets) ] 
-
-        # on the fly declared function that returns x[0] if x is the argument
-        # equivalent to def getsize(x): return x[0]
-        # use this to find size of the files in a bucket
-        getsize = lambda x: x[0]
-
-        # fullpaths = [[size, path], [size, path], ...]
-        # thanks to the choice of data representation, this will produce
-        # filenames sorted in order of descending size
-        fullpaths = reversed(sorted(copy.deepcopy(self.fullpaths)))
-
-        for fp in fullpaths:
-            # returns the bucket with the minimum size
-            # if multiple buckets are the same size, then returns the first
-            bucketContent = min(self.partitioned, key=getsize)
-
-            currentSize = fp[0]
-            currentPath = fp[1]
-
-            #add the current file to the minimum bucket
-            bucketContent[0] += currentSize
-            bucketContent[1].append(currentPath)
-
-        #this line prints a list of sizes for all the segments
-        print (map(getsize,self.partitioned))
-
-        self.partitionedPaths = [x[1] for x in self.partitioned]
-        
-class EOSDataset(object):
-    '''Just a simple object to hold the information for a castor/eos dataset'''
-    def __init__(self, path, matchPattern='*', blacklist=[]):
-        '''path is castor/eos path with, matchPattern is unix style wildcards (*root for example)'''
-        import os, os.path, fnmatch
-        prefix = 'root://eosatlas/'
-        #prefix = ''
-        datadir = os.path.normpath(path) + '/'  #adds slash and cleans up path if needed
-
-        print datadir
-	#os.system('xrd eosatlas dirlist %s' % datadir)
-    
-        filehandle = os.popen('xrd eosatlas dirlist %s' % datadir)
-
-        fileList = [l.strip() for l in filehandle if len(l) > 0]
-        filehandle.close()
-
-        #for ff in filehandle:
-        #    print ff
-
-        # crude blacklist at the file level
-        for b in blacklist:
-            for l in fileList:
-                if (b in l):
-                    fileList.remove(l)
-
-        #for ll in fileList:
-        #        print ll
- 
-        filenames = [l.split()[4] for l in fileList if (len(l) > 1)]
-        filesizes = [float(l.split()[1])/(1024.0*1024.0) for l in fileList if len(l) > 0] #size in MB
-
-        #filenames = filenames[0:1]
-        #loop through, form a full list
-        #self.filePaths = [ prefix+datadir+line for line in filenames ]
-        self.filePaths = [ prefix+line for line in filenames ]
-        #self.filePaths = [ line for line in filenames ]
-
-        self.fullpaths = zip(filesizes, self.filePaths)
-
-        # this applies unix style wildcards (see python fnmatch documentation)
-        self.fullpaths = [ p for p in self.fullpaths if fnmatch.fnmatch(p[1], matchPattern) ]
-
-        tempPath = []
-        for ii in self.filePaths:
-            found = False
-            for jj in self.fullpaths:
-                if found:
-                    continue
-                if ii == jj[1]:
-                    found = True
-            if found:
-                tempPath.append(ii)
-
-        self.filePaths = tempPath
-
-    def getFormat(self):
-
-        self.fileFormat = ''
-        if ('ESD' in self.filePaths[0]):
-            self.fileFormat = 'ESD'
-        elif ('AOD' in self.filePaths[0]):
-            self.fileFormat = 'AOD'
-        elif ('RDO' in self.filePaths[0]):
-            self.fileFormat = 'RAW'
-        elif ('RAW' in self.filePaths[0]):
-            self.fileFormat = 'RAW'
-        else:
-            self.fileFormat = 'unknown'
-        return self.fileFormat
-
-    def isMC(self):
-        mc = False
-        if ('mc10' in self.filePaths[0] or 'mc11' in self.filePaths[0]):
-            mc = True
-        return mc
-        
-    def activate(self, shuffle=False, seed=0):
-        '''Activates the dataset for use in athena'''
-
-        import copy
-        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-        athenaCommonFlags.FilesInput = copy.deepcopy(self.filePaths)
-
-        #ServiceMgr.EventSelector.InputCollections = copy.deepcopy(self.filePaths)
-        #ServiceMgr.ByteStreamInputSvc.FullFileName = copy.deepcopy(self.filePaths)
-
-        if (shuffle):
-            import random
-            random.seed(seed)
-        #    random.shuffle(athenaCommonFlags.FilesInput)
-
-
-    def activateSegment(self, nSegments, iSegment, shuffle=False, seed=0):
-        '''Activates a segment of the dataset for use in athena'''
-        self.partition(nSegments)
-
-        assert(iSegment < nSegments and iSegment >= 0 ) #zero indexed
-
-        import copy
-        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-        athenaCommonFlags.FilesInput = copy.deepcopy(self.partitionedPaths[iSegment])
-        #ServiceMgr.EventSelector.InputCollections   = copy.deepcopy(self.partitionedPaths[iSegment])
-        
-        print self.partitionedPaths
-        print athenaCommonFlags.FilesInput		
-        if (shuffle):
-            import random
-            random.seed(seed)
-        #    random.shuffle(athenaCommonFlags.FilesInput)
-
-    def partition(self, nBuckets):
-        '''We assume the data we are looping over has an average size per event that
-        is roughly constant. Thus, the fairest way to partition data into a set of
-        segments is by total size of data to loop over.'''
-        import copy
-
-        assert(nBuckets >0 and nBuckets <= 500) #sanity check
-        #indexed as [partition][partitionsize=0,paths=1]
-        self.partitioned = [ [0.0, [] ] for x in range (nBuckets) ] 
-
-        # on the fly declared function that returns x[0] if x is the argument
-        # equivalent to def getsize(x): return x[0]
-        # use this to find size of the files in a bucket
-        getsize = lambda x: x[0]
-
-        # fullpaths = [[size, path], [size, path], ...]
-        # thanks to the choice of data representation, this will produce
-        # filenames sorted in order of descending size
-        fullpaths = reversed(sorted(copy.deepcopy(self.fullpaths)))
-
-        for fp in fullpaths:
-            # returns the bucket with the minimum size
-            # if multiple buckets are the same size, then returns the first
-            bucketContent = min(self.partitioned, key=getsize)
-
-            currentSize = fp[0]
-            currentPath = fp[1]
-
-            #add the current file to the minimum bucket
-            bucketContent[0] += currentSize
-            bucketContent[1].append(currentPath)
-
-        #this line prints a list of sizes for all the segments
-        print (map(getsize,self.partitioned))
-
-        self.partitionedPaths = [x[1] for x in self.partitioned]
-    
-#all files 
-#data_IDCalibSkim = CastorDataset('/castor/cern.ch/user/a/atlidali/calibration_IDTracks/', matchPattern="*.root", blacklist=["Collision_158975_11.ESD.root"])
-#data_155697_Minbias_DESD = CastorDataset('/castor/cern.ch/grid/atlas/atlasdatadisk/data10_7TeV/DESD_MBIAS/f261_m497/data10_7TeV.00155697.physics_MinBias.merge.DESD_MBIAS.f261_m497/')
-#data_161397_Minbias_DESD = CastorDataset('/castor/cern.ch/grid/atlas/atlasdatadisk/data10_7TeV/DESD_MBIAS/f282_m574/data10_7TeV.00161379.physics_MinBias.merge.DESD_MBIAS.f282_m574/')
-#data_PeriodI_Minbias_DESD =  CastorDataset('/castor/cern.ch/grid/atlas/atlasdatadisk/data10_7TeV/DESD_MBIAS/r1774_p327/data10_7TeV.00166850.physics_MinBias.merge.DESD_MBIAS.r1774_p327_tid210487_00/')
-#data_2011_Minbias_DESD =  CastorDataset('/castor/cern.ch/grid/atlas/atlasdatadisk/data11_7TeV/DESD_MBIAS/f351_m766/data11_7TeV.00178109.physics_MinBias.merge.DESD_MBIAS.f351_m766/')
-#data_2011_Muons_DESD = CastorDataset('/castor/cern.ch/grid/atlas/atlasdatadisk/data11_7TeV/DRAW_ZMUMU/f368_m716/data11_7TeV.00180164.physics_Muons.merge.DRAW_ZMUMU.f368_m716/')#CastorDataset('/castor/cern.ch/grid/atlas/atlasdatadisk/data11_7TeV/ESD/f351/data11_7TeV.00178109.express_express.recon.ESD.f351/')
-#data_2011_CALIB_RAW  = CastorDataset('/castor/cern.ch/grid/atlas/DAQ/2011/00180636/calibration_IDTracks/')
-#mc10_Minbias_DESD = EOSDataset('/eos/atlas/atlasdatadisk/mc10_7TeV/DESD_MBIAS/e574_s932_s946_r2094/mc10_7TeV.105001.pythia_minbias.recon.DESD_MBIAS.e574_s932_s946_r2094_tid280668_00')
-#data11_Muons_DRAW = EOSDataset('/eos/atlas/atlasdatadisk/data11_7TeV/DRAW_ZMUMU/f368_m716/data11_7TeV.00180164.physics_Muons.merge.DRAW_ZMUMU.f368_m716')
-# dataset doesn't exist in eos # data11_Minbias_DESD = EOSDataset('/eos/atlas/atlasdatadisk/data11_7TeV/DESD_MBIAS/f414_m1026/data11_7TeV.00191628.physics_MinBias.merge.DESD_MBIAS.f414_m1026')
-#data11_Muons_DESD = EOSDataset('/eos/atlas/atlasdatadisk/data11_7TeV/DESD_ZMUMU/f368_m716_r2764/data11_7TeV.00180124.physics_Muons.recon.DESD_ZMUMU.f368_m716_r2764_tid534417_00')
-#data11_calibration_RAW = EOSDataset('/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622')
-#data11_calibration_RAW = EOSDataset('/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.*.calibration_IDTracks.daq.RAW_der1324561622')
-#data11_calibration_RAW_local = EOSDataset('/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622')
-#mc11_Ztautau_RAW = EOSDataset('/eos/atlas/atlasgroupdisk/perf-egamma/dq2/mc11_valid/RDO/e825_s1310_s1300_d578/mc11_valid.106052.PythiaZtautau.digit.RDO.e825_s1310_s1300_d578_tid512904_00')
-#mc11_Zprime_ESD = EOSDataset('/eos/atlas/atlasgroupdisk/det-muon/dq2/group/det-muon/mc11_7TeV/group.det-muon.mc11_7TeV.105601.Pythia_Zprime_mumu_SSM1000.e825_s1310_s1300.RECO.03122011.MboyMoo.v1_TPC.111203171822')
-#mc10_muons_RAW = EOSDataset('/eos/atlas/atlascerngroupdisk/perf-idtracking/rtt/mc10_7TeV.107233.singlepart_mu100.digit.RDO.e605_s933_s946_d369')
-#mc10_muons_RAW_highStat = EOSDataset('/eos/atlas/atlascerngroupdisk/perf-idtracking/rtt/valid1.107233.singlepart_mu100.digit.RDO.e380_s593_tid080975','*.root.1')
-#mc12_muons = EOSDataset('/eos/atlas/atlasscratchdisk/mc12_8TeV/ESD/e1242_s1469_s1470_r3542/mc12_8TeV.158025.Pythia8_AU2MSTW2008LO_Zprime_mumu_SSM500.recon.ESD.e1242_s1469_s1470_r3542_tid00813590_00')
-mc12_Ztautau = EOSDataset('/eos/atlas/user/c/cerio/user.bcerio.mc12_8TeV.147818.Pythia8_AU2CTEQ6L1_Ztautau.recon.ESD.e1176_s1479_s1470_r3578_tid783779_00_der1347371102')
-mc12_muons = EOSDataset('/eos/atlas/user/c/cerio/mc12_8TeV.158025.Pythia8_AU2MSTW2008LO_Zprime_mumu_SSM500.recon.ESD.e1242_s1469_s1470_r3542_tid00813590_00')
-
-
-data15_267073_Express_RAW = EOSDataset('/eos/atlas/atlastier0/rucio/data15_13TeV/express_express/00267073/data15_13TeV.00267073.express_express.merge.RAW')
-
-data15_267073_Express_ESD = EOSDataset('/eos/atlas/atlastier0/rucio/data15_13TeV/express_express/00267073/data15_13TeV.00267073.express_express.recon.ESD.f594')
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errorScalingTool.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errorScalingTool.py
deleted file mode 100644
index 4e2945113dbc633cd00c2d3cf8e2783d611357ab..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errorScalingTool.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-from glob import glob
-#from decimal import Decimal
-#import numpy
-#import pylab
-
-class errorScalingTool:
-    def __init__(self, filename = 'results_iterC*.txt'):
-        file = open(filename,'r')
-        self.lines = file.readlines()
-        for ii in self.lines:
-            ii.strip()
-        
-    def getParamA(self):
-        paramA = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>5 and ii<14:
-                paramA[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[2]
-        return paramA
-        
-    def getParamC(self):
-        paramC = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>5 and ii<14:
-                paramC[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[3]
-        return paramC
-        
-    def getSigma0(self):
-        getSigma0 = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>17 and ii<26:
-                getSigma0[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[2]
-        return getSigma0
-        
-    def getPull(self):
-        getPull = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>17 and ii<26:
-                getPull[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[4]
-        return getPull
-        
-    def getPullError(self):
-        getPullError = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>17 and ii<26:
-                getPullError[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[5]
-        return getPullError
-        
-    def getRMS(self):
-        getRMS = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>17 and ii<26:
-                getRMS[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[6]
-        return getRMS
-        
-    def getRMSerror(self):
-        getRMSerror = {}
-        for ii,vv in enumerate(self.lines):
-            if ii>17 and ii<26:
-                getRMSerror[vv.split()[0] + '_' + vv.split()[1]] = vv.split()[7]
-        return getRMSerror
-        
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errscal.skel b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errscal.skel
deleted file mode 100644
index 456dc7ebe7c30c282406f4280448ac055ea5b823..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errscal.skel
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/zsh
-
-export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
-alias asetup='source $AtlasSetup/scripts/asetup.sh'
-
-#cd $RELAREA
-#cd /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.1.2.1
-#asetup 17.1.2.1
-#asetup $REL
-
-cd /afs/cern.ch/user/p/pbutti/spacework/Validation_13TeV
-asetup 20.1.5.8,here
-
-#pool_insertFileToCatalog /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.1.2.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/MisalignmentSet2.pool.root
-
-#export STAGE_SVCCLASS=atlcal
-
-cd %(fullpwd)s
-
-rm -rf out.log
-
-echo "running athena.py -c runmode = 'batch'; nSegments=%(nSegments)d; iSegment=%(iSegment)d;errorScalingOverride='%(eso)s'" %(joboptions)s
-
-athena.py -c "runmode='batch'; nSegments=%(nSegments)d; iSegment=%(iSegment)d; errorScalingOverride='%(eso)s'" %(joboptions)s  | tee  out.log
-
-bzip2 -9 out.log
-
-touch done
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errscale_7 b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errscale_7
deleted file mode 100755
index 7d96bcf143248438f5aba8a44278ed026cddd04a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/errscale_7
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/zsh
-
-export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
-
-alias asetup='source $AtlasSetup/scripts/asetup.sh'
-cd /afs/cern.ch/user/a/atlidali/w1/users/amorley/testarea/17.0.1.2
-asetup 17.0.1.2
-
-#source ~shekhar/cmthome/setup.sh -tag=16.0.0.2,setup,AtlasProduction
-export STAGE_SVCCLASS=atlcal
-
-
-cd /afs/cern.ch/user/a/atlidali/w1/users/amorley/testarea/17.0.1.2/ErrorScalingOld/run
-
-echo ${PATH}
-
-echo "\\n\\n\\n\\n\\n\\n\\n"
-
-which athena.py
-
-echo ""
-
-#./iterateTrkError.py -c -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py >! outTest.log
-rm -rf outTest.log
-./iterateTrkError.py -s1 -c --batch -n20 jobOptions.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/generatePulls.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/generatePulls.py
deleted file mode 100755
index 23631e2afddefbedc511ca3da37bddf307345824..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/generatePulls.py
+++ /dev/null
@@ -1,593 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# Ravi Shekhar <ravi.shekhar@duke.edu>
-
-# This script generates plots when given a monitoring root file and a prefix.
-
-import os, sys
-
-pos = len(sys.argv)
-sys.argv.append('-b')
-
-#--------------------------------------------------------------------------------------------------
-# This section simply does the imports and checks versions. 
-
-root_err_msg = """
-This is a PyROOT script, so make sure that is functional in your root installation if you're not
-using this script directly on lxplus. To test if PyROOT is functional, you can do the following.
-	$ python
-	>>> import ROOT """+"""
-without any errors. If you get a 'No module named ROOT' error, then you don't have PyROOT on 
-your python path. If you get a 'No module named libPyROOT' you need to set LD_LIBRARY_PATH to 
-include where libPyROOT.so lives and make sure it matches the version of python you are using.
-"""
-
-try:
-	import ROOT
-	from ROOT import gDirectory, gROOT, TCanvas, TH1F, TF1
-except Exception as e:
-	print(e)
-	print(root_err_msg)
-try:
-	assert(sys.version_info >= (2,5,0))
-except Exception as e:
-	print("This script requires python 2.5 or later")
-	sys.exit(8)
-
-try:
-	import numpy as np
-	import pylab as pl
-except Exception as e:
-	print("Numpy and Matplotlib are required")
-	sys.exit(8)
-#--------------------------------------------------------------------------------------------------
-def parse_args():
-	"""Parse command line arguments. If none are specified, it assumes file is monitoring.root
-	and the type of residual is Fully Unbiased"""
-
-	usage = ''
-	if (sys.argv[0].startswith('./')):
-		usage = (sys.argv[0] + " FILENAME outputprefix \"Plot Prefix\"\n"
-			 + "Example: " + sys.argv[0] + 
-				" monitoring.root fullyunbiased \"Fully Unbiased\"")
-	else:
-		usage = ("python " + sys.argv[0] + " FILENAME outputprefix \"Plot Prefix\"\n"
-			 + "Example: python " + sys.argv[0] + 
-				" monitoring.root fullyunbiased \"Fully Unbiased\"")
-
-	print("Command line arguments are: ")
-	print(sys.argv)
-
-	if (len(sys.argv) == 1):
-		print("No command line arguments specified. Assuming monitoring.root and " +
-			"Unbiased residuals")
-		rootfilename = "monitoring.root"
-		outprefix = "fullyunbiased"
-		plotprefix = "Unbiased"
-	elif (len(sys.argv) == 5):
-		rootfilename = sys.argv[1]
-		outprefix = sys.argv[2]
-		plotprefix = sys.argv[3]
-	else:
-		print("Do not understand command line arguments. Usage is:")
-		print(usage)
-		sys.exit(8)
-
-	try:
-		os.mkdir(outprefix)
-	except:
-		pass
-
-	return (rootfilename, outprefix, plotprefix)
-
-#--------------------------------------------------------------------------------------------------
-class tprint(object):
-	"simple object to make printing easier and more flexible. see fullpath and fullstring"
-	def __init__(self, tup):
-		'tup should contain (rootfilename, outputprefix, plotprefix)'
-		(self.rootfilename, self.outputprefix, self.plotprefix) = tup
-	def fullpath(self, filename):
-		'returns the full path for output files (like plots and txts)'
-		return "%s/%s" % (self.outputprefix, filename)
-	def fullstring(self, plotstring):
-		'returns the appropriate title for a plot given a plotstring'
-		return "%s %s" % (self.plotprefix, plotstring)
-		
-#--------------------------------------------------------------------------------------------------
-def gaussfit(hist, limitRange):
-	"Fits a Gaussian to the histogram (TH1F) in question, limiting range to +-2.5 if specified"
-	
-	#print "AKMAKM "
-	#print hist.GetEntries()
-	if hist.GetEntries()==0:
-		print 'DEBUG There is something wrong with the input - histogram has zero entries'
-	
-	if (limitRange):
-		ranged_gaus = TF1("ranged_gaus" , "gaus", -2.5, 2.5)
-		hist.Fit("ranged_gaus") 
-		gaus = hist.GetFunction("ranged_gaus")
-		#print "Fitting ranged"
-	else:
-		hist.Fit("gaus")
-		gaus = hist.GetFunction("gaus")
-	
-
-	#Double_t* temppars
-	#temppars = gaus.GetParameters()
-	
-	sigma      = gaus.GetParameter(2)
-	sigmaError = gaus.GetParError(2)
-	mean       = gaus.GetParameter(1)
-	meanError  = gaus.GetParError(1)
-	rms        = hist.GetRMS()
-	rmsError   = hist.GetRMSError()
-
-	return (gaus, sigma, sigmaError, rms, rmsError)
-
-#--------------------------------------------------------------------------------------------------
-def makePixelBarrelPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 600)
-	c1.Divide(2,2)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("pix_b1_residualx")).Clone()
-	h1.SetName("pix_b_residualx")
-	h1.Add(gDirectory.Get("pix_b2_residualx"))
-	h1.Add(gDirectory.Get("pix_b3_residualx"))
-	h1.SetTitle(fs("Pixel Barrel Residual X; Residual; Events"))
-	t = gaussfit(h1, False)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("pix_b1_pullx")).Clone()
-	h2.SetName("pix_b_pullx")
-	h2.Add(gDirectory.Get("pix_b2_pullx"))
-	h2.Add(gDirectory.Get("pix_b3_pullx"))
-	h2.SetTitle(fs("Pixel Barrel Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5,2.5)
-	t[0].Draw("SAME")
-
-	pulls["pixbarx"] = t[1:]
-
-	c1.cd(3)
-	h3 = (gDirectory.Get("pix_b1_residualy")).Clone()
-	h3.SetName("pix_b_residualy")
-	h3.Add(gDirectory.Get("pix_b2_residualy"))
-	h3.Add(gDirectory.Get("pix_b3_residualy"))
-	h3.SetTitle(fs("Pixel Barrel Residual Y; Residual; Events"))
-	t = gaussfit(h3, False)
-	h3.UseCurrentStyle()
-	h3.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(4)
-	h4 = (gDirectory.Get("pix_b1_pully")).Clone()
-	h4.SetName("pix_b_pully")
-	h4.Add(gDirectory.Get("pix_b2_pully"))
-	h4.Add(gDirectory.Get("pix_b3_pully"))
-	h4.SetTitle(fs("Pixel Barrel Pull Y; Pull; Events"))
-	t = gaussfit(h4, True)
-	h4.UseCurrentStyle()
-	h4.Draw("HIST")
-	t[0].SetRange(-2.5,2.5)
-	t[0].Draw("SAME")
-
-	pulls["pixbary"] = t[1:]
-
-	c1.SaveAs(fp("pixelBarrel.pdf"))
-	c1.SaveAs(fp("pixelBarrel.png"))
-	c1.SaveAs(fp("pixelBarrel.gif"))
-	c1.SaveAs(fp("pixelBarrel.eps"))
-
-#--------------------------------------------------------------------------------------------------
-def makePixelECAPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 600)
-	c1.Divide(2,2)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("pix_eca_residualx")).Clone()
-	h1.SetTitle(fs("Pixel Endcap A Residual X; Residual; Events"))
-	t = gaussfit(h1, False)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("pix_eca_pullx")).Clone()
-	h2.SetTitle(fs("Pixel Endcap A Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-	
-	pulls["pixecAx"] = t[1:]
-
-	c1.cd(3)
-	h3 = (gDirectory.Get("pix_eca_residualy")).Clone()
-	h3.SetTitle(fs("Pixel Endcap A Residual Y; Residual; Events"))
-	t = gaussfit(h3, False)
-	h3.UseCurrentStyle()
-	h3.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(4)
-	h4 = (gDirectory.Get("pix_eca_pully")).Clone()
-	h4.SetTitle(fs("Pixel Endcap A Pull Y; Pull; Events"))
-	t = gaussfit(h4, True)
-	h4.UseCurrentStyle()
-	h4.Draw("HIST")
-	t[0].SetRange(-2.5,2.5)
-	t[0].Draw("SAME")
-
-	pulls["pixecAy"] = t[1:]
-
-	c1.SaveAs(fp("pixelECA.pdf"))
-	c1.SaveAs(fp("pixelECA.png"))
-	c1.SaveAs(fp("pixelECA.gif"))
-	c1.SaveAs(fp("pixelECA.eps"))
-
-	
-#--------------------------------------------------------------------------------------------------
-def makePixelECCPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 600)
-	c1.Divide(2,2)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("pix_ecc_residualx")).Clone()
-	h1.SetTitle(fs("Pixel Endcap C Residual X; Residual; Events"))
-	t = gaussfit(h1, False)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("pix_ecc_pullx")).Clone()
-	h2.SetTitle(fs("Pixel Endcap C Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-
-	pulls["pixecCx"] = t[1:]
-
-	c1.cd(3)
-	h3 = (gDirectory.Get("pix_ecc_residualy")).Clone()
-	h3.SetTitle(fs("Pixel Endcap C Residual Y; Residual; Events"))
-	t = gaussfit(h3, False)
-	h3.UseCurrentStyle()
-	h3.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(4)
-	h4 = (gDirectory.Get("pix_ecc_pully")).Clone()
-	h4.SetTitle(fs("Pixel Endcap C Pull Y; Pull; Events"))
-	t = gaussfit(h4, True)
-	h4.UseCurrentStyle()
-	h4.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-
-	pulls["pixecCy"] = t[1:]
-
-	c1.SaveAs(fp("pixelECC.pdf"))
-	c1.SaveAs(fp("pixelECC.png"))
-	c1.SaveAs(fp("pixelECC.gif"))
-	c1.SaveAs(fp("pixelECC.eps"))
-
-#--------------------------------------------------------------------------------------------------
-def makeIBLPlots(fp, fs, pulls):
-
-	c1 = TCanvas("c1", "c1", 971, 600)
-	c1.Divide(2,2)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("pix_b0_residualx")).Clone()
-	h1.SetTitle(fs("IBL Residual X; Residual; Events"))
-	t = gaussfit(h1, False)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("pix_b0_pullx")).Clone()
-	h2.SetTitle(fs("IBL Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-
-	pulls["iblx"] = t[1:]
-
-	c1.cd(3)
-	h3 = (gDirectory.Get("pix_b0_residualy")).Clone()
-	h3.SetTitle(fs("IBL Residual Y; Residual; Events"))
-	t = gaussfit(h3, False)
-	h3.UseCurrentStyle()
-	h3.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(4)
-	h4 = (gDirectory.Get("pix_b0_pully")).Clone()
-	h4.SetTitle(fs("IBL Pull Y; Pull; Events"))
-	t = gaussfit(h4, True)
-	h4.UseCurrentStyle()
-	h4.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-
-	pulls["ibly"] = t[1:]
-
-	c1.SaveAs(fp("IBL.pdf"))
-	c1.SaveAs(fp("IBL.png"))
-	c1.SaveAs(fp("IBL.gif"))
-	c1.SaveAs(fp("IBL.eps"))
-
-#--------------------------------------------------------------------------------------------------
-def makeSCTBarrelPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 300)
-	c1.Divide(2,1)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("sct_b0_residualx")).Clone()
-	h1.SetName("sct_b_residualx")
-	h1.Add(gDirectory.Get("sct_b1_residualx"))
-	h1.Add(gDirectory.Get("sct_b2_residualx"))
-	h1.Add(gDirectory.Get("sct_b3_residualx"))
-	h1.SetTitle(fs("SCT Barrel Residual X; Residual; Events"))
-	t = gaussfit(h1, True)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("sct_b0_pullx")).Clone()
-	h2.SetName("sct_b_pullx")
-	h2.Add(gDirectory.Get("sct_b1_pullx"))
-	h2.Add(gDirectory.Get("sct_b2_pullx"))
-	h2.Add(gDirectory.Get("sct_b3_pullx"))
-	h2.SetTitle(fs("SCT Barrel Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-	
-	pulls["sctbar"] = t[1:]
-
-	c1.SaveAs(fp("sctBarrel.pdf"))
-	c1.SaveAs(fp("sctBarrel.png"))
-	c1.SaveAs(fp("sctBarrel.gif"))
-	c1.SaveAs(fp("sctBarrel.eps"))
-	
-##--------------------------------------------------------------------------------------------------
-def makeSCTECAPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 300)
-	c1.Divide(2,1)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("sct_eca_residualx")).Clone()
-	h1.SetTitle(fs("SCT Endcap A Residual X; Residual; Events"))
-	t = gaussfit(h1, True)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("sct_eca_pullx")).Clone()
-	h2.SetTitle(fs("SCT Endcap A Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-	
-	pulls["sctecA"] = t[1:]
-
-	c1.SaveAs(fp("sctECA.pdf"))
-	c1.SaveAs(fp("sctECA.png"))
-	c1.SaveAs(fp("sctECA.gif"))
-	c1.SaveAs(fp("sctECA.eps"))
-
-#--------------------------------------------------------------------------------------------------
-def makeSCTECCPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 300)
-	c1.Divide(2,1)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("sct_ecc_residualx")).Clone()
-	h1.SetTitle(fs("SCT Endcap C Residual X; Residual; Events"))
-	t = gaussfit(h1, True)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("sct_ecc_pullx")).Clone()
-	h2.SetTitle(fs("SCT Endcap C Pull X; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-	
-	pulls["sctecC"] = t[1:]
-
-	c1.SaveAs(fp("sctECC.pdf"))
-	c1.SaveAs(fp("sctECC.png"))
-	c1.SaveAs(fp("sctECC.gif"))
-	c1.SaveAs(fp("sctECC.eps"))
-#--------------------------------------------------------------------------------------------------
-def makeTRTBarrelPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 300)
-	c1.Divide(2,1)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("trt_b_residualR")).Clone()
-	h1.SetTitle(fs("TRT Barrel Residual R; Residual; Events"))
-	t = gaussfit(h1, True)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("trt_b_pullR_notube")).Clone()
-	h2.SetTitle(fs("TRT Barrel Pull; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-	
-	pulls["trtbar"] = t[1:]
-	
-	c1.SaveAs(fp("trtBarrel.pdf"))
-	c1.SaveAs(fp("trtBarrel.png"))
-	c1.SaveAs(fp("trtBarrel.gif"))
-	c1.SaveAs(fp("trtBarrel.eps"))
-#--------------------------------------------------------------------------------------------------
-def makeTRTECAPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 300)
-	c1.Divide(2,1)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("trt_ec_residualR_Endcap_A")).Clone()
-	h1.SetTitle(fs("TRT Endcap A Residual R; Residual; Events"))
-	t = gaussfit(h1, True)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("trt_ec_pullR_notube_Endcap_A")).Clone()
-	h2.SetTitle(fs("TRT Endcap A Pull; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-
-	pulls["trtecA"] = t[1:]
-
-	c1.SaveAs(fp("trtECA.pdf"))
-	c1.SaveAs(fp("trtECA.png"))
-	c1.SaveAs(fp("trtECA.gif"))
-	c1.SaveAs(fp("trtECA.eps"))
-#--------------------------------------------------------------------------------------------------
-def makeTRTECCPlots(fp, fs, pulls):
-	c1 = TCanvas("c1", "c1", 971, 300)
-	c1.Divide(2,1)
-
-	c1.cd(1)
-	h1 = (gDirectory.Get("trt_ec_residualR_Endcap_C")).Clone()
-	h1.SetTitle(fs("TRT Endcap C Residual R; Residual; Events"))
-	t = gaussfit(h1, True)
-	h1.UseCurrentStyle()
-	h1.Draw("HIST")
-	t[0].Draw("SAME")
-
-	c1.cd(2)
-	h2 = (gDirectory.Get("trt_ec_pullR_notube_Endcap_C")).Clone()
-	h2.SetTitle(fs("TRT Endcap C Pull; Pull; Events"))
-	t = gaussfit(h2, True)
-	h2.UseCurrentStyle()
-	h2.Draw("HIST")
-	t[0].SetRange(-2.5, 2.5)
-	t[0].Draw("SAME")
-	
-	pulls["trtecC"] = t[1:]
-
-	c1.SaveAs(fp("trtECC.pdf"))
-	c1.SaveAs(fp("trtECC.png"))
-	c1.SaveAs(fp("trtECC.gif"))
-	c1.SaveAs(fp("trtECC.eps"))
-
-#--------------------------------------------------------------------------------------------------
-def calculateEndcapAverages(p):
-	"Averages errors for +ve/-ve. Not exact, but assumes errors are about the same"
-	
-	averagingSets = [
-						["pixecAx", "pixecCx", "pixecx"],
-						["pixecAy", "pixecCy", "pixecy"],
-						["sctecA" , "sctecC" , "sctec"],
-						["trtecA" , "trtecA" , "trtec"]
-					]
-
-	for a in averagingSets:
-		(eca, ecc, avg) = a
-		ecaParams = p[eca]
-		eccParams = p[ecc]
-		
-		sigma = 0.5 * (ecaParams[0] + eccParams[0])
-		sigmaError = 0.5 * (ecaParams[1] + eccParams[1]) / (2.0**0.5)
-		rms = 0.5 * (ecaParams[2] + eccParams[2])
-		rmsError = 0.5 * (ecaParams[3] + eccParams[3]) / (2.0**0.5)
-		
-		p[avg] = (sigma, sigmaError, rms, rmsError)
-		
-#--------------------------------------------------------------------------------------------------
-def printPulls(p):
-	fh = open('pulls.txt','w')
-	
-	for detector in sorted(p):
-		vals = p[detector]
-		print detector,vals
-		vals = ["%.6f" % v for v in vals] #convert to strings
-		
-		fh.write(detector + " " + " ".join(vals))
-		fh.write('\n')
-		
-		
-	fh.close()
-
-
-#--------------------------------------------------------------------------------------------------
-def main():
-	# parse command line argument
-	(rootfilename, outprefix, plotprefix) =  parse_args()
-
-	# create a tprint object and export functions to current scope
-	#  remember functions can be treated as variables in python
-	tp = tprint((rootfilename, outprefix, plotprefix))
-	fp= tp.fullpath    #fp(filename) returns string with prefixed dir/filename (see outprefix)
-	fs = tp.fullstring #fs(title) returns string with prefixed title (see plotprefix)
-
-	# read the rootlogon.C file for plot style 
-	gROOT.ProcessLine(".x rootlogon.C")
-
-	tf = ROOT.TFile(rootfilename)
-	runNumberDirectory=tf.GetListOfKeys()[0].GetName()
-	gDirectory.cd(tf.GetListOfKeys()[0].GetName()+"/IDAlignMon/ExtendedTracks_NoTriggerSelection/Residuals")
-
-	p = {} #dictionary to store the pulls
-
-	makeIBLPlots(fp,fs,p)
-	makePixelBarrelPlots(fp, fs, p)
-	makePixelECAPlots(fp, fs, p)
-	makePixelECCPlots(fp, fs, p)
-	makeSCTBarrelPlots(fp, fs, p)
-	makeSCTECAPlots(fp, fs, p)
-	makeSCTECCPlots(fp, fs, p)
-	makeTRTBarrelPlots(fp, fs, p)
-	makeTRTECAPlots(fp, fs, p)
-	makeTRTECCPlots(fp, fs, p)
-	
-	#since we don't treat endcaps seperately (yet), average both endcaps
-	calculateEndcapAverages(p)
-	
-	printPulls(p)
-	
-
-#--------------------------------------------------------------------------------------------------
-if (__name__ == '__main__'):
-	main()
-	sys.exit(0)
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateA.sh b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateA.sh
deleted file mode 100755
index f817f6870e859b58d33ba708c57c3027dba8d228..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateA.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# starting from nominal error scaling
-#./iterateTrkError.py -c -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-#
-# starting from error scaling from third A iteration
-#./iterateTrkError.py -c -n10 -pparam_iterA03.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py >! outTest.log
-
-
-#source ~/w1/users/amorley/cmthome/setup.sh -tag=16.0.2.5
-
-export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
-alias asetup='source $AtlasSetup/scripts/asetup.sh'
-
-#cd /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.1.2.1
-cd $RELAREA
-
-asetup $REL
-export STAGE_SVCCLASS=atlcal
-
-#cd /afs/cern.ch/user/a/atlidali/w0/users/amorley/testarea/17.0.1.2/ErrorScalingOld/run/
-#cd /afs/cern.ch/user/a/atlidali/w0/users/bcerio/testarea/17.0.3/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-#cd /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.1.2.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-cd $ERSCPATH
-rm outTest.log
-
-#./iterateTrkError.py -c --batch -s1 -n6  ReadInDet_jobOptions.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-./iterateTrkError.py -a -k --batch -s1 -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-
-#./iterateTrkError.py -c --batch -s1 -n9 -i10 --param=param_iterC09.py ReadInDet_jobOptions.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateC.sh b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateC.sh
deleted file mode 100755
index 36a534ecf47c13b9b8d8ed33f92515645de79fcb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateC.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# starting from nominal error scaling
-#./iterateTrkError.py -c -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-#
-# starting from error scaling from third A iteration
-#./iterateTrkError.py -c -n10 -pparam_iterA03.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py >! outTest.log
-
-export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
-alias asetup='source $AtlasSetup/scripts/asetup.sh'
-
-#cd /afs/cern.ch/user/c/cerio/scratch1/17.1.2.1
-cd $RELAREA
-#asetup 17.1.2.1
-asetup $REL
-
-export STAGE_SVCCLASS=atlcal
-
-#cd /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.1.2.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-#cd /afs/cern.ch/user/c/cerio/scratch1/17.1.2.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-cd $ERSCPATH
-rm outTest.log
-
-#./iterateTrkError.py -c --batch -s1 -n6  ReadInDet_jobOptions.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-#./iterateTrkError.py -c -k --batch -s1 -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-./iterateTrkError.py -c -k --batch -s1 -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-#./iterateTrkError.py -c -k --batch -s1 -n10 -d 0.35 --param=highpTMuon2_A_2/param_iterA11.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-
-#./iterateTrkError.py -c --batch -s1 -n9 -i10 --param=param_iterC09.py ReadInDet_jobOptions.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateTrkError.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateTrkError.py
deleted file mode 100755
index 2e08f30d95bb017a92542870769f120e98f1f501..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/iterateTrkError.py
+++ /dev/null
@@ -1,585 +0,0 @@
-#! /usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# usage: iterateTrkError.py [options] [file1.py [file2.py [...]]]
-#
-# options:
-#   -h, --help            show this help message and exit
-#   -p FILE, --param=FILE
-#                         parameter file
-#   -c                    tune parameter c
-#   -a                    tune parameter a
-#   -n NUM, --numiter=NUM
-#                         max number of iterations
-#   -i NUM, --iter=NUM    first iteration number
-#   -r, --rms             use rms rather than pull width
-#   -t FILE, --target=FILE
-#                         converge to pull width or rms in FILE.
-#   -u FILE, --usentuple=FILE
-#                         Use ntuple FILE for first iteration
-#   -d NUM, --damping=NUM
-#                         Damping factor used in C iterations, Default = 0.5
-#   -s NUM, --strategy=NUM
-#                         Select different strategies for convergence,
-#                         0(default): Damping only applied if c2 < 0, 1: damping
-#                         applied to all C iterations
-#   -e OPTION, --rpoptions=OPTION
-#                         Extra options for ResidualAndPulls program (eg
-#                         Drifttime or NoDrifttime)
-#   -k SIMULATION         input dataset is simulation
-
-# if iter is not supplied the default will depend on the file name param 
-# if it ends in iterA## or iterC## and A or C is selected it will use ## as the
-# first iteration number
-
-# TODO:
-# - Check that athena and residuals program ran successfully and take appropriate action
-# - More intellegent use of previous iterations to improve convergence.
-
-
-# Defaults
-
-# Set true to do a quick test that does not run the athena job. A file TrkValidation.root
-# must exist
-quickTest = False
-
-nominalTag = 'IndetTrkErrorScaling_nominal'
-defaultJobOptions = 'jobOptionsErrorTuning.py'
-foldername = "/Indet/TrkErrorScaling"
-
-entries = [
-    ('PixPhi Barrel', 'pixbarx'),
-    ('PixEta Barrel', 'pixbary'),
-    ('PixPhi Endcap', 'pixecx'),
-    ('PixEta Endcap', 'pixecy'),
-    ('PixPhi IBL'   , 'iblx'),
-    ('PixEta IBL'   , 'ibly'),
-    ('SCT Barrel',    'sctbar'),
-    ('SCT Endcap',    'sctec'),
-    ('TRT Barrel',    'trtbar'),
-    ('TRT Endcap',    'trtec'),
-]
-
-
-micron = 0.001
-
-#########################################################
-# intrinsic resolutions
-
-# nominal values
-pixX_sigma0 = 14 * micron
-pixY_sigma0 = 115 * micron
-iblX_sigma0 = 14 * micron
-iblY_sigma0 = 72 * micron
-sct_sigma0 = 23 * micron
-trt_sigma0 = 170 * micron
-
-#pixbarX_sigma0 = pixX_sigma0
-#pixbarY_sigma0 = pixY_sigma0
-#pixecX_sigma0  = pixX_sigma0
-#pixecY_sigma0  = pixY_sigma0
-#sctbar_sigma0  = sct_sigma0
-#sctec_sigma0   = sct_sigma0
-#trtbar_sigma0  = trt_sigma0
-#trtec_sigma0   = trt_sigma0
-
-
-# From 200GeV muon residuals with perfect alignment
-pixbarX_sigma0 = 11.1 * micron
-pixbarY_sigma0 = 117 * micron
-pixecX_sigma0  = 13.5 * micron
-pixecY_sigma0  = 118 * micron
-#iblbarX_sigma0 = 14 * micron
-#iblbarY_sigma0 = 72 * micron
-sctbar_sigma0  = 21.0 * micron
-sctec_sigma0   = 24.5 * micron
-trtbar_sigma0  = 163 * micron
-trtec_sigma0   = 145 * micron
-
-
-sigma0 ={
-    'PixPhi Barrel':  pixbarX_sigma0,
-    'PixEta Barrel':  pixbarY_sigma0,
-    'PixPhi Endcap':  pixecX_sigma0,
-    'PixEta Endcap':  pixecY_sigma0,
-    'PixPhi IBL'   :  iblX_sigma0,
-    'PixEta IBL'   :  iblY_sigma0,
-    'SCT Barrel':     sctbar_sigma0,
-    'SCT Endcap':     sctec_sigma0,
-    'TRT Barrel':     trtbar_sigma0,
-    'TRT Endcap':     trtec_sigma0
-}
-##########################################################
-
-import sys
-import TrkErrorScalingDB
-
-#--------------------------------------------------------------
-# Get next scaling parameters.
-# c_i = sqrt(a^2 * s_0^2 * (p_obs^2 - 1) + c_{i-1}^2 * p_obs^2)
-# if targetp != 1 then scale p_obs by 1/targetp. This prevents it
-# from trying to improve the pull more than was achieved with
-# tuning parameter a.
-def getNextScalingC(s, p_obs, sigma_0, targetp, damping, strategy):
-    from math import sqrt
-
-    if (targetp <= 0): targetp = 1
-    p = p_obs/targetp
-    a = s[0]
-    c = s[1]
-    cnext2 = a*a * sigma_0*sigma_0 * (p*p - 1) + c*c * p*p;
-    if  (cnext2 < 0):
-        cnext = damping * c
-    else:
-        cnext = sqrt(cnext2)
-        if (strategy == 1):
-            cnext = c + (cnext - c) * damping
-    #print cnext
-    return (a,cnext)
-
-#--------------------------------------------------------------
-# Get next parameter a. Assume c = 0.
-def getNextScalingA(s, p_obs):
-    a = s[0]
-    anext = a * p_obs
-    #print anext
-    return (anext,0.)
-
-#--------------------------------------------------------------
-# cool dataset -> scaling set
-def makeScaling(dataset):
-    scaling = {}
-    for data in dataset:
-        key = data[0]
-        scaling[key] = (data[1],data[2])
-    return scaling
-
-# scaling set -> cool dataset
-def makeDataset(scalingset):
-    dataset = []
-    for entry in entries:
-        key = entry[0]
-        data = scalingset[key]
-        dataset.append((key,data[0],data[1]))
-    return dataset
-
-#--------------------------------------------------------------
-def createNominalScaling():
-    dataset = []
-    for entry in entries:
-        key = entry[0]
-        a = 1.0
-        c = 0.0
-        dataset.append((key,a,c))
-    return (nominalTag,dataset)
-
-#--------------------------------------------------------------
-def printDataset(file,dataset):
-    file.write('dataset = [')
-    first = True
-    for data in dataset:
-        if (not first):
-            file.write(',\n           ')
-        file.write(str(data))
-        first = False
-    file.write('\n           ]\n')
-    
-#--------------------------------------------------------------
-def addToDatabase(dataset, tag, mc):
-    #if (not quickTest):
-    #comp with data, ofl with MC
-    
-    if not mc:
-        connect="sqlite://X;schema=mycool.db;dbname=CONDBR2"  #COMP200
-    else:
-        connect="sqlite://X;schema=mycool.db;dbname=OFLP200"
-    TrkErrorScalingDB.make(dataset, tag, foldername, connect)
-    #TrkErrorScalingDB.make(dataset, tag, foldername)
-    
-#--------------------------------------------------------------
-def printResults(outfile, tag, sigma0, targetpull, pulls, scalingset, extraRPOptions=None, rmsoption=False):
-    outfile.write('Tag: '+tag+'\n')
-    if (extraRPOptions == ""): extraRPOptions="None"
-    if (extraRPOptions is None): extraRPOptions="None"
-    outfile.write('Use RMS: '+str(rmsoption)+'\n')
-    outfile.write('Extra options: '+extraRPOptions+'\n')
-    outfile.write("%-15s %10s %10s %10s %10s %10s %10s %10s %10s\n" % ('Det', 'sigma0', 'target', 'Pull','Pull_err','RMS','RMS_err','A','C'))
-    for entry in entries:
-        key = entry[0]
-        keypull = entry[1]
-        targetp = getTargetPull(keypull, targetpull, rmsoption)           
-        outfile.write("%-15s %10g %10g %10g %10g %10g %10g %10g %10g\n" %
-                      (key, sigma0[key], targetp,
-                       pulls[keypull][0], pulls[keypull][1],
-                       pulls[keypull][2], pulls[keypull][3],
-                       scalingset[key][0], scalingset[key][1]))
-
-def printScaling(outfile, tag, scalingset):
-    outfile.write('Tag: '+tag+'\n')
-    outfile.write("%-15s %10s %10s\n" % ('Det','A','C'))
-    for entry in entries:
-        key = entry[0]
-        keypull = entry[1]
-        outfile.write("%-15s %10g %10g\n" %
-                      (key, scalingset[key][0], scalingset[key][1]))
-
-
-#--------------------------------------------------------------
-def runAthena(jobOptions,tag, logfile, batchmode, itertag):
-    import os
-    import sys
-    from subprocess import Popen
-
-    if not batchmode:
-        commandstr = ('athena.py -c "runmode=\'local\'; errorScalingOverride = \''
-                      + tag + '\'" ' + jobOptions + ' | tee ' + logfile)
-        print "Executing:",commandstr
-        sys.stdout.flush()
-        if (not quickTest):
-            p = Popen(commandstr, shell=True)
-            rc = os.waitpid(p.pid, 0)[1]
-        else:
-            rc = 0
-            return rc
-    else:
-        #-n is number of segments, -t is the iter tag
-        # the errorScalingOverride='tag' line must NOT have any spaces or extra quotes 
-        # and must come before the jobOptions
-        commandstr = ( 'python run_RecEx.py -n40 -t %s ' % itertag +
-                       ("--estag %s" % tag)
-                       + ' ' + jobOptions )
-                       
-
-        print "ExecutingBen:",commandstr
-        sys.stdout.flush()
-        p = Popen(commandstr, shell=True)
-        rc = os.waitpid(p.pid, 0)[1]
-        #print rc
-
-#--------------------------------------------------------------
-def readPullsFile(filename):                              
-   infile = open(filename)
-   lines = infile.readlines()
-   pulls = {}
-   for l in lines:
-       words = l.split()
-       pulls[words[0]] = [float(words[1]),float(words[2]),float(words[3]),float(words[4])]
-   #print pulls
-   infile.close()
-    
-   return pulls
-
-#--------------------------------------------------------------
-# Get the target pull width or rms for convergence 
-def getTargetPull(key, targetpull, rmsoption):
-    targetp = 1
-    if (targetpull != None and key in targetpull) :
-        targetp = targetpull[key][0]
-        if (rmsoption): targetp = targetpull[key][2]
-    #if (targetp < 1): targetp = 1
-    return targetp
-
-#--------------------------------------------------------------
-def iterStr(num):
-    return str(num).zfill(2)
-
-#--------------------------------------------------------------
-def doIteration(jobOptions, tag, prevDataset, itercount, doAorC, targetpull, rms, usentuple, damping, strategy, extraRPOptions, batchmode,mc):    
-    print "-----------------------------------------------------------------"
-    print "Running iteration:", itercount
-    print " tag =", tag
-    print " Tuning parameter", doAorC
-    print 
-    
-    pullsfilename = 'pulls_iter'+doAorC+iterStr(itercount)+'.txt'
-    #pullsfile = 'pulls.txt'
-    monitoringfile = 'monitoring_iter'+doAorC+iterStr(itercount)+'.root'
-    paramfile = 'param_iter'+doAorC+iterStr(itercount+1)+'.py'
-    nexttag = 'IndetTrkErrorScaling_iter'+doAorC+iterStr(itercount+1)
-    logfile = 'out_iter'+doAorC+iterStr(itercount)+'.log'
-    resultsfilename = 'results_iter'+doAorC+iterStr(itercount)+'.txt'
-
-    import os
-    import os.path
-    from subprocess import Popen
-
-    if not (doAorC == 'A' or doAorC == 'C') :
-        doAorC = 'C'
-
-        
-    resultsfile = open(resultsfilename,'w')
-    resultsfile.write('---------------------------------------------------------------------------------------------------------\n')
-    resultsfile.write("Iteration: "+str(itercount)+'\n')
-    resultsfile.write("Tuning parameter "+doAorC+'\n')
-    resultsfile.write("\n")
-
-    prevScalingSet = makeScaling(prevDataset)
-    printScaling(sys.stdout, tag, prevScalingSet)
-    printScaling(resultsfile, tag, prevScalingSet)
-    #print prevScalingSet
-
-
-    print "Is  this mc ? : ", mc
-    addToDatabase(prevDataset, tag, mc) 
-
-
-    if (not usentuple):
-        runAthena(jobOptions, tag, logfile, batchmode,
-                  itertag=('iter' + doAorC + iterStr(itercount)))
-    else:
-        print "Athena not run. Using ntuple file:", usentuple
-    
-    if (usentuple):
-        monitoringfile = usentuple 
-    elif (quickTest):
-        monitoringfile = "monitoring.root"
-    
-    
-    # rename ntuple output file
-    if (not quickTest and not usentuple):
-        os.rename('monitoring.root',monitoringfile)
-
-    #commandstr = './AllResidualsAndPulls -b '+ntuplebasename+' Validation Tracks 65 2000 250 ' + extraRPOptions
-    #commandstr = './AllResidualsAndPulls -b '+ntuplebasename+' Validation CombinedInDetTracks 65 2000 250 Drifttime ' + extraRPOptions
-    commandstr = 'python generatePulls.py ' + monitoringfile + ' iter' + doAorC+iterStr(itercount) + ' "Fully Unbiased"'
-    print "Executing:",commandstr
-    sys.stdout.flush()
-    p = Popen(commandstr, shell=True)
-    rc = os.waitpid(p.pid, 0)[1]
-
-    os.rename('pulls.txt',pullsfilename)
-        
-    #rc = 0
-    #print 'return status: ',rc
-
-    pulls = {}
-    pulls = readPullsFile(pullsfilename)
-
-    nextScalingSet = {}
-    for entry in entries:
-        key = entry[0]
-        pullkey = entry[1]
-        p = pulls[pullkey]
-        p_obs = p[0]
-        p_err = p[1]
-        if (rms): # use rms instead
-            p_obs = p[2]
-            p_err = p[3]
-            
-        nextScaling  = prevScalingSet[key]
-
-        targetp = getTargetPull(pullkey, targetpull, rms)           
-
-        if (doAorC == 'A'):
-            nextScaling = getNextScalingA(nextScaling, p_obs)
-        else:
-            nextScaling = getNextScalingC(nextScaling, p_obs, sigma0[key], targetp, damping, strategy)
-        #print nextScaling
-        nextScalingSet[key] = nextScaling
-
-    printResults(sys.stdout,  tag, sigma0, targetpull, pulls, nextScalingSet, extraRPOptions, rms)
-    printResults(resultsfile, tag, sigma0, targetpull, pulls, nextScalingSet, extraRPOptions, rms)
-    print 'Next tag:',nexttag
-    resultsfile.write('Next tag: '+nexttag+'\n')
-    resultsfile.write('---------------------------------------------------------------------------------------------------------\n')
-    resultsfile.write('\n')
-
-    #print nextScalingSet
-    dataset = makeDataset(nextScalingSet)
-    print 'Writing parameters for next iteration:',paramfile
-    outfile = open(paramfile,'w')
-    outfile.write('tag = \''+nexttag+'\'\n')
-    printDataset(outfile,dataset)
-    outfile.close()
-    
-    resultsfile.close()
-
-    # signal to continue iterations.
-    # Placeholder to allow the possibility to abort iterations
-    more = True
-
-    return (more, nexttag, dataset)
-#--------------------------------------------------------------
-def parseOptions():
-
-    from optparse import OptionParser
-
-    usage = "usage: %prog [options] [file1.py [file2.py [...]]] "
-    parser = OptionParser(usage=usage)
-    parser.add_option("-p", "--param", dest="paramfile",
-                      help="parameter file", metavar="FILE")
-    parser.add_option("-c", "",
-                      action="store_true", dest="tunec", default=False,
-                      help="tune parameter c")
-    parser.add_option("-a", "",
-                      action="store_true", dest="tunea", default=False,
-                      help="tune parameter a")
-    parser.add_option("-n", "--numiter", dest="numIter", type="int",
-                      default = 1,
-                      help="max number of iterations", metavar="NUM")
-    parser.add_option("-i", "--iter", dest="firstIter", type="int",
-                      help="first iteration number", metavar="NUM")
-    parser.add_option("-r", "--rms",
-                      action="store_true", dest="rms", default=False,
-                      help="use rms rather than pull width")
-    parser.add_option("-t", "--target", dest="pullsfile", 
-                      help="converge to pull width or rms in FILE.",
-                      metavar="FILE")
-    parser.add_option("-u", "--usentuple", dest="ntuplefile", 
-                      help="Use ntuple FILE for first iteration",
-                      metavar="FILE")   
-    parser.add_option("-d", "--damping", dest="damping", type="float",
-                      default = 0.5,
-                      help="Damping factor used in C iterations, Default = %default",
-                      metavar="NUM")
-    parser.add_option("-s", "--strategy", dest="strategy",  type="int",
-                      default = 0,
-                      help="Select different strategies for convergence, "
-                      "0(default): Damping only applied if c2 < 0, "
-                      "1: damping applied to all C iterations", 
-                      metavar="NUM")
-    parser.add_option("-e", "--rpoptions", dest="rpoptions",
-                      help="Extra options for ResidualAndPulls program (eg Drifttime or NoDrifttime)",
-                      metavar="OPTION")
-    parser.add_option('-b', '--batch', dest='batch', help='run on the batch system',
-                      action='store_true', default=False)
-    parser.add_option("-k", "",
-                      action="store_true", dest="simul", default=False,
-                      help="input dataset is simulation")
-    parser.add_option("-q", "--queue", dest="queue", default="atlasb1",
-                      help="queue for job submission")
-    
-
-   
-    (options, args) = parser.parse_args()
-
-    if options.tunea and options.tunec:
-        parser.error("options -a and -c are mutually exclusive")
-    if (options.strategy <0 or  options.strategy > 1):
-        parser.error("-s,--strategy option: value out of range")
-    return (options, args)
-
-
-#--------------------------------------------------------------
-def getIterAndParam(s):
-    #Gets iteration number and tuning parameter from filename assuming it is
-    #of the form param_iter[A,C]##.py
-
-    #Look for the string "iter"
-    tuneParam = None
-    iter = None
-
-    if (s != None):
-        i = s.find('iter')
-        if (i >= 0):
-            i += 4
-            if (i < len(s)):
-                nextChar = s[i]
-                if (s[i] == 'A' or s[i] == 'C'):
-                    tuneParam = s[i] 
-                    i += 1
-                ifirst = i
-                while (i < len(s) and s[i].isdigit()): i += 1
-                if (i - ifirst > 0): iter = int(s[ifirst:i])
-
-    return (tuneParam, iter)
-
-############
-##MainBody##
-############ 
-
-(options, args) = parseOptions()
-
-print "Running Errorscaling iterations"
-
-if (options.paramfile == None) :
-    tag,dataset = createNominalScaling()
-else:
-    print "Reading parameter file:", options.paramfile
-    execfile(options.paramfile)
-    
-nextDataset = dataset
-nextTag = tag
-
-
-# use the paramfile name to get tuning parameter and iteration number
-(tuneParam, firstIter) = getIterAndParam(options.paramfile)
-
-jobOptions = ''
-if (len(args) == 0):
-    jobOptions = defaultJobOptions
-else :
-    for j in args:
-        jobOptions += j + ' '
-
-        
-doA = 'A'
-doC = 'C'
-
-# Set tuneParam. If requested tuning paramater differs from
-# that determined from paramfile then reset firstIter to 0.
-if (options.tunea):
-    if (tuneParam == 'C'): firstIter = 0
-    tuneParam = doA
-if (options.tunec): 
-    if (tuneParam == 'A'): firstIter = 0
-    tuneParam = doC
-
-if (tuneParam == None):
-    print "Tuning parameter not specified. Tuning parameter A" 
-    tuneParam = doA
-
-targetpull = None
-if (tuneParam == doA and options.pullsfile != None):
-    print "WARNING pullsfile is ignored if tuning parameter A" 
-elif (options.pullsfile):
-    targetpull = readPullsFile(options.pullsfile)
- 
-if (options.firstIter != None): firstIter = options.firstIter 
-if (firstIter == None): firstIter = 0 
-numIter = options.numIter
-
-usentuple = options.ntuplefile
-rpoptions = options.rpoptions
-batch = options.batch
-if (rpoptions is None): rpoptions = ""
-
-print "First Iteration:", firstIter
-print "Number of iterations:", numIter 
-print "JobOptions file(s):", jobOptions
-print "Tuning parameter:", tuneParam
-print "Use RMS:", options.rms
-print "Use ntuple in first iteration:", usentuple
-print "Target pullsfile:", options.pullsfile
-print "Damping factor:",  options.damping
-print "Strategy:",options.strategy
-print "Extra Residual and Pulls options:", options.rpoptions
-print "Is MC : ", options.simul
-print "queue: ",options.queue
-
-
-for i in range(firstIter,firstIter+numIter):
-    print 'Iteration:', i
-    if (i != firstIter): usentuple = None
-    more,nextTag,nextDataset = doIteration(jobOptions = jobOptions,
-                                           tag = nextTag,
-                                           prevDataset = nextDataset,
-                                           itercount = i,
-                                           doAorC = tuneParam,
-                                           targetpull = targetpull,
-                                           rms = options.rms,
-                                           usentuple = usentuple,
-                                           damping = options.damping,
-                                           strategy = options.strategy,
-                                           extraRPOptions = rpoptions,
-                                           batchmode = options.batch,
-                                           mc=options.simul)
-                                           #queue = options.queue)
-
-
-    if (not more):
-        print "Remaining iterations canceled."
-        break
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py
deleted file mode 100644
index b1641022cf52ae52ecd75d71bea528aa91eeacda..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptions.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-include("datasets.py")
-
-# --- read BS 
-doReadBS        = True
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-
-#if not doReadBS:
-#  athenaCommonFlags.FilesInput = ["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"] 
-#else:
-#  athenaCommonFlags.FilesInput = ["rfio:/castor/cern.ch/grid/atlas/DAQ/2011/00180481/calibration_IDTracks/data11_7TeV.00180481.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data"]
-
-#athenaCommonFlags.FilesInput = [ 'root://eosatlas//eos/atlas/atlasdatadisk/mc10_7TeV/DESD_MBIAS/e574_s932_s946_r2094/mc10_7TeV.105001.pythia_minbias.recon.DESD_MBIAS.e574_s932_s946_r2094_tid280668_00/DESD_MBIAS.280668._016228.pool.root.1']
-
-#if doReadBS:
-import os
-os.environ['STAGE_HOST']="castoratlas"
-os.environ['STAGE_SVCCLASS']="atlcal"
-
-
-#os.environ['STAGE_HOST']="castoratlast3"
-#os.environ['STAGE_SVCCLASS']="atlascerngroupdisk"      
-#//athenaCommonFlags.FilesInput = ["rfio:/castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/data10_7TeV.00154817.physics_MinBias.merge.RAW/data10_7TeV.00154817.physics_MinBias.merge.RAW._lb0100._0001.1"]
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-004-05")
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-005-06")
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-005-07")
-
-print athenaCommonFlags.FilesInput()
-
-import AthenaPython.ConfigLib as apcl
-cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput())
-cfg.configure_job()
-
-if doReadBS:
-  from AthenaCommon.GlobalFlags import globalflags
-
-  if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-
-theApp.EvtMax = 10
-  
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = False
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-#--------------------------------------------------------------
-# Additional Detector Setup
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning=False
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.SCT_setOff()
-#DetFlags.detdescr.SCT_setOn()
-#DetFlags.TRT_setOff()
-#DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-# --- output level
-#OutputLevel          = DEBUG
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-InDetFlags.doxKalman              = False
-InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-#InDetFlags.cutLevel = 3
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doTrackSegmentsPixel = True
-#InDetFlags.doTrackSegmentsSCT   = True
-#InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPrimaryVertexingEnhanced = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-InDetFlags.doMonitoringGlobal    = True
-InDetFlags.doMonitoringPixel     = True
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = True
-
-#InDetFlags.doPixelClusterSplitting = False
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = True
-#InDetFlags.doPixelTrkNtuple = True
-#InDetFlags.doSctTrkNtuple   = True
-#InDetFlags.doTrtTrkNtuple   = True
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-#InDetFlags.doMinBias   = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-if True:
-  redoPatternRecoAndTracking = True
-  from InDetRecExample.InDetJobProperties import InDetFlags
-  InDetFlags.doTruth            = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-  InDetFlags.preProcessing      = redoPatternRecoAndTracking
-  InDetFlags.doPRDFormation        = False                       # those two will be (later) automatically false if
-  InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking  # preProcessing is false
-  InDetFlags.doNewTracking      = redoPatternRecoAndTracking
-  InDetFlags.doiPatRec          = False
-  InDetFlags.doxKalman          = False
-  InDetFlags.doLowPt            = False
-  InDetFlags.doCTBTracking      = False
-  InDetFlags.doBackTracking     = redoPatternRecoAndTracking
-  InDetFlags.doTRTStandalone    = redoPatternRecoAndTracking
-  InDetFlags.doTrtSegments      = redoPatternRecoAndTracking
-  InDetFlags.doParticleCreation = redoPatternRecoAndTracking
-  InDetFlags.doSlimming    = False
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-include("InDetRecExample/InDetRec_all.py")
-
-# --- dump MC truth into logfile
-#from TruthExamples.TruthExamplesConf import DumpMC
-#topSequence += DumpMC(McEventKey = "TruthEvent")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsAlignmentSet.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsAlignmentSet.py
deleted file mode 100644
index e8825063bf9059baba14937c323d295bbe1d6b4e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsAlignmentSet.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# Examples of overriding with different alignment sets
-
-##conddb.addOverride("/Indet/Align","InDetAlign_EoverPv2.3_2011_E") #bc
-##conddb.addOverride("/TRT/Align","TRTAlign_EoverPv2_2011_E") #bc
-#conddb.addOverride("/PIXEL/PixReco", "PixelOfflineReco-Extended-01")
-#conddb.addOverride("/PIXEL/PixReco", "PixelOfflineReco-Extended-000-01")
-
-#conddb.addOverride("/Indet/Align","InDetAlign_Collision_7T_L3_2010_04")
-#conddb.addOverride("/TRT/Align","TRTAlign_Collision_7T_L3L2_2010_04")
-
-#conddb.addFolder('TRT_OFL','/TRT/Calib/DX')
-##conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverPv2_2011_E') #bc
-
-#conddb.addOverride('/Indet/Beampos', 'IndetBeampos-ES1-UPD2')
-#conddb.addOverride('/Indet/PixelDist','InDetPixelDist-000-01')
-
-doMisAlign = False
-
-# uncomment to use misaligned geometry 
-##############
-if doMisAlign:
-    from IOVDbSvc.CondDB import conddb
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-##############
-
-# uncomment to use misaligned geometry
-##########
-if doMisAlign:
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-
-# uncomment to use misaligned geometry
-######## set this to the file containing AlignableTransform objects
-if doMisAlign:
-    ServiceMgr.CondProxyProvider.InputCollections += ["/afs/cern.ch/user/a/atlidali/public/TRTZ_SiL3/Iter3_AlignmentConstants.root"]
-    ServiceMgr.CondProxyProvider.InputCollections += ["MisalignmentSet2.pool.root"] 
-    ServiceMgr.CondProxyProvider.OutputLevel = DEBUG
-    ServiceMgr.IOVSvc.preLoadData=True
-#########
-
-#print ServiceMgr.CondProxyProvider
-
-## This Athena job consists of algorithms that loop over events;
-## here, the (default) top sequence is used:
-### from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-### job = AlgSequence()
-### seq = AthSequencer("AthFilterSeq")
-
-#-----------------
-# This block handles good run lists. Uncomment to enable goodrunlist
-#-----------------
-#from GoodRunsLists.GoodRunsListsConf import *
-#ToolSvc += GoodRunsListSelectorTool() 
-#GoodRunsListSelectorTool.GoodRunsListVec = [ 'MyLBCollection.xml' ]
-#GoodRunsListSelectorTool.OutputLevel = DEBUG
-
-#from GoodRunsListsUser.GoodRunsListsUserConf import *
-#seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-#seq.GRLTriggerAlg1.GoodRunsListArray = ['MyLBCollection'] ## pick up correct name from inside xml file!
-#-----------------
-
-## AthFilterSeq is always executed before the top sequence, and is configured such that
-## any follow-up sequence (eg. top sequence) is not executed in case GRLTriggerAlg1 does
-## not pass the event
-## In short, the sequence AthFilterSeq makes sure that all algs in the job sequence
-## are skipped when an event gets rejects
-
-## Add the ntuple dumper to the top sequence, as usual
-## DummyDumperAlg1 is run in the top sequence, but is not executed in case GRLTriggerAlg1 rejects the event.
-#job += DummyDumperAlg('DummyDumperAlg1')
-#job.DummyDumperAlg1.RootFileName = 'selection1.root'
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py
deleted file mode 100755
index 87a809110d42a7152e0b307a153d9cf02a9f16bd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD.py
+++ /dev/null
@@ -1,219 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-include("datasets.py")
-
-# --- read BS 
-doReadBS        = True
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-
-#if not doReadBS:
-#  athenaCommonFlags.FilesInput = ["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"] 
-#else:
-#  athenaCommonFlags.FilesInput = ["rfio:/castor/cern.ch/grid/atlas/DAQ/2011/00180481/calibration_IDTracks/data11_7TeV.00180481.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data"]
-
-#athenaCommonFlags.FilesInput = [ 'root://eosatlas//eos/atlas/atlasdatadisk/mc10_7TeV/DESD_MBIAS/e574_s932_s946_r2094/mc10_7TeV.105001.pythia_minbias.recon.DESD_MBIAS.e574_s932_s946_r2094_tid280668_00/DESD_MBIAS.280668._016228.pool.root.1']
-
-#if doReadBS:
-import os
-os.environ['STAGE_HOST']="castoratlas"
-os.environ['STAGE_SVCCLASS']="atlcal"
-
-
-#os.environ['STAGE_HOST']="castoratlast3"
-#os.environ['STAGE_SVCCLASS']="atlascerngroupdisk"      
-#//athenaCommonFlags.FilesInput = ["rfio:/castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/data10_7TeV.00154817.physics_MinBias.merge.RAW/data10_7TeV.00154817.physics_MinBias.merge.RAW._lb0100._0001.1"]
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-004-05")
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-005-06")
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-005-07")
-
-print athenaCommonFlags.FilesInput()
-
-import AthenaPython.ConfigLib as apcl
-cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput())
-cfg.configure_job()
-
-if doReadBS:
-  from AthenaCommon.GlobalFlags import globalflags
-
-  if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-
-#theApp.EvtMax = 10
-  
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = False
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-#--------------------------------------------------------------
-# Additional Detector Setup
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning=False
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.SCT_setOff()
-#DetFlags.detdescr.SCT_setOn()
-#DetFlags.TRT_setOff()
-#DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-# --- output level
-#OutputLevel          = DEBUG
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-InDetFlags.doxKalman              = False
-InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-#InDetFlags.cutLevel = 3
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doTrackSegmentsPixel = True
-#InDetFlags.doTrackSegmentsSCT   = True
-#InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPrimaryVertexingEnhanced = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-InDetFlags.doMonitoringGlobal    = True
-InDetFlags.doMonitoringPixel     = True
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = True
-
-InDetFlags.doPixelClusterSplitting = False
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = True
-#InDetFlags.doPixelTrkNtuple = True
-#InDetFlags.doSctTrkNtuple   = True
-#InDetFlags.doTrtTrkNtuple   = True
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-#InDetFlags.doMinBias   = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-if True:
-  redoPatternRecoAndTracking = True
-  from InDetRecExample.InDetJobProperties import InDetFlags
-  InDetFlags.doTruth            = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-  InDetFlags.preProcessing      = redoPatternRecoAndTracking
-  InDetFlags.doPRDFormation        = False                       # those two will be (later) automatically false if
-  InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking  # preProcessing is false
-  InDetFlags.doNewTracking      = redoPatternRecoAndTracking
-  InDetFlags.doiPatRec          = False
-  InDetFlags.doxKalman          = False
-  InDetFlags.doLowPt            = False
-  InDetFlags.doCTBTracking      = False
-  InDetFlags.doBackTracking     = redoPatternRecoAndTracking
-  InDetFlags.doTRTStandalone    = redoPatternRecoAndTracking
-  InDetFlags.doTrtSegments      = redoPatternRecoAndTracking
-  InDetFlags.doParticleCreation = redoPatternRecoAndTracking
-  InDetFlags.doSlimming    = False
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-include("InDetRecExample/InDetRec_all.py")
-#include("/afs/cern.ch/work/c/cerio/private/17.6.0.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetRec_all.py")
-#include("/afs/cern.ch/work/c/cerio/private/17.6.0.1/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py")
-
-# --- dump MC truth into logfile
-#from TruthExamples.TruthExamplesConf import DumpMC
-#topSequence += DumpMC(McEventKey = "TruthEvent")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD_Run2.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD_Run2.py
deleted file mode 100755
index 193754fa06d7f7b7239adc970b79b4ced9a99797..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsESD_Run2.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-
-#--------------------------------------------------------------
-# Import config
-#--------------------------------------------------------------
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-
-
-rec.AutoConfiguration=['everything']
-
-print athenaCommonFlags.FilesInput()
-
-from AthenaCommon.GlobalFlags import globalflags
-globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2015-08")
-globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-03-01-00")
-globalflags.DataSource.set_Value_and_Lock("data")
-
-import MagFieldServices.SetupField
-
-from IOVDbSvc.CondDB import conddb
-conddb.setGlobalTag(globalflags.ConditionsTag())
-
-
-# --- number of events to process
-athenaCommonFlags.EvtMax     = 50
-athenaCommonFlags.SkipEvents = 0
-
-
-# --- disable error protection of RecExCommon
-athenaCommonFlags.AllowIgnoreConfigError.set_Value_and_Lock(False)
-
-
-#--------------------------------------------------------------
-# Additional Detector Setup
-#--------------------------------------------------------------
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-# --- turn off Calo
-DetFlags.Calo_setOff()
-# --- and switch off Muons
-DetFlags.Muon_setOff()
-DetFlags.BField_setOn()
-
-
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-rec.OutputLevel.set_Value_and_Lock       (INFO)
-
-rec.doWriteESD.set_Value_and_Lock        (False)
-rec.doAOD.set_Value_and_Lock             (False)
-rec.doWriteAOD.set_Value_and_Lock        (False)
-rec.doDPD.set_Value_and_Lock             (False)
-rec.doCBNT.set_Value_and_Lock            (False)
-rec.doWriteTAG.set_Value_and_Lock        (False)
-
-# --- turn on InDet
-rec.doInDet.set_Value_and_Lock           (True)
-# --- turn off calo
-rec.doCalo.set_Value_and_Lock            (False)
-# --- turn off muons
-rec.doMuon.set_Value_and_Lock            (False) 
-# --- turn off forward detectors
-rec.doForwardDet.set_Value_and_Lock      (False)
-
-# --- turn off combined reconstruction
-rec.doEgamma.set_Value_and_Lock          (False)
-rec.doMuonCombined.set_Value_and_Lock    (False)
-rec.doTau.set_Value_and_Lock             (False)
-rec.doJetMissingETTag.set_Value_and_Lock (False)
-
-# --- turn off global monitoring 
-rec.doMonitoring.set_Value_and_Lock      (False)
-
-
-# --- turn of calo stuff we don't need anyway
-from CaloRec.CaloRecFlags import jobproperties
-jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock  (False)
-jobproperties.CaloRecFlags.doCaloEMTopoCluster.set_Value_and_Lock(False)
-jobproperties.CaloRecFlags.doCaloTopoTower.set_Value_and_Lock    (False)
-
-# --- turn off jets (Hack!!!)
-from JetRec.JetRecFlags import jetFlags
-jetFlags.Enabled.set_Value_and_Lock          (False)
-
-# --- turn off egamma Brem
-recAlgs.doEgammaBremReco.set_Value_and_Lock  (False)
-# --- turn off Eflow and missing ET
-recAlgs.doEFlow.set_Value_and_Lock           (False)
-recAlgs.doEFlowJet.set_Value_and_Lock        (False)
-recAlgs.doMissingET.set_Value_and_Lock       (False)
-recAlgs.doMissingETSig.set_Value_and_Lock    (False)
-recAlgs.doObjMissingET.set_Value_and_Lock    (False)
-# --- turn off combined muons
-recAlgs.doMuGirl.set_Value_and_Lock          (False)
-recAlgs.doMuTag.set_Value_and_Lock           (False)
-recAlgs.doMuidLowPt.set_Value_and_Lock       (False)
-recAlgs.doMuonIDCombined.set_Value_and_Lock  (False)
-recAlgs.doMuonIDStandAlone.set_Value_and_Lock(False)
-recAlgs.doMuonSpShower.set_Value_and_Lock    (False)
-recAlgs.doStaco.set_Value_and_Lock           (False)
-recAlgs.doCaloTrkMuId.set_Value_and_Lock     (False)
-recAlgs.doTileMuID.set_Value_and_Lock        (False)
-# --- trigger
-recAlgs.doTrigger.set_Value_and_Lock         (False)
-rec.doTagRawSummary.set_Value_and_Lock   (False)
-
-
-
-#--------------------------------------------------------------
-# Printout config
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-print "globalflags configuration:"
-print globalflags
-
-print "detflags configuration:"
-DetFlags.Print()
-
-print "rec configuration:"
-print rec
-
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-# --- setup InDetJobProperties (default)
-from InDetRecExample.InDetJobProperties import InDetFlags
-#InDetFlags.doTruth.set_Value_and_Lock (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-InDetFlags.doTruth.set_Value_and_Lock (False)
-
-if datasample.getFormat()=='ESD': 
-    InDetFlags.doRefit=True
-
-#Anthony's recommendation: Is to load old SCT conditions. To be off >= M8
-#InDetFlags.ForceCoraCool.set_Value_and_Lock                        (True)
-
-# --- enable brem recovery
-InDetFlags.doBremRecovery.set_Value_and_Lock                       (False)
-InDetFlags.doCaloSeededBrem.set_Value_and_Lock                     (False)
-# --- enable forward tracks
-InDetFlags.doForwardTracks.set_Value_and_Lock                      (False)
-# --- enable 
-InDetFlags.doTrackSegmentsPixelPrdAssociation.set_Value_and_Lock   (False)
-# --- enable low mu run setup
-InDetFlags.doLowMuRunSetup.set_Value_and_Lock                      (False)
-InDetFlags.doTRTSeededTrackFinder.set_Value_and_Lock               (False)
-InDetFlags.doBackTracking.set_Value_and_Lock                       (False)
-InDetFlags.doPseudoTracking.set_Value_and_Lock                     (False)
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal.set_Value_and_Lock                   (False)
-InDetFlags.doMonitoringPrimaryVertexingEnhanced.set_Value_and_Lock (False)
-InDetFlags.doMonitoringPixel.set_Value_and_Lock                    (False)
-InDetFlags.doMonitoringSCT.set_Value_and_Lock                      (False)
-InDetFlags.doMonitoringTRT.set_Value_and_Lock                      (False)
-InDetFlags.doMonitoringAlignment.set_Value_and_Lock                (False)
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables.set_Value_and_Lock                 (True)
-
-
-InDetFlags.cutLevel.set_Value_and_Lock                             (12) 
-InDetFlags.doTRTStandalone.set_Value_and_Lock                      (False)
-
-
-InDetFlags.doInnerDetectorCommissioning.set_Value_and_Lock         (False)
-InDetFlags.useBroadClusterErrors.set_Value_and_Lock(False);
-
-#NN clustering for pixel
-InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(True);
-InDetFlags.doTIDE_Ambi.set_Value_and_Lock(True);
-
-
-
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-conddb.blockFolder("/Indet/TrkErrorScaling")
-conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema=mycool.db;dbname=CONDBR2</dbConnection>/Indet/TrkErrorScaling',errorScalingOverride,True);
-#conddb.addOverride('/Indet/Beampos','IndetBeampos-data15_13TeV-ReproJun15-v0')
-
-
-conddb.blockFolder("/Indet/Align")
-conddb.blockFolder("/TRT/Align")
-from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-from AthenaCommon.AppMgr import ServiceMgr
-ServiceMgr += CondProxyProvider()
-ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-# set this to the file containing AlignableTransform objects
-ServiceMgr.CondProxyProvider.InputCollections = ["/afs/cern.ch/user/m/mdanning/hias/public/13TeV/20.1.5.8/run_DCSfix/Iter3/Iter3_AlignmentConstants.root"]
-print "INPUT POOL FILES COLLECTION", ServiceMgr.CondProxyProvider.InputCollections 
-ServiceMgr.CondProxyProvider.OutputLevel = DEBUG
-print ServiceMgr.CondProxyProvider
-# this preload causes callbacks for read in objects to be activated,
-# allowing GeoModel to pick up the transforms
-ServiceMgr.IOVSvc.preLoadData = True
-ServiceMgr.IOVSvc.OutputLevel = INFO
-
-
-include("InDetMonitoringAlignment.py")
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsErrorTuning.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsErrorTuning.py
deleted file mode 100755
index ad80357d673b287abe9fe3b41ada91a4470ea632..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsErrorTuning.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#
-# include standard InDetRecExample joboptions
-#
-# get_files InDetRecExample/jobOptions.manual.py
-#
-# Make sure Inner Detector Monitoring is enabled
-# InDetFlags.doMonitoringGlobal    = True
-# InDetFlags.doMonitoringPixel     = True
-# InDetFlags.doMonitoringSCT       = True
-# InDetFlags.doMonitoringTRT       = True
-# InDetFlags.doMonitoringAlignment = True
-
-#This block prints out the error scaling used into the athena logfile
-# Unfortunately it is bugged and causes segfaults sometimes
-#from AthenaCommon.AppMgr import ToolSvc
-#from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackErrorScalingTool
-#InDetRotErrorScalingTool = Trk__RIO_OnTrackErrorScalingTool(
-#    name= 'RIO_OnTrackErrorScalingTool',
-#    OutputLevel = DEBUG )
-#ToolSvc += InDetRotErrorScalingTool
-
-#data sets are defined here
-include('datasets.py')
-
-#choose your dataset from those defined in datasets.py.
-#datasample = data_2011_CALIB_RAW#data_2011_Muons_DESD#data_2011_Minbias_DESD
-#datasample = data_2011_Muons_DESD
-#datasample = data_IDCalibSkim
-#datasample = data_155697_Minbias_DESD
-#datasample = data_161397_Minbias_DESD
-#datasample = data_PeriodI_Minbias_DESD
-#datasample = data_2011_Minbias_DESD
-#datasample = data_2011_Muons_DESD
-#datasample = data_2011_CALIB_RAW
-#datasample = mc10_Minbias_DESD
-#datasample = data11_Muons_DRAW
-#datasample = data11_Muons_DESD
-#datasample = data11_calibration_RAW
-#datasample = mc11_Ztautau_RAW
-#datasample = mc12_muons
-#datasample = mc12_Ztautau
-#datasample = mc11_Zprime_ESD
-#datasample = mc10_muons_RAW
-#datasample = mc10_muons_RAW_highStat
-
-datasample = data15_267073_Express_RAW
-#datasample = data15_267073_Express_ESD
-print 'Pre-job-option data set type:',datasample.getFormat()
-
-#this should be passed in on the command line via the athena.py -c switch.
-# Normally it's called by iterateTrkError.py which takes care of the 
-# switches being set correctly
-if (runmode == 'local'):
-    theApp.EvtMax = 10
-    datasample.activate()
-
-#this should be passed in on the command line via the athena.py -c switch.
-# Normally it's called by iterateTrkError.py which takes care of the 
-# switches being set correctly. nSegments and iSegment are passed in this way
-# as well
-if (runmode == 'batch'):
-    #theApp.EvtMax = 2500
-    theApp.EvtMax = 500
-    datasample.activateSegment(nSegments, iSegment, shuffle=True)
-
-# just the InDetRecExample options as mentioned above
-#include('ReadInDet_jobOptions.py')
-
-if datasample.getFormat()=='ESD': 
-    print "Using a ESD Dataset"
-    include('jobOptionsESD_Run2.py')
-
-if datasample.getFormat()=='RAW':
-    print "Using a RAW Dataset"
-    include('jobOptionsESD_Run2.py')
-
-print 'This dataset is mc:',datasample.isMC()
-
-#this fixes MC for now- look into why later
-#if not datasample.isMC():
-#conddb.blockFolder("/Indet/TrkErrorScaling")
-    #errorScalingOverride is passed in on the command line when this job is invoked in
-    # iterateTrkError.py . It typically contains the name of the override tag from the iteration.
-#conddb.addFolderWithTag("LOCAL","/Indet/TrkErrorScaling", errorScalingOverride, force=True)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py
deleted file mode 100755
index 5c2b20f3c4e67282a3fecee734855e9abf59a6a7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/jobOptionsRAW.py
+++ /dev/null
@@ -1,227 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# --- read BS 
-doReadBS        = True
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-import os
-
-#if not doReadBS:
-#  athenaCommonFlags.FilesInput = ["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"] 
-#else:
-#  athenaCommonFlags.FilesInput = ["rfio:/castor/cern.ch/grid/atlas/DAQ/2011/00180481/calibration_IDTracks/data11_7TeV.00180481.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data"]
-
-#athenaCommonFlags.FilesInput = [ 'root://eosatlas//eos/atlas/atlasdatadisk/mc10_7TeV/DESD_MBIAS/e574_s932_s946_r2094/mc10_7TeV.105001.pythia_minbias.recon.DESD_MBIAS.e574_s932_s946_r2094_tid280668_00/DESD_MBIAS.280668._016228.pool.root.1']
-
-#athenaCommonFlags.FilesInput = [ 'root://eosatlas//eos/atlas/atlasdatadisk/data11_7TeV/DRAW_ZMUMU/f368_m716/data11_7TeV.00180164.physics_Muons.merge.DRAW_ZMUMU.f368_m716/data11_7TeV.00180164.physics_Muons.merge.DRAW_ZMUMU.f368_m716._0002.1' ]
-
-#athenaCommonFlags.FilesInput = [ 'root://eosatlas//eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0006.data' ]
-
-#athenaCommonFlags.FilesInput = [ '/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0006.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0011.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-11._0003.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-11._0004.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-4._0009.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-4._0010.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-5._0003.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-5._0007.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-5._0012.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-9._0004.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-9._0007.data','/afs/cern.ch/user/a/atlidali/eos/atlas/atlasdatadisk/user/lacuesta/data11_7TeV/user.lacuesta.data11_7TeV.00191425.calibration_IDTracks.daq.RAW_der1324561622/data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-9._0011.data']
-
-#athenaCommonFlags.FilesInput = ["root://eosatlas//eos/atlas/atlasgroupdisk/perf-egamma/dq2/mc11_valid/RDO/e825_s1310_s1300_d578/mc11_valid.106052.PythiaZtautau.digit.RDO.e825_s1310_s1300_d578_tid512904_00/RDO.512904._000001.pool.root.1"]
-
-#use vicente's RAW files
-#os.system('eosforceumount ${HOME}/eos')
-#os.system('eosmount ${HOME}/eos')
-#a = os.popen('eosforceumount ${HOME}/eos')
-#b = os.popen('eosmount ${HOME}/eos')
-
-#rawDatasets = open('rawDatasets','r')
-#files = rawDatasets.readlines()
-#localFiles = []
-#for ii in files:
-#  tt = '/afs/cern.ch/user/a/atlidali' + ii[16:]
-#  localFiles.append(tt.rstrip('\n'))
-
-#athenaCommonFlags.FilesInput = localFiles
-#rawDatasets.close()
-
-#athenaCommonFlags.FilesInput = [ 'data11_7TeV.00191425.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0006.data' ]
-
-#if doReadBS:
-
-os.environ['STAGE_HOST']="castoratlas"
-os.environ['STAGE_SVCCLASS']="atlcal"
-
-
-#os.environ['STAGE_HOST']="castoratlast3"
-#os.environ['STAGE_SVCCLASS']="atlascerngroupdisk"      
-#//athenaCommonFlags.FilesInput = ["rfio:/castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/data10_7TeV.00154817.physics_MinBias.merge.RAW/data10_7TeV.00154817.physics_MinBias.merge.RAW._lb0100._0001.1"]
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-004-05")
-notMC = False
-if notMC:
-    globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-005-06")
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-BLKPST-005-07")
-
-print athenaCommonFlags.FilesInput()
-
-import AthenaPython.ConfigLib as apcl
-cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput())
-cfg.configure_job()
-
-if doReadBS:
-  from AthenaCommon.GlobalFlags import globalflags
-
-  if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-
-#theApp.EvtMax = 100
-  
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = False
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-#--------------------------------------------------------------
-# Additional Detector Setup
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning=False
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.SCT_setOff()
-#DetFlags.detdescr.SCT_setOn()
-#DetFlags.TRT_setOff()
-#DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-# --- output level
-#OutputLevel          = DEBUG
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-InDetFlags.doxKalman              = False
-InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-#InDetFlags.cutLevel = 3
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doTrackSegmentsPixel = True
-#InDetFlags.doTrackSegmentsSCT   = True
-#InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPrimaryVertexingEnhanced = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-InDetFlags.doMonitoringGlobal    = True
-InDetFlags.doMonitoringPixel     = True
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = True
-
-InDetFlags.doPRDFormation = True
-#InDetFlags.doPixelClusterSplitting = False
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = True
-#InDetFlags.doPixelTrkNtuple = True
-#InDetFlags.doSctTrkNtuple   = True
-#InDetFlags.doTrtTrkNtuple   = True
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-#InDetFlags.doMinBias   = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-include("InDetRecExample/InDetRec_all.py")
-
-# --- dump MC truth into logfile
-#from TruthExamples.TruthExamplesConf import DumpMC
-#topSequence += DumpMC(McEventKey = "TruthEvent")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/localIterateA.sh b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/localIterateA.sh
deleted file mode 100755
index fa9e4f4af76525ba223c2e6b0c4313017fbf5bca..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/localIterateA.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# starting from nominal error scaling
-#./iterateTrkError.py -c -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-#
-# starting from error scaling from third A iteration
-#./iterateTrkError.py -c -n10 -pparam_iterA03.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py >! outTest.log
-
-
-#source ~/w1/users/amorley/cmthome/setup.sh -tag=16.0.2.5
-
-#export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup
-#alias asetup='source $AtlasSetup/scripts/asetup.sh'
-#cd /afs/cern.ch/user/a/atlidali/w0/users/amorley/testarea/17.0.1.2
-#cd /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.0.3
-#asetup 17.0.1.2
-#asetup 17.0.3 
-export STAGE_SVCCLASS=atlcal
-
-#cd /afs/cern.ch/user/a/atlidali/w0/users/amorley/testarea/17.0.1.2/ErrorScalingOld/run/
-#cd /afs/cern.ch/user/a/atlidali/w0/users/bcerio/testarea/17.0.3/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-#cd /afs/cern.ch/user/a/atlidali/scratch1/users/bcerio/17.0.3/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-rm outTest.log
-
-./iterateTrkError.py -a -s1 -n10 -k jobOptionsErrorTuning.py jobOptionsAlignmentSet.py | tee outTest.log
-
-#./iterateTrkError.py -c --batch -s1 -n9 -i10 --param=param_iterC09.py ReadInDet_jobOptions.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/localIterateC.sh b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/localIterateC.sh
deleted file mode 100755
index 17b25518ce5b5bca754f55842e45095bb3aedd4e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/localIterateC.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# starting from nominal error scaling
-#./iterateTrkError.py -c -n10 jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
-#
-# starting from error scaling from third A iteration
-#./iterateTrkError.py -c -n10 -pparam_iterA03.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py >! outTest.log
-
-export STAGE_SVCCLASS=atlcal
-
-rm outTest.log
-
-./iterateTrkError.py -c -s1 -n2 -k jobOptionsErrorTuning.py jobOptionsAlignmentSet.py | tee outTest.log
-#./iterateTrkError.py -c -k -s1 -n2 --param=highpTMuon2_A_2/param_iterA11.py jobOptionsErrorTuning.py jobOptionsAlignmentSet.py > outTest.log
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/make_IndetTrkError.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/make_IndetTrkError.py
deleted file mode 100755
index 58a13dc8ce085f3cb8a9b46ee5020c5aad8a076e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/make_IndetTrkError.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#! /usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# Write out error scalings that are read in from python fragments.
-# The fragment should define dataset and tag
-# If the keyword "nominal" is passed as one of the arguments then
-# nominal error scalings (a=1,c=0) will be writen.
-# See usage:
-
-import TrkErrorScalingDB
-import sys
-
-nominal_tag = 'IndetTrkErrorScaling_nominal'
-nominal_dataset=[ ("PixPhi Barrel",1.0,0.0),
-                  ("PixEta Barrel",1.0,0.0),
-                  ("PixPhi Endcap",1.0,0.0),
-                  ("PixEta Endcap",1.0,0.0),
-                  ("SCT Barrel",1.0,0.0),
-                  ("SCT Endcap",1.0,0.0),
-                  ("TRT Barrel",1.0,0.0),
-                  ("TRT Endcap",1.0,0.0)
-                  ]
-
-foldername="/Indet/TrkErrorScaling"
-#connect="sqlite://X;schema=mycool.db;dbname=COMP200"
-connect="sqlite://X;schema=mycool.db;dbname=OFLP200"
-
-
-args = sys.argv[1:]
-
-if (len(args) > 0):
-    for inputfile in args:
-        if (inputfile == "nominal"):
-            print "Writing nominal error scalings"
-            TrkErrorScalingDB.make(nominal_dataset, nominal_tag, foldername, connect)
-        else:
-            if "dataset" in dir(): del dataset
-            if "tag" in dir(): del tag
-            print "Reading in",inputfile
-            execfile(inputfile)
-            if (not "dataset" in dir()) or (not "tag" in dir()):
-                print "ERROR: dataset or tag not defined in",inputfile
-            else:
-                TrkErrorScalingDB.make(dataset, tag, foldername, connect)
-        
-else:
-    print "usage:",sys.argv[0],"[param1.py [param2.py [...]]]"
-    print '  If the string "nominal" is used as an argument then nominal'
-    print '  scalings will be written (a=1,c=0)'
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/mvRunOutput.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/mvRunOutput.py
deleted file mode 100644
index 7a598194ea0c53050cc66cf5dab5f1b3902c7fec..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/mvRunOutput.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-import os
-import sys
-
-if len(sys.argv) < 2:
-    print 'ERROR: please supply a directory for the output'
-    sys.exit(0)
-
-newDir = sys.argv[1]
-
-os.system('python parseText.py')
-
-print 'Moving output to',newDir
-
-os.system('mkdir -p ' + newDir)
-
-os.system('mv results_iterC??.txt ' + newDir)
-os.system('mv out_iterC??.log ' + newDir)
-os.system('mv monitoring_iterC??.root ' + newDir)
-os.system('mv pulls_iterC??.txt ' + newDir)
-os.system('mv iterC?? ' + newDir)
-os.system('mv param_iterC??.py ' + newDir)
-os.system('mv testOutput.txt ' + newDir)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/myparameters.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/myparameters.py
deleted file mode 100644
index e406ddd4d81eaf488ce5c7308d4faf021ddab776..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/myparameters.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-tag = 'IndetTrkErrorScaling_MyTest'
-dataset = [('PixPhi Barrel', 1.0, 0.0056041573996374978),
-           ('PixEta Barrel', 1.0, 0.03969924988268),
-           ('PixPhi Endcap', 1.0, 0.0068769139592390833),
-           ('PixEta Endcap', 1.0, 0.038164283063112849),
-           ('SCT Barrel', 1.0, 0.011130510319502988),
-           ('SCT Endcap', 1.0, 0.0090743192951565927),
-           ('TRT Barrel', 1.0, 0.0),
-           ('TRT Endcap', 1.0, 0.0)
-           ]
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/parseText.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/parseText.py
deleted file mode 100644
index 32b392397ca598dbf849195ed65d770b3786ddc4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/parseText.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-from glob import glob
-from decimal import Decimal
-import numpy
-import pylab
-import os
-import sys
-
-
-
-if len(sys.argv) == 2:
-    outFolder = sys.argv[1] + '/'
-else:
-    outFolder = ''
-print outFolder
-
-outStr = 'test'
-
-files = glob(outFolder + 'results_iterC*.txt')
-
-pixPhiB = []
-pixEtaB = []
-pixPhiE = []
-pixEtaE = []
-sctBarrel = []
-sctEndcap = []
-trtBarrel = []
-trtEndcap = []
-
-pixPhiB_pull = []
-pixEtaB_pull = []
-pixPhiE_pull = []
-pixEtaE_pull = []
-sctBarrel_pull = []
-sctEndcap_pull = []
-trtBarrel_pull = []
-trtEndcap_pull = []
-
-for ff in files:
-    fff = open(ff,'r')
-    lineVec = fff.readlines()
-    lineVec_C = lineVec[5:14]
-    lineVec_pull = lineVec[18:26]
-    for i in lineVec_C:
-        i.strip()
-        if 'PixPhi Barrel' in i:
-            pixPhiB.append(i.split()[3])
-        if 'PixEta Barrel' in i:
-            pixEtaB.append(i.split()[3])
-        if 'PixPhi Endcap' in i:
-            pixPhiE.append(i.split()[3])
-        if 'PixEta Endcap' in i:
-            pixEtaE.append(i.split()[3])
-        if 'SCT Barrel' in i:
-            sctBarrel.append(i.split()[3])
-        if 'SCT Endcap' in i:
-            sctEndcap.append(i.split()[3])
-        if 'TRT Barrel' in i:
-            trtBarrel.append(i.split()[3])
-        if 'TRT Endcap' in i:
-            trtEndcap.append(i.split()[3])
-    for i in lineVec_pull:
-        i.strip()
-        print i
-        if 'PixPhi Barrel' in i:
-            pixPhiB_pull.append(i.split()[4])
-        if 'PixEta Barrel' in i:
-            pixEtaB_pull.append(i.split()[4])
-        if 'PixPhi Endcap' in i:
-            pixPhiE_pull.append(i.split()[4])
-        if 'PixEta Endcap' in i:
-            pixEtaE_pull.append(i.split()[4])
-        if 'SCT Barrel' in i:
-            sctBarrel_pull.append(i.split()[4])
-        if 'SCT Endcap' in i:
-            sctEndcap_pull.append(i.split()[4])
-        if 'TRT Barrel' in i:
-            trtBarrel_pull.append(i.split()[4])
-        if 'TRT Endcap' in i:
-            trtEndcap_pull.append(i.split()[4])
-
-    fff.close()
-
-print 'PixPhi Barrel C evolution'
-for i in pixPhiB:
-    print i
-
-print 'PixEta Barrel pull evolution'
-for i in pixEtaB_pull:
-    print i
-
-print len(pixPhiB),len(pixEtaB),len(pixPhiE),len(pixEtaE),len(sctBarrel),len(sctEndcap),len(trtBarrel),len(trtEndcap)
-
-textFile = open(outStr + 'Output.txt','w')
-
-for i in range(0,len(sctEndcap)):
-    if i == 0:
-        fileStr = 'i' + ' ' + 'pixPhiB' + ' ' + 'pixEtaB' + ' ' + 'pixPhiE' + ' ' + 'pixEtaE' + ' ' + 'sctBarrel' + ' ' + 'sctEndcap' + ' ' + 'trtBarrel' + ' ' + 'trtEndcap' + '\n'
-        textFile.write(fileStr)
-    fileStr = str(i) + ' ' + pixPhiB[i] + ' ' + pixEtaB[i] + ' ' + pixPhiE[i] + ' ' + pixEtaE[i] + ' ' + sctBarrel[i] + ' ' + sctEndcap[i] + ' ' + trtBarrel[i] + ' ' + trtEndcap[i] + '\n'
-    textFile.write(fileStr)
-
-textFile.write('\n')
-
-for i in range(0,len(sctEndcap)):
-    #if i == 0:
-    #    fileStr = 'i' + ' ' + 'pixPhiB' + ' ' + 'pixEtaB' + ' ' + 'pixPhiE' + ' ' + 'pixEtaE' + ' ' + 'sctBarrel' + ' ' + 'sctEndcap' + ' ' + 'trtBarrel' + ' ' + 'trtEndcap' + '\n'
-    #    textFile.write(fileStr)
-    fileStr = str(i) + ' ' + pixPhiB_pull[i] + ' ' + pixEtaB_pull[i] + ' ' + pixPhiE_pull[i] + ' ' + pixEtaE_pull[i] + ' ' + sctBarrel_pull[i] + ' ' + sctEndcap_pull[i] + ' ' + trtBarrel_pull[i] + ' ' + trtEndcap_pull[i] + '\n'
-    textFile.write(fileStr)
-
-
-
-textFile.close()
-
-
-
-"""
-pixPhiBarrC = []
-for ff in files:
-    f = open(ff, 'r')
-
-    strTest = ''
-    while(strTest != 'PixPhi'):
-        #print 'Reading text file.'
-	line =  f.readline()
-        lineList = line.split()
-        if(len(lineList)==0):
-            continue
-        strTest=lineList[0]
-
-    pixPhiBarrC.append(lineList[3])
-
-    #for s in lineList:
-        #print s
-
-iterateList = []
-pixPhiBarrCVec = []
-for i,s in enumerate(pixPhiBarrC):
-    print s
-"""
-
-#    pixPhiBarrCVec.append(float(s))
-#    iterateList.append(float(i))
-
-#pylab.plot(iterateList,pixPhiBarrCVec)
-#pylab.show()
-
-#pylab.savefig('plotIterate')
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/plotIteration.C b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/plotIteration.C
deleted file mode 100644
index 12ead046333ad84bca6f5fb868f8958460ac04d1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/plotIteration.C
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-//
-// Usage:
-// cat results_iterA*.txt > results_allA.txt
-// cat results_iterC*.txt > results_allC.txt
-// root
-// root [0] .L plotIteration.C+
-// root [1] plotIteration("results_allA.txt");
-// root [1] plotIteration("results_allC.txt");
-//
-
-#include <fstream>
-#include <iostream>
-#include <vector>
-#include <string>
-#include <sstream>
-#include "TMultiGraph.h"
-#include "TGraphErrors.h"
-#include "TCanvas.h"
-#include "TH1F.h"
-#include "TLegend.h"
-#include "TStyle.h"
-#include "TROOT.h"
-
-void splitline(const std::string & s, std::vector<std::string> & words);
-void splitdataline(const std::string & s, std::string & name, std::vector<double> & cols);
-void plotIteration(const char * filename = 0, bool getNextAC = true);
-void readResults(unsigned int ndet, 
-		 std::vector<int> & iterOrig,
-		 std::string * det, 
-		 std::vector<float> * pull, 
-		 std::vector<float> * pullError, 
-		 std::vector<float> * rms, 
-		 std::vector<float> * rmsError, 
-		 std::vector<float> * aprev, 
-		 std::vector<float> * cprev,
-		 std::vector<float> * a, 
-		 std::vector<float> * c,
-		 const char * filename,
-		 bool getNextAC = true);
-
-TGraphErrors * makeGraph(const std::vector<float> &y_in);
-TGraphErrors * makeGraph(const std::vector<float> &y_in, const std::vector<float> &ey_in);
-TGraphErrors * makeGraph(const std::vector<int> &iter, const std::vector<float> &y_in, const std::vector<float> &ey_in);
-TGraphErrors * makeGraph(const std::vector<int> &iter, const std::vector<float> &y_in);
-
-
-
-/*
-int main() {
-  plotIteration();
-  return 0;
-}
-*/
-
-void
-plotIteration(const char * filename, bool getNextAC)
-{
-  gROOT->SetStyle("ATLAS");
-  gROOT->ForceStyle();
-
-  if (!filename) filename = "results.txt";
-
-  const unsigned int NDET = 8;
-  std::vector<int> iteration;
-  std::vector<float> pull[NDET]; 
-  std::vector<float> pullError[NDET]; 
-  std::vector<float> rms[NDET]; 
-  std::vector<float> rmsError[NDET]; 
-  std::vector<float> aprev[NDET];
-  std::vector<float> cprev[NDET];
-  std::vector<float> a[NDET];
-  std::vector<float> c[NDET];
-  std::string det[NDET];
-
-  int mtype[] = {20,21,22,23,24,25,26,27};
-  int color[] = {kBlack,kRed,kBlue,kGreen,kCyan,kMagenta,30,47};
-
-  //int style = 0; // Put legeng within graph
-  int style = 1; // Put legend at side
-
-  readResults(NDET, iteration, det, pull, pullError, rms, rmsError, aprev, cprev, a, c, filename, getNextAC);
-
-  /*
-  for (unsigned int i = 0; i < iteration.size(); i++) {
-    std::cout << "Iteration:" << iteration[i] << std::endl;
-    for (int unsigned j=0; j < NDET; j++) {
-      std::cout << det[j] << " " 
- 		<< pull[j][i] << " " 
-  		<< pullError[j][i] << " "
- 		<< rms[j][i] << " " 
-  		<< rmsError[j][i] << " "
-  		<< aprev[j][i] << " "
-  		<< cprev[j][i] << " "
-  		<< a[j][i] << " "
-  		<< c[j][i] 
-		<< std::endl;
-    }
-  }
-  */
-
-  unsigned int ndet2 = NDET;
-  //unsigned int ndet2 = 6;
-  int canvW = 700;
-  int canvH = 500;
-  int canvX = 100;
-  int canvY = 100;
-  int canvStep = 100;
-
-  {
-    TCanvas * c1  = new TCanvas("c1","Pull Sigma", canvX, canvY, canvW, canvH);
-    if (style == 1) c1->SetRightMargin(0.2);
-    TLegend * leg = 0;
-    if (style == 1) {
-      leg = new TLegend(0.803,0.544,0.993,0.951);
-    } else {
-      leg = new TLegend(0.573,0.18,0.83,0.53);
-    }
-   
-    TMultiGraph * mg = new TMultiGraph();
- 
-
-    for (unsigned int j=0; j < ndet2; j++) { 
-      TGraphErrors * gr = makeGraph(iteration, pull[j], pullError[j]);
-      gr->SetMarkerColor(color[j]);
-      gr->SetMarkerStyle(mtype[j]);
-      leg->AddEntry(gr,det[j].c_str(),"pl");
-      mg->Add(gr);
-   }
-
-    mg->Draw("ALP");
-    mg->GetXaxis()->SetTitle("Iteration");
-    mg->GetYaxis()->SetTitle("Pull");
-    leg->Draw();
-  }
-
-  {
-    TCanvas * c2  = new TCanvas("c2","Pull RMS", canvX, canvY, canvW, canvH);
-    if (style == 1) c2->SetRightMargin(0.2);
-    TLegend * leg = 0;
-    if (style == 1) {
-      leg = new TLegend(0.803,0.544,0.993,0.951);
-    } else {
-      leg = new TLegend(0.573,0.18,0.83,0.53);
-    }
-   
-    TMultiGraph * mg = new TMultiGraph();
- 
-
-    for (unsigned int j=0; j < ndet2; j++) { 
-      TGraphErrors * gr = makeGraph(iteration, rms[j], rmsError[j]);
-      gr->SetMarkerColor(color[j]);
-      gr->SetMarkerStyle(mtype[j]);
-      leg->AddEntry(gr,det[j].c_str(),"pl");
-      mg->Add(gr);
-   }
-
-    mg->Draw("ALP");
-    mg->GetXaxis()->SetTitle("Iteration");
-    mg->GetYaxis()->SetTitle("RMS");
-    leg->Draw();
-  }
-
-
-  {
-    canvX += canvStep;
-    canvY += canvStep;
-    TCanvas * c3  = new TCanvas("c3","Parameter A",canvX, canvY, canvW, canvH);
-    if (style == 1) c3->SetRightMargin(0.2);
-        TLegend * leg = 0;
-    if (style == 1) {
-      leg = new TLegend(0.803,0.544,0.993,0.951);
-    } else {
-      leg = new TLegend(0.573,0.18,0.83,0.53);
-    }
-
-    TMultiGraph * mg = new TMultiGraph();
-
-    for (unsigned int j=0; j < ndet2; j++) { 
-      TGraphErrors * gr = makeGraph(iteration,aprev[j]);
-      gr->SetMarkerColor(color[j]);
-      gr->SetMarkerStyle(mtype[j]);
-      mg->Add(gr);
-      leg->AddEntry(gr,det[j].c_str(),"pl");
-    }
-    
-    mg->Draw("ALP");
-    mg->GetXaxis()->SetTitle("Iteration");
-    mg->GetYaxis()->SetTitle("A");
-    leg->Draw();
-  }
-
-  {
-    canvX += canvStep;
-    canvY += canvStep;
-    TCanvas * c4  = new TCanvas("c4","Parameter C",canvX, canvY, canvW, canvH);
-    if (style == 1) c4->SetRightMargin(0.2);
-    TLegend * leg = 0;
-    if (style == 1) {
-      leg = new TLegend(0.803,0.544,0.993,0.951);
-    } else {
-      leg = new TLegend(0.573,0.18,0.83,0.53);
-    }
-    
-    TMultiGraph * mg = new TMultiGraph();
-
-    for (unsigned int j=0; j < ndet2; j++) { 
-      TGraphErrors * gr = makeGraph(iteration,cprev[j]);
-      gr->SetMarkerColor(color[j]);
-      gr->SetMarkerStyle(mtype[j]);
-      leg->AddEntry(gr,det[j].c_str(),"pl");
-      mg->Add(gr);
-   }
-    
-    mg->Draw("ALP");
-    mg->GetXaxis()->SetTitle("Iteration");
-    mg->GetYaxis()->SetTitle("C (micron)");
-    //mg->GetHistogram()-GetXaxis()>SetRangeUser(0,10);
-    leg->Draw();
-  }
-
-    
-} 
-
-void  
-readResults(unsigned int ndet, 
-	    std::vector<int> & iterOrig,
-	    std::string * det, 
-	    std::vector<float> * pull, 
-	    std::vector<float> * pullError, 
-	    std::vector<float> * rms, 
-	    std::vector<float> * rmsError, 
-	    std::vector<float> * aprev, 
-	    std::vector<float> * cprev,
-	    std::vector<float> * a, 
-	    std::vector<float> * c,
-	    const char * filename,
-	    bool getNextAC)
-{
-  //int iteration = 0;
-  std::ifstream infile(filename);
-  if (!infile) std::cout << "Problem opening file: " << filename << std::endl;
-
-  while(infile) {
-    std::string tmpline;
-    std::getline(infile, tmpline);
-    //std::cout << tmpline << std::endl;
-    std::istringstream istr(tmpline);
-    std::string s;
-    int iorig;
-    istr >> s >> iorig;
-    if (s == "Iteration:") {
-      //std::cout <<  "Iteration:" << iorig << std::endl;
-      if (iorig >= 100) iorig = -1;
-      iterOrig.push_back(iorig);
-  
-      std::vector<std::string> words;
-
-      // Previous values of A and C
-      do {
-	words.clear();
-	std::getline(infile, tmpline);
-	splitline(tmpline, words);
-      } while (infile && !(words.size() > 0 && words[0] == "Det"));
-	
-      //std::cout << tmpline << std::endl;
-      if (words.size() > 0 && words[0] == "Det") {
-	for (unsigned int i = 0; i < ndet; i++) {
-	  std::getline(infile, tmpline);
-	  std::vector<double> cols;
-	  cols.push_back(0); // "Det" col
-	  std::string name;
-	  splitdataline(tmpline, name, cols);
-	  det[i] = name;
-	  for (unsigned int j = 0; j < cols.size(); j++) {
-	    //std::cout << "words[" << j << "]:" << words[j] << cols[j] << std::endl;
-	    if (words[j] == "A") aprev[i].push_back(cols[j]);
-	    if (words[j] == "C") cprev[i].push_back(cols[j]*1000);
-	  }
-	}
-      }  
-
-      // Resulting pulls and next values of A and C
-      do {
-	words.clear();
-	std::getline(infile, tmpline);
-	splitline(tmpline, words);
-      } while (infile && !(words.size() > 0 && words[0] == "Det"));
-
-      if (words.size() > 0 && words[0] == "Det") {
-	for (unsigned int i = 0; i < ndet; i++) {
-	  std::getline(infile, tmpline);
-	  std::vector<double> cols;
-	  cols.push_back(0); // "Det" col
-	  std::string name;
-	  splitdataline(tmpline, name, cols);
-	  det[i] = name;
-	  for (unsigned int j = 0; j < cols.size(); j++) {
-	    //std::cout << "words[" << j << "]:" << words[j] << ": " << cols[j] << std::endl;
-	    if (words[j] == "A") a[i].push_back(cols[j]);
-	    if (words[j] == "C") c[i].push_back(cols[j]*1000);
-	    if (words[j] == "Pull") pull[i].push_back(cols[j]);
-	    if (words[j] == "Pull_err") pullError[i].push_back(cols[j]);
-	    if (words[j] == "RMS") rms[i].push_back(cols[j]);
-	    if (words[j] == "RMS_err") rmsError[i].push_back(cols[j]);
-	  }
-	}
-      }  
-    }
-  }
-
-  // Add next value of a and c
-  if (getNextAC) {
-    for (unsigned int i = 0; i < ndet; i++) {
-      if (!c[i].empty()) cprev[i].push_back(c[i].back());
-      if (!a[i].empty()) aprev[i].push_back(a[i].back());
-    }
-    if (!iterOrig.empty()) iterOrig.push_back(iterOrig.back()+1);
-  }
- 
-}
-
-void splitline(const std::string & s,  std::vector<std::string> & words) {
-  std::istringstream istr(s);
-  std::string tmp;
-  while (istr) { 
-    istr >> tmp;
-    if (istr) words.push_back(tmp);
-  }      
-}
-
-void splitdataline(const std::string & s, std::string & name, std::vector<double> & cols) {
-  std::istringstream istr(s);
-  std::string name2;
-  istr >> name >> name2;
-  name += " "+name2;
-  while (istr) { 
-    double tmp;
-    istr >> tmp;
-    if (istr) cols.push_back(tmp);
-  }      
-}
-
-TGraphErrors * makeGraph(const std::vector<float> &y_in)
-{
-  std::vector<int> emptyiter;
-  std::vector<float> empty;
-  return makeGraph(emptyiter, y_in, empty);
-}
-
-
-TGraphErrors * makeGraph(const std::vector<int> &iter, const std::vector<float> &y_in)
-{
-  std::vector<float> empty;
-  return makeGraph(iter, y_in, empty);
-}  
-
-TGraphErrors * makeGraph(const std::vector<float> &y_in, const std::vector<float> &ey_in)
-{
-  std::vector<int> emptyiter;
-  return makeGraph(emptyiter, y_in, ey_in);
-}
-
-TGraphErrors * makeGraph(const std::vector<int> &iter, const std::vector<float> &y_in, const std::vector<float> &ey_in)
-{
-  unsigned int npoints = y_in.size();
-  float * x = new float[npoints];
-  float * ex = new float[npoints];
-  float * y = new float[npoints];
-  float * ey = new float[npoints];
-  for (unsigned int i =0; i < npoints; i++) {
-    x[i] = (iter.size() > i) ? float(iter[i]) : float(i);
-    y[i] = y_in[i];
-    ex[i] = 0;
-    ey[i] = (ey_in.size() > i) ? ey_in[i] : 0;
-    //std::cout <<  npoints << " " << x[i] << " " << y[i] << std::endl;
-  }
-  TGraphErrors * g = new TGraphErrors(npoints,x,y,ex,ey);
-
-  delete [] x;
-  delete [] y;
-  delete [] ex;
-  delete [] ey;
-  return g;
-}
-      
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/rootlogon.C b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/rootlogon.C
deleted file mode 100644
index 576448092fc1163508c56815f7f5c185054911a3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/rootlogon.C
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-{
- 
-  
-  TStyle* GloStyle;
-  GloStyle = gStyle;            
-
-  TStyle* RaviStyle = new TStyle("RaviStyle"
-				,"The Even More Perfect Style for Plots ;-)");
-  gStyle = RaviStyle;
-  // Paper size
-  RaviStyle->SetPaperSize(gStyle->kUSLetter);
-  
-  // Canvas
-  
-  RaviStyle->SetCanvasColor     (0);
-  RaviStyle->SetCanvasBorderSize(10);
-  RaviStyle->SetCanvasBorderMode(0);
-  RaviStyle->SetCanvasDefH      (600);
-  RaviStyle->SetCanvasDefW      (971);
-  RaviStyle->SetCanvasDefX      (10);
-  RaviStyle->SetCanvasDefY      (10);
-
-  // Pads
-
-  RaviStyle->SetPadColor       (0);
-  RaviStyle->SetPadBorderSize  (10);
-  RaviStyle->SetPadBorderMode  (0);
-  RaviStyle->SetPadBottomMargin(0.1);//0.05?
-  RaviStyle->SetPadTopMargin   (0.10);
-  RaviStyle->SetPadLeftMargin  (0.12);
-  RaviStyle->SetPadRightMargin (0.05);
-  RaviStyle->SetPadGridX       (0);
-  RaviStyle->SetPadGridY       (0);
-  RaviStyle->SetPadTickX       (1);
-  RaviStyle->SetPadTickY       (1);
-
-  // Frames
-
-  RaviStyle->SetFrameFillStyle ( 0);
-  RaviStyle->SetFrameFillColor ( 0);
-  RaviStyle->SetFrameLineColor ( 1);
-  RaviStyle->SetFrameLineStyle ( 0);
-  RaviStyle->SetFrameLineWidth ( 1);
-  RaviStyle->SetFrameBorderSize(10);
-  RaviStyle->SetFrameBorderMode( 0);
-
-  // Histograms
-
-  // RaviStyle->SetHistFillColor(38);
-  // RaviStyle->SetHistFillStyle(1);
-  RaviStyle->SetHistLineColor(1);
-  RaviStyle->SetHistLineStyle(1);
-  RaviStyle->SetHistLineWidth(1);
-
-  // Functions
-
-  RaviStyle->SetFuncColor(2);
-  RaviStyle->SetFuncStyle(1);
-  RaviStyle->SetFuncWidth(1);
-
-  // Various
-
-  RaviStyle->SetTickLength ( 0.02,"X");
-
-  RaviStyle->SetTitleSize  ( 0.050,"X");
-  RaviStyle->SetTitleOffset( 0.900,"X");
-  RaviStyle->SetLabelOffset( 0.005,"X");
-  RaviStyle->SetLabelSize  ( 0.05,"X");
-  RaviStyle->SetLabelFont  ( 42   ,"X");
-  //RaviStyle->SetTitleFont  ( 42   ,"XY");
-
-
-  RaviStyle->SetTickLength ( 0.02,"Y");
-  RaviStyle->SetTitleSize  ( 0.050,"Y");
-  RaviStyle->SetTitleOffset( 1.25,"Y");
-  RaviStyle->SetLabelOffset( 0.005,"Y");
-  RaviStyle->SetLabelSize  ( 0.05,"Y");
-  RaviStyle->SetLabelFont  ( 42   ,"Y");
-  
-  //  RaviStyle->SetMarkerSize (1);
-  //  RaviStyle->SetMarkerStyle(1);
-
-  // Options
-  //  RaviStyle->SetOptStat(1110);
-  RaviStyle->SetPalette(1);
-  RaviStyle->SetLineWidth(1);
-
-
-  // stats
-  RaviStyle->SetStatBorderSize(0);
-  RaviStyle->SetStatColor(0);
-  RaviStyle->SetStatX(0.93);
-  RaviStyle->SetStatY(0.88);
-  RaviStyle->SetStatH(0.025);
-  RaviStyle->SetStatStyle(0);
-  RaviStyle->SetStatFont(42);
-  RaviStyle->SetStatFontSize(0.04);
-  RaviStyle->SetStatW(0.15);
-  RaviStyle->SetOptStat(1111);
-  
-  RaviStyle->SetOptFit(1111);
-  RaviStyle->SetFitFormat(".3f");
-
-
-  // title
-  RaviStyle->SetOptTitle(1);
-  RaviStyle->SetTitleColor(1);
-  RaviStyle->SetTitleStyle(0);
-  RaviStyle->SetTitleBorderSize(0);
-  RaviStyle->SetTitleFont(42,"Junk");
-  RaviStyle->SetTitleFont(42,"XY");
-  RaviStyle->SetTitleFontSize(0.06);
-  RaviStyle->SetTitleX(0.08);
-  RaviStyle->SetTitleY(0.98 );
-
-
- // gROOT->LoadMacro("~/rootfiles/my_functions.C");
- // printf(">> gStyle initialized with favorite parameters!\n");
-}
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/run_RecEx.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/run_RecEx.py
deleted file mode 100644
index 876314fc56049edc9969abe31f242587c28519d1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/run_RecEx.py
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#This is a python script, not an athena jobOptions file
-# Ravi Shekhar <ravi.shekhar@duke.edu>
-
-# This script runs multiple batch jobOptions files and combines at the end
-
-import os, os.path
-from subprocess import Popen
-
-def parseOptions():
-    from optparse import OptionParser
-
-    usage = "usage: %prog [options] jobOptions.py jobOptions2.py ..."
-    parser = OptionParser(usage=usage)
-    parser.add_option('-n', dest='nSegments', help='number of batch segments', metavar="SEGMENTS")
-    parser.add_option('-t', dest='itertag', help='iteration prefix (ex. iterC03)', metavar="TAG")
-    parser.add_option('-q', dest='queue', help='queue used for job submission', default="atlasb1")
-    parser.add_option('--estag', dest='esotag', help='error scaling override tag', metavar="TAG")
-    (o,a) = parser.parse_args()
-
-    return (o,a)
-
-def submitjobs(prefix, nSegments, estag,queue, args):
-
-    #setup directory structure
-    if (os.path.exists(prefix)):
-        if (os.path.isdir(prefix)):
-            # directory exists, create directories in it
-            for i in range(nSegments):
-                try:
-                    os.mkdir(prefix + ("/%02d" % i))
-                except Exception as e:
-                    print e
-    else:
-        try:
-            os.mkdir(prefix)
-            for i in range(nSegments):
-                os.mkdir(prefix+ ("/%02d" % i))
-        except Exception as e:
-            print e
-    #directories are now setup, lets launch jobs
-
-    #we build a dictionary with 'definitions'. These are then substituted into
-    vals = {}
-    vals['releasetag'] = '20.1.5.8'
-    vals['nSegments'] = nSegments
-    vals['eso'] = estag #error scaling override
-    vals['joboptions'] = ' '.join(args[0:])
-
-    cwd = os.getcwd()
-    pwd = cwd +'/'+ prefix +'/'
-
-    for i in range(nSegments):
-        # launch a shell command
-        #a = Popen("cp -a datasets.py jobOptions.py  ReadInDet_jobOptions.py jobOptionsAlignmentSet.py mycool.db "
-        #          + (" jobOptionsErrorTuning.py %s/%02d" % (prefix, i)), shell=True )
-
-        #a = Popen("cp -a InDetRecAOD.root InDetRecESD.root "
-        #                  + ("%s/%02d" % (prefix, i)), shell=True )  
-
-        #print "ln -s datasets.py " + ("%s/%02d" % (prefix, i)) + "/datasets.py"
-        a = Popen("ln -s " + cwd + "/datasets.py " + ("%s/%02d" % (prefix, i)) + "/datasets.py", shell=True)
-        a = Popen("ln -s " + cwd + "/mycool.db " + ("%s/%02d" % (prefix, i)) + "/mycool.db", shell=True)
-        #a = Popen("ln -s " + cwd + "/jobOptions.py " +  ("%s/%02d" % (prefix, i)) + "/jobOptions.py", shell=True)
-        a = Popen("ln -s " + cwd + "/jobOptionsRAW.py " +  ("%s/%02d" % (prefix, i)) + "/jobOptionsRAW.py", shell=True)
-        a = Popen("ln -s " + cwd + "/jobOptionsESD.py " +  ("%s/%02d" % (prefix, i)) + "/jobOptionsESD.py", shell=True)
-        a = Popen("ln -s " + cwd + "/jobOptionsESD_Run2.py " +  ("%s/%02d" % (prefix, i)) + "/jobOptionsESD_Run2.py", shell=True)
-        a = Popen("ln -s " + cwd + "/InDetMonitoringAlignment.py " +  ("%s/%02d" % (prefix, i)) + "/InDetMonitoringAlignment.py", shell=True)
-        #a = Popen("ln -s " + cwd + "/ReadInDet_jobOptions.py " + ("%s/%02d" % (prefix, i)) + "/ReadInDet_jobOptions.py", shell=True)
-        a = Popen("ln -s " + cwd + "/jobOptionsAlignmentSet.py " + ("%s/%02d" % (prefix, i)) + "/jobOptionsAlignmentSet.py", shell=True)
-        a = Popen("ln -s " + cwd + "/jobOptionsErrorTuning.py " + ("%s/%02d" % (prefix, i)) + "/jobOptionsErrorTuning.py", shell=True)
-        a = Popen("ln -s " + cwd + "/MisalignmentSet2.pool.root " + ("%s/%02d" % (prefix, i)) + "/MisalignmentSet2.pool.root", shell=True)
-        
-        #wait for command to finish, get the return code rc
-        rc = os.waitpid(a.pid, 0)[1]
-
-        fh = open('errscal.skel','r')
-        s = fh.read()
-        fh.close()
-        vals['fullpwd'] = pwd + ("%02d" %  i)
-        vals['iSegment'] = i
-
-
-        jobOptionsVec = (vals['joboptions'].strip()).split()
-        for ij in jobOptionsVec:
-            print ij
-            print len(ij.split('.'))
-            if len(ij.split('.'))==1:
-                jobOptionsVec.remove(ij)
-            else:
-                if ij.split('.')[1] != 'py':
-                    jobOptionsVec.remove(ij)
-
-        jobOptionsSt = ''
-
-        for ij in jobOptionsVec:
-            jobOptionsSt = jobOptionsSt + ij + ' '
-        
-        vals['joboptions'] = jobOptionsSt
-
-        print 'The job options string is',vals['joboptions']
-                
-        s = s % vals # adjusts the template, substituting named variables
-        fh = open(vals['fullpwd']+('/ersc%02d' % i), 'w')
-        fh.write(s) # write the job back out as a job submission script in the appropriate dir
-        fh.close()
-
-        #have to chmod +x
-        a = Popen("chmod +x " + vals['fullpwd']+('/ersc%02d' % i), shell=True )
-        rc = os.waitpid(a.pid, 0)[1]
-
-        # change dir, submit to batch, change back
-        os.chdir(pwd + ("%02d" % i))
-        command = "bsub -o batchLogFile -q %s ersc%02d " % (queue, i)
-        print "Executing, %s" % command
-        a = Popen(command, shell=True)
-        rc = os.waitpid(a.pid, 0)[1]
-        a = Popen("rm -rf done", shell=True)
-        rc = os.waitpid(a.pid, 0)[1]
-        os.chdir(cwd)
-
-    completed = [False, ] * nSegments
-
-    import time
-
-    #yes polling is bad, but the interval is fairly high
-    while ( not all(completed) ):
-        for i in range(nSegments):
-            if (completed[i] == False and os.path.exists(pwd + ("%02d/done" %  i))):
-                completed[i] = True
-            else:
-                time.sleep(2.0) # slow down the afs access, bugs out sometimes
-        time.sleep(30.0) # sleep 60s 
-
-    a = Popen("hadd -T monitoring.root "+pwd+"/*/*.root" , shell=True)
-    rc = os.waitpid(a.pid, 0)[1]
-                
-    
-
-def main():
-    (o, a ) = parseOptions()
-
-    prefix = o.itertag
-    nSegments = int(o.nSegments)
-    estag = o.esotag
-    queue = o.queue
-
-#    print (prefix, nSegments, a)
-
-    submitjobs(prefix, nSegments, estag,queue, a)
-
-
-if (__name__ == '__main__'):
-    main()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/setupES.sh b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/setupES.sh
deleted file mode 100644
index dc14f707f17d0d3a38630c349904a5fd5980d28f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/setupES.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#export ERSCPATH=/afs/cern.ch/user/c/cerio/scratch1/17.1.2.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-export ERSCPATH=/afs/cern.ch/work/c/cerio/private/17.6.0.1/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling
-#export RELAREA=/afs/cern.ch/user/c/cerio/scratch1/17.1.2.1
-export RELAREA=/afs/cern.ch/work/c/cerio/private/17.6.0.1
-#export REL=17.1.2.1
-export REL=17.6.0.1
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/cmt/requirements b/InnerDetector/InDetExample/InDetAlignExample/cmt/requirements
deleted file mode 100755
index d0e3bdc065da96a4af03700d2ec2860f269b6415..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/cmt/requirements
+++ /dev/null
@@ -1,25 +0,0 @@
-package InDetAlignExample
-
-author Grant Gorfine <Grant.Gorfine@cern.ch>
-author Salvador Marti <Salvador.Marti@ific.uv.es> 
-
-use AtlasPolicy AtlasPolicy-*
-use TestPolicy TestPolicy-*
-use AtlasReconstructionRunTime AtlasReconstructionRunTime-* -no_auto_imports
-
-include_path none
-
-apply_pattern declare_scripts        files = "RunIterator_Run2Rel19.py"
-
-# the txt files are not jobOs but if they are not here get_files does not find them
-apply_pattern declare_joboptions     files = "*.py InDetAlignExampleFlags/*.py  Data/*.txt"
-apply_pattern declare_python_modules files = "*.py"
-
-# for RTT files and ATN tests
-macro InDetAlignExample_TestConfiguration "../test/InDetAlignExample_TestConfiguration.xml"
-apply_pattern declare_runtime       extras = "../test/InDetAlignExample_TestConfiguration.xml ../macros/*.cc ../html/*.html"
-
-private
-apply_pattern validate_xml
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/doc/mainpage.h b/InnerDetector/InDetExample/InDetAlignExample/doc/mainpage.h
deleted file mode 100755
index d0d06460c7ed4f922bee4bc931d8dccfb67cad3f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/doc/mainpage.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
-
-@mainpage InDetAlignExample Package
-
-@author Grant Gorfine
-@author Vicente Lacuesta <vicente.lacuesta@ific.uv.es>
-@author Muge Karagoz Unel <muge.karagoz.unel@cern.ch>
-@author Salva Marti <martis@ific.uv.es>
-
-
-@section RunInDetAlignExample How to run InDetAlignExample
-@subsection Rel13040 Release 13.0.40
- - Checkout the package:
- \code cmt co -r InDetAlignExample-00-00-18 InnerDetector/InDetExample/InDetAlignExample
- \endcode
- - Compile the package, in InDetAlignExample/cmt:
-\code 
-cmt config
-source setup.csh or setup.sh
-gmake
-\endcode
- - If you want, copy the jobOptions.py to the directory run and modify it
-
-@section InDetAlignExampleIntro Introduction
-
-The package is the common repository for InDet Alignment jobs. 
-The bulk data processing scripts with proper algorithm flag settings are placed here.   
-
-This package contains joboptions for creating and reading alignment
-constants, testing the alignments and examples of running simulation with
-misalignments.
-
-
-@section InDetAlignExampleJobOptions Job Options
-
- - WriteDBS.py : Job option fragment for generating random alignment
-   constants and putting them in COOL. It is configured to use an
-   sqlite file. The recommended may to write to the public database
-   is to first write an sqlite file and then use the mergeCoolDB 
-   utility. See https://uimon.cern.ch/twiki/bin/view/Atlas/CoolPublishing 
-
- - TestWriteDBS.py : Standalone job options to use WriteDBS.py
-
- - SiWriteDBS_CSC.py: Write CSC alignment set
-
- - SiWriteDBS_Nominal.py: Write a null alignment set
-
- - SiWriteDBS_ResIni.py: Write alignment set with expected residual misalignments.
- 
- - InDetAlignable.py: Job option fragment for common items needed for reading in 
-   alignment form conditions database. This is already called in the geometry 
-   initialization.
- 
- - InDetAlignableOverride.py: Job option fragment to help override alignment folders.
-
- - ReadDBS.py : Deprecated. Please use InDetAlignableOverride.py.  
-   Job option fragment for setting up to read alignment constants from
-   COOL.  It is configure for using the CSC alignment sets but can be
-   easily configured for using an sqlite file by
-   commenting/uncommenting lines. Based on InDetAlignGenAlgs/ReadDBS.py.
-
- - ReadPool.py: Job option fragment for reading alignments directly
-   from POOL file using CondProxyProvider instead of IOVSvc. Based on
-   InDetAlignGenAlgs/ReadPool.py
-
- - TestInDetAlignment_jobOptions.py : Standalone job options for testing
-   alignment shifts. Loops through all detector elements and prints
-   out their shifts from the nominal position. Uses ReadDBS.py. Various
-   use cases can be tested. See the joboptions file for more details.
-   You can edit the DetFlags if you wish to turn off detectors.
-
- - InDetG4Atlas_Sim.py : Standalone job options for running
-   Inner Detector simulation with misalignments.
-
- - InDetG4Atlas_SimGeomTest.py : Standalone job options for
-   running Inner Detector simulation geometry test with
-   misaligments. This is the standard Geant4 geometry test for
-   detecting overlaps. Takes a long time to run (about two hours).
-
-
-@section InDetAlignExampleUsageNotes Usage Notes
-
-The job options for writing alignment constants are configured for using an sqlite file.
-
-To create this file run
-
-@verbatim
-athena InDetAlignExample/TestWriteDBS.py
-@endverbatim
-
-This should create the files \p alignobjs.root (the POOL file containing
-the alignment constants) \p mycool.db (the sqlite file) and
-\p PoolFileCatalog.xml.
-
-The job options for reading the alignments are configured to use the production COOL database.
-They can be easily configured for using an sqlite file by commenting/uncommenting lines. 
-See ReadDBS.py and WriteDBS.py.
-
-The standalone job options should run out of the box.
-
-@section InDetAlignExampleReq Requirements
-
-@include requirements
-
-*/
diff --git a/InnerDetector/InDetExample/InDetAlignExample/html/InDetAlignExample_InDetSiLevel1Alignment.html b/InnerDetector/InDetExample/InDetAlignExample/html/InDetAlignExample_InDetSiLevel1Alignment.html
deleted file mode 100644
index 25be9b2e117dd96b12361ef020794bfc1cba5130..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/html/InDetAlignExample_InDetSiLevel1Alignment.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<html><head>
-<Title>InDetAlignExample</Title></head>
-<body>
-<p align="center">
-  <font size=30 color=395e83>InDetAlignExample RTT</font>
-</p>
-
-<p align="center">
-  <font size=30 color=395e83>Level 1 Silicon Alignment on 5000 multi muon events</font>
-</p>
-
-<ul>
-<li>Alignment Constants:</li>
-  <ul>
-    <li>Constants after 0th iteration: <a href="Iter0/Iter0_AlignmentConstants.txt">click me</a></li>
-    <li>Constants after 1th iteration: <a href="Iter1/Iter1_AlignmentConstants.txt">click me</a></li>
-  </ul>
-<li>Plots</li>
-  <ul>
-    <li>Residuals after 0th iteration: <a href="Iter0_plots.png"><img src="Iter0_plots.png" width=1000></a></li>
-    <li>Residuals after 1th iteration: <a href="Iter1_plots.png"><img src="Iter1_plots.png" width=1000></a></li>
-  </ul>
-</ul>
-
-</body>
-</html>
diff --git a/InnerDetector/InDetExample/InDetAlignExample/html/InDetAlignExample_NewInDetSiLevel1Alignment.html b/InnerDetector/InDetExample/InDetAlignExample/html/InDetAlignExample_NewInDetSiLevel1Alignment.html
deleted file mode 100644
index 24cc5337975370ec2bf7fe89da5c8fa1849b6040..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/html/InDetAlignExample_NewInDetSiLevel1Alignment.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<html><head>
-<Title>InDetAlignExample</Title></head>
-<body>
-<p align="center">
-  <font size=30 color=395e83>InDetAlignExample New RTT</font>
-</p>
-
-<p align="center">
-  <font size=30 color=395e83>Level 1 Silicon Alignment on 5000 multi muon events</font>
-</p>
-
-<ul>
-<li>Alignment Constants:</li>
-  <ul>
-    <li>Constants after 0th iteration: <a href="Iter0/alignlogfile.txt">click me</a></li>
-    <li>Constants after 1th iteration: <a href="Iter1/alignlogfile.txt">click me</a></li>
-  </ul>
-<li>Plots</li>
-  <ul>
-    <li>Residuals after 0th iteration: <a href="Iter0_plots.png"><img src="Iter0_plots.png" width=1000></a></li>
-    <li>Residuals after 1th iteration: <a href="Iter1_plots.png"><img src="Iter1_plots.png" width=1000></a></li>
-  </ul>
-</ul>
-
-</body>
-</html>
diff --git a/InnerDetector/InDetExample/InDetAlignExample/macros/Constants_L1.cc b/InnerDetector/InDetExample/InDetAlignExample/macros/Constants_L1.cc
deleted file mode 100644
index a2cc2dd3fc3dedbf21e2db87f9926b18bc0ef67f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/macros/Constants_L1.cc
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// ********************************************************//
-//    RTT Constants at Level1 for rel_X ; X= [0,6]         //
-//*********************************************************//
-#include <iostream>
-#include <fstream>
-#include <cmath>
-#include <string>
-#include <TH1F.h>
-#include <TCanvas.h>
-#include <TLegend.h>
-void Constants_L1(){
- 
-  ifstream relX;
-  const int struc = 4;
-  const int rel=7;
-  //Constants values
-  double X,pTx,pTy,pTz,pRx,pRy,pRz;
-  
-  //Definim els vectors
-  float Tx[struc][rel],Ty[struc][rel],Tz[struc][rel],Rx[struc][rel],Ry[struc][rel],Rz[struc][rel];
-  
-  for (int j=0; j<struc;j++){
-    for (int i=0; i<rel;i++){
-      Tx[j][i]=0;
-      Ty[j][i]=0;
-      Tz[j][i]=0;
-      Rx[j][i]=0;
-      Ry[j][i]=0;
-      Rz[j][i]=0;
-    } 
-  }
-  
-  for (int i=0; i<rel;i++){
-    if(i==0) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_0/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==1) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_1/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==2) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_2/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==3) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_3/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==4) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_4/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==5) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_5/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==6) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_6/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
- 	
-
-   if(relX.is_open()) {
-      cout <<"****  OutputsiAlignment.txt file opened in rel"<< i << endl;   
-      char line[200];
-      // First line
-      relX>>line;
-	  for (int j=0; j<4; j++){
-		relX >> X >> X >> X >> X >> X >> X >> X >> pTx >> pTy >> pTz >> pRx >> pRy >> pRz;          
-		Tx[j][i]=pTx;
-		Ty[j][i]=pTy;
-		Tz[j][i]=pTz;
-		Rx[j][i]=pRx;
-		Ry[j][i]=pRy; 
-		Rz[j][i]=pRz;
-		cout << " Tx: "<< Tx[j][i] << " Ty: "<< Ty[j][i] << " Tz: "<< Tz[j][i] << " Rx: "<< Rx[j][i] <<" Ry: "<< Ry[j][i] <<" Rz: "<< Rz[j][i] <<endl;
-     }
-    relX.close();
-    } 
-    else cout<<" **** OutputsiAlignment.txt file doesn't exist in rel"<< i << endl;
-  }      
-   
-
-
-  //HISTOGRAM:
-  const char *Nightlies[7]={"rel0","rel1","rel2","rel3","rel4","rel5","rel6"};
-  const char *Structures[4]={"PIX","SCTECC","SCTBA","SCTECA"};
-
-  //Definim els histogrames:
-  TH1F *hTx[struc];
-  TH1F *hTy[struc];
-  TH1F *hTz[struc];
-  TH1F *hRx[struc];
-  TH1F *hRy[struc];
-  TH1F *hRz[struc];
-    
-  char name_Tx[200],name_Ty[200],name_Tz[200],name_Rx[200],name_Ry[200],name_Rz[200] ; 
-
-  for (int i=0;i<struc;i++){  
-    sprintf(name_Tx,"hTx_struc%d",i);
-    sprintf(name_Ty,"hTy_struc%d",i);
-    sprintf(name_Tz,"hTz_struc%d",i);
-    sprintf(name_Rx,"hRx_struc%d",i);
-    sprintf(name_Ry,"hRy_struc%d",i);
-    sprintf(name_Rz,"hRz_struc%d",i);
-    
-    hTx[i]=new TH1F(name_Tx,name_Tx,7,0,7);
-    hTy[i]=new TH1F(name_Ty,name_Ty,7,0,7);
-    hTz[i]=new TH1F(name_Tz,name_Tz,7,0,7);
-    hRx[i]=new TH1F(name_Rx,name_Ry,7,0,7);      
-    hRy[i]=new TH1F(name_Ry,name_Rx,7,0,7);
-    hRz[i]=new TH1F(name_Rz,name_Rz,7,0,7);  
-    
-    for (int j=0;j<rel;j++){        
-      hTx[i]->SetBinContent(j+1,Tx[i][j]);
-      hTx[i]->GetYaxis()->SetTitleOffset(1.3);
-      hTx[i]->GetYaxis()->SetLabelSize(0.03);
-      hTx[i]->GetYaxis()->SetTitle(" Alignment corrections (mm)");
-      hTx[i]->GetXaxis()->SetTitle("Nightlies");
-      hTx[i]->GetXaxis()->SetBinLabel(j+1,Nightlies[j]);
-      hTx[i]->SetTitle("Alignment Constants Tx");
-     
-      hTy[i]->GetYaxis()->SetLabelSize(0.03);
-      hTy[i]->GetYaxis()->SetTitleOffset(1.3);
-      hTy[i]->SetBinContent (j+1,Ty[i][j]);
-      hTy[i]->GetYaxis()->SetTitle(" Alignment corrections (mm)");
-      hTy[i]->GetXaxis()->SetTitle("Nightlies");
-      hTy[i] ->GetXaxis()->SetBinLabel(j+1,Nightlies[j]);
-      hTy[i]->SetTitle("Alignment Constants Ty");
-      
-      hTz[i]->GetYaxis()->SetLabelSize(0.03);
-      hTz[i]->GetYaxis()->SetTitleOffset(1.3);
-      hTz[i]->SetBinContent (j+1,Tz[i][j]);
-      hTz[i]->GetYaxis()->SetTitle(" Alignment corrections (mm)");
-      hTz[i]->GetXaxis()->SetTitle("Nightlies");
-      hTz[i] ->GetXaxis()->SetBinLabel(j+1,Nightlies[j]);
-      hTz[i]->SetTitle("Alignment Constants Tz");
-      
-      hRx[i]->GetYaxis()->SetLabelSize(0.03);
-      hRx[i]->GetYaxis()->SetTitleOffset(1.3);
-      hRx[i]->SetBinContent (j+1,Rx[i][j]);
-      hRx[i] ->GetXaxis()->SetBinLabel(j+1,Nightlies[j]);
-      hRx[i]->SetTitle("Alignment Constants Rx");
-      hRx[i]->GetXaxis()->SetTitle("Nightlies");
-      hRx[i]->GetYaxis()->SetTitle(" Alignment corrections (mrad)");
-      
-      hRy[i]->GetYaxis()->SetLabelSize(0.03); 
-      hRy[i]->GetYaxis()->SetTitleOffset(1.3);  
-      hRy[i]->SetBinContent (j+1,Ry[i][j]);
-      hRy[i] ->GetXaxis()->SetBinLabel(j+1,Nightlies[j]);
-      hRy[i]->SetTitle("Alignment Constants Ry");
-      hRy[i]->GetXaxis()->SetTitle("Nightlies");
-      hRy[i]->GetYaxis()->SetTitle(" Alignment corrections (mrad)");
-      
-      hRz[i]->GetYaxis()->SetLabelSize(0.03);
-      hRz[i]->GetYaxis()->SetTitleOffset(1.3);
-      hRz[i]->SetBinContent (j+1,Rz[i][j]);
-      hRz[i] ->GetXaxis()->SetBinLabel(j+1,Nightlies[j]);
-      hRz[i]->GetXaxis()->SetTitle("Nightlies");
-      hRz[i]->SetTitle("Alignment Constants Rz");
-      hRz[i]->GetYaxis()->SetTitle(" Alignment corrections (mrad)");
-    }
-
-    hTx[i]->GetYaxis()->SetRangeUser(-0.02,0.02);
-    hTy[i]->GetYaxis()->SetRangeUser(-0.02,0.02);
-    hTz[i]->GetYaxis()->SetRangeUser(-0.02,0.02);
-    hRx[i]->GetYaxis()->SetRangeUser(-0.02,0.02);
-    hRy[i]->GetYaxis()->SetRangeUser(-0.02,0.02);
-    hRz[i]->GetYaxis()->SetRangeUser(-0.02,0.02);
-  }  
-
-
-  //Draw 
-  TCanvas *Constants_L1=new TCanvas("Constants_L1","Constants_L1",1200,800);
-  Constants_L1->SetFillColor(0);  
-  Constants_L1->Divide(3,2);
-   
-  const int Colors[4]={2,3,4,6};
-  const char Marker[4]={kStar,kFullCircle,kOpenSquare,kOpenCross};
-  
-  char colorTest = kStar;
-  TLegend *legend = new TLegend(0.70, 0.75, 0.88, 0.89);
-  legend->SetFillColor(10);
-    
-  for(int AlignmentConstant=1; AlignmentConstant<7; AlignmentConstant++){
-    Constants_L1->cd(AlignmentConstant); // Tx  
-    gPad->SetGridx();
-    gPad->SetGridy();
-    gStyle->SetOptStat(0);
-   
-    for (int j=0; j<struc;j++){
-      if(AlignmentConstant==1)legend->AddEntry(hTx[j], Structures[j] , "P"); 
-      gStyle->SetMarkerSize(0.8);
-      hTx[j]->SetMarkerStyle(Marker[j]); hTy[j]->SetMarkerStyle(Marker[j]); hTz[j]->SetMarkerStyle(Marker[j]);
-      hRx[j]->SetMarkerStyle(Marker[j]); hRy[j]->SetMarkerStyle(Marker[j]); hRz[j]->SetMarkerStyle(Marker[j]);
-      hTx[j]->SetMarkerColor(Colors[j]);hTy[j]->SetMarkerColor(Colors[j]);hTz[j]->SetMarkerColor(Colors[j]);
-      hRx[j]->SetMarkerColor(Colors[j]);hRy[j]->SetMarkerColor(Colors[j]);hRz[j]->SetMarkerColor(Colors[j]);
-          
-      if(AlignmentConstant==1 && j==0) hTx[j]->Draw("P"); legend->Draw();
-      if(AlignmentConstant==1 && j!=0) hTx[j]->DrawCopy("same,P");
-      if(AlignmentConstant==2 && j==0) hTy[j]->Draw("P");legend->Draw();
-      if(AlignmentConstant==2 && j!=0) hTy[j]->DrawCopy("same,P");
-      if(AlignmentConstant==3 && j==0) hTz[j]->Draw("P");legend->Draw();
-      if(AlignmentConstant==3 && j!=0) hTz[j]->DrawCopy("same,P");
-      if(AlignmentConstant==4 && j==0) hRx[j]->Draw("P");legend->Draw();
-      if(AlignmentConstant==4 && j!=0) hRx[j]->DrawCopy("same,P");
-      if(AlignmentConstant==5 && j==0) hRy[j]->Draw("P");legend->Draw();
-      if(AlignmentConstant==5 && j!=0) hRy[j]->DrawCopy("same,P");
-      if(AlignmentConstant==6 && j==0) hRz[j]->Draw("P");legend->Draw();
-      if(AlignmentConstant==6 && j!=0) hRz[j]->DrawCopy("same,P");
-    }
-  }
-  
-
-  Constants_L1->Update();
-  Constants_L1->Print("Constants_RelX.eps", "eps");
-  Constants_L1->Print("Constants_RelX.png", "png");
-  
-}
diff --git a/InnerDetector/InDetExample/InDetAlignExample/macros/Constants_L1_OldVersion.cc b/InnerDetector/InDetExample/InDetAlignExample/macros/Constants_L1_OldVersion.cc
deleted file mode 100644
index 893c49d9eef49eaa541ff29495b81737c6043949..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/macros/Constants_L1_OldVersion.cc
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// ********************************************************//
-//    RTT Constants at Level1 for rel_X ; X= [0,6]         //
-//*********************************************************//
-#include <iostream>
-#include <fstream>
-#include <cmath>
-#include <string>
-#include <TH1F.h>
-#include <TCanvas.h>
-#include <TLegend.h>
-void Constants_L1(){
-  ifstream relX;
-  const int Struc = 4;
-  const int rel=7;
-  //Constants values
-  double X,pTx,pTy,pTz,pRx,pRy,pRz;
-  
-  //Definim els vectors
-  float Tx[rel][Struc],Ty[rel][Struc],Tz[rel][Struc],Rx[rel][Struc],Ry[rel][Struc],Rz[rel][Struc];
-  
-  for (int j=0; j<rel;j++){
-    for (int i=0; i<Struc;i++){
-      Tx[j][i]=0;
-      Ty[j][i]=0;
-      Tz[j][i]=0;
-      Rx[j][i]=0;
-      Ry[j][i]=0;
-      Rz[j][i]=0;
-    } 
-  }
-  
-  for (int i=0; i<rel;i++){
-    if(i==0) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_0/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==1) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_1/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==2) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_2/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==3) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_3/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==4) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_4/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==5) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_5/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
-    if(i==6) relX.open("/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_6/devval/build/x86_64-slc5-gcc43-opt/offline/InDetAlignExample/NewInDetSiLevel1Alignment/Iter0/OutputSiAlignment.txt");
- 	
-
-   if(relX.is_open()) {
-      cout <<"****  OutputsiAlignment.txt file opened in rel"<< i << endl;   
-      char line[200];
-      // First line
-      relX>>line;
-	  for (int j=0; j<4; j++){
-		relX >> X >> X >> X >> X >> X >> X >> X >> pTx >> pTy >> pTz >> pRx >> pRy >> pRz;          
-		Tx[i][j]=pTx;
-		Ty[i][j]=pTy;
-		Tz[i][j]=pTz;
-		Rx[i][j]=pRx;
-		Ry[i][j]=pRy; 
-		Rz[i][j]=pRz;
-		cout << " Tx: "<< Tx[i][j] << " Ty: "<< Ty[i][j] << " Tz: "<< Tz[i][j] << " Rx: "<< Rx[i][j] <<" Ry: "<< Ry[i][j] <<" Rz: "<< Rz[i][j] <<endl;
-     }
-    relX.close();
-    } 
-    else cout<<" **** OutputsiAlignment.txt file doesn't exist in rel"<< i << endl;
-  }      
-   
-  //HISTOGRAM:
-  const char *Structures[4]={"PIX","SCTECC","SCTBA","SCTECA"};
-  
-  //Definim els histogrames:
-  TH1F *hTx[rel];
- 
-  TH1F *hTy[rel];
-  TH1F *hTz[rel];
-  TH1F *hRx[rel];
-  TH1F *hRy[rel];
-  TH1F *hRz[rel];
-    
-  char name_Tx[200],name_Ty[200],name_Tz[200],name_Rx[200],name_Ry[200],name_Rz[200] ; 
-
-  for (int i=0;i<rel;i++){  
-    sprintf(name_Tx,"hTx_rel%d",i);
-    sprintf(name_Ty,"hTy_rel%d",i);
-    sprintf(name_Tz,"hTz_rel%d",i);
-    sprintf(name_Rx,"hRx_rel%d",i);
-    sprintf(name_Ry,"hRy_rel%d",i);
-    sprintf(name_Rz,"hRz_rel%d",i);
-    
-    hTx[i]=new TH1F(name_Tx,name_Tx,4,0,4);
-    hTy[i]=new TH1F(name_Ty,name_Ty,4,0,4);
-    hTz[i]=new TH1F(name_Tz,name_Tz,4,0,4);
-    hRx[i]=new TH1F(name_Rx,name_Ry,4,0,4);      
-    hRy[i]=new TH1F(name_Ry,name_Rx,4,0,4);
-    hRz[i]=new TH1F(name_Rz,name_Rz,4,0,4);  
-    
-    float Tx_MAX=0,Ty_MAX=0,Tz_MAX=0,Rx_MAX=0,Ry_MAX=0,Rz_MAX=0;
-
-    for (int j=0;j<Struc;j++){       
-      hTx[i]->SetBinContent(j+1,Tx[i][j]);
-      hTx[i]->GetXaxis()->SetBinLabel(j+1,Structures[j]);
-      hTx[i]->SetTitle("Alignment Constants Tx");
-      if(fabs(Tx[i][j])>Tx_MAX) Tx_MAX=fabs(Tx[i][j]);
-      hTy[i]->SetBinContent (j+1,Ty[i][j]);
-      hTy[i] ->GetXaxis()->SetBinLabel(j+1,Structures[j]);
-      hTy[i]->SetTitle("Alignment Constants Ty");
-      if(fabs(Ty[i][j])>Ty_MAX) Ty_MAX=fabs(Ty[i][j]);
-      hTz[i]->SetBinContent (j+1,Tz[i][j]);
-      hTz[i] ->GetXaxis()->SetBinLabel(j+1,Structures[j]);
-      hTz[i]->SetTitle("Alignment Constants Tz");
-      if(fabs(Tz[i][j])>Tz_MAX) Tz_MAX=fabs(Tz[i][j]);
-      hRx[i]->SetBinContent (j+1,Rx[i][j]);
-      hRx[i] ->GetXaxis()->SetBinLabel(j+1,Structures[j]);
-      hRx[i]->SetTitle("Alignment Constants Rx");
-      if(fabs(Rx[i][j])>Rx_MAX) Rx_MAX=fabs(Rx[i][j]);
-      hRy[i]->SetBinContent (j+1,Ry[i][j]);
-      hRy[i] ->GetXaxis()->SetBinLabel(j+1,Structures[j]);
-      hRy[i]->SetTitle("Alignment Constants Ry");
-      if(fabs(Ry[i][j])>Ry_MAX) Ry_MAX=fabs(Ry[i][j]);
-      hRz[i]->SetBinContent (j+1,Rz[i][j]);
-      hRz[i] ->GetXaxis()->SetBinLabel(j+1,Structures[j]);
-      hRz[i]->SetTitle("Alignment Constants Rz");
-      if(fabs(Rz[i][j])>Rz_MAX) Rz_MAX=fabs(Rz[i][j]);
-    }
-    hTx[i]->GetYaxis()->SetRangeUser(-(Tx_MAX+0.1),Tx_MAX+0.1);
-    hTy[i]->GetYaxis()->SetRangeUser(-(Ty_MAX+0.1),Ty_MAX+0.1);
-    hTz[i]->GetYaxis()->SetRangeUser(-(Tz_MAX+0.1),Tz_MAX+0.1);
-    hRx[i]->GetYaxis()->SetRangeUser(-(Rx_MAX+0.1),Rx_MAX+0.1);
-    hRy[i]->GetYaxis()->SetRangeUser(-(Ry_MAX+0.1),Ry_MAX+0.1);
-    hRz[i]->GetYaxis()->SetRangeUser(-(Rz_MAX+0.1),Rz_MAX+0.1);
-  }  
-  
-  //Draw 
-  TCanvas *Constants_L1=new TCanvas("Constants_L1","Constants_L1",600,400);
-  Constants_L1->SetFillColor(0);  
-  Constants_L1->Divide(3,2);
-
-  Constants_L1->cd(1); // Tx  
-
-  TLegend *legTx = new TLegend(0.84, 0.72, 0.99, 0.99);
-  legTx->SetMargin(0.45);
-  legTx->SetFillColor(10);
-  
-  gPad->SetFrameBorderMode(0);
-  gPad->SetFillColor(kGreen-3);
-  gPad->SetFillStyle(3002);   
-  gPad->SetGridx();
-  gPad->SetGridy(); 
-  gPad->SetFrameFillColor(10);  
-  
-  
-  
-    
-  char legend[200];  
-  for (int i=0; i<rel;i++){
-    hTx[i]->SetStats(kFALSE);
-    hTx[i]->SetLineColor(i+1);
-    hTx[i]->SetLineWidth(2);
-    hTx[i]->SetMarkerColor(i+1);
-    hTx[i]->SetMarkerStyle(7);   
-    hTx[i]->SetMarkerSize(3);
-   
-    sprintf(legend,"rel%d",i);
-      if(i==0){
-	hTx[i]->Draw("LP");
-	legTx->AddEntry(hTx[i], legend , "L");
-      }
-      else{ 
-	hTx[i]->DrawCopy("same,LP");
-	legTx->AddEntry(hTx[i], legend, "L");  
-      }
-      legTx->Draw("same");
-  }
-
-  Constants_L1->cd(2);
-  gPad->SetFrameBorderMode(0);
-  gPad->SetFillColor(kGreen-3);
-  gPad->SetFillStyle(3002);   
-  gPad->SetGridx();
-  gPad->SetGridy(); 
-  gPad->SetFrameFillColor(10);  
-  
-  TLegend *legTy = new TLegend(0.84, 0.72, 0.99, 0.99);   
-  legTy->SetMargin(0.45);
-  legTy->SetFillColor(10);
-  
-  for (int i=0; i<rel;i++){
-    hTy[i]->SetStats(kFALSE);
-    hTy[i]->SetLineColor(i+1);
-    hTy[i]->SetLineWidth(2);
-    hTy[i]->SetMarkerColor(i+1);
-    hTy[i]->SetMarkerSize(3);
-    hTy[i]->SetMarkerStyle(7);
-    sprintf(legend,"rel%d",i);
-    if(i==0){
-      hTy[i]->Draw("LP");
-      legTy->AddEntry(hTy[i], legend, "L");
-    }
-    else{ 
-      hTy[i]->DrawCopy("same,LP");
-      legTy->AddEntry(hTy[i], legend, "L");
-    }    
-    legTy->Draw("same");
-  }
-
-  Constants_L1->cd(3);
-  gPad->SetFrameBorderMode(0);
-  gPad->SetFillColor(kGreen-3);
-  gPad->SetFillStyle(3002);   
-  gPad->SetGridx();
-  gPad->SetGridy(); 
-  gPad->SetFrameFillColor(10);  
-
-   TLegend *legTz = new TLegend(0.84, 0.72, 0.99, 0.99);   
-  legTz->SetMargin(0.45);
-  legTz->SetFillColor(10);
- 
-  for (int i=0; i<rel;i++){
-    hTz[i]->SetStats(kFALSE);
-    hTz[i]->SetLineColor(i+1);
-    hTz[i]->SetLineWidth(2);
-    hTz[i]->SetMarkerColor(i+1);
-    hTz[i]->SetMarkerSize(3);
-    hTz[i]->SetMarkerStyle(7);
-    sprintf(legend,"rel%d",i); 
-    if(i==0){
-      hTz[i]->Draw("LP");
-      legTz->AddEntry(hTz[i], legend, "L");
-      
-    }
-    else{ 
-      hTz[i]->DrawCopy("same,LP");
-      legTz->AddEntry(hTz[i],legend, "L"); 
-    } 
-    legTz->Draw("same");
-  }
-
-  Constants_L1->cd(4);
-  gPad->SetFrameBorderMode(0);
-  gPad->SetFillColor(kGreen-3);
-  gPad->SetFillStyle(3002);   
-  gPad->SetGridx();
-  gPad->SetGridy(); 
-  gPad->SetFrameFillColor(10);  
-  
-  TLegend *legRx = new TLegend(0.84, 0.72, 0.99, 0.99);   
-  legRx->SetMargin(0.45);  
-  legRx->SetFillColor(10);
-
-  for (int i=0; i<rel;i++){
-    hRx[i]->SetStats(kFALSE);
-    hRx[i]->SetLineColor(i+1);
-    hRx[i]->SetLineWidth(2);
-    hRx[i]->SetMarkerColor(i+1);
-    hRx[i]->SetMarkerSize(3);
-    hRx[i]->SetMarkerStyle(7);
-    sprintf(legend,"rel%d",i);
-    if(i==0){
-      hRx[i]->Draw("LP");
-      legRx->AddEntry(hRx[i], legend, "L");
-    }
-    else{ 
-      hRx[i]->DrawCopy("same,LP");
-      legRx->AddEntry(hRx[i], legend, "L");
-    }
-    legRx->Draw("same");
-  }
-
-  
-  Constants_L1->cd(5);
-  gPad->SetFrameBorderMode(0);
-  gPad->SetFillColor(kGreen-3);
-  gPad->SetFillStyle(3002);   
-  gPad->SetGridx();
-  gPad->SetGridy(); 
-  gPad->SetFrameFillColor(10);  
-  
-  TLegend *legRy = new TLegend(0.84, 0.72, 0.99, 0.99);   
-  legRy->SetMargin(0.45);
-  legRy->SetFillColor(10);
-   
-  for (int i=0; i<rel;i++){
-    hRy[i]->SetStats(kFALSE);
-    hRy[i]->SetLineColor(i+1);
-    hRy[i]->SetLineWidth(2);
-    hRy[i]->SetMarkerColor(i+1);
-    hRy[i]->SetMarkerSize(3);
-    hRy[i]->SetMarkerStyle(7);
-    sprintf(legend,"rel%d",i);
-    if(i==0){
-      hRy[i]->Draw("LP");
-      legRy->AddEntry(hRy[i], legend, "L");
-    }
-    else{ 
-      hRy[i]->DrawCopy("same,LP");
-      legRy->AddEntry(hRy[i], legend, "L");
-    }
-    legRy->Draw("same");
-  }
-
-  Constants_L1->cd(6);
-  gPad->SetFrameBorderMode(0);
-  gPad->SetFillColor(kGreen-3);
-  gPad->SetFillStyle(3002);   
-  gPad->SetGridx();
-  gPad->SetGridy(); 
-  gPad->SetFrameFillColor(10);  
-  
-  TLegend *legRz = new TLegend(0.84, 0.72, 0.99, 0.99);   
-  legRz->SetMargin(0.45);
-  legRz->SetFillColor(10);
-
-   
-  for (int i=0; i<rel;i++){
-    hRz[i]->SetStats(kFALSE);
-    hRz[i]->SetLineColor(i+1);
-    hRz[i]->SetLineWidth(2);
-    hRz[i]->SetMarkerColor(i+1);
-    hRz[i]->SetMarkerSize(3);
-    hRz[i]->SetMarkerStyle(7);
-    sprintf(legend,"rel%d",i);
-    if(i==0){
-      hRz[i]->Draw("LP");
-      legRz->AddEntry(hRz[i], legend, "L");
-    }
-    else{ 
-      hRz[i]->DrawCopy("same,LP");
-      legRz->AddEntry(hRz[i], legend, "L");
-    }
-    legRz->Draw("same");
-  }
-
-  Constants_L1->Update();
-  Constants_L1->Print("Constants_RelX.eps", "eps");
-  Constants_L1->Print("Constants_RelX.png", "png");
-  
-}
-
-//   hRz->SetMarkerColor(2);
-//   hRz->SetMarkerSize(1);
-//   hRz->SetMarkerStyle(24);
-//   gPad->SetGridx();
-//   gPad->SetGridy();
-//   hrefRz->Draw("P");
-//   hRz->Draw ("same,P");
-//   hRz2->Draw ("same,P");
-
-//   TLegend *leg = new TLegend(0.6, 0.8, 0.9, 0.95);
-//   leg->AddEntry(hrefRz, "CSC Reference", "P");
-//   leg->AddEntry(hRz, "Level18 IT0", "P");
-//   leg->AddEntry(hRz2, "Level18 IT1", "P");
-//   leg->Draw("same");
-//   gPad->SetGridx();
-//   gPad->SetGridy();
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/macros/NewSiL1AlignRTT.cc b/InnerDetector/InDetExample/InDetAlignExample/macros/NewSiL1AlignRTT.cc
deleted file mode 100644
index 20d3cfdb7338fbfa0953da7d73b309d0d9f87760..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/macros/NewSiL1AlignRTT.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// do not rename the next method, RTT will stop working
-void NewSiL1AlignRTT()
-{
-  gROOT->SetBatch(kTRUE);
-  makePlot("Iter0/Collision/TotalMonitoring.root", "Iter0_plots");
-  makePlot("Iter1/Collision/TotalMonitoring.root", "Iter1_plots");
-}
-
-void makePlot(Char_t filename[300], TString psname){
-
-  //Track Collections to check
-  TString FirstTrackCollection="ExtendedTracks_all"; // all tracks
-  TString SecondTrackCollection="AlignTracks_all"; //tracks used to align 
-  TString histname;
-  Char_t nameh[300];
-
-  file = new TFile(filename);
-  TDirectory *IDAlignMonDir = file->GetDirectory("IDAlignMon");
-  tmpName = "IDAlignMon/"+FirstTrackCollection;
-  TDirectory *FirstTrkSelDir = file->GetDirectory(tmpName);
-  tmpName = "IDAlignMon/"+SecondTrackCollection;
-  TDirectory *SecondTrkSelDir = file->GetDirectory(tmpName);
-  
-
-  TH1F *hPixel_TrkPhiRes;
-  TH1F *hPixel_TrkEtaRes;
-  TH1F *hPixel_TrkPhiRes_2;
-  TH1F *hPixel_TrkEtaRes_2;
-  TH1F *hSCT_TrkRes;
-  TH1F *hSCT_TrkRes_2;
-  TH1F *h_events;
-  TH1F *h_Aligntracks;
-  TH1F *h_Tracks;
-
-
-  TCanvas *cRes;
-  cRes = new TCanvas("Silicon Residuals"," Silicon Residuals (New Code)",1000,800);
-  cRes->Divide(2,2);
-   
-  // SUMMARY
-  Int_t font=42;
-
-  cRes->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();
- 
-  int iConsts = 0;
-  
-  TLatex *t = new TLatex();
-  t->SetNDC();
-  t->SetTextFont(font);
-  t->SetTextSize(0.05);
-  t->SetTextAlign(12);
-
-  // Information
-  t->SetTextSize(0.035);
-  histname = "IDAlignMon/"+FirstTrackCollection+"/GenericTracks/Nhits_per_event";
-  h_events = (TH1F*)file->Get(histname);
-  float iEvents = h_events->GetEntries();	
-  sprintf(nameh,"Events: %d",iEvents);
-  t->DrawLatex(0.08,0.78,nameh);
-  histname = "IDAlignMon/"+FirstTrackCollection+"/GenericTracks/Nhits_per_track";
-  h_tracks = (TH1F*)file->Get(histname);
-  float TotalTracks = h_tracks->GetEntries();
-  sprintf(nameh,"ResolvedTrks_all: %d",TotalTracks);
-  t->DrawLatex(0.08,0.74,nameh);
-  histname = "IDAlignMon/"+SecondTrackCollection+"/GenericTracks/Nhits_per_track";
-  h_Aligntracks = (TH1F*)file->Get(histname);
-  float AlignTracks = h_Aligntracks->GetEntries();
-  sprintf(nameh,"AlignTrks_all: %d",AlignTracks);
-  t->DrawLatex(0.08,0.70,nameh);
-
-  
-  cRes->cd(2);
-
-  histname = "IDAlignMon/"+FirstTrackCollection+"/Residuals/sct_b_biasedresidualx";
-  hSCT_TrkRes = (TH1F*)file->Get(histname);	
-  hSCT_TrkRes->SetTitle("Biased SCT  Residuals (Barrel)");
-  hSCT_TrkRes->GetXaxis()->SetTitle("SCT Barrel Residuals (mm)");
-  hSCT_TrkRes->GetYaxis()->SetTitle("Entries");
-  hSCT_TrkRes->SetLineColor(kGray+2);
-  hSCT_TrkRes->SetFillColor(kGray);
-  hSCT_TrkRes->SetLineWidth(1);
-  hSCT_TrkRes->SetFillStyle(3001);
-  hSCT_TrkRes->Draw("histname");
-  
-  histname = "IDAlignMon/"+SecondTrackCollection+"/Residuals/sct_b_biasedresidualx";
-  hSCT_TrkRes_2 = (TH1F*)file->Get(histname);	
-  hSCT_TrkRes_2->SetLineColor(kRed+2);
-  hSCT_TrkRes_2->SetFillColor(kRed);
-  hSCT_TrkRes_2->SetLineWidth(1);
-  hSCT_TrkRes_2->SetFillStyle(3001);
-  hSCT_TrkRes_2->DrawCopy("same");
-
-  cRes->cd(3);
-  histname = "IDAlignMon/"+FirstTrackCollection+"/Residuals/pix_b_biasedresidualx";
-  hPixel_TrkPhiRes = (TH1F*)file->Get(histname);	
-  hPixel_TrkPhiRes->SetTitle("Biased Pixel #phi Residuals (Barrel)");
-  hPixel_TrkPhiRes->GetXaxis()->SetTitle("Pixel Barrel #phi Residuals (mm)");
-  hPixel_TrkPhiRes->GetYaxis()->SetTitle("Entries");
-  hPixel_TrkPhiRes->SetLineColor(kGray+2);
-  hPixel_TrkPhiRes->SetFillColor(kGray);
-  hPixel_TrkPhiRes->SetLineWidth(1);
-  hPixel_TrkPhiRes->SetFillStyle(3001);
-  hPixel_TrkPhiRes->Draw("histname");
-  
-  histname = "IDAlignMon/"+SecondTrackCollection+"/Residuals/pix_b_biasedresidualx";
-  hPixel_TrkPhiRes_2 = (TH1F*)file->Get(histname);	
-  hPixel_TrkPhiRes_2->SetLineColor(kRed+2);
-  hPixel_TrkPhiRes_2->SetFillColor(kRed);
-  hPixel_TrkPhiRes_2->SetLineWidth(1);
-  hPixel_TrkPhiRes_2->SetFillStyle(3001);
-  hPixel_TrkPhiRes_2->DrawCopy("same");
-
-
-  cRes->cd(4);
-  histname = "IDAlignMon/"+FirstTrackCollection+"/Residuals/pix_b_biasedresidualy";
-  hPixel_TrkEtaRes = (TH1F*)file->Get(histname);	
-  hPixel_TrkEtaRes->SetTitle("Biased Pixel #eta Residuals (Barrel)");
-  hPixel_TrkEtaRes->GetXaxis()->SetTitle("Pixel Barrel #eta Residuals (mm)");
-  hPixel_TrkEtaRes->GetYaxis()->SetTitle("Entries");
-  hPixel_TrkEtaRes->SetLineColor(kGray+2);
-  hPixel_TrkEtaRes->SetLineWidth(1);
-  hPixel_TrkEtaRes->SetFillColor(kGray);
-  hPixel_TrkEtaRes->SetFillStyle(3001);
-  hPixel_TrkEtaRes->Draw("histname");
-
-  histname = "IDAlignMon/"+SecondTrackCollection+"/Residuals/pix_b_biasedresidualy";
-  hPixel_TrkEtaRes_2 = (TH1F*)file->Get(histname);	
-  hPixel_TrkEtaRes_2->SetLineColor(kRed+2);
-  hPixel_TrkEtaRes_2->SetFillColor(kRed);
-  hPixel_TrkEtaRes_2->SetLineWidth(1);
-  hPixel_TrkEtaRes_2->SetFillStyle(3001);
-  hPixel_TrkEtaRes_2->DrawCopy("same");
-  
- 
-  cRes->Update();
-  cRes->Print(psname+".eps");
-  cRes->Print(psname+".png");
-  
-  delete cRes;
-   
-}
diff --git a/InnerDetector/InDetExample/InDetAlignExample/macros/SiL1AlignRTT.cc b/InnerDetector/InDetExample/InDetAlignExample/macros/SiL1AlignRTT.cc
deleted file mode 100644
index 6b257adb633696d0bcef3b631a993a46cb0b641b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/macros/SiL1AlignRTT.cc
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// do not rename the next method, RTT will stop working
-void SiL1AlignRTT()
-{
-  gROOT->SetBatch(kTRUE);
-  makePlot("Iter0/Iter0_monitor.root", "Iter0_plots");
-  makePlot("Iter1/Iter1_monitor.root", "Iter1_plots");
-}
-
-void makePlot(Char_t filename[300], TString psname){
-  TFile *file;
-  TTree *GlobalChi2;
-  TH1F *hSCTRes[2];
-  TH1F *hPIXPhiRes[2];
-  TH1F *hPIXEtaRes[2];
-
-  TCanvas *cRes;
-  Char_t nameh[300];
-  Char_t titolh[300];
-  Int_t font=42;
-  Int_t EventNumber;
-  Int_t NTracks;
-  Int_t VnHits[2000];
-  Float_t VRes_RPhi[2000][200];
-  Float_t VRes_eta[2000][200];
-  Int_t VUsedTrack[2000];
-  Int_t VUsedHit[2000][200];
-  Int_t VHit_DetType[2000][200];
-  
-  Int_t SCTHits = 0;
-  Int_t PixelHits = 0;
-  Int_t SCTUsedHits = 0;
-  Int_t PixelUsedHits = 0;
-  Int_t TotalTracks = 0;
-  Int_t TotalUsedTracks = 0;
-  
-  Bool_t Debug = false;
-  
-  file = TFile::Open(filename);
-  GlobalChi2 = (TTree*)(file->Get("GlobalChi2/General"));
- 
-  gStyle->SetOptStat(111110);
-  gStyle->SetCanvasColor(kWhite);  
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetCanvasBorderSize(0);
-  
-  GlobalChi2->SetBranchAddress("event",         &EventNumber);
-  GlobalChi2->SetBranchAddress("nTracks",       &NTracks);
-  GlobalChi2->SetBranchAddress("nhits",         &VnHits);
-  GlobalChi2->SetBranchAddress("TrkRes",        &VRes_RPhi);
-  GlobalChi2->SetBranchAddress("TrkEtaRes",     &VRes_eta); // only for PIX
-  GlobalChi2->SetBranchAddress("usedHit",       &VUsedHit);
-  GlobalChi2->SetBranchAddress("usedTrk",       &VUsedTrack);
-  GlobalChi2->SetBranchAddress("Hit_DetType",   &VHit_DetType);
-  
-  int entries = GlobalChi2->GetEntries();
-  cout << entries << " events found" << endl;
-  for(int level = 0; level<2; level++){
-    sprintf(titolh,"SCT Residuals (Barrel+Endcaps)");
-    sprintf(nameh,"hSCTRes_%d",level);
-  
-    hSCTRes[level] = new TH1F(nameh, titolh, 
-		       60,-0.2, 0.2);
-    hSCTRes[level]->GetXaxis()->SetTitle("SCT #phi Residuals (mm)");
-    hSCTRes[level]->SetLineColor(1);
-    hSCTRes[level]->SetFillColor(18);
-
-
-    sprintf(nameh,"hPIXPhiRes_%d",level);
-    sprintf(titolh,"Pixel phi Residuals (Barrel+Endcaps)");
-    hPIXPhiRes[level] = new TH1F(nameh, titolh, 
-			  60 ,-0.20, 0.2);
-    hPIXPhiRes[level]->GetXaxis()->SetTitle("Pixel #phi Residuals (mm)");
-    hPIXPhiRes[level]->SetLineColor(1);
-    hPIXPhiRes[level]->SetFillColor(18);
-  
-    sprintf(nameh,"hPIXEtaRes_%d",level);
-    sprintf(titolh,"Pixel eta Residuals (Barrel+Endcaps)");
- 
-    hPIXEtaRes[level] = new TH1F(nameh, titolh, 
-			  60 ,-0.20, 0.2);
-    hPIXEtaRes[level]->GetXaxis()->SetTitle("Pixel #eta Residuals (mm)");
-    hPIXEtaRes[level]->SetLineColor(1);
-    hPIXEtaRes[level]->SetFillColor(18);
-  }
-
-  
-  GlobalChi2->GetEntry(0);
-  //cout << "hits " << VnHits[0] << endl;
-  
-  for(int e=0; e<entries; e++){
-    GlobalChi2->GetEntry(e);
-    if(Debug){
-      cout << "Event " << e << endl;
-      cout << "|- " << NTracks << " tracks" << endl;
-    }
-    for(int track=0; track < NTracks; track++){
-      TotalTracks++;
-      if(VUsedTrack[track] == 1)
-	TotalUsedTracks++;
-      if(Debug){
-	cout << "|- Track "<< track << endl;
-	cout << "   |- " << VnHits[track] << " hits" << endl;
-      }
-      for(int h=0; h<VnHits[track] ; h++){
-	if(Debug){
-	  cout << "   |- Hit "<< h << " ,Detector: " << VHit_DetType[track][h] << endl;
-	  cout << "   |- used: " << VUsedHit[track][h] << endl;
-	}
-	if(VHit_DetType[track][h]==2){
-	  SCTHits++;
-	  hSCTRes[0]->Fill(VRes_RPhi[track][h]);
-	  if(VUsedHit[track][h]==1 && VUsedTrack[track] == 1){
-	    hSCTRes[1]->Fill(VRes_RPhi[track][h]);
-	    SCTUsedHits++;
-	  }
-	}
-
-	if(VHit_DetType[track][h]==1){
-	  PixelHits++;
-	  hPIXPhiRes[0]->Fill(VRes_RPhi[track][h]);
-	  hPIXEtaRes[0]->Fill(VRes_eta[track][h]);
-	  if(VUsedHit[track][h]==1 && VUsedTrack[track] == 1){
-	    PixelUsedHits++;
-	    hPIXPhiRes[1]->Fill(VRes_RPhi[track][h]);
-	    hPIXEtaRes[1]->Fill(VRes_eta[track][h]);
-	  }
-	}
-      }
-      
-    }
-  }
-  
-
-  cRes = new TCanvas("GlobalResiduals","Global Residuals",1000,800);
-  cRes->Divide(2,2);
-   
-
-  // SUMMARY
-  cRes->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();
-  
-  int iConsts = 0;
-  
-  TLatex *t = new TLatex();
-  t->SetNDC();
-  t->SetTextFont(font);
-  t->SetTextSize(0.05);
-  t->SetTextAlign(12);
-
-  
-  // Information
-  t->SetTextSize(0.035);
-  sprintf(nameh,"Events: %d",entries);
-  t->DrawLatex(0.08,0.78,nameh);
-  sprintf(nameh,"AlignTrks: %d",TotalTracks);
-  t->DrawLatex(0.08,0.74,nameh);
-  sprintf(nameh," - Total hits: %d [ Pixel hits: %d, SCT hits: %d ]",PixelHits+SCTHits,PixelHits,SCTHits);
-  t->DrawLatex(0.08,0.70,nameh);
-  cRes->Update();
-  sprintf(nameh,"Processed AlignTrks: %d",TotalUsedTracks);
-  t->DrawLatex(0.08,0.66,nameh);
-  sprintf(nameh," - Processed hits: %d [ Pixel hits: %d, SCT hits: %d ]",PixelUsedHits+SCTUsedHits,PixelUsedHits,SCTUsedHits);
-  t->DrawLatex(0.08,0.62,nameh);
-  cRes->Update();
-  
-  cRes->cd(2);
-  hSCTRes[0]->SetLineColor(kGray+2);
-  hSCTRes[0]->SetLineWidth(1.5);
-  hSCTRes[0]->SetFillColor(kGray);
-  hSCTRes[0]->SetFillStyle(3001);
-  hSCTRes[0]->Draw();
-  
-  hSCTRes[1]->SetLineColor(kRed+2);
-  hSCTRes[1]->SetLineWidth(1.5);
-  hSCTRes[1]->SetFillColor(kRed);
-  hSCTRes[1]->SetFillStyle(3001);
-  hSCTRes[1]->Draw("SAME");
-  
-  cRes->cd(3);
-  hPIXPhiRes[0]->SetLineColor(kGray+2);
-  hPIXPhiRes[0]->SetLineWidth(1.5);
-  hPIXPhiRes[0]->SetFillColor(kGray);
-  hPIXPhiRes[0]->SetFillStyle(3001);
-  hPIXPhiRes[0]->Draw();
-
-  hPIXPhiRes[1]->SetLineColor(kRed+2);
-  hPIXPhiRes[1]->SetLineWidth(1.5);
-  hPIXPhiRes[1]->SetFillColor(kRed);
-  hPIXPhiRes[1]->SetFillStyle(3001);
-  hPIXPhiRes[1]->Draw("SAME");
-
-  cRes->cd(4);
-  hPIXEtaRes[0]->SetLineColor(kGray+2);
-  hPIXEtaRes[0]->SetLineWidth(1.5);
-  hPIXEtaRes[0]->SetFillColor(kGray);
-  hPIXEtaRes[0]->SetFillStyle(3001);
-  hPIXEtaRes[0]->Draw();
-   
-  hPIXEtaRes[1]->SetLineColor(kRed+2);
-  hPIXEtaRes[1]->SetLineWidth(1.5);
-  hPIXEtaRes[1]->SetFillColor(kRed);
-  hPIXEtaRes[1]->SetFillStyle(3001);
-  hPIXEtaRes[1]->Draw("SAME");
-  cRes->Print(psname+".eps");
-  cRes->Print(psname+".png");
-  
-  delete cRes;
-   
-}
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/IDAlignGridDatasets.py b/InnerDetector/InDetExample/InDetAlignExample/python/IDAlignGridDatasets.py
deleted file mode 100644
index 01832f96e1fbd082ea2c7a4c44f202bf00e8eeec..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/IDAlignGridDatasets.py
+++ /dev/null
@@ -1,338 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-#################################################################
-#    Script for running ATLAS ID alignment jobs on Grid resources
-#    Authors: Jike Wang      (jike.wang@cern.ch)
-#################################################################
-
-import os, types 
-import commands
-
-
-class ConfiguredIDAlignDatasets:
-	def __init__ (self, datasetType, geometrySetting, DatasetsOptions) : 
-		self.__datasetType            = datasetType
-		self.__DatasetsOptions        = DatasetsOptions
-
-
-		#########################################################################################
-		if self.__datasetType == "MC09":
-			
-			if geometrySetting == 'Nominal':
-				self.__DatasetsOptions["CollisionDetDescr" ] = "ATLAS-GEO-08-00-00"
-				self.__DatasetsOptions["CollisionGlobalTag"] = 'OFLCOND-SIM-00-00-07'
-			if geometrySetting == 'Perfect':
-				self.__DatasetsOptions["CollisionDetDescr" ] = "ATLAS-GEO-08-00-00"
-				self.__DatasetsOptions["CollisionGlobalTag"] = 'OFLCOND-CSC-01-00-00'
-		#########################################################################################
-		if self.__datasetType.find("900GeV") != -1 :
-
-			if len(self.__DatasetsOptions["CollisionRunList"]) != len(self.__DatasetsOptions["CollisionRecoTag"]) : 
-				print "Hi, the RunList and the RecoTagList length are not equal!!!"
-				sys.exit()
-
-			if "Nominal" == geometrySetting :
-				self.__DatasetsOptions["CollisionDetDescr" ] = "ATLAS-GEO-08-00-02"
-				self.__DatasetsOptions["CollisionGlobalTag"] = "COMCOND-ES1PS-001-00"
-			self.__DatasetsOptions["CollisionDetDescrBoff"     ] = "ATLAS-GEONF-08-00-00"
-
-		#########################################################################################
-		if self.__datasetType.find("7TeV") != -1 :
-
-			if len(self.__DatasetsOptions["CollisionRunList"]) != len(self.__DatasetsOptions["CollisionRecoTag"]) :
-				print "Hi, the RunList and the RecoTagList length are not equal!!!"
-				sys.exit()
-
-			if 'Nominal' == geometrySetting :
-				self.__DatasetsOptions["CollisionDetDescr" ] = "COMCOND-ES1PST-002-00"
-				self.__DatasetsOptions["CollisionGlobalTag"] = "ATLAS-GEO-10-00-00"
-			self.__DatasetsOptions["CollisionDetDescrBoff"     ] = "ATLAS-GEONF-08-00-00"
-		
-		#########################################################################################
-
-
-
-
-	def detDescrVersion (self, topology = "", i = 0) :
-		if "CosmicBoff" == topology : 
-			return self.__DatasetsOptions["CollisionDetDescrBoff"]
-		else : 
-			if (self.containType("Customed") and  "Customed" == topology ) :
-				return self.__DatasetsOptions["CustomedDatasetsDetDescr"][i]
-			elif "Collision" == topology : 
-				return self.__DatasetsOptions["CollisionDetDescr"]
-
-
-
-	def detDescrVersionNoField (self) :
-		self.__detDescrVersionNoField
-
-
-	def globalTag (self, topology = "", i = 0) : 
-		if self.containType("Customed") and "Customed" == topology :
-			return self.__DatasetsOptions["CustomedDatasetsGlobalTag"][i]
-		elif "Collision" == topology :
-			return self.__DatasetsOptions["CollisionGlobalTag"]
-
-
-
-	def containType (self, type) :
-		if self.__datasetType.find(type) != -1 : 
-			return True
-		else : 
-			return False
-
-	def doDetailedTagsConfig(self) :
-		if self.__DatasetsOptions["doDetailedTagsConfig"] :   
-			return True
-		else : 
-			return False 
-
-
-	def stream(self) :
-		return self.__DatasetsOptions["CollisionStream"]
-
-
-	def oneDatasetName (self, topology) :
-		oneDatasetName = ""
-		if ("mc09" == self.__datasetType or "MC09" == self.__datasetType) :
-			oneDatasetName = "mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731"
-			return oneDatasetName
-	 
-		elif self.containType("Customed") and "Customed" == topology :
-			oneDatasetName = self.__DatasetsOptions["CustomedDatasetsNameList"][0]
-
-		elif ("Collision" == topology) :  
-			if self.stream() == "MinBias" and self.containType("900GeV") :
-				oneDatasetName = "data09_900GeV.%08d.physics_MinBias.recon.ESD.%s" % ( int(self.__DatasetsOptions["CollisionRunList"][0]), self.__DatasetsOptions["CollisionRecoTag"][0] )
-									                                  
-			if self.stream() == "MinBias" and self.containType("7TeV"):
-				oneDatasetName = "data10_7TeV.%08d.physics_MinBias.recon.ESD.%s"   % ( int(self.__DatasetsOptions["CollisionRunList"][0]), self.__DatasetsOptions["CollisionRecoTag"][0] )
-
-		#elif ("CosmicBon" == topology) :
-		return oneDatasetName
-
-
-
-	def oneFileName (self, topology) :
-		oneFileName = ""
-		if ("mc09" == self.__datasetType or "MC09" == self.__datasetType) :
-			datasetName = "mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731"
-
-		elif (self.containType("Customed") and ("Customed" == topology) ) :
-			datasetName = self.__DatasetsOptions["CustomedDatasetsNameList"][0]
-
-		elif ("Collision" == topology) :
-			if self.stream() == "MinBias" and self.containType("900GeV") :
-				datasetName = "data09_900GeV.%08d.physics_MinBias.recon.ESD.%s" % ( int(self.__DatasetsOptions["CollisionRunList"][0]), self.__DatasetsOptions["CollisionRecoTag"][0] )
-			if self.stream() == "MinBias" and self.containType("7TeV") :
-				datasetName = "data10_7TeV.%08d.physics_MinBias.recon.ESD.%s"   % ( int(self.__DatasetsOptions["CollisionRunList"][0]), self.__DatasetsOptions["CollisionRecoTag"][0] )
-
-		#elif ("CosmicBon" == topology) :
-		status, oneFileName = commands.getstatusoutput(" dq2-ls -f %s | tail -n 6 | head -n 1 |  cut -f2 " % datasetName)
-		return oneFileName
-
-
-
-
-	def nFiles(self, topology) :	
-		num    = 0
-		nFiles = []
-
-		print self.__datasetType
-
-		if (self.__datasetType.find("mc09") != -1) or (self.__datasetType.find("MC09") != -1) :
-			datasetName = "mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731"
-			os.system('dq2-ls -f %s | grep -i files | grep -i total | cut -c 13- >> num' % datasetName)
-
-		elif (self.containType("Customed") and ("Customed" == topology) ) : 
-			os.system('rm -f tmp_dataset_NFile.txt')
-			os.system('touch tmp_dataset_NFile.txt')
-
-			for i in range(len(self.__DatasetsOptions["CustomedDatasetsNameList"])) :
-				#print i
-				datasetName = self.__DatasetsOptions["CustomedDatasetsNameList"][i]
-				# protection be here? if the dataset name is not exist, should warn ! 
-				os.system('dq2-ls -f %s | grep -i files | grep -i total | cut -c 13- >> tmp_dataset_NFile.txt ' % datasetName )
-				print "datasetName: " , datasetName    
-
-			inputfiles = open(("tmp_dataset_NFile.txt"), "r")
-
-			#print inputfiles 
-			for line in inputfiles :
-				#print " line: " , line
-				if int(line) < 0 :
-					print "Hi guys, very weird the files number of this customed dataset is not integer or negetive!!! "
-					sys.exit()
-				else :
-					print "Hi guys, the files number of this customed dataset is: " , line
-					nFiles.append(int(line))
-					num += int(line)
-
-			if self.__DatasetsOptions["doDetailedTagsConfig"] : 
-				return nFiles
-			else : 
-				return num
-
-
-		elif ("Collision" == topology) :
-			os.system('rm -f tmp_dataset_NFile.txt')
-			os.system('touch tmp_dataset_NFile.txt')
-
-			for i in range(len(self.__DatasetsOptions["CollisionRunList"])):
-				run     = int(self.__DatasetsOptions["CollisionRunList"][i])
-				tag     =     self.__DatasetsOptions["CollisionRecoTag"][i]
-
-				if self.stream() == "MinBias" and self.containType("900GeV") :
-					datasetName = "data09_900GeV.%08d.physics_MinBias.recon.ESD.%s" % (run,tag)
-				if self.stream() == "MinBias" and self.containType("7TeV") :
-					datasetName = "data10_7TeV.%08d.physics_MinBias.recon.ESD.%s"   % (run,tag)
-
-				print "Hi guys, the full name of this run is: ", datasetName
-				os.system('dq2-ls -f %s | grep -i files | grep -i total | cut -c 13- >> tmp_dataset_NFile.txt ' % datasetName)
-
-			inputfiles = open(("tmp_dataset_NFile.txt"), "r")
-			for line in inputfiles :
-				if int(line) < 0 : 
-					print "Hi guys, very weird the files number of this run is not integer or negetive!!! "
-					sys.exit()
-				else:	
-					print "Hi guys, the files number of this run is: " , line
-					num += int(line)
-
-		#elif ("CosmicBon" == topology) :
-		return num
-
-
-
-	def namesList(self, topology="") : 
-		namesList = []
-
-		if (self.__datasetType == "mc09") or (self.__datasetType == "MC09" ) :
-			return "mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731"
-
-		elif (self.containType("Customed")  and "Customed" == topology ) :
-			for i in range(   len(self.__DatasetsOptions["CustomedDatasetsNameList"]) ):
-				datasetName = self.__DatasetsOptions["CustomedDatasetsNameList"][i]
-				namesList.append(datasetName) 
-
-			if self.__DatasetsOptions["doDetailedTagsConfig"] :
-				return namesList 
-			else : 
-				str = ",".join(namesList)
-				return str
-
-
-		elif("Collision" == topology) : 
-			for i in range(  len(self.__DatasetsOptions["CollisionRunList"]) ):
-				run = int( self.__DatasetsOptions["CollisionRunList"][i] )
-				tag = self.__DatasetsOptions["CollisionRecoTag"][i]
-
-				if self.__DatasetsOptions["CollisionStream"] == "MinBias" and self.containType("900GeV") :
-					datasetName = "data09_900GeV.%08d.physics_MinBias.recon.ESD.%s" % (run,tag)
-
-				if self.__DatasetsOptions["CollisionStream"] == "MinBias" and self.containType("7TeV") :
-					datasetName = "data10_7TeV.%08d.physics_MinBias.recon.ESD.%s"   % (run,tag)
-
-				namesList.append(datasetName)
-			str = ",".join(namesList)
-			return str
-                #elif("CosmicBon" == topology)
-
-
-
-	def recoScript(self, topology = "", i = 0) :
-
-		if ( self.containType("Customed") and "Customed" == topology ) : 
-
-			if ( "Sim" in self.__DatasetsOptions["CustomedDatasetsNameList"][i]) and ("Cos" in self.__DatasetsOptions["CustomedDatasetsNameList"][i]) :
-				recoScript = "InDetAlignExample/loadInDetRec_MC_Cosmics.py"
-
-			#elif "mc" in self.__DatasetsOptions["CustomedDatasetsNameList"][i] :
-			#	recoScript = "InDetAlignExample/loadInDetRec.py"                               
-	     	         
-			else:                           
-				recoScript = "InDetAlignExample/loadInDetRec_new.py"
-
-			return recoScript 
-
-
-		if ("CosmicBon" == topology or "CosmicBoff" == topology) : 
-			recoScript = "InDetAlignExample/loadInDetRec_cosmics.py"
-
-		elif self.__datasetType.find("900GeV") != -1 :
-			recoScript      = "InDetAlignExample/loadInDetRec900GeV.py"
-		elif self.__datasetType.find("SingleBeam") != -1 :
-			recoScript      = "InDetAlignExample/loadInDetRecSingleBeam.py"
-		elif self.__datasetType.find("7TeV") != -1 :
-			recoScript      = "InDetAlignExample/loadInDetRec_new.py"
-		else:
-			recoScript      = "InDetAlignExample/loadInDetRec.py"
-		
-		return recoScript
-
-
-
-	def extraInfoFromAMI(self, datasetName) :
-
-		geometry_tag  = ""
-		condition_tag = ""
-		a, line1 = commands.getstatusoutput("dump-athfile.py ami://%s | grep geometry "   % datasetName )
-		print "dumping geometry version of %s from AMI ... "  % datasetName
-		print  line1
-		item1 = line1.split()
-		#print " item1 : " , item1		
-		if "None" != item1[-1] :
-			geometry_tag = item1[-1]
-			print "geometry_tag retrieved from AMI: " ,  geometry_tag
-		else :
-			print "Hmn, seems can't retrieve the geometry tag information for dataset  %s "    % datasetName
-
-		a, line2 = commands.getstatusoutput("dump-athfile.py ami://%s | grep conditions " % datasetName )
-		print "dumping condition tag version of %s from AMI ... "  % datasetName
-		print  line2
-		item2 = line2.split()
-		if "None" != item2[-1] :
-			condition_tag = item2[-1]
-			print "condition_tag retrieved from AMI: " , condition_tag
-
-		else :
-			print "Hmn, seems can't retrieve the conditions tag information for dataset  %s "  % datasetName
-		return (geometry_tag,condition_tag)
-
-
-
-
-	def configDatasetTags(self, topology = "") : 
-
-		geometry_tag_fromAMI  = ""
-		condition_tag_fromAMI = ""
-
-		if ( self.containType("Customed") and "Customed" == topology and self.__DatasetsOptions["CompareTagsWithAMI"] ) : 
-
-			for i in range(len(self.__DatasetsOptions["CustomedDatasetsNameList"])):
-
-				(geometry_tag_fromAMI, condition_tag_fromAMI) = self.extraInfoFromAMI(self.__DatasetsOptions["CustomedDatasetsNameList"][i])
-				print "the geometry tag and condition tag from AMI are %s and %s : " %  ( geometry_tag_fromAMI, condition_tag_fromAMI ) 	
-
-				if self.__DatasetsOptions["CustomedDatasetsDetDescr"][i]  != "" :    
-					if ( geometry_tag_fromAMI  and geometry_tag_fromAMI  != self.__DatasetsOptions["CustomedDatasetsDetDescr"][i]) :  	
-						print inred("WARNING!!!") + "you are going to change the intrinsic geometry tag of your CustomedDatasets "
-				else : 
-					print inred("WARNING!!!") + " you have not set the geometry tag for your CustomedDatasets, so set the one from AMI "
-					self.__DatasetsOptions["CustomedDatasetsDetDescr"][i] = geometry_tag_fromAMI
-
-				if self.__DatasetsOptions["CustomedDatasetsGlobalTag"][i] != "" : 
-					if ( condition_tag_fromAMI and condition_tag_fromAMI != self.__DatasetsOptions["CustomedDatasetsGlobalTag"][i]) :   
-						print inred("WARNING!!!") + "you are going to change the intrinsic condition tag of your CustomedDatasets "
-				else : 																            
-					print inred("WARNING!!!") + " you have not set the condition tag for your CustomedDatasets, so set the one from AMI "
-					self.__DatasetsOptions["CustomedDatasetsGlobalTag"][i] = condition_tag_fromAMI
-
-
-
-def inred( s ):
-	return "%s[31;2m%s%s[0m" % (chr(27), s, chr(27))
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignExample_IteratorClasses.py b/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignExample_IteratorClasses.py
deleted file mode 100644
index 744ec4ee383323707454bbc5d2ed6453ef744479..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignExample_IteratorClasses.py
+++ /dev/null
@@ -1,645 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# =====================================================================
-#
-#  Class for local processing
-#
-# =====================================================================
-from threading import Thread
-import os
-import time
-class runProcess(Thread):
-    def __init__ (self,
-                  jobOptions,
-                  iter,
-                  part,
-                  OutputPath,
-                  OutputLevel):
-        Thread.__init__(self)
-        self.jobOptions = jobOptions
-        self.i = iter
-        self.j = part
-        self.OutputPath = OutputPath
-        self.OutputLevel = OutputLevel
-        self.status = -1
-    def run(self):
-        print "----------------------------------------------"
-        print "  Running Iter%d - Part%02d in local machine" % (self.i, self.j)
-        print "----------------------------------------------"
-        print " - output path: %s/Iter%d/%02d" % (self.OutputPath, self.i, self.j)
-
-        if self.OutputLevel == 'INFO':
-            print "Running..."
-            process=os.popen("athena.py %s >& %s/Iter%d/logs/Iter%dPart%02d.log" % (self.jobOptions, self.OutputPath, self.i, self.i ,self.j))
-        else:
-            process=os.popen("athena.py %s | tee %s/Iter%d/logs/Iter%dPart%02d.log" % (self.jobOptions, self.OutputPath, self.i, self.i ,self.j))
-        while 1:
-            line = process.readline()
-            if self.OutputLevel == 'DEBUG':
-                print line,
-            if not line:
-                self.status=1
-                break
-            
-import os
-class SortCpus:
-	def __init__(self, TOTALCPUS, LOCALDIR, FILELIST, OutputLevel):
-		def sort_by_value(d):
-			""" Returns the keys of dictionary d sorted by their values """
-			items=d.items()
-			backitems=[ [v[1],v[0]] for v in items]
-			backitems.sort()
-			backitems.reverse()	
-			return [ backitems[i][1] for i in range(0,len(backitems))]		
-		self.OutputLevel = OutputLevel
-		inputfiles = open(FILELIST, "r")
-		filelist = inputfiles.read().split()
-		inputfiles.close()
-		if not LOCALDIR:
-			print "Reading Custom File"
-			FinalListSorted = []
-			for line in filelist:
-				if line and line[0] != '#':
-					FinalListSorted.append(line)
-			print FinalListSorted
-			
-		elif "castor" in LOCALDIR:
-			print "Reading castor directory. Please wait..."
-			extendedFileList = os.popen("rfdir "+ LOCALDIR[7:]).read().splitlines()
-		else:
-			print "Reading directory. Please wait..."
-			extendedFileList = os.popen("ls -l "+ LOCALDIR).read().splitlines()
-
-		if LOCALDIR:
-			i = 0
-			SizeList = {}
-			for line in extendedFileList:
-				curr = line.split()
-				SizeList[i] = {}
-				SizeList[i][0] = curr[8]
-				SizeList[i][1] = curr[4]
-				i = i+1
-			FinalList = {}
-			count = 0
-			for i in range(0,len(SizeList)):
-				if SizeList[i][0] in filelist:
-					#print SizeList[i][0], " size:", SizeList[i][1]
-					FinalList[SizeList[i][0]] = int(SizeList[i][1])
-
-			#SizeListSorted = [ (k,SizeList[k]) for k in sorted(SizeList.values())] 
-			FinalListSorted = sort_by_value(FinalList)
-			#print "Sorted list" 
-			#for i in range(0,len(FinalListSorted)):
-			#	print FinalListSorted[i], "\tsize:\t", FinalList[FinalListSorted[i]]
-		currCPU = 0
-		reverse = False
-		self.CPUsFiles = {}
-		for i in range(0,len(FinalListSorted)):
-			#print FinalListSorted[i], "CPU: ", currCPU
-			if currCPU in self.CPUsFiles:
-				self.CPUsFiles[currCPU].append(LOCALDIR+FinalListSorted[i])
-			else:
-				self.CPUsFiles[currCPU] = [LOCALDIR+FinalListSorted[i]]
-			if(not reverse):
-				currCPU = currCPU + 1
-				if(currCPU == TOTALCPUS):
-					#currCPU = currCPU - 1
-					reverse = not reverse
-			if(reverse):
-				currCPU = currCPU - 1
-				if(currCPU == -1):
-					currCPU = currCPU + 1
-					reverse = not reverse
-                    
-                                        
-	def getCPU(self,CURRENTCPU):
-		if self.OutputLevel=='DEBUG':
-			print "|",40*"-"," CPU #: ", CURRENTCPU, 40*"-", "|"
-			for line in self.CPUsFiles[CURRENTCPU]:
-				print "|  - ",line
-			print "|",93*"-","|"
-		return self.CPUsFiles[CURRENTCPU]
-           
-                
-		
-class writeJob:
-    def __init__(self,
-                 OutputPath,
-                 Events,
-                 CosmicsNoBField,
-                 CosmicsBField,
-                 BeamHalo,
-                 BeamGas,
-                 Challenge,
-                 Nominal,
-                 Aligned,
-                 Files,
-                 ReadAlignmentConstants,
-                 PreviousIteration,
-                 RunGlobalChi2Align,
-                 RunRobustAlign,
-                 SolveOption,
-                 AlignLevel,
-                 iter,
-                 part,
-                 JOBNAME
-                 ):
-        self.OutputPath = OutputPath
-        self.Events = Events
-        self.CosmicsNoBField = CosmicsNoBField
-        self.CosmicsBField = CosmicsBField
-        self.BeamHalo = BeamHalo
-        self.BeamGas = BeamGas
-        self.Nominal = Nominal
-        self.Aligned = Aligned
-        self.Challenge = Challenge
-        self.Files = Files
-        self.ReadAlignmentConstants = ReadAlignmentConstants
-        self.PreviousIteration = PreviousIteration
-        self.RunGlobalChi2Align = RunGlobalChi2Align
-        self.RunRobustAlign     = RunRobustAlign    
-        self.SolveOption = SolveOption
-        self.AlignLevel = AlignLevel
-        self.i = iter
-        self.j = part
-        self.JOBNAME = JOBNAME
-
-    def write(self):
-        PrefixName="Iter%d_" % self.i
-        if self.SolveOption==3:
-            TempPath="%s/Iter%d" % (self.OutputPath, self.i)
-        else:
-            if self.CosmicsNoBField:
-                TempPath="%s/Iter%d/CosmicsNoBField/%02d" % (self.OutputPath, self.i, self.j)
-            elif self.CosmicsBField:
-                TempPath="%s/Iter%d/CosmicsBField/%02d" % (self.OutputPath, self.i, self.j)
-            elif self.BeamHalo:
-                TempPath="%s/Iter%d/Halo/%02d" % (self.OutputPath, self.i, self.j)
-            elif self.BeamGas:
-                TempPath="%s/Iter%d/Gas/%02d" % (self.OutputPath, self.i, self.j)
-            else:
-                TempPath="%s/Iter%d/Collision/%02d" % (self.OutputPath, self.i, self.j)
-
-        os.system('mkdir -p %s' % TempPath)
-        topOptionFileName = ''
-        if self.CosmicsNoBField or self.CosmicsBField:
-            topOptionFileName  = 'InDetAlignExample_Cosmic_topOptions.py'
-        elif self.BeamHalo:
-            topOptionFileName = 'InDetAlignExample_Halo_topOptions.py'
-        elif self.BeamGas:
-            topOptionFileName = 'InDetAlignExample_Gas_topOptions.py'
-        else:
-            topOptionFileName = 'InDetAlignExample_topOptions.py'
-        os.system("get_files -jo InDetAlignExample/"+topOptionFileName+" >/dev/null")
-        topOptions=open(topOptionFileName,'r')
-            
-        #job=open(TempPath+"/"+self.JOBNAME,'w')
-        job=open(self.JOBNAME,'w')	
-        job.write(topOptions.readline())
-        job.write(topOptions.readline())
-        job.write("\n")
-        job.write("InDetAlignExampleFlags.Iteration              = %d \n" % self.i)
-        job.write("InDetAlignExampleFlags.EvtMax                 = %d \n" % self.Events)
-        job.write("InDetAlignExampleFlags.challenge              = \"%s\" \n" % (self.Challenge))
-        job.write("InDetAlignExampleFlags.Magnet                 = %s \n" % (self.CosmicsBField))
-        job.write("InDetAlignExampleFlags.Cosmics                = %s \n" % (self.CosmicsBField or self.CosmicsNoBField)  )
-        job.write("InDetAlignExampleFlags.BeamHalo               = %s \n" % self.BeamHalo)
-        job.write("InDetAlignExampleFlags.BeamGas                = %s \n" % self.BeamGas)
-        job.write("InDetAlignExampleFlags.SiNominal              = %s \n" % self.Nominal)
-        job.write("InDetAlignExampleFlags.Aligned                = %s \n" % self.Aligned)
-        job.write("InDetAlignExampleFlags.ReadAlignmentConstants = %s \n" % self.ReadAlignmentConstants)
-        job.write("InDetAlignExampleFlags.AlignConstsPath        = \"%s/Iter%d/\" \n" % (self.OutputPath, (self.i-1)))
-        job.write("InDetAlignExampleFlags.WritePrefixName        = \"%s\" \n" % PrefixName)
-        job.write("InDetAlignExampleFlags.ReadPrefixName         = \"%s\" \n" % self.PreviousIteration)
-        job.write("InDetAlignExampleFlags.doGlobalChi2Align      = %s \n" % self.RunGlobalChi2Align)
-        job.write("InDetAlignExampleFlags.doRobustAlign          = %s \n" % self.RunRobustAlign)
-        job.write("InDetAlignExampleFlags.OutputPath             = \"%s/\" \n" % TempPath)
-        job.write("InDetAlignExampleFlags.Files       = %s \n" % self.Files)
-        
-        if self.RunRobustAlign:
-            if self.SolveOption==0: # for RA only
-                job.write("InDetAlignExampleFlags.TextFileWriteIndex     = %d \n" % self.j)
-                job.write("InDetAlignExampleFlags.TextFileReadEndIndex   = 1 \n")
-            if self.SolveOption==3: # for RA only
-                job.write("InDetAlignExampleFlags.TextFileWriteIndex     = 999 \n") # for RA
-                job.write("InDetAlignExampleFlags.TextFileReadEndIndex   = %d \n" % (self.j-1)) # dummy for RA
-        job.write("InDetAlignExampleFlags.AlignLevel             = %d \n" % self.AlignLevel)        
-        job.write("InDetAlignExampleFlags.SolveOption            = %d \n" % self.SolveOption)
-        job.write("print ' Outputpath = ', InDetAlignExampleFlags.OutputPath \n")
-        job.write("\n")
-        
-        for line in topOptions.readlines():
-            job.write(line)
-        job.close()
-        os.system("rm "+topOptionFileName)
-
-class writeScript:        
-    def __init__(self,
-                 OutputPath,
-                 preName,
-                 iter,
-                 part,
-                 CosmicsNoBField,
-                 CosmicsBField,
-                 BeamHalo,
-                 BeamGas,
-                 QUEUE,
-                 CMTDIR,
-                 ATHENAREL,
-                 TAGS,
-                 RUNPATH,
-                 SCRIPTNAME,
-                 JOBNAME
-                 #files 
-                 ):
-        self.OutputPath = OutputPath
-        self.preName = preName
-        self.i=iter
-        self.j=part
-        self.CosmicsNoBField = CosmicsNoBField
-        self.CosmicsBField = CosmicsBField
-        self.BeamHalo = BeamHalo
-        self.BeamGas = BeamGas
-        self.QUEUE=QUEUE
-        self.CMTDIR=CMTDIR
-        self.ATHENAREL=ATHENAREL
-        self.TAGS = TAGS
-        self.RUNPATH=RUNPATH
-        self.SCRIPTNAME=SCRIPTNAME
-        self.JOBNAME=JOBNAME
-        #self.files = files
-        #self.temppath = ""
-    def write(self):
-        script=open(self.SCRIPTNAME,'w')
-        ##   if self.j!=-1: 
-        ##             if self.CosmicsNoBField:
-        ##                 temppath = "%s/Iter%d/CosmicsNoBField/%02d/" % (self.OutputPath,self.i,self.j)
-        ##             elif self.CosmicsBField:
-        ##                 temppath = "%s/Iter%d/CosmicsBField/%02d/" % (self.OutputPath,self.i,self.j)
-        ##             elif self.BeamHalo:
-        ##                 temppath = "%s/Iter%d/Halo/%02d/" % (self.OutputPath,self.i,self.j)
-        ##             elif self.BeamGas:
-        ##                 temppath = "%s/Iter%d/Gas/%02d/" % (self.OutputPath,self.i,self.j) 
-        ##             else:
-        ##                 temppath = "%s/Iter%d/Collision/%02d/" % (self.OutputPath,self.i,self.j)
-        ##         else:
-        ##             temppath = "%s/Iter%d/" % (self.OutputPath,self.i)
-            
-        ##         script=open(temppath+self.SCRIPTNAME,'w')
-        if self.j!=-1:
-            if self.CosmicsNoBField:
-                script.write("#BSUB -J %s_Iter%dPart%02d_CosmicNoBField \n" % (self.preName,self.i, self.j))
-                script.write("#BSUB -o %s/Iter%d/logs/Iter%dPart%02d_CosmicNoBField.log \n" % (self.OutputPath,self.i,self.i,self.j))
-            elif self.CosmicsBField:
-                script.write("#BSUB -J %s_Iter%dPart%02d_CosmicBField \n" % (self.preName,self.i, self.j))
-                script.write("#BSUB -o %s/Iter%d/logs/Iter%dPart%02d_CosmicBField.log \n" % (self.OutputPath,self.i,self.i,self.j))    
-            elif self.BeamHalo:
-                script.write("#BSUB -J %s_Iter%dPart%02d_Halo \n" % (self.preName,self.i, self.j))
-                script.write("#BSUB -o %s/Iter%d/logs/Iter%dPart%02d_Halo.log \n" % (self.OutputPath,self.i,self.i,self.j))
-            elif self.BeamGas:
-                script.write("#BSUB -J %s_Iter%dPart%02d_Gas \n" % (self.preName,self.i, self.j))
-                script.write("#BSUB -o %s/Iter%d/logs/Iter%dPart%02d_Gas.log \n" % (self.OutputPath,self.i,self.i,self.j))
-            else:
-                script.write("#BSUB -J %s_Iter%dPart%02d_Collision \n" % (self.preName,self.i, self.j))
-                script.write("#BSUB -o %s/Iter%d/logs/Iter%dPart%02d_Collision.log \n" % (self.OutputPath,self.i,self.i,self.j))
-        else:
-            script.write("#BSUB -J %s_Iter%dSolve \n" % (self.preName, self.i))
-            script.write("#BSUB -o %s/Iter%d/logs/Iter%dSolve.log \n" % (self.OutputPath,self.i,self.i))
-        
-        script.write("#BSUB -q %s \n" % self.QUEUE)
-        script.write("\n")
-        script.write("#   setup the environment \n")
-        script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENAREL, self.TAGS))
-        script.write("source %s/../InnerDetector/InDetExample/InDetAlignExample/cmt/setup.sh \n" % self.CMTDIR)
-
-#        script.write("source %s/../%s/InnerDetector/InDetExample/InDetAlignExample/cmt/setup.sh \n" % (self.CMTDIR,self.ATHENAREL))
-		
-#        script.write("cd %s \n" % temppath)
-        script.write("cd %s \n" % self.RUNPATH)
-
-       ##  for file in self.files:
-##             script.write("pool_insertFileToCatalog %s\n" % file)
-        script.write("athena.py %s \n" % self.JOBNAME)
-        script.close()
-      #  self.temppath = temppath
-    def send(self):
-        
-        print "----------------------------------------------"
-        if self.j==-1:
-            print "  Sending %s_Solve_Iter%d job to LxBatch " % (self.preName, self.i)
-        else:
-            if self.CosmicsNoBField:
-                print "  Sending %s_Iter%d_Part%02d_CosmicsNoBField job to LxBatch" % (self.preName,self.i,self.j)
-            elif self.CosmicsBField:
-                print "  Sending %s_Iter%d_Part%02d_CosmicsBField job to LxBatch" % (self.preName,self.i,self.j)
-            elif not self.BeamHalo and not self.BeamGas:
-                print "  Sending %s_Iter%d_Part%02d_Collision job to LxBatch" % (self.preName,self.i,self.j)
-            elif self.BeamHalo:
-                print "  Sending %s_Iter%d_Part%02d_Halo job to LxBatch" % (self.preName,self.i,self.j)
-            elif self.BeamGas:
-                print "  Sending %s_Iter%d_Part%02d_Gas job to LxBatch" % (self.preName,self.i,self.j)
-        print "----------------------------------------------"
-
-        os.system("chmod +x %s" % self.SCRIPTNAME)
-        os.system("bsub <%s" % self.SCRIPTNAME)
-
-        #os.system("chmod +x %s" % self.temppath+self.SCRIPTNAME)
-        #os.system("bsub <%s" % self.temppath+self.SCRIPTNAME)
-
-    def wait(self):
-        print "Processing in lxbatch..."
-        # Wait for signal
-        time.sleep(30)
-        while os.popen('bjobs -w').read().find(self.preName)!=-1:
-            time.sleep(30)
-
-
-class collectRAmodules:        
-    def __init__(self,
-                 OutputPath,
-                 iter,
-                 CPUs,
-                 RUNPATH,
-                 info
-                 ):
-        self.OutputPath=OutputPath
-        self.i=iter
-        self.CPUs=CPUs
-        self.RUNPATH=RUNPATH
-        self.info=info
-
-    def run(self):
-        print 
-        print "------------------------------------------"
-        print "  Collecting Iter%d RA module files" % self.i
-        print "------------------------------------------"
-        HOME = os.environ['HOME']
-        os.chdir("%s/Iter%d" % (self.OutputPath,self.i))
-        os.mkdir("moduleRA")
-        
-        firstMatrix = 0
-        TempPath = "%s/Iter%d/Collision/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-             TempPath = "%s/Iter%d/CosmicsNoBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-             TempPath = "%s/Iter%d/CosmicsBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-             TempPath = "%s/Iter%d/Halo/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-            TempPath = "%s/Iter%d/Gas/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        print "checking %s/Iter%d_AlignmentRAmodule_%dPIX/SCT.txt" % (TempPath,self.i,firstMatrix)
-        while not ( os.path.isfile( "%s/Iter%d_AlignmentRAmodule_%dPIX.txt" % (TempPath,self.i,firstMatrix) ) or os.path.isfile( "%s/Iter%d_AlignmentRAmodule_%dSCT.txt" % (TempPath,self.i,firstMatrix) ) ):
-            print "%s/Iter%d_AlignmentRAmodule_%dPIX/SCT.txt" % (TempPath,self.i,firstMatrix)
-            print "WARNING: Initial Check: RA module file with index %02d is missing" % firstMatrix
-            self.info.write("WARNING: Initial Check: RA module file with index %02d is missing\n" % firstMatrix)
-            firstMatrix += 1
-            if firstMatrix == self.CPUs:
-                print 'ERROR: Initial Check: No RA module files found'
-                break
-            TempPath = "%s/Iter%d/Collision/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsNoBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Halo/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Gas/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        
-        # looping over CPUs
-        for j in range(firstMatrix, self.CPUs):
-            TempPath = "%s/Iter%d/Collision/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsNoBField/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsBField/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Halo/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Gas/%02d/" %  (self.OutputPath,self.i,j)
-            if os.path.isfile("%s/Iter%d_AlignmentRAmodule_%dPIX.txt" % (TempPath,self.i,j)) or os.path.isfile("%s/Iter%d_AlignmentRAmodule_%dSCT.txt" % (TempPath,self.i,j)):
-                os.system("cp %s/Iter%d_AlignmentRAmodule_*txt %s/Iter%d/moduleRA/." % (TempPath,self.i,self.OutputPath,self.i))
-                self.info.write("RA module file with index %02d exists\n" % j)
-                print "RA module file with index %02d exists" % j      
-            else:
-                print "WARNING: RA module file with index %02d is missing" % j
-                print "file name: %s/Iter%d_AlignmentRAmodule_%dPIX/SCT.txt" % (TempPath,self.i,j)
-                self.info.write("WARNING: RA module file with index %02d is missing\n" % j)
-        os.chdir(self.RUNPATH)
-
-
-class mergeMatrix:        
-    def __init__(self,
-                 OutputPath,
-                 iter,
-                 CPUs,
-                 RUNPATH,
-                 addbigPath,
-                 info
-                 ):
-        self.OutputPath=OutputPath
-        self.i=iter
-        self.CPUs=CPUs
-        self.RUNPATH=RUNPATH
-        self.addbigPath=addbigPath
-        self.info=info
-        
-        
-    def run(self):
-        print 
-        print "------------------------------------------"
-        print "  Merging Iter%d GX2 Matrices" % self.i
-        print "------------------------------------------"
-        HOME = os.environ['HOME']
-        if os.environ['HOSTNAME'] != 'tst01.ific.uv.es':
-            os.chdir(self.addbigPath)
-            print self.addbigPath
-            print "compiling matrix merger..."
-            os.system("g++  -Wno-deprecated big_add.C -o big_add.exe")
-
-        os.chdir("%s/Iter%d" % (self.OutputPath,self.i))
-        os.mkdir("temp")
-        firstMatrix = 0
-        TempPath = "%s/Iter%d/Collision/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-             TempPath = "%s/Iter%d/CosmicsNoBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-             TempPath = "%s/Iter%d/CosmicsBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)   
-        if not os.path.isdir(TempPath):
-             TempPath = "%s/Iter%d/Halo/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-        if not os.path.isdir(TempPath):
-            TempPath = "%s/Iter%d/Gas/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-             
-        while not os.path.isfile( "%s/Iter%d_bigmatrix.bin" % (TempPath,self.i)):
-            print "%s/Iter%d_bigmatrix.bin" % (TempPath,self.i)
-            print "WARNING: Matrix number %02d is missing" % firstMatrix
-            self.info.write("WARNING: Matrix number %02d is missing\n" % firstMatrix)
-            firstMatrix += 1
-            if firstMatrix == self.CPUs:
-                print 'ERROR: No matrices found'
-                break
-            TempPath = "%s/Iter%d/Collision/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsNoBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsBField/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Halo/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Gas/%02d/" %  (self.OutputPath,self.i,firstMatrix)
-                
-        #self.info.write("Matrix number %02d exists\n" % firstMatrix)
-        print "Matrix number %02d exists" % firstMatrix            
-        
-        os.system("cp %s/Iter%d_bigmatrix.bin %s/Iter%d/temp/bigmatrix.bin" % (TempPath,self.i,self.OutputPath,self.i))
-        os.system("cp %s/Iter%d_bigvector.bin %s/Iter%d/temp/bigvector.bin" % (TempPath,self.i,self.OutputPath,self.i))
-        os.system("cp %s/Iter%d_hitmap.txt %s/Iter%d/temp/hitmap.txt" % (TempPath,self.i,self.OutputPath,self.i))
-
-        # looping over CPUs
-        for j in range(firstMatrix+1, self.CPUs):
-            TempPath = "%s/Iter%d/Collision/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsNoBField/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/CosmicsBField/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Halo/%02d/" %  (self.OutputPath,self.i,j)
-            if not os.path.isdir(TempPath):
-                TempPath = "%s/Iter%d/Gas/%02d/" %  (self.OutputPath,self.i,j)
-            if os.path.isfile("%s/Iter%d_bigmatrix.bin" % (TempPath,self.i)):
-                os.system("cp %s/Iter%d_bigmatrix.bin %s/bigmatrix.bin" % (TempPath,self.i,TempPath))
-                os.system("cp %s/Iter%d_bigvector.bin %s/bigvector.bin" % (TempPath,self.i,TempPath))
-                os.system("cp %s/Iter%d_hitmap.txt %s/hitmap.txt" %       (TempPath,self.i,TempPath))
-                self.info.write("Matrix number %02d exists\n" % j)
-                print "Matrix number %02d exists" % j      
-                print "merging matrix..."
-                m = os.popen("time %s/big_add.exe" % self.addbigPath,'w')
-                m.write("%s \n" % TempPath)
-                m.write("%s/Iter%d/temp \n" % (self.OutputPath,self.i))
-                m.close()
-        
-                os.system("rm %s/bigmatrix.bin" % TempPath)
-                os.system("rm %s/bigvector.bin" % TempPath)
-                os.system("rm %s/hitmap.txt" % TempPath)
-                          
-                os.system("mv %s/Iter%d/bigmatrix.bin %s/Iter%d/temp/" % (self.OutputPath,self.i, self.OutputPath, self.i))
-                os.system("mv %s/Iter%d/bigvector.bin %s/Iter%d/temp/" % (self.OutputPath,self.i, self.OutputPath, self.i))
-                os.system("mv %s/Iter%d/hitmap.txt %s/Iter%d/temp/" % (self.OutputPath,self.i, self.OutputPath, self.i))
-            else:
-                print "WARNING: Matrix number %02d is missing" % j
-                self.info.write("WARNING: Matrix number %02d is missing\n" % j)
-    
-        #for j in range(0, self.CPUs):
-        #    if os.path.isfile("%s/Iter%d/Collision/%02d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,j,self.i)):
-        #        os.system("rm %s/Iter%d/Collision/%02d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,j,self.i))
-        #    if os.path.isfile("%s/Iter%d/CosmicsNoBField/%02d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,j,self.i)):
-        #        os.system("rm %s/Iter%d/CosmicsNoBField/%02d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,j,self.i))
-        #    if os.path.isfile("%s/Iter%d/CosmicsBField/%02d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,j,self.i)):
-        #        os.system("rm %s/Iter%d/CosmicsBField/%02d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,j,self.i))
-               
-        os.system("mv %s/Iter%d/temp/bigmatrix.bin %s/Iter%d/Iter%d_bigmatrix.bin" % (self.OutputPath,self.i,self.OutputPath,self.i,self.i))
-        os.system("mv %s/Iter%d/temp/bigvector.bin %s/Iter%d/Iter%d_bigvector.bin" % (self.OutputPath,self.i,self.OutputPath,self.i,self.i))
-        os.system("mv %s/Iter%d/temp/hitmap.txt %s/Iter%d/Iter%d_hitmap.txt" % (self.OutputPath,self.i,self.OutputPath,self.i,self.i))
-        os.rmdir("%s/Iter%d/temp" % (self.OutputPath,self.i))
-        os.chdir(self.RUNPATH)
-
-
-class COG:
-    def __init__(self,
-                 OutputPath,
-                 iter,
-                 Nominal,
-                 Challenge,
-                 JOBNAME,
-                 SCRIPTNAME,
-                 preName
-                 ):
-        self.OutputPath=OutputPath
-        self.iter=iter
-        self.Nominal = Nominal
-        self.Challenge = Challenge
-        self.JOBNAME = JOBNAME
-        self.SCRIPTNAME = SCRIPTNAME
-        self.preName=preName
-    def writeJob(self):
-        TempPath="%s/Iter%d/" % (self.OutputPath, self.iter)
-        InputConstants = TempPath+"Iter%d_AlignmentConstantsPreCog.root" % (self.iter)
-        OutputConstants =  TempPath+"Iter%d_AlignmentConstants.root" % (self.iter)
-        OutputDbConstants =  TempPath+"Iter%d_AlignmentConstants.db" % (self.iter)
-        OutputTxtConstants = TempPath+"Iter%d_AlignmentConstants.txt" % (self.iter)
-        topOptions=open("InDetAlignCog.py",'r')
-        job=open(self.JOBNAME,'w')
-        job.write(topOptions.readline())
-        job.write(topOptions.readline())
-        job.write("\n")
-        
-        job.write("InputConstants         = \"%s\" \n" % InputConstants) 
-        job.write("OutputConstants        = \"%s\" \n" % OutputConstants)
-        job.write("OutputDbConstants      = \"%s\" \n" % OutputDbConstants)
-        job.write("OutputTxtConstants     = \"%s\" \n" % OutputTxtConstants)
-        job.write("onlySilicon            = True \n")
-        job.write("ReadAlignmentConstants = True \n")
-        job.write("\n")
-        
-        for line in topOptions.readlines():
-            job.write(line)
-        job.close()
-        
-    def moveConstants(self):
-        os.system("mv %s/Iter%d/Iter%d_AlignmentConstants.root %s/Iter%d/Iter%d_AlignmentConstantsPreCog.root" % (self.OutputPath, self.iter, self.iter, self.OutputPath, self.iter, self.iter))
-        os.system("mv %s/Iter%d/Iter%d_AlignmentConstants.db %s/Iter%d/Iter%d_AlignmentConstantsPreCog.db" % (self.OutputPath, self.iter, self.iter, self.OutputPath, self.iter, self.iter))
-        os.system("mv %s/Iter%d/Iter%d_AlignmentConstants.txt %s/Iter%d/Iter%d_AlignmentConstantsPreCog.txt" % (self.OutputPath, self.iter, self.iter, self.OutputPath, self.iter, self.iter))
-        
-    def writeScript(self,
-                    QUEUE,
-                    CMTDIR,
-                    ATHENAREL,
-                    TAGS,
-                    RUNPATH):
-        TempPath="%s/Iter%d/" % (self.OutputPath, self.iter)
-        script=open(self.SCRIPTNAME,'w')
-        script.write("#BSUB -J %s_Iter%dCog \n" % (self.preName,self.iter))         
-        script.write("#BSUB -o %s/Iter%d/logs/Iter%dCog.log \n" % (self.OutputPath,self.iter,self.iter))
-        script.write("#BSUB -q %s \n" % QUEUE)
-        script.write("\n")
-        script.write("#   setup the environment \n")
-        script.write("source %s/setup.sh -tag=val,%s,%s \n" % (CMTDIR, ATHENAREL, TAGS))
-        script.write("source %s/../cmt/setup.sh \n" % RUNPATH)
-
-        script.write("cd %s \n" % RUNPATH)
-        script.write("athena.py %s \n" % self.JOBNAME)
-        script.close()
-
-    def sendScript(self):
-        print "----------------------------------------------"
-        print "  Sending Iter%d - COG job to LxBatch " % self.iter
-        print "----------------------------------------------"
-        os.system("chmod +x %s" % self.SCRIPTNAME)
-        os.system("bsub <%s" % self.SCRIPTNAME)
-
-    def wait(self):
-        print "Processing in lxbatch..."
-        # Wait for signal
-        time.sleep(30)
-        while os.popen('bjobs -w').read().find(self.preName)!=-1:
-            time.sleep(30)
-
-
-    def run(self,
-            OutputLevel):
-        print "----------------------------------------------"
-        print "  Running %s_Iter%d - COG in local machine" % (self.preName,self.iter)
-        print "----------------------------------------------"
-        print " - output path: %s/Iter%d/" % (self.OutputPath, self.iter)
-
-        if OutputLevel == 'INFO':
-            process=os.popen("athena.py %s > %s/Iter%d/logs/Iter%dCog.log" % (self.JOBNAME, self.OutputPath, self.iter, self.iter))
-        else:
-            process=os.popen("athena.py %s" % self.JOBNAME)
-        while 1:
-            line = process.readline()
-            if OutputLevel == 'DEBUG':
-                print line,
-            if not line:
-                self.status=1
-                break          
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignJobRunner.py b/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignJobRunner.py
deleted file mode 100644
index 1fa618dd85dc9e30bba853d7e606519296b6027f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/InDetAlignJobRunner.py
+++ /dev/null
@@ -1,247 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# $Id: InDetAlignJobRunner.py,v 1.6 2008-07-31 18:02:08 beringer Exp $
-# Written by Juerg Beringer in April 2008.
-
-import math
-import os
-import socket
-import commands
-import time
-
-
-# Default template of job submission script
-scriptTemplate = """#!/bin/sh
-source %(cmthome)s/setup.sh -tag=%(release)s
-mkdir -p %(rundir)s
-cd %(rundir)s
-athena.py %(configfile)s %(joboptionPath)s
-"""
-
-
-# Exception class
-class InDetAlignJobRunnerError(AttributeError):
-    """InDetAlignJobRunner exception class"""
-
-
-class InDetAlignJobRunner:
-    """InDetAlignJobRunner is a generic "job runner" class that can be used to run a
-       number of jobs on a given set of input files in parallel on a batch system.
-       Written by Juerg Beringer in April 2008."""
-
-
-    def __init__(self,**options):
-        """Constructor (takes any number of parameters as an argument)."""
-        self.options = options
-        self.optionDescription = {}
-        self.setDefault('batchType','LSF','Type of batch system (LSF, background, configureOnly)')
-        self.setDefault('batchQueue','8nm','Batch queue')
-        self.setDefault('filesPerJob',1,'Number of input files per job')
-        self.setDefault('joboptionPath',os.getcwd()+'/joboptions.py','Master joboption file, including full path')
-        self.setDefault('release','13.2.0,opt,runtime','Software release (may include flags such as opt,runtime)')
-        self.setDefault('cmthome','$HOME/cmthome','Location of cmthome directory')
-        self.setDefault('jobnameTemplate','job%(jobnr)03i','Job name template (use %(jobnr)i for current job number, use <10 char for LSF)')
-        self.setDefault('startdirTemplate',os.getcwd(),'Directory template from where the jobs are started')
-        self.setDefault('rundirTemplate','.','Directory template where the jobs execute')
-        self.setDefault('configfileTemplate','%(startdir)s/%(jobname)s-config.py','Job configuration file name template (use %(jobnr)i for current job number)')
-        self.setDefault('scriptfileTemplate','%(startdir)s/%(jobname)s.sh','Script file name template (use %(jobnr)i for current job number)')
-        self.setDefault('scriptTemplate',scriptTemplate,'Template of job submission script')
-        self.setDefault('outputfileTemplate','%(startdir)s/%(jobname)s.root','Output file name template (use %(jobnr)i for current job number)')
-        self.setDefault('histfileTemplate','%(startdir)s/%(jobname)s-hist.root','Histogram/ntuple file name template (use %(jobnr)i for current job number)')
-        self.setDefault('logfileTemplate','%(startdir)s/%(jobname)s.log','Log file name template (use %(jobnr)i for current job number)')
-        self.setDefault('logmail','','E-mail address for sending status e-mails')
-
-        # The following will be regenerated for each job
-        self.setDefault('jobnr',-1,'Current job number')
-        self.setDefault('startdir',os.getcwd(),'Directory from where the jobs are started (generated)')
-        self.setDefault('rundir','.','Directory where the jobs execute (generated)')
-        self.setDefault('jobname','','Job name (generated)')
-        self.setDefault('configfile','','Name of job configuration file (generated)')
-        self.setDefault('outputfile','','Name of output file (generated)')
-        self.setDefault('histfile','','Name of histogram/ntuple output file (generated)')
-        self.setDefault('logfile','','Name of log file (generated)')
-        self.setDefault('scriptfile','','Name of job submission script (generated)')
-        self.setDefault('inputfiles',[],'List of input files (generated)')
-
-        # Misc default values
-        self.setDefault('EvtMax','-1','Maximum number of events to run over in each job')
-        self.setDefault('alignmentFile','','File with alignment constants')
-        self.setDefault('useNLumiBlocksPerBeamspot',1,'Number of LBs to use for each beamspot')
-        self.setDefault('maxCountPerBeamspot',-1,'Maximum number of tracks/vertices to be used (or -1 for all)') 
-
-        self.checkOptions()
-        self.inputfiles = [ ]
-        self.jobs = {}
-        self.jobNames = {}
-
-
-    def setDefault(self,name,value,desc=''):
-        """Set a default option value with an optional option description"""
-        self.options[name] = self.options.get(name,value)
-        self.optionDescription[name] = desc
-
-
-    def setOption(self,name,value):
-        """Set an option value"""
-        self.options[name] = value
-
-
-    def checkOptions(self):
-        """A generic routine for checking options. Intended to be implemented by
-           a subclass if desired."""
-        pass
-
-
-    def showOptions(self):
-        """Show current InDetAlignJobRunner options."""
-        options = self.options.keys()
-        options.sort()
-        for o in options:
-            print "%-20s = %-30s  # %s" % (o,self.options[o],self.optionDescription.get(o,'')) 
-
-
-    def addFiles(self,fileList):
-        """ Add a list of input files to be processed."""
-        self.inputfiles.extend(fileList)
-
-
-    def configureJob(self,jobnr):
-        """Configure options for job number jobnr."""
-        if jobnr in self.jobs: raise InDetAlignJobRunnerError, 'Job number %s already configured' % jobnr
-
-        # Check if any input files are available for this job
-        iFirst = self.options['filesPerJob']*jobnr
-        if iFirst >= len(self.inputfiles): raise InDetAlignJobRunnerError, 'jobnr too high for available number of files'
-        iLast = iFirst + self.options['filesPerJob']
-        if iLast > len(self.inputfiles): iLast=len(self.inputfiles)
-
-        # Update options for current job
-        self.options['jobnr'] = jobnr
-        self.options['inputfiles'] =  self.inputfiles[iFirst:iLast]
-        for p in ('jobname', 'startdir', 'rundir', 'configfile', 'scriptfile', 'outputfile', 'histfile', 'logfile'):
-            self.options[p] = self.options[p+'Template'] % self.options
-        
-        # Check if job's output files exist already in order to prevent overwriting of data
-        for f in ('outputfile', 'histfile', 'logfile'):
-            if os.access(self.options[f],os.F_OK): raise InDetAlignJobRunnerError, 'File %s exists already' % self.options[f]
-
-        # Make sure start directory where script and config files will be written to exists
-        os.system('mkdir -p %(startdir)s' % self.options)
-
-        # Write job files
-        self._writeConfig()
-        self._writeScript()
-
-        # Record job configuration
-        self.jobs[jobnr] = self.options.copy()
-        self.jobNames[self.options['jobname']] = jobnr
-
-
-    def _writeConfig(self):
-        """Write job configuration file for current job."""
-        config = open(self.options['configfile'],'w')
-        config.write('# Job configuration data for job %(jobname)s\n' % self.options)
-        config.write('# Generated by InDetAlignJobRunner.py\n\n')
-        config.write('jobConfig = '+repr(self.options))
-        config.write('\n')
-        config.close()
-
-
-    def _writeScript(self):
-        """Write job execution script for current job."""
-        script = open(self.options['scriptfile'],'w')
-        script.write(self.options['scriptTemplate'] % self.options)
-        script.close()
-        os.chmod(self.options['scriptfile'],0755)
-
-
-    def submitBackground(self,jobnr):
-        """Execute a configured job in the background"""
-        if not jobnr in self.jobs: raise InDetAlignJobRunnerError, 'Job number %s is not yet configured' % jobnr
-        scriptfile = self.jobs[jobnr]['scriptfile']
-        logfile = self.jobs[jobnr]['logfile']
-        os.system(scriptfile+' >& '+logfile+' &')
-
-
-    def submitLSF(self,jobnr):
-        """Execute a configured job as a LSF batch job"""
-        if not jobnr in self.jobs: raise InDetAlignJobRunnerError, 'Job number %s is not yet configured' % jobnr
-        batchCmd = 'bsub -q %(batchQueue)s -J %(jobname)s -o %(logfile)s %(scriptfile)s' % self.jobs[jobnr]
-        print batchCmd
-        os.system(batchCmd)
-
-
-    def run(self):
-        """Run all jobs either in batch or in the background, as specified by option batchType."""
-        batchType = self.options['batchType']    # Currently the same for all jobs
-        if not batchType in ('LSF','background','configureOnly'): raise InDetAlignJobRunnerError, 'Cannot run job type %s' % type
-        filesPerJob = self.options['filesPerJob']
-        njobs = int(math.ceil(float(len(self.inputfiles))/filesPerJob))
-        self.options['njobs'] = njobs
-        for i in range(njobs):
-            print '\nSubmitting job %s (using batchType=%s) ...' % (i,batchType)
-            self.configureJob(i)
-            if batchType=='LSF': self.submitLSF(i)
-            if batchType=='background': self.submitBackground(i)
-        self.log('InDetAlignJobRunner: starting jobs','',inputfiles=self.inputfiles,options=self.options)
-
-
-    def getRunningLSFJobs(self):
-        """Get list of jobs submitted by this InDetAlignJobRunner that are still running"""
-        runningJobs = [ ]
-        jobnamecol = commands.getoutput("bjobs 2>&1 | tail +2 | cut -c 60- | awk '{print $1}'").split()
-        #jobnamecol = commands.getoutput("cat bjobs.log | tail +2 | cut -c 60- | awk '{print $1}'").split()
-        for j in jobnamecol:
-            if j in self.jobNames: runningJobs.append(j)
-        return runningJobs
-
-
-    def wait(self):
-        """Wait until all jobs have completed (currently only implemented for LSF batch jobs)."""
-        batchType = self.options['batchType']    # Currently the same for all jobs
-        if batchType != 'LSF': raise InDetAlignJobRunnerError, 'wait() is not yet implemented for %s' % batchType
-        while 1:
-            time.sleep(30)    # Give LSF time to see recently submitted jobs
-            runningJobs = self.getRunningLSFJobs()
-            if not runningJobs: break
-            print
-            print time.asctime(),' Waiting for %2s job(s) (%s)' % (len(runningJobs),runningJobs)
-        self.log('InDetAlignJobRunner: finished','',outputfiles=self.getOutputFiles())
-
-
-    def getOutputFiles(self):
-        """Get a list of all output files."""
-        outputFiles = [ ]
-        for i in self.jobs:
-            outputFiles.append(self.jobs[i]['outputfile'])
-        return outputFiles
-
-
-    def log(self,subject,body,**data):
-        if self.options['logmail']:
-            msg = 'Generated by InDetAlignJobRunner on host '+socket.gethostname()+' by '+os.getlogin()+' at '+time.asctime()
-            msg += '\n\nCurrent working directory = '+os.getcwd()
-            if body: msg += '\n\n'+body
-            for k in data.keys():
-                if isinstance(data[k],dict):
-                    msg += "\n\n%s:" % k
-                    items = data[k].keys()
-                    items.sort()
-                    for i in items:
-                        msg += "\n    %-30s = %s" % (i,data[k][i])
-                else:
-                    msg += "\n\n%-15s = %s" % (k,data[k])
-            #print msg
-            os.system('echo "%s" | mail -s "%s" "%s"' % (msg,subject,self.options['logmail']))
-
-
-#
-# Test code
-#
-if __name__ == '__main__':
-    print 'Testing InDetAlignJobRunner:'
-    t = InDetAlignJobRunner(batchType='configureOnly')
-    t.addFiles([1,2,3])
-    t.showOptions()
-    t.run()
-    #t.log("test","my message",options=t.options,inputFiles=t.inputfiles)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/IteratorGridClasses.py b/InnerDetector/InDetExample/InDetAlignExample/python/IteratorGridClasses.py
deleted file mode 100644
index c4a8c776d30628a80426c388bdb08f52103ddada..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/IteratorGridClasses.py
+++ /dev/null
@@ -1,1773 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# =====================================================================
-#  Classes for running ATLAS ID alignment jobs on Grid resources
-#    Authors: Jike Wang      (jike.wang@cern.ch)
-#             Song-Ming Wang (smwang@phys.sinica.edu.tw)
-# =====================================================================
-
-
-from threading import Thread
-import os
-import time,datetime
-import commands, string
-import sys
-
-
-class runProcess(Thread):
-	def __init__ (self,
-		      jobOptions,
-		      iter,
-		      part,
-		      OutputPath,
-		      OutputLevel):
-		Thread.__init__(self)
-		self.jobOptions = jobOptions
-		self.i = iter
-		self.j = part
-		self.OutputPath = OutputPath
-		self.OutputLevel = OutputLevel
-		self.status = -1
-
-	def run(self):
-		if self.j == -1:
-			print "----------------------------------------------"
-			print "  Running Iter%d - Solve in local machine" % (self.i)
-			print "----------------------------------------------"
-			process=os.popen("athena.py %s | tee %s/Iter%02d/logs/Iter%02dSolve.log" % (self.jobOptions, self.OutputPath, self.i, self.i))
-		else:
-			print "----------------------------------------------"
-			print "  Running Iter%d - Part%02d in local machine" % (self.i, self.j)
-			print "----------------------------------------------"
-			print " - output path: %s/Iter%02d/%02d" % (self.OutputPath, self.i, self.j)
-			process=os.popen("athena.py %s | tee %s/Iter%02d/logs/Iter%02dPart%02d.log" % (self.jobOptions, self.OutputPath, self.i, self.i ,self.j))
-
-		print "Running..."
-		while 1:
-			line = process.readline()
-			if self.OutputLevel == 'DEBUG':
-				print line,
-			if not line:
-				self.status=1
-				break
-			
-
-
-
-def prepareForThisIter(iteration, GridFileOptions):
-
-	GridFileOptions["GridAccSubJobID"]  = 'GridAccSubJobID_%02d.txt'  % (iteration)
-	GridFileOptions["GridAccSubInfo"]   = 'GridAccSubInfo_%02d.txt'   % (iteration)
-	GridFileOptions["GridAccOutDS"]     = 'GridAccOutDS_%02d.txt'     % (iteration)
-	GridFileOptions["GridSolvingOutDS"] = 'GridSolvingOutDS_%02d.txt' % (iteration)
-
-
-			
-class writeJobGrid:
-	def __init__(self,
-		     OutputPath,
-		     CosmicsBoff,
-		     CosmicsBon,
-		     iter,
-		     part,
-		     JOBNAME,
-		     RecoOptions      = {},
-		     extraOptions     = {},
-		     AlignmentOptions = {},
-		     RecoScript       = "InDetAlignExample/NewTopOptions.py",
-		     #AlignmentScript  = "InDetAlignExample/NewInDetAlignAlgSetup.py",
-		     AlignmentScript  = "NewInDetAlignAlgSetup.py",
-		     AlignmentLevels  = "InDetAlignExample/NewInDetAlignLevels.py",
-		     MonitoringScript = "InDetRecExample/InDetMonitoringAlignment.py"
-		     ):
-		self.OutputPath       = OutputPath
-		self.CosmicsBoff      = CosmicsBoff
-		self.CosmicsBon       = CosmicsBon
-		self.i                = iter
-		self.part             = part
-		self.JOBNAME          = JOBNAME
-		self.RecoOptions      = RecoOptions
-		self.extraOptions     = extraOptions
-		self.RecoScript       = RecoScript
-		self.AlignmentOptions = AlignmentOptions
-		self.AlignmentScript  = AlignmentScript
-		self.AlignmentLevels  = AlignmentLevels
-		self.MonitoringScript = MonitoringScript
-		
-	def write(self):
-		PrefixName="Iter%02d_" % self.i
-		if self.part == "Solve":
-			TempPath         = "%s/Iter%02d/"                 % (self.OutputPath, self.i)
-		else:
-			if self.CosmicsBoff:
-				TempPath = "%s/Iter%02d/CosmicsBoff/" % (self.OutputPath, self.i)
-			elif self.CosmicsBon:
-				TempPath = "%s/Iter%02d/CosmicsBon/"   % (self.OutputPath, self.i)
-			else:
-				TempPath = "%s/Iter%02d/Collision/"       % (self.OutputPath, self.i)
-
-		os.system('mkdir -p %s' % TempPath)
-		os.system('mkdir -p %s' % TempPath+"/InDetRecExample")
-		if self.MonitoringScript != "":
-			os.system('ln -s %s %s' % (self.MonitoringScript,TempPath+"/InDetRecExample/InDetMonitoringAlignment.py") )
-
-		# Make Monitoring script dir and file here
-
-		#job=open(TempPath+self.JOBNAME,'w')
-		job=open(self.JOBNAME,'w')
-		job.write('##-------- Alignment Configuration --------------------\n')
-
-		for option in self.AlignmentOptions:
-			if type(self.AlignmentOptions[option]) is str:
-				customoption = option + "\t=\t\"" +  self.AlignmentOptions[option]+'\"\n'
-				job.write(customoption)
-			else:
-				customoption = option + "\t=\t"   +  str(self.AlignmentOptions[option])+'\n'
-				job.write(customoption)
-			
-		job.write("\n")
-		job.write('##-------- Loading the Alignment Levels --------------------\n')
-		job.write('include("'+str(self.AlignmentLevels)+'") \n')
-		job.write("\n")
-		job.write('##-------- Reconstruction Configuration --------------------\n')
-		
-		for option in self.RecoOptions:
-			if type(self.RecoOptions[option]) is str:
-				customoption = option + "\t=\t\"" +  self.RecoOptions[option]+'\"\n'
-				job.write(customoption)
-			else:
-				customoption = option + "\t=\t"   +  str(self.RecoOptions[option])+'\n'
-				job.write(customoption)
-
-		if len(self.extraOptions):
-			job.write("\n")
-			job.write('##-------- Extra Configuration --------------------\n')
-		
-		for option in self.extraOptions:
-			if type(self.extraOptions[option]) is str:
-				customoption = option + "\t=\t\"" +  self.extraOptions[option]+'\"\n'
-				job.write(customoption)
-			else:
-				customoption = option + "\t=\t"   +  str(self.extraOptions[option])+'\n'
-				job.write(customoption)
-
-		job.write("\n")
-		job.write('##-------- End of custom options -------------\n')
-
-		# Need to write the InDetRec Options Here:
-		job.write("\n")
-		job.write('##-------- Load Reconstruction or purely build geometry ---------------\n')
-		job.write('include("'+str(self.RecoScript)+'") \n')
-
-		job.write("\n")
-		job.write('##-------- Load Alignment --------------------\n')
-		job.write('include("'+str(self.AlignmentScript)+'") \n')
-		job.write("\n")
-		job.close()
-
-	
-
-
-
-
-
-class writeScriptGridForTFile :
-
-	def __init__(self,
-		     OutputPath,
-		     preName,
-		     iter,
-		     part,
-		     ATHENAREL,
-		     SCRIPTNAME,
-		     Datasets,
-		     outDS,
-		     AccSubJobID,
-		     AccSubInfo,
-		     JOBNAMES,
-		     thisJobDir,
-		     jobId,
-		     retryNo,
-		     GridOptions = {},
-		     AlignmentOptions = {}
-       		     ):
-
-			self.OutputPath       = OutputPath
-			self.preName          = preName
-			self.i                = iter
-			self.part             = part
-			self.ATHENAREL	      = ATHENAREL
-			self.SCRIPTNAME       = SCRIPTNAME
-			self.Datasets         =  Datasets
-			self.outDS            = outDS
-			self.AccSubJobID      = AccSubJobID
-			self.AccSubInfo       = AccSubInfo     
-			self.JOBNAMES         = JOBNAMES
-			self.thisJobDir       = thisJobDir
-			self.jobId            = -99
-			self.retryNo	      = 0
-			self.GridOptions      = GridOptions
-			self.AlignmentOptions = AlignmentOptions
-
-
-
-	def write(self) :
-
-
-		print " start to create the job submit command line ...\n "   
-		extOutFileStr    = "AlignmentTFile.root"
-		extOutFileStrAcc = extOutFileStr
-
-		if self.GridOptions["doMonitoring"] :
-			extOutFileStrAcc = extOutFileStr + ",monitoring.root"
-		if self.GridOptions["doTrkNtuple"]  :
-			extOutFileStrAcc += ",TrkValidation.root"
-
-		if self.part == "Accumulate":
-			self.SCRIPTNAME
-			script = open(self.SCRIPTNAME,'w')
-
-			if self.Datasets.containType("Customed") :
-				if self.Datasets.doDetailedTagsConfig() :
-					for index in range(len(self.Datasets.namesList("Customed"))) :
-						if ( "group" in self.GridOptions["userIDnum"] ) :
-							scriptStr   = "pathena --official --voms=atlas:/atlas/det-indet/Role=production  %s  " % (self.JOBNAMES["Customed"][index])
-						else :
-							scriptStr   = "pathena  %s  " % (self.JOBNAMES["Customed"][index])
-
-						if ("accumulateLibDS" in self.GridOptions) and (self.GridOptions["accumulateLibDS"] != "") :
-							scriptStr += " --libDS %s "          % self.GridOptions["accumulateLibDS"]
-							scriptStr += " --excludeFile %s "    % "*.cxx,*.h,*.o"
-
-						if ("removeFileList" in self.GridOptions) and (self.GridOptions["removeFileList"]   != "") :
-							scriptStr += " --removeFileList %s " % self.GridOptions["removeFileList"]
-
-						if ("fileList"       in self.GridOptions) and (self.GridOptions["fileList"]         != "") :
-							scriptStr += " --fileList %s "       % self.GridOptions["fileList"]
-
-						if ("siteName"	     in self.GridOptions) and (self.GridOptions["siteName"]         != "") :
-							scriptStr += " --site %s "           % self.GridOptions["siteName"]
-
-						if ("excludedSite"   in self.GridOptions) and (self.GridOptions["excludedSite"]     != "") :
-							scriptStr += " --excludedSite %s "   % self.GridOptions["excludedSite"]
-
-						if ("SkipFiles"      in self.GridOptions) and (self.GridOptions["SkipFiles"]        != "") :
-							scriptStr += " --nSkipFiles %s "     % self.GridOptions["SkipFiles"][self.i]
-
-
-						if self.GridOptions["dbRelease"]    == "":
-							scriptStr += " --dbRelease LATEST "
-						else :
-							scriptStr += " --dbRelease %s "    % self.GridOptions["dbRelease"]
-
-
-
-						scriptStr += " --extFile "
-
-						if (0 == self.i) : 
-							if os.path.isfile("initial_AlignmentConstants.root") :
-								scriptStr += "   initial_AlignmentConstants.root,Scaling.root  "   
-							else : 
-								scriptStr += " Scaling.root " 
-						else :
-							lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-							if os.path.isfile("%s"  % lastAlignConstant ) : 
-								scriptStr += "  %s,Scaling.root "      % lastAlignConstant 
-								
-						
-		
-						if self.GridOptions["debugLevel"] == 4 :
-							self.GridOptions["doNFilesPerJobSplit"] = False
-							scriptStr += " --nEventsPerJob %s" % self.GridOptions["nEventsPerJob"]
-  	
-						if self.GridOptions["doNFilesPerJobSplit" ] :
-							if (-1 != self.GridOptions["CustomedNFiles"][index]) :
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.GridOptions["CustomedNFiles"][index], self.GridOptions["CustomedNFPJ"][index], self.GridOptions["TmpWorkDir"], int(index) )
-							else : 
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s  --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.GridOptions["CustomedNFPJ"][index], self.GridOptions["TmpWorkDir"], int(index) ) 
-						else : 
-							if (-1 != self.GridOptions["CustomedNFiles"][index]) :
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.GridOptions["CustomedNFiles"][index], self.GridOptions["CustomedCPUs"][index], self.GridOptions["TmpWorkDir"], int(index) )
-							
-							else :   
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.Datasets.nFiles("Customed")[index], self.GridOptions["CustomedCPUs"][index], self.GridOptions["TmpWorkDir"], int(index) )
-
-							
-						script.write(scriptStr)
-							
-					print " You are running alignment accumulation and using TFile for bookkeeping \n" 
-					print " You are running on customed dataset and doing detailed tags configuration \n"
-					print " the Grid job submission command line is : \n"
-					print scriptStr
-
-
-			if (self.Datasets.containType("900GeV") or self.Datasets.containType("7TeV")) :
-
-				if self.GridOptions["ColCPUs"][self.i]:
-					scriptStr   = "pathena  %s  " % (self.JOBNAMES["Collision"])
-				if self.GridOptions["CosBonCPUs"][self.i]:
-					scriptStr   = "pathena  %s  " % (self.JOBNAMES["CosBon"])
-				if self.GridOptions["CosBoffCPUs"][self.i]:
-					scriptStr   = "pathena  %s  " % (self.JOBNAMES["CosBoff"])
-
-
-				if ("fileList" in self.GridOptions) and (self.GridOptions["fileList"]     != "") :
-					scriptStr += "--fileList %s "     % self.GridOptions["fileList"]
-
-				if ("siteName" in self.GridOptions ) and (self.GridOptions["siteName"]     != "") :
-					scriptStr += "--site %s "         % self.GridOptions["siteName"]
-						
-				if ("excludedSite" in self.GridOptions) and (self.GridOptions["excludedSite"] != "") :
-					scriptStr += "--excludedSite %s " % self.GridOptions["excludedSite"]
-						                       
-				if self.GridOptions["dbRelease"]    == "":
-					scriptStr += "--dbRelease LATEST "
-				else:
-					scriptStr += "--dbRelease %s "    % self.GridOptions["dbRelease"]
-
-
-
-
-				scriptStr += " --extFile "
-
-				if (0 == self.i) : 
-					if os.path.isfile("initial_AlignmentConstants.root") :
-						scriptStr += "   initial_AlignmentConstants.root,Scaling.root  "   
-					else : 
-						scriptStr += " Scaling.root " 
-				else :
-					lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-					if os.path.isfile("%s"  % lastAlignConstant ) : 
-						scriptStr += "  %s,Scaling.root "      % lastAlignConstant 
-
-
-
-
-				if self.GridOptions["ColCPUs"][self.i] :
-					if self.GridOptions["doNFilesPerJobSplit" ] :
-						scriptStr_forCollision = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_collision.txt ; \n" % ( self.Datasets.namesList("Collision"), self.outDS["Collision"], extOutFileStrAcc, self.Datasets.nFiles("Collision"), self.GridOptions["ColNFPJ"][self.i], self.GridOptions["TmpWorkDir"] )   
-					else :
-						scriptStr_forCollision = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_collision.txt ; \n" % ( self.Datasets.namesList("Collision"), self.outDS["Collision"], extOutFileStrAcc, self.Datasets.nFiles("Collision"), self.GridOptions["ColCPUs"][self.i], self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr_forCollision)
-
-
-				if self.GridOptions["CosBonCPUs"][self.i]:
-					scriptStr_forBon       = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d --tmpDir %s  >& tmpSubJobInfo_Bon.txt ;       \n" % ( self.Datasets.namesList("CosBon"),    self.outDS["CosBon"], extOutFileStrAcc, self.Datasets.nFiles("Bon"),       self.GridOptions["CosBonCPUs"][self.i],   self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr_forBon)
-
-				if self.GridOptions["CosBoffCPUs"][self.i]:
-					scriptStr_forBoff      = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d --tmpDir %s  >& tmpSubJobInfo_Boff.txt ;      \n" % (self.Datasets.namesList("CosBoff"), self.outDS["CosBoff"],   extOutFileStrAcc, self.Datasets.nFiles("Boff"),      self.GridOptions["CosBoffCPUs"][self.i], self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr_forBoff)
-	
-			script.close()
-
-
-		elif self.part == "Prun" :
-			print self.SCRIPTNAME
-			script     = open(self.SCRIPTNAME,'w')
-
-			prunSolve = open("prunSolve.py",'w')
-			prunSolve.write('import os\nimport commands, string\nimport sys\n\n\n')
-			prunSolve.write('inputTFiles = []\ninFiles = []\n\n\n')
-			prunSolve.write('ret, out = commands.getstatusoutput(\"cat input1.txt\")\n')
-			prunSolve.write('print \" the content of file input1.txt:  \", out \n')
-			prunSolve.write('lines = out.split(\",\")\n')
-			prunSolve.write('for line in lines:\n')
-			prunSolve.write('\tif \"AlignmentTFile.root\" in str(line):\n\t\tinputTFiles.append(line)\n')
-	
-			tmpStrJO = "newSolveJO_Iter%02d.py" % self.i
-			prunSolve.write('jofile = open( \'%s\' , \'w+\')\n' % tmpStrJO )
-
-			tmpStr = ""
-
-			if (0 == self.i) :
-				if os.path.isfile("initial_AlignmentConstants.root") :
-					tmpStr = "pool_insertFileToCatalog  initial_AlignmentConstants.root "
-
-
-			else : 
-
-				alignConstants = "Iter%02d_AlignmentConstants.root" % (self.i - 1)
-				if os.path.isfile(alignConstants) :
-					tmpStr = "pool_insertFileToCatalog  %s "  % alignConstants
-				else :
-					print "ALIGNMENT CONSTANTS %s NOT EXIST, WILL EXIT ANYHOW !!!  "  % alignConstants
-					sys.exit()
-
-
-			prunSolve.write('jofile.write(\'os.system(\\\"%s\\\")\\n\')\n'  % tmpStr)
-			prunSolve.write('jofile.write(\"inputTFiles = \" + str(inputTFiles) + \'\\n\')\n')
-	
-			prunSolve.write('ff = open(\'%s\', \'r\')\n' % self.JOBNAMES["Solve"] )                               
-			prunSolve.write('jofile.write(ff.read())\nff.close()\njofile.close()\n')
-	
-			prunSolve.write('os.system(\"athena.py %s \")\n'  % tmpStrJO )
-
-			# debugging ...
-			print "prunSolve.py: "
-			os.system(" cat prunSolve.py ")
-			print " newSolveJO_Iter%02d.py: " % self.i
-			os.system(" cat %s " % tmpStrJO)
-
-
-			extOutFileStrSol = ""
-
-			if (    ("sctAlignmentLevel"          in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevel"]          == 3 ) or 
-				("sctAlignmentLevelBarrel"    in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevelBarrel"]    == 3)  or 
-				("sctAlignmentLevelEndcaps"   in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevelEndcaps"]   == 3)  or 
-				("pixelAlignmentLevel"        in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevel"]        == 3)  or 
-				("pixelAlignmentLevelBarrel"  in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevelBarrel"]  == 3)  or 
-				("pixelAlignmentLevelEndcaps" in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevelEndcaps"] == 3) ) :
-				print "hmn, you are going to run L3 alignment, Eigen is being used, so no eigen value information!!! "
-			 
-			else : 
-
-				if ( "writeEigenMat"      in self.GridOptions  and self.GridOptions["writeEigenMat"]    == True  ) and ( self.AlignmentOptions["runLocal"] == False ):
-					extOutFileStrSol += "eigenvectors.bin,";
-					extOutFileStrSol += "eigenvalues.bin," ;
-			   
-				if ( "writeEigenMatTxt"   in self.GridOptions  and self.GridOptions["writeEigenMatTxt"] == True  ) and ( self.AlignmentOptions["runLocal"] == False ):
-					extOutFileStrSol += "eigenvectors.txt,";
-					extOutFileStrSol += "eigenvalues.txt," ;
-
-
-			extOutFileStrSol = extOutFileStrSol + extOutFileStr + ",Iter%02d_AlignmentConstants.root,OldSiAlignment.txt,OutputSiAlignment.txt,alignlogfile.txt" % (self.i)
-
-
-			extFileStr = ""
-
-			if (0 == self.i) :
-				if os.path.isfile("initial_AlignmentConstants.root") :
-					extFileStr = " initial_AlignmentConstants.root,Scaling.root "
-				else : 
-					extFileStr = " Scaling.root "
-
-			else :
-				lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-				if os.path.isfile("%s"  % lastAlignConstant ) :
-					extFileStr = lastAlignConstant + ",Scaling.root "
-
-
-			TNFiles = 0
-			tmpInDS = []
-			print " self.outDS : " , self.outDS
-
-			print " self.outDS[Customed]: " , self.outDS["Customed"]
-			for item in self.outDS["Customed"] :
-				print "self.outDS[Customed] item:  " , item
-				tmpInDS.append(item+"/")
-				rec, nFiles = commands.getstatusoutput("dq2-ls -f %s | grep -i files | grep -i total | cut -c 13-" %  (item+"/") )
-				print " nFiles of this outDS[Customed] :" , nFiles
-				TNFiles += int(nFiles)
-			solveInDS = ",".join(tmpInDS)
-
-			#scriptStr = " prun --exec \" python prunSolve.py \" --writeInputToTxt IN:input1.txt --express --athenaTag %s,AtlasProduction --inDS %s --outputs %s --outDS %s --extFile %s --nJobs 1 --nFilesPerJob %d -v --maxNFilesPerJob 100000 " % (self.ATHENAREL, solveInDS , extOutFileStrSol, self.outDS["Solve"], extFileStr,  int(TNFiles) )
-			if ( "group" in self.GridOptions["userIDnum"] ) : 
-				scriptStr = " prun --exec \" python prunSolve.py \" --writeInputToTxt IN:input1.txt --express  --useAthenaPackages --match \"*AlignmentTFile.root*\"  --official --voms=atlas:/atlas/det-indet/Role=production --inDS %s --outputs %s --outDS %s --extFile %s --nJobs 1 --nFilesPerJob %d -v --maxNFilesPerJob 100000 " % ( solveInDS , extOutFileStrSol, self.outDS["Solve"], extFileStr,  int(TNFiles) )
-			else : 
-				scriptStr = " prun --exec \" python prunSolve.py \" --writeInputToTxt IN:input1.txt --express  --useAthenaPackages --match \"*AlignmentTFile.root*\"  --inDS %s --outputs %s --outDS %s --extFile %s --nJobs 1 --nFilesPerJob %d -v --maxNFilesPerJob 100000 " % ( solveInDS , extOutFileStrSol, self.outDS["Solve"], extFileStr,  int(TNFiles) )
-
-
-
-			if  (True == self.GridOptions["reUseSolveLibDS"]) and  self.GridOptions["solveLibDS"]   != "":
-				scriptStr += " --libDS %s "        % self.GridOptions["solveLibDS"]
-
-
-			scriptStr += " --tmpDir %s >& tmpSubJobInfo_prunSolve.txt; \n" % self.GridOptions["TmpWorkDir"]
-
-			script.write(scriptStr)
-			script.close()
-
-
-		else : 
-			print "Hi, except accumulate and solve, where do you want to go?"
-
-
-
-	def send(self) :
-
-		os.system("pwd")
-		os.system("chmod 777 %s" % self.SCRIPTNAME)
-
-		print "----------------------------------------------"
-		if self.part == "Accumulate":           
-			print "Sending the %dth iteration accumulation job to grid at site ... %s" % (self.i, self.GridOptions["siteName"])
-		 
-			if self.Datasets.containType("Customed") :
-				for i in range(len(self.Datasets.namesList("Customed"))) :   
-					os.system(" rm -rf tmpSubJobInfo_Customed_%02d.txt" % i )
-		     
-			os.system(" rm -rf  tmpSubJobInfo_collision.txt tmpSubJobInfo_Bon.txt tmpSubJobInfo_Boff.txt ")
-			os.system("source %s" % self.SCRIPTNAME)
-		     
-
-			if self.Datasets.containType("Customed") :
-				if self.Datasets.doDetailedTagsConfig() :
-					for i in range(len(self.Datasets.namesList("Customed"))) :
-						os.system("cat tmpSubJobInfo_Customed_%02d.txt                 >> %s\n" % (i, self.AccSubInfo))
-						os.system("cat tmpSubJobInfo_Customed_%02d.txt | grep -i JobID >> %s\n" % (i, self.AccSubJobID))
-				else :
-					print " you don't plan to do detailed tags configuration for every dataset, so will submit only one job with long inDS: "
-			     	                                       
-			     	
-			if (self.Datasets.containType("900GeV") or self.Datasets.containType("7TeV")) :
-				if self.GridOptions["ColCPUs"][self.i]:
-					os.system("cat tmpSubJobInfo_collision.txt                 >> %s\n" % (self.AccSubInfo))
-					os.system("cat tmpSubJobInfo_collision.txt | grep -i JobID >> %s\n" % (self.AccSubJobID))
-				 	
-				if self.GridOptions["CosBonCPUs"][self.i]:
-					os.system("cat tmpSubJobInfo_Bon.txt                       >> %s\n" % (self.AccSubInfo))
-					os.system("cat tmpSubJobInfo_Bon.txt       | grep -i JobID >> %s\n" % (self.AccSubJobID))
-				   	
-				if self.GridOptions["CosBoffCPUs"][self.i]:
-					os.system("cat tmpSubJobInfo_Boff.txt                      >> %s\n" % (self.AccSubInfo))
-					os.system("cat tmpSubJobInfo_Boff.txt      | grep -i JobID >> %s\n" % (self.AccSubJobID))
-
-
-		elif self.part == "Prun" :
-
-			print "  Sending the %dth iteration prun matrix solving job to grid site ... %s" % (self.i, self.GridOptions["siteName"])
-			os.system("rm -f tmpSubJobInfo_prunSolve.txt")
-			os.system("source %s" % self.SCRIPTNAME)
-			os.system("cat tmpSubJobInfo_prunSolve.txt                 >> %s\n" % (self.AccSubInfo))
-			os.system("cat tmpSubJobInfo_prunSolve.txt | grep -i JobID >> %s\n" % (self.AccSubJobID))
-	
-			print "----------------------------------------------"
-		
-		else : 
-
-			print "Hi, where do you want to go?"
-
-
-
-
-	def wait(self,logfilename):
-		print "Pathena wait()" 
-	
-		if self.jobId == -99:
-			print "logiflename: ",logfilename
-			ret, out = commands.getstatusoutput("cat "+logfilename)
-			lines = out.split('\n')
-             
-			# looping over all the job IDs
-			for line in lines:
-				items = line.split()
-				if len(items)>0 and items[0]=="JobID" :
-					self.jobId = int(items[2])
-					print "jobId = ",self.jobId
-
-				# check status of each job ID
-				# while self.bjobs() == 0:
-				while self.bjobs() != 1:       
-					print " waiting for jobID ",self.jobId,"..."
-					time.sleep(300)
-
-
-
-
-
-	def bjobs(self) :
-		if self.jobId == -99:
-			print "need jobId"
-			sys.exit(3)
-	
-		print "Pathena bjobs(), jobId: ",self.jobId
-		jobId = self.jobId
-		bjobstring = "pbook -c 'show(" + str(jobId) + ")'"
-		print bjobstring
-		ret, out = commands.getstatusoutput(bjobstring)
-		print "statusoutput: ",out
-		for line in out.split("\n") :
-			items_1 = line.split()
-			if len(items_1)>0 and items_1[0] != "jobStatus" :
-				continue
-	
-			if len(items_1)>2 :
-				if items_1[2] == "frozen" :
-					print "jobStatus: " , items_1[2]
-	
-					### search the libDS #######   
-					for line2 in out.split("\n") :
-						print " line2: " , line2
-						items_2 = line2.split()
-						if items_2[0] == "libDS" :
-							break 
-	
-					if self.part == "Accumulate" and self.GridOptions["accumulateLibDS"] == "" :   
-						self.GridOptions["accumulateLibDS"] = items_2[2]
-						print " self.GridOptions accumulateLibDS: " , self.GridOptions["accumulateLibDS"]
-	
-					if (self.part == "Grid" or self.part == "Prun") and self.GridOptions["solveLibDS"] == "":
-						self.GridOptions["solveLibDS"     ] = items_2[2]                               
-						print " self.GridOptions solveLibDS: "      , self.GridOptions["solveLibDS"]
-	                                  
-					return 1
-				else :
-					print "jobStatus: ",items_1[2]
-					return 0
-	
-
-
-	def whetherRetry(self) :               
-		nfailed   = 0
-		nfinished = 0
-		if self.jobId == -99 :
-			print "need jobId, JOB SUBMISSION FAILED!!!, check the log files"
-			sys.exit(3)
-	
-		print "Pathena bjobs(), jobId: ",self.jobId
-		jobId = self.jobId
-		bjobstring = "pbook -c 'show(" + str(jobId) + ")'"
-		print bjobstring
-		ret, out = commands.getstatusoutput(bjobstring)
-               
-		lines  = out.split("\n")
-		nlines = len(lines)
-		print " nlines: " , nlines
-	
-		for i in range(0, nlines) :
-			items = lines[i].split()
-			print " items: " , items
-			if "failed"   in items :
-				nfailed   = int(items[-1])
-			if "finished" in items :
-				nfinished = int(items[-1])
-				# Hi, just stop, next line will cause the loop crash ...
-				break
-
-
-		if (self.retryNo == 0) and (self.i == 0) : 
-			if ( 0 == (nfailed + nfinished - 1) ) : 
-				successRatio = -1 
-			else : 
-				successRatio = float(nfinished - 1)/(nfailed + nfinished - 1) 
-		else : 
-			successRatio = float(nfinished)/(nfailed + nfinished) 
-
-
-		print "the success ratio: ", successRatio
-		if successRatio >= self.GridOptions["successRatioCut"] :
-			print "The success ratio is higher than the cut, will not retry ---"
-			return False
-		else :
-			print "The success ratio is lower than the cut, will retry ---"
-			return True
-	
-
-
-
-
-	def retry(self) :
-		jobId = self.jobId
-		retrystring = "pbook -c 'retry(" + str(jobId) + ")'"   
-		ret, out    = commands.getstatusoutput(retrystring)
-		print " out1: " , out
-		#self.jobId =  self.jobId + 2
-
-		## get the new JobID ## 
-		for line in out.split("\n") : 
-			items = line.split() 
-			nitems = len(items) 
-			for i in range(0, nitems) : 
-				if items[i] == "New" : 
-					jobstring = items[i+1].split("=") 
-					self.jobId = int(jobstring[-1]) 
-					print "new JobID: " , self.jobId 
-					break 
-		self.retryNo = self.retryNo + 1 
-
-
-
-		while self.bjobs() != 1 :
-			print " waiting for the first retry jobID " , self.jobId , "..."
-			time.sleep(300)
-	
-		if self.whetherRetry() :
-			jobId = self.jobId
-			retrystring = "pbook -c 'retry(" + str(jobId) + ")'"
-			ret, out    = commands.getstatusoutput(retrystring)
-			print " out2: " , out
-	
-			#self.jobId = self.jobId + 2
-
-			## get the new JobID ## 
-			for line in out.split("\n") : 
-				items = line.split() 
-				nitems = len(items) 
-				for i in range(0, nitems) : 
-					if items[i] == "New" : 
-						jobstring = items[i+1].split("=") 
-						self.jobId = int(jobstring[-1]) 
-						print "new JobID: " , self.jobId 
-						break 
-			self.retryNo = self.retryNo + 1
-
-
-
-			while self.bjobs() != 1 :
-				print " waiting for the second retry jobID " , self.jobId,"..."
-				time.sleep(300)
-	
-			
-	
-	def getGridOptions(self, option = "") :
-		return self.GridOptions[option]
-	
-	def setGridOptions(self, option1 = "", option2 = "") :
-		self.GridOptions[option1] = option2
-
-
-
-
-
-
-
-
-
-class writeScriptGrid :		
-	def __init__(self,
-		     OutputPath,
-		     preName,
-		     iter,
-		     part,
-		     CMTDIR,
-		     ATHENAREL,
-		     TAGS,
-		     SCRIPTNAME,
-		     Datasets,
-		     outDS,
-		     AccSubJobID,
-		     AccSubInfo,
-		     JOBNAMES,
-		     thisJobDir,
-		     jobId,
-		     GridOptions = {},
-		     AlignmentOptions = {}
-		     ):
-		self.OutputPath       = OutputPath
-		self.preName          = preName
-		self.i                = iter
-		self.part             = part
-		self.CMTDIR           = CMTDIR
-		self.ATHENAREL        = ATHENAREL
-		self.TAGS             = TAGS
-		self.SCRIPTNAME       = SCRIPTNAME
-		self.Datasets         =  Datasets
-		self.outDS            = outDS
-		self.AccSubJobID      = AccSubJobID 
-		self.AccSubInfo       = AccSubInfo	
-		self.JOBNAMES         = JOBNAMES
-		self.thisJobDir       = thisJobDir
-		self.jobId            = -99
-		self.GridOptions      = GridOptions
-		self.AlignmentOptions = AlignmentOptions
-
-
-	def write(self):
-
-
-		extOutFile = []
-
-		extOutFile.append("hitmap.bin")
-		extOutFile.append("matrix.bin")
-		extOutFile.append("vector.bin")
-			
-
-		if (    ("sctAlignmentLevel"          in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevel"]          == 3 ) or 
-			("sctAlignmentLevelBarrel"    in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevelBarrel"]    == 3)  or 
-			("sctAlignmentLevelEndcaps"   in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevelEndcaps"]   == 3)  or 
-			("pixelAlignmentLevel"        in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevel"]        == 3)  or 
-			("pixelAlignmentLevelBarrel"  in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevelBarrel"]  == 3)  or 
-			("pixelAlignmentLevelEndcaps" in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevelEndcaps"] == 3) ) : 
-			#extOutFile.append("vector.txt")
-			print "hmmn, you plan to do Level 3 alignment ... "
-
-			### put the three flags writeMatrixFileTxt,writeHitmapTxt,writeEigenMatTxt in the GridOptions, not in the AlignmentOptions
-			if ( "writeMatrixFileTxt" in self.GridOptions  and self.GridOptions["writeMatrixFileTxt"] == True  ) : 
-				extOutFile.append("matrix.txt")
-				extOutFile.append("vector.txt")
-			if ( "writeHitmapTxt"     in self.GridOptions  and self.GridOptions["writeHitmapTxt"]     == True  ) :        
-				extOutFile.append("hitmap.txt")
-
-		else :
-			extOutFile.append("matrix.txt")
-			extOutFile.append("hitmap.txt")				
-			if ( "writeMatrixFileTxt" in self.GridOptions  and self.GridOptions["writeMatrixFileTxt"] == False  ) :        
-				extOutFile.remove("matrix.txt")
-			if ( "writeHitmapTxt"     in self.GridOptions  and self.GridOptions["writeHitmapTxt"    ] == False  ) :        
-				extOutFile.remove("hitmap.txt")
-
-			
-		extOutFileStr = ",".join(extOutFile)
-
-
-		if self.GridOptions["doMonitoring"] :
-			extOutFileStrAcc = extOutFileStr + ",monitoring.root"
-		if self.GridOptions["doTrkNtuple"]  :
-			extOutFileStrAcc += ",TrkValidation.root"
-
-
-		if self.part == "Accumulate":
-			print self.SCRIPTNAME
-			script = open(self.SCRIPTNAME,'w')
-
-			if self.Datasets.containType("Customed") : 
-				if self.Datasets.doDetailedTagsConfig() : 
-					for index in range(len(self.Datasets.namesList("Customed"))) :
-
-						if ("group" in self.GridOptions["userIDnum"] ) :
-							scriptStr   = "pathena  --official --voms=atlas:/atlas/det-indet/Role=production %s  " % (self.JOBNAMES["Customed"][index])
-						else : 
-							scriptStr   = "pathena  %s  " % (self.JOBNAMES["Customed"][index])
-						
-						if self.GridOptions["accumulateLibDS"]   != "":
-							scriptStr += " --libDS %s "        % self.GridOptions["accumulateLibDS"]
-							scriptStr += " --excludeFile %s "  % "*.cxx,*.h,*.o"
-
-						if  "removeFileList" in self.GridOptions : 
-							if self.GridOptions["removeFileList"] != "" :
-								scriptStr += " --removeFileList %s " % self.GridOptions["removeFileList"] 
-
-						if self.GridOptions["fileList"]     != "":
-							scriptStr += " --fileList %s "     % self.GridOptions["fileList"]
-						if self.GridOptions["siteName"]     != "":
-							scriptStr += " --site %s "         % self.GridOptions["siteName"]
-						if self.GridOptions["excludedSite"] != "":
-							scriptStr += " --excludedSite %s " % self.GridOptions["excludedSite"]
-						if self.GridOptions["dbRelease"]    == "":
-							scriptStr += " --dbRelease LATEST "
-						else:
-							scriptStr += " --dbRelease %s "    % self.GridOptions["dbRelease"]
-
-
-						#if self.GridOptions["reUseAccumulateLibDS"] :
-						if (0 == self.i) and os.path.isfile("initial_AlignmentConstants.root") : 
-							scriptStr += " --extFile  initial_AlignmentConstants.root,Scaling.root  "    
-						else :
-							lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-							if os.path.isfile("%s"  % lastAlignConstant ) :  
-								scriptStr += " --extFile %s,Scaling.root  "      % lastAlignConstant    
-						
-						#print index
-						#print self.Datasets.namesList("Customed")[index]
-						#print self.outDS["Customed"][index]
-						#print self.Datasets.nFiles("Customed")[index]
-						#print self.GridOptions["CustomedCPUs"][index]
-
-
-						if self.GridOptions["debugLevel"] == 4 :
-							self.GridOptions["doNFilesPerJobSplit"] = False 
-							scriptStr += " --nEventsPerJob %s" % self.GridOptions["nEventsPerJob"]
-
-						if self.GridOptions["doNFilesPerJobSplit" ] :
-							if (-1 != self.GridOptions["CustomedNFiles"][index]) : 
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.GridOptions["CustomedNFiles"][index], self.GridOptions["CustomedNFPJ"][index], self.GridOptions["TmpWorkDir"], int(index) )
-
-							else : 
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s  --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.GridOptions["CustomedNFPJ"][index], self.GridOptions["TmpWorkDir"], int(index) )
-
-						else : 
-							if (-1 != self.GridOptions["CustomedNFiles"][index]) :
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.GridOptions["CustomedNFiles"][index], self.GridOptions["CustomedCPUs"][index], self.GridOptions["TmpWorkDir"], int(index) )
-
-							else :   
-								scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_Customed_%02d.txt ; \n" % ( self.Datasets.namesList("Customed")[index], self.outDS["Customed"][index], extOutFileStrAcc, self.Datasets.nFiles("Customed")[index], self.GridOptions["CustomedCPUs"][index], self.GridOptions["TmpWorkDir"], int(index) )
-						script.write(scriptStr)
-
-				else : 
-					print " you don't plan to do detailed tags configuration for every dataset, so will submit only one job with a LONG inDS: "
-
-					if ( "group" in self.GridOptions["userIDnum"] ) :
-						scriptStr   = "pathena  --official --voms=atlas:/atlas/det-indet/Role=production  %s  " % (self.JOBNAMES["Customed"][0])
-					else :
-						scriptStr   = "pathena  %s  " % (self.JOBNAMES["Customed"][0])
-
-					#if self.GridOptions["accumulateLibDS"]   != "":
-					#	scriptStr += " --libDS %s "        % self.GridOptions["accumulateLibDS"]
-					if self.GridOptions["fileList"]     != "":
-						scriptStr += " --fileList %s "     % self.GridOptions["fileList"]
-					if self.GridOptions["siteName"]     != "":
-						scriptStr += " --site %s "         % self.GridOptions["siteName"]
-					if self.GridOptions["excludedSite"] != "":
-						scriptStr += " --excludedSite %s " % self.GridOptions["excludedSite"]
-					if self.GridOptions["dbRelease"]    == "":
-						scriptStr += " --dbRelease LATEST "
-					else:
-						scriptStr += " --dbRelease %s "    % self.GridOptions["dbRelease"]
-
-
-					#if self.GridOptions["reUseAccumulateLibDS"] :
-					if (0 == self.i) and os.path.isfile("initial_AlignmentConstants.root") :
-						scriptStr += " --extFile  initial_AlignmentConstants.root "      
-					else :
-						lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-						if os.path.isfile("%s"  % lastAlignConstant ) :
-							scriptStr += " --extFile %s "      % lastAlignConstant
-
-
-					if self.GridOptions["doNFilesPerJobSplit" ] :
-						scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_Customed.txt ; \n" % ( self.Datasets.namesList("Customed"), self.outDS["Customed"][0], extOutFileStrAcc, self.Datasets.nFiles("Customed"), self.GridOptions["CustomedNFPJ"][0], self.GridOptions["TmpWorkDir"] )
-					else : 
-						scriptStr += " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_Customed.txt ; \n" % ( self.Datasets.namesList("Customed"), self.outDS["Customed"][0], extOutFileStrAcc, self.Datasets.nFiles("Customed"), self.GridOptions["CustomedCPUs"][0], self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr)
-
-
-			######################################################################################################################################		
-			if (self.Datasets.containType("900GeV") or self.Datasets.containType("7TeV")) :
-
-				if self.GridOptions["ColCPUs"][self.i]:
-					scriptStr   = "pathena  %s  " % (self.JOBNAMES["Collision"])
-				if self.GridOptions["CosBonCPUs"][self.i]:
-					scriptStr   = "pathena  %s  " % (self.JOBNAMES["CosBon"])
-				if self.GridOptions["CosBoffCPUs"][self.i]:
-					scriptStr   = "pathena  %s  " % (self.JOBNAMES["CosBoff"])
-
-				#if self.GridOptions["accumulateLibDS"]   != "":
-				#	scriptStr += "--libDS %s "        % self.GridOptions["accumulateLibDS"]
-
-				if self.GridOptions["fileList"]     != "":
-					scriptStr += "--fileList %s "     % self.GridOptions["fileList"]
-
-				if self.GridOptions["siteName"]     != "":
-					scriptStr += "--site %s "         % self.GridOptions["siteName"]
-
-				if self.GridOptions["excludedSite"] != "":
-					scriptStr += "--excludedSite %s " % self.GridOptions["excludedSite"]
-			
-				if self.GridOptions["dbRelease"]    == "":
-					scriptStr += "--dbRelease LATEST "
-				else:
-					scriptStr += "--dbRelease %s "    % self.GridOptions["dbRelease"] 
-		
-
-				#if self.GridOptions["reUseAccumulateLibDS"] :
-
-				if (0 == self.i) and os.path.isfile("initial_AlignmentConstants.root") :
-					scriptStr += " --extFile  initial_AlignmentConstants.root "
-				else :                                         
-					lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-					if os.path.isfile("%s"  % lastAlignConstant ) :    
-						scriptStr += " --extFile %s "      % lastAlignConstant
-
-
-        	                ########################## for submitting different topology jobs ########################################################################
-				if self.GridOptions["ColCPUs"][self.i] :
-					if self.GridOptions["doNFilesPerJobSplit" ] :
-						scriptStr_forCollision = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --nFilesPerJob %d --tmpDir %s  >& tmpSubJobInfo_collision.txt ; \n" % ( self.Datasets.namesList("Collision"), self.outDS["Collision"], extOutFileStrAcc, self.Datasets.nFiles("Collision"), self.GridOptions["ColNFPJ"][self.i], self.GridOptions["TmpWorkDir"] )   
-					else : 
-						scriptStr_forCollision = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d        --tmpDir %s  >& tmpSubJobInfo_collision.txt ; \n" % ( self.Datasets.namesList("Collision"), self.outDS["Collision"], extOutFileStrAcc, self.Datasets.nFiles("Collision"), self.GridOptions["ColCPUs"][self.i], self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr_forCollision)
-
-				if self.GridOptions["CosBonCPUs"][self.i]:
-					scriptStr_forBon       = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d --tmpDir %s  >& tmpSubJobInfo_Bon.txt ;       \n" % ( self.Datasets.namesList("CosBon"),    self.outDS["CosBon"], extOutFileStrAcc, self.Datasets.nFiles("Bon"),       self.GridOptions["CosBonCPUs"][self.i],   self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr_forBon)
-
-				if self.GridOptions["CosBoffCPUs"][self.i]:
-					scriptStr_forBoff      = scriptStr + " --inDS %s --outDS %s --extOutFile %s --nFiles %d --split %d --tmpDir %s  >& tmpSubJobInfo_Boff.txt ;      \n" % (self.Datasets.namesList("CosBoff"), self.outDS["CosBoff"],   extOutFileStrAcc, self.Datasets.nFiles("Boff"),      self.GridOptions["CosBoffCPUs"][self.i], self.GridOptions["TmpWorkDir"] )
-					script.write(scriptStr_forBoff)
-			script.close()
-
-
-
-		elif self.part == "Grid" :
-			print self.SCRIPTNAME
-			script     = open(self.SCRIPTNAME,'w')
-		
-			extOutFileStrSol = extOutFileStr + ",Iter%02d_AlignmentConstants.root,OldSiAlignment.txt,OutputSiAlignment.txt,mycool.db,alignlogfile.txt" % (self.i)
- 			#  should consider more details about how to get one files and the corresponding geometry/condition tags, below is just temporary solution 
-			'''
-			if self.Datasets.containType("Customed") :
-				scriptStr  = "pathena %s --inDS %s --fileList %s --outDS %s --extOutFile %s --nEventsPerFile 1 --nEventsPerJob 1 --nFilesPerJob 1  " % (self.JOBNAMES["Solve"], self.Datasets.oneDatasetName("Customed"), self.Datasets.oneFileName("Customed"),   self.outDS["Solve"], extOutFileStrSol)
-
-			if (self.Datasets.containType("900GeV") or self.Datasets.containType("7TeV")) :
-				scriptStr  = "pathena %s --inDS %s --fileList %s --outDS %s --extOutFile %s --nEventsPerFile 1 --nEventsPerJob 1 --nFilesPerJob 1  " % (self.JOBNAMES["Solve"], self.Datasets.oneDatasetName("Collision"), self.Datasets.oneFileName("Collision"), self.outDS["Solve"], extOutFileStrSol)
-			'''
- 
-			if ( "group" in self.GridOptions["userIDnum"] ) :
-				scriptStr  = "pathena  --official --voms=atlas:/atlas/det-indet/Role=production  %s  --outDS %s --extOutFile %s --nEventsPerFile 1 --nEventsPerJob 1 --nFilesPerJob 1  " % (self.JOBNAMES["Solve"], self.outDS["Solve"], extOutFileStrSol)
-			      
-			else :
-				scriptStr  = "pathena %s  --outDS %s --extOutFile %s --nEventsPerFile 1 --nEventsPerJob 1 --nFilesPerJob 1  " % (self.JOBNAMES["Solve"], self.outDS["Solve"], extOutFileStrSol)
-
-
-			if ( True == self.GridOptions["reUseSolveLibDS"] ) and self.GridOptions["solveLibDS"]   != "":
-				scriptStr += "--libDS %s "        % self.GridOptions["solveLibDS"]
-
-			if self.GridOptions["siteName"]     != "":
-				scriptStr += "--site %s "         % self.GridOptions["siteName"]
-
-			if self.GridOptions["excludedSite"] != "":
-				scriptStr += "--excludedSite %s " % self.GridOptions["excludedSite"]
-
-			if self.GridOptions["dbRelease"]    == "":
-				scriptStr += "--dbRelease LATEST "
-			else:
-				scriptStr += "--dbRelease %s "    % self.GridOptions["dbRelease"]
-
-
-
-			if (0 == self.i) and os.path.isfile("initial_AlignmentConstants.root") :
-				scriptStr += " --extFile  initial_AlignmentConstants.root,"
-			else :
-				lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-				if os.path.isfile("%s"  % lastAlignConstant ) :
-					scriptStr += " --extFile %s,"      % lastAlignConstant
-
-			scriptStr += "*.bin "
-
-			if self.GridOptions["reUseSolveLibDS"] : 
-				#ret, out = commands.getstatusoutput("cat %s" % GridAccOutDS)
-				ret, out = commands.getstatusoutput("cat GridAccOutDS.txt")
-				print "out: ",out
-				lines = out.split('\n')
-				extFiles = []
-				 
-
-				#fileName = open('GridAccOutDS.txt', 'r+')				
- 				#ret, out = commands.getstatusoutput('fileName.read()')
-				#lines = out.split('\n')
-				#extFiles = []
-
-				#for line in lines :
-				#	print "line: ", line
-				#	thisStr = "%s/\*.bin" % line
-				#	extFiles.append(thisStr)
-				#print " thisStr: " , thisStr
-				#extFileStr = ",".join(extFiles)
-				#print " extFileStr: " , extFileStr
-				#scriptStr += " --extFile %s "     %  extFileStr
-
-
-
-			scriptStr += " --tmpDir %s >& tmpSubJobInfo_solve.txt; \n" % self.GridOptions["TmpWorkDir"]
-
-			script.write(scriptStr)
-			script.close()
-
-		elif self.part == "Prun" :
-			print self.SCRIPTNAME
-			script     = open(self.SCRIPTNAME,'w')
-
-
-			prunSolve = open("prunSolve.py",'w')
-			prunSolve.write('import os\nimport commands, string\nimport sys\n\n\n')
-			prunSolve.write('inputHitmapFiles = []\ninputMatrixFiles = []\ninputVectorFiles = []\ninFiles = []\n\n\n')
-			prunSolve.write('ret, out = commands.getstatusoutput(\"cat input1.txt\")\n')
-			prunSolve.write('print \" the content of file input1.txt:  \", out \n')
-			prunSolve.write('lines = out.split(\",\")\n')
-			prunSolve.write('for line in lines:\n')
-			prunSolve.write('\tif \"hitmap.bin\" in str(line):\n\t\tif \"dcap://\" in str(line) :\n\t\t\tos.system(\" dccp %s ./\" % str(line) )\n\t\t\tlineHitmap = line.split(\'/\')[-1]\n\t\t\tprint \'file name retrived after splitting dcap address is %s \' % lineHitmap\n\t\t\tinputHitmapFiles.append(lineHitmap)\n\t\telse : \n\t\t\tinputHitmapFiles.append(line)\n')
-			prunSolve.write('\tif \"vector.bin\" in str(line):\n\t\tif \"dcap://\" in str(line) :\n\t\t\tos.system(\" dccp %s ./\" % str(line) )\n\t\t\tlineVector = line.split(\'/\')[-1]\n\t\t\tprint \'file name retrived after splitting dcap address is %s \' % lineVector\n\t\t\tinputVectorFiles.append(lineVector)\n\t\telse : \n\t\t\tinputVectorFiles.append(line)\n')
-			prunSolve.write('\tif \"matrix.bin\" in str(line):\n\t\tif \"dcap://\" in str(line) :\n\t\t\tos.system(\" dccp %s ./\" % str(line) )\n\t\t\tlineMatrix = line.split(\'/\')[-1]\n\t\t\tprint \'file name retrived after splitting dcap address is %s \' % lineMatrix\n\t\t\tinputMatrixFiles.append(lineMatrix)\n\t\telse : \n\t\t\tinputMatrixFiles.append(line)\n')
-
-			tmpStrJO = "newSolveJO_Iter%02d.py" % self.i
-			prunSolve.write('jofile = open( \'%s\' , \'w+\')\n' % tmpStrJO )
-
-
-			tmpStr = ""
-			if (0 == self.i) : 
-				if os.path.isfile("initial_AlignmentConstants.root") :
-					tmpStr = "pool_insertFileToCatalog  initial_AlignmentConstants.root "
-			else :
-				alignConstants = "Iter%02d_AlignmentConstants.root" % (self.i - 1)
-				if os.path.isfile(alignConstants) :
-					tmpStr = "pool_insertFileToCatalog  %s "  % alignConstants
-				else : 
-					print "ALIGNMENT CONSTANTS %s NOT EXIST, WILL EXIT ANYHOW !!!  "  % alignConstants
-					sys.exit()
-
-
-			prunSolve.write('jofile.write(\'os.system(\\\"%s\\\")\\n\')\n'  % tmpStr)
-			prunSolve.write('jofile.write(\"inputHitmapFiles = \" + str(inputHitmapFiles) + \'\\n\')\n')
-			prunSolve.write('jofile.write(\"inputVectorFiles = \" + str(inputVectorFiles) + \'\\n\')\n')
-			prunSolve.write('jofile.write(\"inputMatrixFiles = \" + str(inputMatrixFiles) + \'\\n\')\n')
-
-			prunSolve.write('ff = open(\'%s\', \'r\')\n' % self.JOBNAMES["Solve"] )                               
-			prunSolve.write('jofile.write(ff.read())\nff.close()\njofile.close()\n')
-
-			prunSolve.write('os.system(\"athena.py %s \")\n'  % tmpStrJO )
-
-			# debugging ...
-			print "prunSolve.py: "
-			os.system(" cat prunSolve.py ")
-			print " newSolveJO_Iter%02d.py: " % self.i
-			os.system(" cat %s " % tmpStrJO)
-
-
-			#extOutFileStrSol = "prunSolve.py,newSolveJO_Iter%02d.py,"  % (self.i)	
-			extOutFileStrSol = ""
-
-			if (    ("sctAlignmentLevel"          in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevel"]          == 3 ) or 
-				("sctAlignmentLevelBarrel"    in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevelBarrel"]    == 3)  or 
-				("sctAlignmentLevelEndcaps"   in self.AlignmentOptions and self.AlignmentOptions["sctAlignmentLevelEndcaps"]   == 3)  or 
-				("pixelAlignmentLevel"        in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevel"]        == 3)  or 
-				("pixelAlignmentLevelBarrel"  in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevelBarrel"]  == 3)  or 
-				("pixelAlignmentLevelEndcaps" in self.AlignmentOptions and self.AlignmentOptions["pixelAlignmentLevelEndcaps"] == 3) ) : 
-				print "hmn, you are going to run L3 alignment, Eigen is going to be used, so no eigen value information!!! "
-
-			else : 
-				if ( "writeEigenMat"      in self.GridOptions  and self.GridOptions["writeEigenMat"]    == True  ) and ( self.AlignmentOptions["runLocal"] == False ):
-					extOutFileStrSol += "eigenvectors.bin,";
-					extOutFileStrSol += "eigenvalues.bin," ;
-
-				if ( "writeEigenMatTxt"   in self.GridOptions  and self.GridOptions["writeEigenMatTxt"] == True  ) and ( self.AlignmentOptions["runLocal"] == False ):
-					extOutFileStrSol += "eigenvectors.txt,";
-					extOutFileStrSol += "eigenvalues.txt," ;
-
-			extOutFileStrSol = extOutFileStrSol + extOutFileStr + ",Iter%02d_AlignmentConstants.root,OldSiAlignment.txt,OutputSiAlignment.txt,mycool.db,alignlogfile.txt" % (self.i)
-
-			extFileStr = ""
-			if (0 == self.i) and os.path.isfile("initial_AlignmentConstants.root") :
-				extFileStr = " initial_AlignmentConstants.root "
-			else :
-				lastAlignConstant = "Iter%02d_AlignmentConstants.root"  %  (self.i-1)
-
-				if os.path.isfile("%s"  % lastAlignConstant ) :
-					extFileStr = lastAlignConstant
-
-
-
-			TNFiles = 0
-			tmpInDS = []
-			print " self.outDS : " , self.outDS
-
-			print " self.outDS[Customed]: " , self.outDS["Customed"]
-			for item in self.outDS["Customed"] : 
-				print "self.outDS[Customed] item:  " , item
-				tmpInDS.append(item+"/")
-				rec, nFiles = commands.getstatusoutput("dq2-ls -f %s | grep -i files | grep -i total | cut -c 13-" %  (item+"/") )
-				print " nFiles of this outDS[Customed] :" , nFiles
-				TNFiles += int(nFiles)
-
-			solveInDS = ",".join(tmpInDS) 
-			#scriptStr = " prun --exec \" python prunSolve.py \" --writeInputToTxt IN:input1.txt --athenaTag 15.8.0,AtlasProduction --inDS %s --outputs %s --outDS %s --extFile %s --nJobs 1 --nFilesPerJob %d -v --maxNFilesPerJob 100000 " % ( (self.outDS["Customed"][0]+"/") , extOutFileStrSol, self.outDS["Solve"], extFileStr,  int(float(nFiles)) )
-
-			if ( "group" in self.GridOptions["userIDnum"] ) :
-				scriptStr = " prun --exec \" python prunSolve.py \" --writeInputToTxt IN:input1.txt --official --voms=atlas:/atlas/det-indet/Role=production --express --athenaTag %s,AtlasProduction --inDS %s --outputs %s --outDS %s --extFile %s --nJobs 1 --nFilesPerJob %d -v --maxNFilesPerJob 100000 " % (self.ATHENAREL, solveInDS , extOutFileStrSol, self.outDS["Solve"], extFileStr,  int(TNFiles) )
-
-			else : 
-				scriptStr = " prun --exec \" python prunSolve.py \" --writeInputToTxt IN:input1.txt --express --athenaTag %s,AtlasProduction --inDS %s --outputs %s --outDS %s --extFile %s --nJobs 1 --nFilesPerJob %d -v --maxNFilesPerJob 100000 " % (self.ATHENAREL, solveInDS , extOutFileStrSol, self.outDS["Solve"], extFileStr,  int(TNFiles) )
-
-			if  (True == self.GridOptions["reUseSolveLibDS"]) and  self.GridOptions["solveLibDS"]   != "":
-				scriptStr += " --libDS %s "        % self.GridOptions["solveLibDS"]
-
-			scriptStr += " --tmpDir %s >& tmpSubJobInfo_prunSolve.txt; \n" % self.GridOptions["TmpWorkDir"]
-
-			script.write(scriptStr)
-			script.close()
-
-
-		else:
-		   print "Hi, except accumulate and solve, where do you want to go?"
-			
-			
-	def send(self):
-		os.system("pwd")
-		os.system("chmod 777 %s" % self.SCRIPTNAME)
-
-		print "----------------------------------------------"
-		if self.part == "Accumulate":		
-			print "Sending %s_Iter%02d accumulation job to grid at site ... %s" % (self.preName, self.i, self.GridOptions["siteName"])
-
-			if self.Datasets.containType("Customed") :
-				for i in range(len(self.Datasets.namesList("Customed"))) :   
-					os.system(" rm -rf tmpSubJobInfo_Customed_%02d.txt" % i )
-
-			os.system(" rm -rf  tmpSubJobInfo_collision.txt tmpSubJobInfo_Bon.txt tmpSubJobInfo_Boff.txt ")
-			os.system("source %s" % self.SCRIPTNAME)
-
-			if self.Datasets.containType("Customed") :
-				if self.Datasets.doDetailedTagsConfig() :
-					for i in range(len(self.Datasets.namesList("Customed"))) :
-						os.system("cat tmpSubJobInfo_Customed_%02d.txt                 >> %s\n" % (i, self.AccSubInfo))
-						os.system("cat tmpSubJobInfo_Customed_%02d.txt | grep -i JobID >> %s\n" % (i, self.AccSubJobID))
-				else : 
-					print " you don't plan to do detailed tags configuration for every dataset, so will submit only one job with long inDS: "
-					
-
-			if (self.Datasets.containType("900GeV") or self.Datasets.containType("7TeV")) :
-				if self.GridOptions["ColCPUs"][self.i]:
-					os.system("cat tmpSubJobInfo_collision.txt                 >> %s\n" % (self.AccSubInfo))
-					os.system("cat tmpSubJobInfo_collision.txt | grep -i JobID >> %s\n" % (self.AccSubJobID))
-
-				if self.GridOptions["CosBonCPUs"][self.i]:
-					os.system("cat tmpSubJobInfo_Bon.txt                       >> %s\n" % (self.AccSubInfo))
-					os.system("cat tmpSubJobInfo_Bon.txt       | grep -i JobID >> %s\n" % (self.AccSubJobID))
-
-				if self.GridOptions["CosBoffCPUs"][self.i]:
-					os.system("cat tmpSubJobInfo_Boff.txt                      >> %s\n" % (self.AccSubInfo))
-					os.system("cat tmpSubJobInfo_Boff.txt      | grep -i JobID >> %s\n" % (self.AccSubJobID))
-
-
-		elif self.part == "Grid" :
-
-			print "  Sending %s_Iter%02d matrix solving job to grid site %s" % (self.preName, self.i, self.GridOptions["siteName"])
-			os.system("rm -f tmpSubJobInfo_solve.txt")
-			os.system("source %s" % self.SCRIPTNAME)
-			os.system("cat tmpSubJobInfo_solve.txt                 >> %s\n" % (self.AccSubInfo))
-			os.system("cat tmpSubJobInfo_solve.txt | grep -i JobID >> %s\n" % (self.AccSubJobID))
-
-			print "----------------------------------------------"
-
-		elif self.part == "Prun" :
-
-			print "  Sending %s_Iter%02d prun matrix solving job to grid site %s" % (self.preName, self.i, self.GridOptions["siteName"])
-			os.system("rm -f tmpSubJobInfo_prunSolve.txt")
-			os.system("source %s" % self.SCRIPTNAME)
-			os.system("cat tmpSubJobInfo_prunSolve.txt                 >> %s\n" % (self.AccSubInfo))
-			os.system("cat tmpSubJobInfo_prunSolve.txt | grep -i JobID >> %s\n" % (self.AccSubJobID))
-
-			print "----------------------------------------------"
-
-
-		else:
-			print "Hi, where do you want to go?"
-
-
-
-
-	# take this part from Muon alignment in Jobs.py
-	def wait(self,logfilename):
-		print "Pathena wait()" 
-
-		if self.jobId == -99:
-			print "logiflename: ",logfilename
-			ret, out = commands.getstatusoutput("cat "+logfilename)
-			lines = out.split('\n')
-			
-			# looping over all the job IDs
-			for line in lines:
-				items = line.split()
-				if len(items)>0 and items[0]=="JobID" :
-					self.jobId = int(items[2])
-					print "jobId = ",self.jobId
-
-				# check status of each job ID
-				# while self.bjobs() == 0:
-				while self.bjobs() != 1:	
-					print " waiting for jobID ",self.jobId,"..."
-					time.sleep(300)
-
-
-
-	def bjobs(self) :
-		if self.jobId == -99:
-			print "need jobId"
-			sys.exit(3)
-
-		print "Pathena bjobs(), jobId: ",self.jobId
-		jobId = self.jobId
-		bjobstring = "pbook -c 'show(" + str(jobId) + ")'"
-		print bjobstring
-		ret, out = commands.getstatusoutput(bjobstring)
-		print "statusoutput: ",out
-		for line in out.split("\n") :
-			items_1 = line.split()
-			if len(items_1)>0 and items_1[0] != "jobStatus" :
-				continue
-
-			if len(items_1)>2 :
-				if items_1[2] == "frozen" :
-					print "jobStatus: " , items_1[2]
-
-					### search the libDS #######	
-					for line2 in out.split("\n") : 
-						print " line2: " , line2 
-						items_2 = line2.split()
-						if items_2[0] == "libDS" :
-							break 
-
-					if self.part == "Accumulate" and self.GridOptions["accumulateLibDS"] == "" : 	
-						self.GridOptions["accumulateLibDS"] = items_2[2] 
-						print " self.GridOptions accumulateLibDS: " , self.GridOptions["accumulateLibDS"]
-
-					if (self.part == "Grid" or self.part == "Prun") and self.GridOptions["solveLibDS"] == "":
-						self.GridOptions["solveLibDS"     ] = items_2[2]				
-						print " self.GridOptions solveLibDS: "      , self.GridOptions["solveLibDS"]
-
-					
-					return 1
-				else :
-					print "jobStatus: ",items_1[2]
-					return 0
-
-
-
-
-	def whetherRetry(self) :	  	
-		nfailed   = 0
-		nfinished = 0
-		if self.jobId == -99 :
-			print "need jobId"
-			sys.exit(3)
-
-		print "Pathena bjobs(), jobId: ",self.jobId
-		jobId = self.jobId
-		bjobstring = "pbook -c 'show(" + str(jobId) + ")'"
-		print bjobstring
-		ret, out = commands.getstatusoutput(bjobstring)
-		
-		lines  = out.split("\n")
-		nlines = len(lines)
-		print " nlines: " , nlines
-
-		for i in range(0, nlines) : 
-			items = lines[i].split()
-			print " items: " , items
-			if "failed"   in items :
-				nfailed   = int(items[-1])
-			if "finished" in items :
-				nfinished = int(items[-1])
-				# Hi, just stop, next line will cause the loop crash ...
-				break
-
-		if (self.retryNo == 0) and (self.i == 0) : 
-			if ( 0 == (nfailed + nfinished - 1) ) : 
-				successRatio = -1 
-			else : 
-				successRatio = float(nfinished - 1)/(nfailed + nfinished - 1) 
-		else : 
-			successRatio = float(nfinished)/(nfailed + nfinished) 
-
-
-
-		print "the success ratio: ", successRatio
-		if successRatio >= self.GridOptions["successRatioCut"] :
-			print "The success ratio is higher than the cut, will not retry ---"
-			return False
-		else :
-			print "The success ratio is lower than the cut, will retry ---"
-			return True
-
-
-
-	def retry(self) :
-		jobId = self.jobId
-		retrystring = "pbook -c 'retry(" + str(jobId) + ")'"	
-		ret, out    = commands.getstatusoutput(retrystring)
-		print " out1: " , out 
-		#self.jobId =  self.jobId + 2
-
-		## get the new JobID ## 
-		for line in out.split("\n") : 
-			items = line.split() 
-			nitems = len(items) 
-			for i in range(0, nitems) : 
-				if items[i] == "New" : 
-					jobstring = items[i+1].split("=") 
-					self.jobId = int(jobstring[-1]) 
-					print "new JobID: " , self.jobId 
-					break 
-		self.retryNo = self.retryNo + 1
-
-
-
-		while self.bjobs() != 1 :
-			print " waiting for the first retry jobID " , self.jobId , "..."
-			time.sleep(300)
-
-		if self.whetherRetry() :
-			jobId = self.jobId
-			retrystring = "pbook -c 'retry(" + str(jobId) + ")'"
-			ret, out    = commands.getstatusoutput(retrystring)
-			print " out2: " , out
-
-			#self.jobId =self.jobId + 2
-
-
-			## get the new JobID ## 
-			for line in out.split("\n") : 
-				items = line.split() 
-				nitems = len(items) 
-				for i in range(0, nitems) : 
-					if items[i] == "New" : 
-						jobstring = items[i+1].split("=") 
-						self.jobId = int(jobstring[-1]) 
-						print "new JobID: " , self.jobId 
-						break 
-			self.retryNo = self.retryNo + 1 
-
-
-			while self.bjobs() != 1 :
-				print " waiting for the second retry jobID " , self.jobId,"..."
-				time.sleep(300)
-
-
-
-
-
-	def getGridOptions(self, option = "") : 
-		return self.GridOptions[option]
-
-	def setGridOptions(self, option1 = "", option2 = "") : 
-		self.GridOptions[option1] = option2
-
-
-
-
-
-class writeScriptAFS : 
-	def __init__(self,
-		     iter,
-		     JOBNAME,
-		     SCRIPTNAME,
-		     preName,
-		     QUEUE          = "8nh",
-		     CMTDIR         = "",
-		     ATHENAREL      = "",
-		     TAGS           = "",
-		     inputPoolFiles = ""
-		     ):
-
-		self.i              = iter
-		self.JOBNAME        = JOBNAME
-		self.SCRIPTNAME     = SCRIPTNAME
-		self.preName        = preName
-		self.QUEUE          = QUEUE
-		self.CMTDIR         = CMTDIR
-		self.ATHENAREL      = ATHENAREL
-		self.TAGS           = TAGS
-		self.inputPoolFiles = inputPoolFiles
-
-	def write(self) : 
-		script = open(self.SCRIPTNAME,'w')
-
-		script.write("\n")
-		script.write("#   setup the environment \n")
-		script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENAREL, self.TAGS))
-		for file in self.inputPoolFiles:
-			if "atlasdatadisk" in file: 
-				script.write("export STAGE_SVCCLASS=atldata\n")
-				break
-		for file in self.inputPoolFiles:
-			if "DAQ" in file:
-				script.write("export STAGE_SVCCLASS=atlcal\n")
-				break
-
-		for file in self.inputPoolFiles:
-			if 'ESD' in file or 'AlignmentConstants' in file:
-				script.write("pool_insertFileToCatalog "+ file + " \n")
-
-		nowPath = os.getcwd()
-		print"current path: ", nowPath
-
-		script.write("athena %s \n" % (nowPath + "/" + self.JOBNAME) )
-		script.close()
-
-
-	def send(self, runmode) :
-		os.system("chmod +x %s" % self.SCRIPTNAME)
-		if "Local" == runmode : 
-			print "Running Iter%02dSolve job locally ..." % (self.i)
-			os.system("sh %s | tee Iter%02dSolveLocally.log \n" % (self.SCRIPTNAME, self.i))
-
-		if "Batch" == runmode :
-			print "Submitting Iter%02dSolve job to queue %s ..." % (self.i, self.QUEUE)
-			os.system("bsub -q %s  %s" % (self.QUEUE, self.SCRIPTNAME) )
-
-
-	def wait(self) : 
-		print "Processing in lxbatch..."
-		time.sleep(60)
-		while os.popen('bjobs -w').read().find(self.preName) != -1:
-			time.sleep(30)
-
-
-
-def prepareForNextIter(OutputPath, iteration, GridSolvingOutDS, runSolveMode):
-
-	if ( "Grid"  == runSolveMode or "Prun" == runSolveMode ) :
-		print "GridSolveOutDS = ", (GridSolvingOutDS)
-		ret, outDS = commands.getstatusoutput("cat %s" % GridSolvingOutDS)
-		print "solve outDS: ",outDS
-
-		ret, out = commands.getstatusoutput("dq2-ls -f %s/ " % outDS)
-		rootlist = []
-
-		print "out: ",out
-		lines = out.split('\n')
-		for line in lines :
-			items = line.split()
-			for item in items :
-				print " item : " , item
-				if item.find("AlignmentConstants.root") != -1 :
-					rootlist.append(item)
-		rootstr = ",".join(rootlist)
-		print "rootstr : " , rootstr
-		os.system("dq2-get -f %s -H %s/ -V %s/ "  % ( rootstr, outDS, outDS ) )
-	
-
-		jobstring2  = "mv %s/*.Iter%02d_AlignmentConstants.root  Iter%02d_AlignmentConstants.root\n\n" % \
-			(outDS, iteration, iteration)
-	 
-		'''
-		jobstring2 += "mv %s/*.OldSiAlignment.txt     %s/Iter%02d/OldSiAlignment.txt\n\n" % \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.OutputSiAlignment.txt  %s/Iter%02d/OutputSiAlignment.txt\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.mycool.db   %s/Iter%02d/mycool.db\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.vector.txt  %s/Iter%02d/vector.txt\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.vector.bin  %s/Iter%02d/vector.bin\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.matrix.txt  %s/Iter%02d/matrix.txt\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.matrix.bin  %s/Iter%02d/matrix.bin\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.hitmap.txt  %s/Iter%02d/hitmap.txt\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.hitmap.bin  %s/Iter%02d/hitmap.bin\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.alignlogfile.txt  %s/Iter%02d/alignlogfile.txt\n\n" %  \
-			(outDS, OutputPath, iteration)
-		jobstring2 += "mv %s/*.log.tgz  %s/Iter%02d/\n\n" % (outDS, OutputPath, iteration)     
-		# move the merged total monitoring file into every iteration directory
-		jobstring2 += "mv TotalMonitoring.root %s/Iter%02d/\n\n" % (OutputPath, iteration)
-		'''
-		os.system(jobstring2)
-
-	else : 	
-		jobstring3 = ""
-		jobstring3 += "mv ./OldSiAlignment.txt     %s/Iter%02d/OldSiAlignment.txt\n" %     ( OutputPath, iteration)
-		jobstring3 += "mv ./OutputSiAlignment.txt  %s/Iter%02d/OutputSiAlignment.txt\n" %  ( OutputPath, iteration)
-		jobstring3 += "mv ./mycool.db              %s/Iter%02d/mycool.db\n" %              ( OutputPath, iteration)
-		jobstring3 += "mv ./vector.txt             %s/Iter%02d/vector.txt\n" %             ( OutputPath, iteration)
-		jobstring3 += "mv ./vector.bin             %s/Iter%02d/vector.bin\n" %             ( OutputPath, iteration)
-		jobstring3 += "mv ./matrix.txt             %s/Iter%02d/matrix.txt\n" %             ( OutputPath, iteration)
-		jobstring3 += "mv ./matrix.bin             %s/Iter%02d/matrix.bin\n" %             ( OutputPath, iteration)
-		jobstring3 += "mv ./hitmap.txt             %s/Iter%02d/hitmap.txt\n" %             ( OutputPath, iteration)
-		jobstring3 += "mv ./hitmap.bin             %s/Iter%02d/hitmap.bin\n" %             ( OutputPath, iteration)
-		jobstring3 += "mv ./alignlogfile.txt       %s/Iter%02d/alignlogfile.txt\n" %       ( OutputPath, iteration)
-		os.system(jobstring3)
-
-
-
-
-
-
-
-def mergeMatrix(OutputPath, iteration, GridAccOutDS, GridOptions):
-
-	matrixlist = []
-	vectorlist = []
-	hitmaplist = []
-
-	print "GridAccOutDS = ", (GridAccOutDS)
-
-	ret, out = commands.getstatusoutput("cat %s" % GridAccOutDS)
-	print "out: ",out
-	lines=out.split('\n')
-
-	nowDir = os.getcwd()
-	os.chdir(GridOptions["TmpWorkDir"])
-
-	# looping over all output dataset names
-	for line in lines:
-		items = line.split()
-		if len(items)>0 :
-			outDS = items[0]
-			print "when merging matrixes and vectors, this outDS name : ", outDS
-			binlist = []
-			ret, out = commands.getstatusoutput("dq2-ls -f %s/ " % outDS)
-			print " dq2-ls -f, out : ", out
-			lines = out.split('\n')
-			for line in lines :
-				items = line.split()
-				for item in items :
-					print " item : " , item
-					if item.find(".bin") != -1 :
-						binlist.append(item)
-			binstr = ",".join(binlist)
-			print "binary files string : " , binstr
-			os.system("dq2-get -f %s -H %s/ -V %s/ "  % ( binstr, outDS, outDS ))
-
-
-			jobstr2 = "ls %s/*.matrix.bin" % (outDS)
-			job2 = open("job2.sh",'w')
-			os.system("chmod 777 job2.sh")
-			job2.write(jobstr2)
-			job2.close()
-			ret, out = commands.getstatusoutput('sh job2.sh')
-			for line in out.split("\n"):
-				MatrixPath =  line
-				print "MatrixPath: ",MatrixPath
-				#if os.path.isfile(MatrixPath):
-				matrixlist.append(MatrixPath)
-
-
-			jobstr3 = "ls %s/*.vector.bin" % (outDS)
-			job3 = open("job3.sh",'w')
-			os.system("chmod 777 job3.sh")
-			job3.write(jobstr3)
-			job3.close()
-			print "job3: ",job3
-			ret, out = commands.getstatusoutput('sh job3.sh')
-			for line in out.split("\n"):
-				VectorPath = line
-				#		if os.path.isfile(VectorPath):
-				vectorlist.append(VectorPath)
-
-			print "vectorlist: ",vectorlist
-
-			jobstr4 = "ls %s/*.hitmap.bin" % (outDS)
-			job4 = open("job4.sh",'w')
-			os.system("chmod 777 job4.sh")
-			job4.write(jobstr4)
-			job4.close()
-			print "job4: ",job4
-			ret, out = commands.getstatusoutput('sh job4.sh')
-			for line in out.split("\n"):
-				HitmapPath =  line
-				#		if os.path.isfile(HitmapPath):
-				hitmaplist.append(HitmapPath)
-			print "hitmaplist: ",hitmaplist
-		
-		else:
-			print "Problem getting the outDS files"
-			
-  
-	print "------------------------------------------"
-	print "  Setting Matrices list" 
-	print "------------------------------------------"
-
-	os.system("rm *.sh")
-	os.chdir(nowDir)
-
-	return matrixlist,vectorlist,hitmaplist
-				
-		
-			 
-# For the merging of the monitoring Files
-class mergeMonitoringScript:
-	def __init__(self,
-		     OutputPath,
-		     preName,
-		     iter,
-		     CosmicsBoff,
-		     CosmicsBon,
-		     Collision,
-		     CMTDIR,
-		     ATHENAREL,
-		     TAGS,
-		     SCRIPTNAME,
-		     JOBNAME, 
-		     GridAccOutDS
-		     ):
-		self.OutputPath      = OutputPath
-		self.preName         = preName
-		self.i               = iter
-		self.CosmicsBoff     = CosmicsBoff
-		self.CosmicsBon      = CosmicsBon
-		self.Collision       = Collision
-		self.CMTDIR          = CMTDIR
-		self.ATHENAREL       = ATHENAREL
-		self.TAGS            = TAGS
-		self.SCRIPTNAME      = SCRIPTNAME
-		self.JOBNAME         = JOBNAME
-		self.GridAccOutDS    = GridAccOutDS
-
-
-	def write(self):
-		TempPath="%s/Iter%02d" % (self.OutputPath, self.i)
-		#self.SCRIPTNAME = TempPath + '/' + self.SCRIPTNAME
-		# list of Files to be merged
-		mergeMonitoringFilesName = 'mergeMonitoringFiles.txt'
-
-		script=open(self.SCRIPTNAME,'w')
-		script.write("#BSUB -J %s_Iter%02dMerge \n" % (self.preName, self.i))
-		script.write("#BSUB -o %s/Iter%02d/logs/Iter%02dMerge.log \n" % (self.OutputPath,self.i,self.i))
-		script.write("\n")
-		script.write("#   setup the environment \n")
-		script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENAREL, self.TAGS))
-		#script.write("cd %s/Iter%d/ \n" % (self.OutputPath,self.i))
-		script.write("DQHistogramMerge.py %s TotalMonitoring.root True\n" % mergeMonitoringFilesName)
-		script.close()
-
-		mergeMonitoringFile = open(mergeMonitoringFilesName,"w")
-		ret, out = commands.getstatusoutput("cat %s" % self.GridAccOutDS)
-		print "out: ",out
-		lines = out.split('\n')
-		# looping over all output dataset names
-		for line in lines:
-			items = line.split()
-			if len(items)>0 :
-				outDS = items[0]
-				print "outDS = ",outDS
-				#print "hmn", glob.glob(("%s/*.root") % outDS)
-				os.system("find %s/*.root >> %s \n " % (outDS, mergeMonitoringFilesName))
-
-		mergeMonitoringFile.close()
-
-
-	def send(self):
-		os.system("chmod +x %s" % self.SCRIPTNAME)
-		print "in doing merge----------------------------------------------"
-		os.system("sh %s  \n"   % self.SCRIPTNAME)
-		print "after doing merge----------------------------------------------"
-
-
-
-
-# For Comparing the before and after monitoring files 
-class compareMonitoringScript:
-	def __init__(self,
-		     OutputPath,
-		     numIter,
-		     CMTDIR,
-		     ATHENAREL,
-		     TAGS
-		     ):
-		self.OutputPath = OutputPath
-		self.numIter    = numIter
-		self.CMTDIR     = CMTDIR
-		self.ATHENAREL  = ATHENAREL
-		self.TAGS       = TAGS
-
-		
-	def write(self):
-		# Names of the Job and the Script
-		self.SCRIPTNAME = self.OutputPath + '/MonitoringComparison.lsf'
-		self.JOBNAME = 'MonitoringComparison.py'
-		
-		# Write the Script
-		script=open(self.SCRIPTNAME,'w')
-		script.write("#BSUB -J MonitoringComparision \n")
-		script.write("#BSUB -o "+self.OutputPath+"/MonitoringComparision.log \n")
-		script.write("\n")
-		script.write("#   setup the environment \n")
-		script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENAREL, self.TAGS))
-		script.write("cd "+self.OutputPath+" \n")
-		script.write("athena.py "+self.JOBNAME+" \n")
-		script.write("cd -")
-		script.close()
-		
-		# Write the Job
-		job=open(self.OutputPath+"/"+self.JOBNAME,"w")
-		job.write(" \n")
-		job.write("# ==================================== \n")
-		job.write("# The Reference File (Black)           \n")
-		job.write('afterAlignmentFile = "'+self.OutputPath+'/Iter'+str(self.numIter-1)+'/TotalMonitoring.root" \n')
-		job.write(" \n")
-		job.write("# ==================================== \n")
-		job.write("# The Monitored File (Red)             \n")
-		job.write('beforeAlignmentFile = "'+self.OutputPath+'/Iter0/TotalMonitoring.root"\n')
-		job.write("\n")
-		job.write("# ==================================== \n")
-		job.write("# The Output File                      \n")
-		job.write('outputFile = "AlignmentOutput.root"    \n')
-		job.write("\n")
-		job.write("# ==================================== \n")
-		job.write("include('InDetAlignmentMonitoring/makeComparision.py') \n")
-		job.write(" \n")
-		job.close()
-		
-	def send(self):
-		os.system("chmod +x %s" % self.SCRIPTNAME)
-		print "----------------------------------------------"
-		print "  Running MonitoringComparision.lsf job"
-		os.system("sh "+self.SCRIPTNAME+" | tee "+self.OutputPath+"/MonitoringComparison.log \n")
-		print "----------------------------------------------"
-			
-         
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_Challenges.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_Challenges.py
deleted file mode 100644
index c147e3dacf98655c7f0e484626a2fcb64bb75383..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_Challenges.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-import os
-
-class setupChallenge:
-	def __init__ (self
-                      ,thisChallenge
-                      ,geometrySetting):
-		self.thisChallenge = thisChallenge
-		self.GlobalTag = ""
-		self.DetDescrVersion = ""
-		self.DetDescrVersionNoField = ""
-		
-		if self.thisChallenge == "CSC":
-			if os.environ['HOSTNAME'] == 'tst01.ific.uv.es':
-				collisionDir = "/data1/cescobar/data/csc/multimuons/"
-			else:
-				collisionDir = "castor:/castor/cern.ch/user/a/atlidali/data/csc/multimuons/"
-				
-			self.setup(CollisionDirectory = collisionDir
-			      ,CollisionFileList = "inputData_CSC_multimuons_digits.txt"
-			      ,CosmicBFieldDirectory = "castor:/castor/cern.ch/user/l/lytken/cosmic_13010/digitization/TRTBarrel/misaligned/"
-			      ,CosmicBFieldFileList  = "inputData_CSC_CosmicsRel13_BFOn.txt"
-			      ,CosmicNoBFieldDirectory = "castor:/castor/cern.ch/user/l/lytken/cosmic_13010/digitization/NoField/TRTBarrel/misaligned/"  
-			      ,CosmicNoBFieldFileList  = "inputData_CSC_CosmicsRel13_BFOff.txt")
-
-			if geometrySetting == 'Nominal':
-			    self.DetDescrVersion = "ATLAS-CSC-01-00-00"
-			    self.GlobalTag = 'OFLCOND-CSC-00-00-00'
-			if geometrySetting == 'Perfect':
-			    self.DetDescrVersion = "ATLAS-CSC-01-02-00"
-			    self.GlobalTag = 'OFLCOND-CSC-00-01-00'
-			if geometrySetting == 'Aligned':
-			    self.DetDescrVersion = "ATLAS-CSC-01-00-00"
-			    self.GlobalTag = 'OFLCOND-CSC-00-01-05'
-
-		if self.thisChallenge == 'FDR1':
-			self.setup(CollisionDirectory = "castor:/castor/cern.ch/user/h/hawkings/calibstream/fdr1/"
-			      ,CollisionFileList  = "inputData_FDR1_idcalibstream.txt")
-			
-			self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-			self.DetDescrVersionNoField = "ATLAS-GEONF-08-00-00"
-			if geometrySetting == 'Nominal':
-				self.GlobalTag = 'COMCOND-REPC-003-00'
-			if geometrySetting == 'Aligned':
-				self.GlobalTag = 'COMCOND-ES1C-000-00'
-
-		if self.thisChallenge == 'FDR2':
-			self.setup(CollisionDirectory = "castor:/castor/cern.ch/user/b/bvendapi/FDR2_Pi/BS_files/CalibStream/"
-			      ,CollisionFileList = "inputData_FDR2_idcalibstream.txt"
-			      ,CosmicBFieldDirectory = "castor:/castor/cern.ch/user/b/bvendapi/cosmics_fdr2/"
-			      ,CosmicBFieldFileLiast = "inputData_FDR2_cosmicstream.txt")
-
-
-		if self.thisChallenge == 'M8plus':
-			self.setup(CosmicBFieldDirectory = "castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/"
-				   ,CosmicBFieldFileList  = "inputData_M8plus_Cosmic_91800.txt"
-				   ,CosmicNoBFieldDirectory = "castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/"
-				   ,CosmicNoBFieldFileList  = "inputData_M8plus_Cosmic_NoBField.txt")
-			
-			self.DetDescrVersion = "ATLAS-GEO-03-00-00"
-			self.DetDescrVersionNoField = "ATLAS-GEONF-04-00-00"
-
-		if self.thisChallenge == 'Cosmic09':
-			self.setup(CosmicBFieldDirectory = ""
-			      #,CosmicBFieldDirectory = "castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data09_cos/ESD/"
-			      ,CosmicBFieldFileList  = "inputData_Cosmic09_BFOn.txt"
-			      ,CosmicNoBFieldDirectory = ""
-			      #,CosmicNoBFieldDirectory = "castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data09_cos/ESD/"
-			      ,CosmicNoBFieldFileList  = "inputData_Cosmic09_BFOff.txt")
-			
-			self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-			self.DetDescrVersionNoField = "ATLAS-GEONF-08-00-00"
-			
-			if geometrySetting == 'Nominal':
-				self.GlobalTag = 'COMCOND-REPC-003-00'
-			if geometrySetting == 'Aligned':
-				self.GlobalTag = 'COMCOND-ES1C-000-00'
-
-
-		if self.thisChallenge == 'CosmicStream':
-			self.setup(CosmicBFieldFileList =  "inputData_CosmicStream.txt"
-			      ,CosmicBFieldDirectory = "rfio:/castor/cern.ch/user/s/sfyrla/91338_PEB/")
-
-		if self.thisChallenge == 'CosmicsRel14':
-			self.setup(CosmicBFieldDirectory = "castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEO-03-00-00/dig/"
-			      ,CosmicBFieldFileList  = "inputData_CosmicsRel14_BFOn.txt"
-			      ,CosmicNoBFieldDirectory = "castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEONF-04-00-00/"
-			      ,CosmicNoBFieldFileList  = "inputData_CosmicsRel14_BFOff.txt")
-
-		if self.thisChallenge == 'CalibrationStream':
-			self.setup(CollisionDirectory = ""
-			      ,CollisionFileList = "inputData_CalibrationStream.txt")
-
-		if self.thisChallenge == 'CosmicSim09':
-			self.setup(CosmicBFieldFileList = "inputData_CosmicSim2009_BOn.txt"
-			      ,CosmicNoBFieldFileList = "inputData_CosmicSim2009_BOff.txt")
-
-
-		if self.thisChallenge == "FDR09":
-			self.setup(CollisionDirectory = "castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/FDR2_IDCalibStream/ESD/"
-			      ,CollisionFileList = "inputData_FDR09.txt")
-			
-			if geometrySetting == 'Nominal':
-				self.DetDescrVersion = "ATLAS-CSC-02-00-00"
-				self.GlobalTag = 'OFLCOND-FDR-02-08-00'
-			if geometrySetting == 'Perfect':
-				self.DetDescrVersion = "ATLAS-CSC-02-00-00"
-				self.GlobalTag = 'OFLCOND-CSC-01-00-00'
-
-		if self.thisChallenge == "MC09":
-			self.setup(CollisionDirectory = "castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/perf-idtracking/dq2/mc09_valid/ESD/e436_s561_r731/mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731_tid076491/"
-			      ,CollisionFileList = "inputData_multimuons09.txt")
-			
-			if geometrySetting == 'Nominal':
-				self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-				self.GlobalTag = 'OFLCOND-SIM-00-00-07'
-			if geometrySetting == 'Perfect':
-				self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-				self.GlobalTag = 'OFLCOND-CSC-01-00-00'
-
-		if self.thisChallenge == "MinBias":
-			self.setup(CollisionDirectory = "/afs/cern.ch/user/a/atlidali/w0/data/minbias/"
-			      ,CollisionFileList = "inputData_minbias.txt")
-
-			if geometrySetting == 'Nominal':
-				self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-				self.GlobalTag = 'OFLCOND-SIM-00-00-00'
-			if geometrySetting == 'Perfect':
-				self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-				self.GlobalTag = 'OFLCOND-SIM-01-00-00'
-			if geometrySetting == 'Aligned':
-				self.DetDescrVersion = "ATLAS-GEO-08-00-00"
-				self.GlobalTag = 'OFLCOND-CSC-00-01-05'
-
-		if self.thisChallenge == "Halo":
-			# Beam halo events
-			self.setup(BeamHaloDirectory = "castor:/castor/cern.ch/user/t/tcorneli/"
-			      ,BeamHaloFileList = "inputData_halo_digits.txt")
-
-		if self.thisChallenge == "BeamGas":
-			# Beam Gas O events
-			self.setup(BeamGasDirectory ="castor:/castor/cern.ch/user/s/stradlin/BeamGas_1.1/digit/hijing.O.digit/"
-			      ,BeamGasFileList  = "inputData_beamgas_digits.txt")
-
-		if self.thisChallenge == "900GeV":
-			self.setup(CollisionDirectory = "",
-				   CollisionFileList  = "CustomRun_900GeV.txt",
-				   CosmicNoBFieldFileList = "GoodRunList_Cosmic_NoBF_DPD_atlasdatadisk.txt")
-
-			if 'Nominal':
-				self.DetDescrVersion = "ATLAS-GEO-08-00-02"
-				# self.GlobalTag = "COMCOND-ES1PST-001-00"
-				self.GlobalTag = "COMCOND-ES1PS-001-00"
-#			self.DetDescrVersion = "ATLAS-GEO-08-00-02"
-			self.DetDescrVersionNoField = "ATLAS-GEONF-08-00-00"
-		
-		if self.thisChallenge == "7TeV":
-			self.setup(CollisionDirectory = "",
-				   CollisionFileList  = "CustomRun_7TeV.txt",
-				   CosmicNoBFieldFileList = "CustomRun_CosmicsNoBF_7TeV.txt",
-				   CosmicBFieldFileList = "CustomRun_CosmicsBF_7TeV.txt")
-			#self.GlobalTag = "COMCOND-ES1PST-002-00"
-			self.GlobalTag = ""  #2010 data
-			#self.DetDescrVersion = "ATLAS-GEO-10-00-00"
-			self.DetDescrVersion = ""
-			self.DetDescrVersionNoField = "ATLAS-GEONF-08-00-00"
-		
-		
-		if self.thisChallenge == "SingleBeam":
-			self.setup(CollisionDirectory = ""
-				   ,CollisionFileList  = "CustomRun_SingleBeam.txt")
-			if 'Nominal':
-				self.DetDescrVersion = "ATLAS-GEO-03-00-00"
-				self.GlobalTag = "COMCOND-ES1C-000-00"
-		
-	
-	def setup(self
-                  ,CollisionDirectory = ""
-                  ,CollisionFileList = ""
-                  ,CosmicBFieldDirectory = ""
-                  ,CosmicBFieldFileList  = ""
-                  ,CosmicNoBFieldDirectory = ""
-                  ,CosmicNoBFieldFileList  = ""):
-		
-		self.CollisionDirectory = CollisionDirectory
-		self.CollisionFileList = CollisionFileList
-		if self.CollisionFileList:
-			os.system("get_files -jo %s >/dev/null" % self.CollisionFileList)
-
-		self.CosmicBFieldDirectory = CosmicBFieldDirectory
-		self.CosmicBFieldFileList = CosmicBFieldFileList
-		if self.CosmicBFieldFileList:
-			os.system("get_files -jo %s >/dev/null" % self.CosmicBFieldFileList)
-
-		self.CosmicNoBFieldDirectory = CosmicNoBFieldDirectory
-		self.CosmicNoBFieldFileList = CosmicNoBFieldFileList
-		if self.CosmicNoBFieldDirectory:
-			os.system("get_files -jo %s >/dev/null" % self.CosmicNoBFieldFileList)
-
-            
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py
deleted file mode 100644
index 2969f37146fddf00d5fbe1564ab16a224ae4a9fe..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py
+++ /dev/null
@@ -1,860 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# =====================================================================
-#
-#  Class for local processing
-#
-# =====================================================================
-from threading import Thread
-import os
-import time
-
-class getAthenaConfig:
-    def __init__(self, options):
-        self.atlasSet = "AtlasSetup"
-        
-        self.athenaRel = os.environ['AtlasVersion']
-        self.athenaProj = os.environ['AtlasProject']
-        self.athenaConf = os.environ['CMTCONFIG']
-        if "x86_64" in self.athenaConf:
-            self.athenaConf=self.athenaConf.replace("x86_64","64")
-        if "devval" in os.environ['AtlasArea']:
-            self.athenaConf += "-devval"
-        
-        try:
-            self.athenaTestArea = os.environ['TestArea']
-        except:
-            self.athenaTestArea = ""
-        try:
-            self.athenaTags = os.environ['AtlasProject'] + ',' + self.athenaConf.replace("-",",")
-        except:
-            self.athenaTags = ""
-        if self.atlasSet == "AtlasSetup":
-            self.atlasSetupPath = os.environ['AtlasSetup']
-        else:
-            self.atlasSetupPath = ""
-        # other options 
-        self.options = options 
-
-        print "------------------------------------------"
-        print "Retrieved athena configuration:"
-        print "* Using " + self.atlasSet
-        print "* Athena release: ", self.athenaRel
-        print "* Athena tags: ", self.athenaTags
-        print "* Athena TestArea: ", self.athenaTestArea
-        print "------------------------------------------"
-    def Release(self):
-        return  self.athenaRel
-    def Tags(self):
-        return self.athenaTags
-    def TestArea(self):
-        return self.athenaTestArea
-    def atlasSetup(self):
-        return self.atlasSet
-    def AtlasSetupPath(self):
-        return self.atlasSetupPath
-    def AtlasSetupOptions(self):
-        return self.options
-
-
-
-
-class manageJob:
-    def __init__(self,
-             OutputPath,
-             dataName,
-             iter,
-             part,
-             JOBNAME,
-             preName,
-             ATHENACFG,
-             RecoOptions={},
-             extraOptions={},
-             AlignmentOptions={},
-             RecoScript="InDetAlignExample/NewTopOptions.py",
-             ConditionsScript="InDetAlignExample/jobOption_ConditionsOverrider.py",
-             AlignmentScript="InDetAlignExample/NewInDetAlignAlgSetup.py",
-             AlignmentLevels = "InDetAlignExample/NewInDetAlignLevels.py",
-             #MonitoringScript = "InDetRecExample/InDetMonitoringAlignment.py", 
-             QUEUE = "1nh",
-             CMTDIR = "",
-             inputPoolFiles = "",
-             inputCoolFiles = "",
-             folderSuffix=""):
-        self.OutputPath = OutputPath
-        self.preName = preName
-        self.i=iter
-        self.j=part
-        self.dataName = dataName
-        self.QUEUE=QUEUE
-        self.CMTDIR=CMTDIR
-        self.ATHENACFG=ATHENACFG
-        self.inputPoolFiles = inputPoolFiles
-        self.inputCoolFiles = inputCoolFiles
-        self.JOBNAME=JOBNAME
-        self.RecoOptions = RecoOptions
-        self.ConditionsScript = ConditionsScript
-        self.extraOptions = extraOptions
-        self.RecoScript = RecoScript
-        self.AlignmentOptions = AlignmentOptions
-        self.AlignmentScript = AlignmentScript
-        self.AlignmentLevels = AlignmentLevels
-        self.folderSuffix = folderSuffix
-        #self.MonitoringScript = MonitoringScript
-        if self.j==-1:
-            self.RunPath="%s/Iter%d%s/" % (self.OutputPath, self.i, self.folderSuffix)
-            self.SCRIPTNAME = "%s_Iter%d_Solve.lsf" % (self.preName,self.i)
-        else:
-            self.RunPath="%s/Iter%d%s/%s/%02d/" % (self.OutputPath, self.i, self.folderSuffix, self.dataName, self.j)
-            self.SCRIPTNAME = "%s_Iter%d%s_%s_Part%02d.lsf" % (self.preName,self.i,self.folderSuffix, self.dataName, self.j)
-
-        
-    def createDirectories(self):
-        os.system('mkdir -p %s' % self.RunPath)
-        #os.system('mkdir -p %s' % self.RunPath+"/InDetRecExample")
-        #if self.MonitoringScript != "":
-        #   os.system('ln -s %s %s' % (self.MonitoringScript,self.RunPath+"/InDetRecExample/InDetMonitoringAlignment.py") )
-
-    def writeJO(self):
-        PrefixName="Iter%d%s_" % (self.i, self.folderSuffix)
-        
-        job=open(self.RunPath + self.JOBNAME,'w')
-        job.write('##-------- Alignment Configuration --------------------\n')
-
-        job.write("outputPoolFile        = \"%s/Iter%d_AlignmentConstants.root\"\n" %(self.RunPath,self.i))
-
-        for option in self.AlignmentOptions:
-            if type(self.AlignmentOptions[option]) is str:
-                customoption = option + "\t=\t\"" +  self.AlignmentOptions[option]+'\"\n'
-                job.write(customoption)
-            else:
-                customoption = option + "\t=\t" +  str(self.AlignmentOptions[option])+'\n'
-                job.write(customoption)
-            
-        job.write("\n")
-        job.write('##-------- Loading the Alignment Levels --------------------\n')
-        job.write('include("'+str(self.AlignmentLevels)+'") \n')
-        job.write("\n")
-        job.write('##-------- Reconstruction Configuration --------------------\n')
-        
-        for option in self.RecoOptions:
-            if type(self.RecoOptions[option]) is str:
-                customoption = option + "\t=\t\"" +  self.RecoOptions[option]+'\"\n'
-                job.write(customoption)
-            else:
-                if option == "inputFiles":
-                    customoption = option + "\t=\t" +  str(self.RecoOptions[option][:-1])+'\n'
-                else:
-                    customoption = option + "\t=\t" +  str(self.RecoOptions[option])+'\n'
-                job.write(customoption)
-
-        if len(self.extraOptions):
-            job.write("\n")
-            job.write('##-------- Extra Configuration --------------------\n')
-        
-        for option in self.extraOptions:
-            if type(self.extraOptions[option]) is str:
-                customoption = option + "\t=\t\"" +  self.extraOptions[option]+'\"\n'
-                job.write(customoption)
-            else:
-                customoption = option + "\t=\t" +  str(self.extraOptions[option])+'\n'
-                job.write(customoption)
-
-        job.write("\n")
-        job.write('##-------- End of custom options -------------\n')
-
-        # Need to write the InDetRec Options Here:
-        job.write("\n")
-        job.write('##-------- Load Reconstruction --------------------\n')
-        job.write('include("'+str(self.RecoScript)+'") \n')
-        job.write("\n")
-        job.write('##-------- Load Conditions Overrider --------------------\n')
-        job.write('include("'+str(self.ConditionsScript)+'") \n')
-        job.write("\n")
-        job.write('##-------- Load Alignment --------------------\n')
-        job.write('include("'+str(self.AlignmentScript)+'") \n')
-        job.write("\n")
-        job.close()
-
-    def writeScript(self):
-        self.SCRIPTNAME = self.RunPath + '/' + self.SCRIPTNAME
-        script=open(self.SCRIPTNAME,'w')
-        if self.j!=-1:      
-            script.write("#BSUB -J %s_Iter%d%s_%s_Part%02d -C 1\n" % (self.preName,self.i,self.folderSuffix,self.dataName, self.j))
-            script.write("#BSUB -o %s/Iter%d%s/logs/Iter%d_%s_Part%02d.log \n" % (self.OutputPath,self.i,self.folderSuffix,self.i,self.dataName,self.j))
-            script.write("#BSUB -e %s/Iter%d%s/logs/Iter%d_%s_Part%02d.err \n" % (self.OutputPath,self.i,self.folderSuffix,self.i,self.dataName,self.j))
-        else:
-            script.write("#BSUB -J %s_Iter%d%sSolve -C 1\n" % (self.preName, self.i, self.folderSuffix))
-            script.write("#BSUB -o %s/Iter%d%s/logs/Iter%d%sSolve.log \n" % (self.OutputPath,self.i,self.folderSuffix,self.i,self.folderSuffix))
-            script.write("#BSUB -e %s/Iter%d%s/logs/Iter%d%sSolve.err \n" % (self.OutputPath,self.i,self.folderSuffix,self.i,self.folderSuffix))
-            
-        script.write("#BSUB -q %s \n" % self.QUEUE)
-        script.write("\n")
-        script.write("#   setup the environment \n")
-        if self.ATHENACFG.atlasSetup() == "CMTHOME":
-            script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENACFG.Release(), self.ATHENACFG.Tags()))
-        elif "single" in self.ATHENACFG.AtlasSetupOptions():
-            script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s --single \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-
-        elif "nightlies" in self.ATHENACFG.AtlasSetupOptions():
-            script.write("source /afs/cern.ch/atlas/software/dist/AtlasSetup/scripts/asetup.sh 20.1.X rel1 --testarea=%s --single \n" % (self.ATHENACFG.TestArea()))
-
-        else:
-            script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-        for file in self.inputPoolFiles:
-            if "atlasdatadisk" in file:
-                script.write("export STAGE_SVCCLASS=atldata\n")
-                break
-            if "DAQ" in file or "tzero" in file:
-                script.write("export STAGE_SVCCLASS=atlcal\n") 
-                break
-            if "atlasgroupdisk" in file:
-                script.write("export STAGE_SVCCLASS=atlasgroupdisk\n") 
-                break
-            if "atlasscratchdisk" in file:
-                script.write("export STAGE_SVCCLASS=atlasscratchdisk\n")
-                break
-            if "atlasdatadisk" in file:
-                script.write("export STAGE_SVCCLASS=atldata\n")
-                break
-            if "atlascerngroupdisk" in file:
-                script.write("export STAGE_SVCCLASS=atlascerngroupdisk\n")
-                script.write("export STAGE_HOST=castoratlast3\n")
-                break
-        
-        script.write("cd %s \n" % self.RunPath)
-
-        for file in self.inputPoolFiles:
-            #if 'ESD' in file or 'AlignmentConstants' in file:
-            if 'AlignmentConstants' in file or 'ESD' in file:
-                script.write("pool_insertFileToCatalog "+ file + " \n")
-        
-        script.write("athena %s \n" % self.JOBNAME)
-        #Cleaning the core in case of errors
-        script.write("rm -rf core* \n")
-        script.write("cd - \n")
-        script.close()
-
-    def send(self,runmode):
-        os.system("chmod +x %s" % self.SCRIPTNAME)
-        print "----------------------------------------------"
-        if runmode == "batch":
-            os.system("bsub <%s" % self.SCRIPTNAME)
-           
-            if self.j==-1:
-                print "  Sending %s_Solve_Iter%d%s job " % (self.preName, self.i, self.folderSuffix)
-            else:
-                print "  Sending %s_Iter%d%s_%s_Part%02d job to LxBatch" % (self.preName,self.i,self.folderSuffix,self.dataName, self.j)
-                  
-        elif runmode == "local":
-            if self.j!=-1:
-                print "  Running %s_Iter%d%s_%s_Part%02d job" % (self.preName,self.i,self.folderSuffix,self.dataName,self.j)
-                os.system("sh %s | tee %s/Iter%d%s/logs/Iter%d%s_%s_Part%02d.log \n" % (self.SCRIPTNAME, self.OutputPath,self.i,self.folderSuffix,self.i,self.folderSuffix,self.dataName,self.j))
-            else:
-                print "  Running %s_Iter%dSolve job" % (self.preName,self.i)
-                os.system("sh %s | tee %s/Iter%d%s/logs/Iter%d%sSolve.log \n" % (self.SCRIPTNAME, self.OutputPath,self.i,self.folderSuffix,self.i,self.folderSuffix))
-            
-        print "----------------------------------------------"
-
-    def wait(self):
-        print "Processing in lxbatch... look for jobs with ", self.preName, " and ", self.folderSuffix  
-        # Wait for signal
-        #print " wait for signal .salva. "
-        time.sleep(30)
-        while (os.popen('bjobs -w').read().find(self.preName)!=-1 and os.popen('bjobs -w').read().find(self.folderSuffix)!=-1):
-            time.sleep(30)
-            
-import os
-class SortCpus:
-    def __init__(self, TOTALCPUS, LOCALDIR, FILELIST, OutputLevel,doDetailedSplitting = False, nEventsPerFile=-1):
-            def sort_by_value(d):
-                """ Returns the keys of dictionary d sorted by their values """
-                items=d.items()
-                backitems=[ [v[1],v[0]] for v in items]
-                backitems.sort()
-                backitems.reverse() 
-                return [ backitems[i][1] for i in range(0,len(backitems))]      
-
-            self.doDetailedSplitting = doDetailedSplitting
-            self.OutputLevel = OutputLevel
-            self.Files = FILELIST
-            self.LocalDir = LOCALDIR
-            self.nSubJobs = TOTALCPUS
-            self.totalNumberOfEvents = 0
-            self.totalNumberOfFiles = 0
-            self.nEventsPerFile = nEventsPerFile
-            inputFileList = []
-            
-            if not self.doDetailedSplitting:
-                inputfiles = open(FILELIST, "r")
-                filelist = inputfiles.read().split('\n')
-                for i in range(0,len(filelist)):
-                    filelist[i] = filelist[i].rstrip()
-                inputfiles.close()
-                if not LOCALDIR:
-
-                    print "Reading Custom File"
-                    FinalListSorted = []
-                    for line in filelist:
-                        if line and line[0] != '#':
-                            FinalListSorted.append(line)
-
-                    #print FinalListSorted
-
-                elif "castor" in LOCALDIR:
-                    print "Reading castor directory " + LOCALDIR + " Please wait..."
-                    extendedFileList = os.popen("rfdir "+ LOCALDIR[7:]).read().splitlines()
-                else:
-                    print "Reading directory " + LOCALDIR + " Please wait..."
-                    extendedFileList = os.popen("ls -l "+ LOCALDIR).read().splitlines()
-
-                if LOCALDIR:
-                    i = 0
-                    SizeList = {}
-                    for line in extendedFileList:
-                        curr = line.split()
-                        if curr[0] != 'total':
-                            #print curr[8], " ", curr[4]
-                            SizeList[i] = {}
-                            SizeList[i][0] = curr[8].rstrip()
-                            SizeList[i][1] = curr[4].rstrip()
-                            i = i+1
-                    FinalList = {}
-                    count = 0
-                    
-                    for i in range(0,len(SizeList)):
-                        #print SizeList[i][0]
-                        if SizeList[i][0] in filelist:
-                            #print "Accepted"
-                            #print SizeList[i][0], " size:", SizeList[i][1]
-                            FinalList[SizeList[i][0]] = int(SizeList[i][1])
-
-                    #SizeListSorted = [ (k,SizeList[k]) for k in sorted(SizeList.values())]
-
-                    FinalListSorted = sort_by_value(FinalList)
-                    #print "Sorted list" 
-                    #for i in range(0,len(FinalListSorted)):
-                    #   print FinalListSorted[i], "\tsize:\t", FinalList[FinalListSorted[i]]
-                currCPU = 0
-                self.CPUsFiles = {}
-                nFiles = len(FinalListSorted)
-                nRemainder = nFiles % TOTALCPUS
-                nFilesPerCpu = nFiles / TOTALCPUS
-                nFilesForThisCpu = 1
-                sumFileSize = 0
-                if len(FinalListSorted[0].split())==2:
-                    for i in range(0,nFiles):
-                        sumFileSize += int(FinalListSorted[i].split()[1])
-                print sumFileSize
-                averageSizePerCpu =sumFileSize/TOTALCPUS*0.97
-                print averageSizePerCpu
-                sumSizeOnCpu = 0
-                #print "NFile, Remainder, NfilesperCpu  ",  nFiles, " ", nRemainder, " ", nFilesPerCpu
-        #If the file size is present then use it to split the files
-                if sumFileSize != 0:
-                    for i in range(0,nFiles):
-                        if currCPU in self.CPUsFiles:
-                            self.CPUsFiles[currCPU].append(LOCALDIR+FinalListSorted[i].split()[0])
-                        else:
-                            self.CPUsFiles[currCPU] = [LOCALDIR+FinalListSorted[i].split()[0]]
-                            extraFiles = 0
-                        sumSizeOnCpu += int(FinalListSorted[i].split()[1])                  
-                        if(sumSizeOnCpu > averageSizePerCpu and i < nFiles-1 and ( sumSizeOnCpu + int(FinalListSorted[i+1].split()[1]) ) > averageSizePerCpu * 1.04 ):
-                            print "File size on CPU: " ,currCPU,'\t' ,  sumSizeOnCpu
-                            currCPU = currCPU + 1
-                            if currCPU >= TOTALCPUS:
-                                currCPU = TOTALCPUS-1
-                            else:
-                                sumSizeOnCpu = 0
-                        elif(nFiles-i == TOTALCPUS - currCPU):
-                            currCPU = currCPU + 1
-                    print "File size on CPU: " ,currCPU,'\t' ,  sumSizeOnCpu
-                else:
-                    for i in range(0,nFiles):
-                        #print FinalListSorted[i], "CPU: ", currCPU, " FPCPU: " , nFilesForThisCpu
-                        if currCPU in self.CPUsFiles:
-                            self.CPUsFiles[currCPU].append(LOCALDIR+FinalListSorted[i].split()[0])
-                        else:
-                            self.CPUsFiles[currCPU] = [LOCALDIR+FinalListSorted[i].split()[0]]
-                        extraFiles = 0
-                        if(currCPU<nRemainder):
-                            extraFiles = 1
-                        if(nFilesForThisCpu < nFilesPerCpu+extraFiles):
-                            nFilesForThisCpu = nFilesForThisCpu + 1
-                        else:
-                            currCPU = currCPU + 1
-                            nFilesForThisCpu = 1
-                        
-
-            # Doing the Detailed slitting
-            else:
-                import PyUtils.PoolFile as PF
-
-                #Getting the number of events in each file.
-                inputfiles = open(FILELIST, "r")
-                numEventsPerFile = {}
-                print "=================================================="
-                print "The input file are: (May take some time..)"
-                for line in inputfiles:
-                    if line.rstrip().find(".root") > 0:
-
-                        fullFileName = self.LocalDir + "/"+ line.rstrip()
-
-                        inputFileList.append(fullFileName)
-
-                        poolFile = PF.PoolFile(fullFileName)
-                        thisNumEvents = int(poolFile.dataHeader.nEntries)
-                        
-                        self.totalNumberOfEvents += thisNumEvents
-
-                        self.totalNumberOfFiles += 1
-
-                        print fullFileName," with ",thisNumEvents," events"
-
-                        numEventsPerFile[fullFileName] = thisNumEvents
-                print "=================================================="
-
-                #Getting the Number of events to process, to skip, and the inputFile
-
-                # The relavent quantities for each subJob
-                self.m_skipEvents = {}
-                self.nEvents = 0
-                self.m_inputFiles = {}
-
-                # This means will do all the events
-                if self.nEventsPerFile == -1:
-                    self.nEvents = int(self.totalNumberOfEvents/self.nSubJobs)
-                else:
-                    self.nEvents = self.nEventsPerFile
-
-                # local counters
-                m_usedFiles = 0
-                m_numberEventsUsed =0
-                for subJob in range(self.nSubJobs):
-                    self.m_inputFiles[subJob] = []
-                    m_eventsNeeded = self.nEvents
-                                        
-                    while(m_eventsNeeded != 0 and m_usedFiles < self.totalNumberOfFiles):
-                        # Two case the file indexed by m_usedFiles has enough event to complete
-                        #  the events needed or it doesn't
-
-                        # If it does
-                        if m_eventsNeeded <= numEventsPerFile[inputFileList[m_usedFiles]]:
-                            numEventsPerFile[inputFileList[m_usedFiles]] -= m_eventsNeeded
-
-                            # Debugging
-                            #print "subJob",subJob
-                            #print "m_eventsNeeded",m_eventsNeeded
-                            #print "self.m_inputFiles",self.m_inputFiles
-                            #print "m_usedFiles",m_usedFiles
-                            
-                            self.m_inputFiles[subJob].append(inputFileList[m_usedFiles])
-                            self.m_skipEvents[subJob] = m_numberEventsUsed
-                            m_numberEventsUsed += m_eventsNeeded
-                            m_eventsNeeded = 0
-                            print "self.m_skipEvents["+str(subJob)+"]",self.m_skipEvents[subJob]
-                            print "m_numberEventsUsed",m_numberEventsUsed
-                            
-                        # If it doesn't
-                        else:
-                            m_eventsNeeded -= numEventsPerFile[inputFileList[m_usedFiles]]
-                            self.m_skipEvents[subJob] = m_numberEventsUsed
-                            self.m_inputFiles[subJob].append(inputFileList[m_usedFiles])
-                            m_usedFiles += 1
-                            m_numberEventsUsed = 0
-
-                            # Debugging
-                            #print "self.m_skipEvents["+str(subJob)+"]",self.m_skipEvents[subJob]
-                            #print "m_numberEventsUsed",m_numberEventsUsed
-                            #print "m_eventsNeeded",m_eventsNeeded
-
-
-                            
-    def getCPU(self,CURRENTCPU):
-        if self.OutputLevel=='DEBUG':
-            print "|",40*"-"," CPU #: ", CURRENTCPU, 40*"-", "|"
-            for line in self.CPUsFiles[CURRENTCPU]:
-                print "|  - ",line
-            print "|",93*"-","|"
-        return self.CPUsFiles[CURRENTCPU]
-           
-    def getNumEvents(self,subJob):
-        return self.nEvents
-
-    def getSkipEvents(self,subJob):
-        return self.m_skipEvents[subJob]
-
-    def getInputFiles(self,subJob):
-        return self.m_inputFiles[subJob]
-        
-def CreateFileList(RunList,recotag,Challenge,Stream,DataFile,Collision,BField=True):
-    if os.path.isfile(DataFile):
-        print "The file ", DataFile, " exists, using the existing one."
-        return 0
-
-    outputFile = open(DataFile, "w")
-    if Collision:
-        count = 0
-        for run in RunList:
-            run = int(run)
-            if Stream == "MinBias" and Challenge.thisChallenge == "900GeV":
-                path = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data09_900GeV/physics_MinBias/%07d/data09_900GeV.%08d.physics_MinBias.recon.ESD.%s/" % (run, run, recotag[count])
-            elif Stream == "express" and Challenge.thisChallenge == "900GeV":
-                path = "/castor/cern.ch/grid/atlas/DAQ/2009/%08d/express_express/" % run
-            elif Stream == "IDTracks" and Challenge.thisChallenge == "900GeV":
-                path = "/castor/cern.ch/grid/atlas/DAQ/2009/%08d/calibration_IDTracks/" % run
-            elif Stream == "IDTracks" and Challenge.thisChallenge == "7TeV":
-                path = "/castor/cern.ch/grid/atlas/DAQ/2010/%08d/calibration_IDTracks/" % run
-            elif Stream == "MinBias" and Challenge.thisChallenge == "7TeV":
-                path = "/castor/cern.ch/grid/atlas/atlasdatadisk/data10_7TeV/ESD/%s/data10_7TeV.%08d.physics_MinBias.recon.ESD.%s/" % (recotag[count],run,recotag[count]) 
-            
-            else:
-                print "Combination Stream/challenge not coded for automatic run list"
-                return 0
-            print "Reading castor directory: ", path
-            inputfiles = os.popen("rfdir "+ path).read().splitlines()
-            for file in inputfiles:
-                outputFile.write(path + file.split()[8] + '\t' + file.split()[4] + '\n')
-              #outputFile.write(path + file.split()[8]  + '\n')
-            count = count + 1
-        print "Created file " ,DataFile, " with the list of datafiles"
-    
-    if not Collision:
-        if BField:
-            count = 0
-            for run in RunList:
-                run = int(run)
-                if Stream == "CosmicCalo" and Challenge.thisChallenge == "7TeV":
-                    path = "/castor/cern.ch/grid/atlas/atlasdatadisk/data10_7TeV/ESD/%s/data10_7TeV.%08d.physics_CosmicCalo.recon.ESD.%s/" % (recotag[count],run,recotag[count])
-                elif Stream == "IDCosmic" and Challenge.thisChallenge == "7TeV":
-                    path = "/castor/cern.ch/grid/atlas/DAQ/merge/2010/%08d/physics_IDCosmic/" % (run)
-                else:
-                    print "Combination Stream/challenge not coded for automatic run list"
-                    return 0
-                print "Reading castor directory: ", path
-                inputfiles = os.popen("rfdir "+ path).read().splitlines()
-                for file in inputfiles:
-                    print file
-                    outputFile.write(path + file.split()[8] + '\t' + file.split()[4] + '\n')
-                count = count + 1   
-            print "Created file " ,DataFile, " with the list of datafiles"
-            
-        
-        
-        
-            
-def CreateCollisionFileList(RunList,recotag,Challenge,Stream):
-    if Challenge.thisChallenge =='900GeV':
-        outputFileName = "CustomRun_900GeV.txt"
-    elif Challenge.thisChallenge == 'SingleBeam':   
-        outputFileName = "CustomRun_SingleBeam.txt"
-    elif Challenge.thisChallenge == '7TeV':
-        outputFileName = "CustomRun_7TeV.txt"
-    else:
-        print "Custom run list not coded for this challenge"
-        return 0
-    
-    CreateFileList(RunList,recotag,Challenge,Stream,outputFileName,True)
-    
-def CreateCosmicNoBFFileList(RunList,recotag,Challenge,Stream):
-    if Challenge.thisChallenge == '7TeV':
-        outputFileName = "CustomRun_CosmicsNoBF_7TeV.txt"
-    else:
-        print "Custom run list not coded for this challenge"
-        return 0
-    
-    CreateFileList(RunList,recotag,Challenge,Stream,outputFileName,False,False)
-    
-def CreateCosmicBFFileList(RunList,recotag,Challenge,Stream):
-    if Challenge.thisChallenge == '7TeV':
-        outputFileName = "CustomRun_CosmicsBF_7TeV.txt"
-    else:
-        print "Custom run list not coded for this challenge"
-        return 0
-    CreateFileList(RunList,recotag,Challenge,Stream,outputFileName,False,True)
-    
-    
-def mergeMatrix(OutputPath, iter, DataToRun):
-
-    print "------------------------------------------"
-    print "  Setting Matrices list" 
-    print "------------------------------------------"
-
-    matrixlist = []
-    vectorlist = []
-    hitmaplist = []
-    for data in DataToRun:
-        for j in range(0, data.getCPUs(iter)):
-            TempPath = "%s/Iter%d/%s/%02d/" %  (OutputPath,iter,data.getName(),j)   
-            if os.path.isfile( "%s/matrix.bin" % TempPath):
-                matrixlist.append("%s/%02d/matrix.bin" % (data.getName(),j))
-                vectorlist.append("%s/%02d/vector.bin" % (data.getName(),j))
-
-            if os.path.isfile( "%s/hitmap.bin" % TempPath):
-                hitmaplist.append("%s/%02d/hitmap.bin" % (data.getName(),j))
-
-    return matrixlist,vectorlist,hitmaplist
-    
-def mergeTFiles(OutputPath, iter, folderSuffix, DataToRun):
-
-    print "------------------------------------------"
-    print "  Setting TFiles list" 
-    print "------------------------------------------"
-
-    tfilelist = []
-    for data in DataToRun:
-        for j in range(0, data.getCPUs(iter)):
-            TempPath = "%s/Iter%d%s/%s/%02d/" %  (OutputPath,iter, folderSuffix, data.getName(),j)  
-            if os.path.isfile( "%s/AlignmentTFile.root" % TempPath) and int(os.stat("%s/AlignmentTFile.root" % TempPath).st_size) != 0:
-                tfilelist.append("%s/%02d/AlignmentTFile.root" % (data.getName(),j))
-
-    return tfilelist
-        
-             
-# For the merging of the monitoring Files
-class mergeScript:
-    def __init__(self,
-             OutputPath,
-             preName,
-             folderSuffix,
-             iter,
-             dataName,
-             nCPUs,
-             QUEUE,
-             CMTDIR,
-             ATHENACFG,
-             SCRIPTNAME,
-             JOBNAME
-             ):
-        self.OutputPath = OutputPath
-        self.preName = preName
-        self.folderSuffix=folderSuffix
-        self.i=iter
-        self.dataName = dataName
-        self.nCPUs = nCPUs
-        self.QUEUE=QUEUE
-        self.CMTDIR=CMTDIR
-        self.ATHENACFG=ATHENACFG
-        self.SCRIPTNAME=SCRIPTNAME
-        self.JOBNAME=JOBNAME
-
-    def write(self):
-        TempPath="%s/Iter%d%s" % (self.OutputPath, self.i, self.folderSuffix)
-
-        self.SCRIPTNAME = TempPath + '/' + self.SCRIPTNAME
-        
-        # list of Files to be merged
-        mergeFilesName = TempPath + '/merge_'+self.dataName+'_Files.txt'
-        script=open(self.SCRIPTNAME,'w')
-        
-        script.write("#BSUB -J %s_Iter%d%s_%s_Merge -C 1\n" % (self.preName, self.i, self.folderSuffix, self.dataName))
-        script.write("#BSUB -o %s/Iter%d%s/logs/Iter%d%s_%s_Merge.log \n" % (self.OutputPath,self.i, self.folderSuffix, self.i, self.folderSuffix, self.dataName))
-        script.write("#BSUB -e %s/Iter%d%s/logs/Iter%d%s_%s_Merge.err \n" % (self.OutputPath,self.i, self.folderSuffix, self.i, self.folderSuffix, self.dataName))
-        
-        script.write("#BSUB -q %s \n" % self.QUEUE)
-        script.write("\n")
-        script.write("#   setup the environment \n")
-        if self.ATHENACFG.atlasSetup() == "CMTHOME":
-            script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENACFG.Release(), self.ATHENACFG.Tags()))
-        elif "single" in self.ATHENACFG.AtlasSetupOptions():
-            script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s --single \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-        elif "nightlies" in self.ATHENACFG.AtlasSetupOptions():
-            script.write("source /afs/cern.ch/atlas/software/dist/AtlasSetup/scripts/asetup.sh 19.1.X rel1 --testarea=%s --single \n" % (self.ATHENACFG.TestArea()))
-        else:
-            script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-        script.write("cd %s/Iter%d%s/ \n" % (self.OutputPath,self.i,self.folderSuffix))
-        script.write("DQHistogramMerge.py %s %s/TotalMonitoring.root True\n" %(mergeFilesName,self.dataName))
-        script.write("cd - \n")
-        for subJob in range(self.nCPUs):
-            script.write("rm %s/Iter%d%s/%s/%02d/monitoring.root \n" % (self.OutputPath,self.i,self.folderSuffix,self.dataName,subJob))
-        script.close()
-        
-        mergeFiles=open(mergeFilesName,"w")
-        for subJob in range(self.nCPUs):
-            mergeFiles.write("%s/Iter%d%s/%s/%02d/monitoring.root \n" %  (self.OutputPath,self.i,self.folderSuffix,self.dataName,subJob))
-        mergeFiles.close()
-                
-
-    def send(self,runmode):
-        os.system("chmod +x %s" % self.SCRIPTNAME)
-        print "----------------------------------------------"
-        if runmode == "batch":
-            os.system("bsub <%s" % self.SCRIPTNAME)
-            
-            print "  Sending %s_Merge_%s_Iter%d%s job " % (self.preName, self.dataName, self.i, self.folderSuffix)
-            
-        elif runmode == "local":
-            print "  Running %s_Merge_%s_Iter%d%s job" % (self.preName, self.dataName, self.i, self.folderSuffix)
-            os.system("sh %s | tee %s/Iter%d%s/logs/Iter%d%s_%s_Merge.log \n" % (self.SCRIPTNAME, self.OutputPath,self.i, self.folderSuffix, self.i, self.folderSuffix, self.dataName))
-            
-        print "----------------------------------------------"
-                       
-         
-
-
-
-# For Comparing the before and after monitoring files 
-class compareMonitoringScript:
-    def __init__(self,
-             OutputPath,
-             numIter,
-             QUEUE,
-             CMTDIR,
-             ATHENACFG
-             ):
-        self.OutputPath = OutputPath
-        self.numIter = numIter
-        self.QUEUE=QUEUE
-        self.CMTDIR=CMTDIR
-        self.ATHENACFG=ATHENACFG
-
-        
-    def write(self):
-        # Names of the Job and the Script
-        self.SCRIPTNAME = self.OutputPath + '/MonitoringComparison.lsf'
-        self.JOBNAME = 'MonitoringComparison.py'
-        
-        # Write the Script
-        script=open(self.SCRIPTNAME,'w')
-        script.write("#BSUB -J MonitoringComparision \n")
-        script.write("#BSUB -o "+self.OutputPath+"/MonitoringComparision.log \n")
-        script.write("#BSUB -e "+self.OutputPath+"/MonitoringComparision.err \n")
-        script.write("#BSUB -q %s \n" % self.QUEUE)
-        script.write("\n")
-        script.write("#   setup the environment \n")
-        if self.ATHENACFG.atlasSetup() == "CMTHOME":
-            script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENACFG.Release(), self.ATHENACFG.Tags()))
-        elif "single" in self.ATHENACFG.AtlasSetupOptions():
-            script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s --single \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-        else:
-            script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s \n" % (self.ATHENACFG.AtlasSetupPath()),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()) 
-        script.write("cd "+self.OutputPath+" \n")
-        script.write("athena.py "+self.JOBNAME+" \n")
-        script.write("cd - \n")
-        script.close()
-        
-        # Write the Job
-        job=open(self.OutputPath+"/"+self.JOBNAME,"w")
-        job.write(" \n")
-        job.write("# ==================================== \n")
-        job.write("# The Reference File (Black)           \n")
-        job.write('afterAlignmentFile = "'+self.OutputPath+'/Iter'+str(self.numIter-1)+'/TotalMonitoring.root" \n')
-        job.write(" \n")
-        job.write("# ==================================== \n")
-        job.write("# The Monitored File (Red)             \n")
-        job.write('beforeAlignmentFile = "'+self.OutputPath+'/Iter0/TotalMonitoring.root"\n')
-        job.write("\n")
-        job.write("# ==================================== \n")
-        job.write("# The Output File                      \n")
-        job.write('outputFile = "AlignmentOutput.root"    \n')
-        job.write("\n")
-        job.write("# ==================================== \n")
-        job.write("include('InDetAlignmentMonitoring/makeComparision.py') \n")
-        job.write(" \n")
-        job.close()
-        
-    def send(self,runmode):
-        os.system("chmod +x %s" % self.SCRIPTNAME)
-        print "----------------------------------------------"
-        if runmode == "batch":
-            os.system("bsub <%s" % self.SCRIPTNAME)
-            
-            print "  Sending MonitoringComparision.lsf job "
-            
-        elif runmode == "local":
-            print "  Running MonitoringComparision.lsf job"
-            os.system("sh "+self.SCRIPTNAME+" | tee "+self.OutputPath+"/MonitoringComparison.log \n")
-            
-        print "----------------------------------------------"
-
-def HandleRunOptions():
-    import sys
-    from InDetAlignExample.NewInDet_SetupData import setupData
-    # =====================================================================
-    #  Default values
-    # =====================================================================
-    Def_RunNumber = 162882
-    User_RunNumber = 0
-    RunNumber = Def_RunNumber
-    Def_ColEvents = 100
-    User_ColEvents = 0
-    Col_Events = Def_ColEvents
-    Def_ColCPUs = 1
-    User_ColCPUs = 0
-    Col_CPUs = Def_ColCPUs
-
-    argNum = 1
-    argMax = len(sys.argv)-1
-    argCurr = -1 # jut to make that first time it points to 0
-    
-    #print ' >>> user input has %s arguments' % argMax
-    for arg in sys.argv:
-        argCurr += 1
-        #print ".. %s .." % arg
-        if arg in ("-h", "--help"):  
-            print ' >>> This is the help message of RunIterator.py'     
-            print ' NAME'
-            print '     RunIterator.py'
-            print ' '
-            print ' SYNOPSIS'
-            print '     python RunIterator.py [-r RunNumber] [-e ColEvents]' 
-            print ' '
-            print ' OPTIONS'
-            print '     The following options are recognized by RunIterator.py'
-            print '     -r RunNumber'
-            print '          The user specifies the run number. Default run number is %d ' % Def_RunNumber
-            print ' '
-            print '     -e ColEvents'
-            print '          The user specifies the number of events for the collision data (default: %d)' % Def_ColEvents 
-            print ' '
-            print '     -q ColCPUs'
-            print '          The user specifies the number of cpus to be used for the collision data (default: %d)' % Def_ColCPUs 
-            print ' '
-            print ' 22/September/2010'
-            sys.exit()
-        elif arg in ("-r", "--run"):    
-            # print ' >>> The user wants to provide his run number... lets see. This argument is the %s argument ' % argCurr       
-            User_RunNumber = int(sys.argv[argCurr+1])
-            if User_RunNumber >0:
-                RunNumber = User_RunNumber
-                # print '>>> User run number = %s' % RunNumber
-        elif arg in ("-e", "--events"):    
-            # print ' >>> The user wants to provide the number of events ... lets see. This argument is the %s argument ' % argCurr       
-            User_ColEvents = int(sys.argv[argCurr+1])
-            if User_ColEvents >0:
-                Col_Events = User_ColEvents
-                # print '>>> User events (collision data) = %s' % Col_Events
-        elif arg in ("-q", "--cpus"):    
-            # print ' >>> The user wants to provide the number of cpus ... lets see. This argument is the %s argument ' % argCurr       
-            User_ColCPUs = int(sys.argv[argCurr+1])
-            if User_ColCPUs >0:
-                Col_CPUs = User_ColCPUs
-                # print '>>> User cpus (collision data) = %s' % Col_CPUs
-        elif arg in("-rtt","-RTT"):
-            RTTConfig = True
-    if 'rtt' in os.environ['USER']:
-        RTTConfig = True    
-    
-    print '>>> RunIterator >>> List of values:'
-    if not RTTConfig:
-        print ' RunNumber = %d' % RunNumber
-    if RTTConfig:
-        print ' Detected RTT!! '
-    print ' # Events (col) = %d' % Col_Events
-    print ' # CPUS (col) = %d' % Col_CPUs
-    print '>>> End of input options processing <<<'             
-    
-    if RTTConfig:
-        Data1 = setupData('Collision')
-        Data1.setDataType('MC10_Singlemuons') 
-        Col_CPUs = 1
-        Col_Events = 10000
-        Data1.setGlobalTag("OFLCOND-DR-BS7T-ANom-11")
-    else:
-        Data1 = setupData('IDTracks')
-        Data1.setDataType("IDTracks")
-    Data1.setRuns([RunNumber])
-    Data1.setCPUs([Col_CPUs,Col_CPUs])
-    Data1.setEvents([Col_Events,Col_Events])
-    Data1.CreateFileList()
-    return Data1
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py
deleted file mode 100644
index 834540f6466123b577a7625a201520c9ab984942..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py
+++ /dev/null
@@ -1,208 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-import os, time
-
-class manageJobEoverPMaps:
-	def __init__(self,
-		     OutputPath,
-		     dataName,
-		     iter,
-		     part,
-		     JOBNAME,
-		     preName,
-     	     ATHENACFG,
-		     RecoOptions={},
-		     extraOptions={},
-		     AlignmentOptions={},
-		     RecoScript="InDetAlignExample/NewTopOptions.py",
-		     AlignmentScript="InDetAlignExample/NewInDetAlignAlgSetup.py",
-		     AlignmentLevels = "InDetAlignExample/NewInDetAlignLevels.py",
-		     #MonitoringScript = "InDetRecExample/InDetMonitoringAlignment.py", 
-		     QUEUE = "1nh",
-		     CMTDIR = "",
-		     inputPoolFiles = "",
-		     SCRIPTNAME = "",
-		     RunPath = ""):
-		self.OutputPath = OutputPath
-		self.preName = preName
-		self.i=iter
-		self.j=part
-		self.dataName = dataName
-		self.QUEUE=QUEUE
-		self.CMTDIR=CMTDIR
-		self.ATHENACFG=ATHENACFG
-		self.inputPoolFiles = inputPoolFiles
-		self.JOBNAME=JOBNAME
-		self.RecoOptions = RecoOptions
-		self.extraOptions = extraOptions
-		self.RecoScript = RecoScript
-		self.AlignmentOptions = AlignmentOptions
-		self.AlignmentScript = AlignmentScript
-		self.AlignmentLevels = AlignmentLevels
-		#self.MonitoringScript = MonitoringScript
-		self.SCRIPTNAME = SCRIPTNAME
-		self.RunPath = RunPath
-
-		
-	def createDirectories(self):
-		os.system('mkdir -p %s' % self.RunPath)
-
-	def writeJO(self):		
-		job=open(self.RunPath + self.JOBNAME,'w')
-		
-
-		job.write('##-------- Reconstruction Configuration --------------------\n')
-		
-		for option in self.RecoOptions:
-			if type(self.RecoOptions[option]) is str:
-				customoption = option + "\t=\t\"" +  self.RecoOptions[option]+'\"\n'
-				job.write(customoption)
-			else:
-				if option == "inputFiles":
-					customoption = option + "\t=\t" +  str(self.RecoOptions[option])+'\n'
-				else:
-					customoption = option + "\t=\t" +  str(self.RecoOptions[option])+'\n'
-				job.write(customoption)
-
-		if len(self.extraOptions):
-			job.write("\n")
-			job.write('##-------- Extra Configuration --------------------\n')
-		
-		for option in self.extraOptions:
-			if type(self.extraOptions[option]) is str:
-				customoption = option + "\t=\t\"" +  self.extraOptions[option]+'\"\n'
-				job.write(customoption)
-			else:
-				customoption = option + "\t=\t" +  str(self.extraOptions[option])+'\n'
-				job.write(customoption)
-
-		job.write("\n")
-		job.write('##-------- End of custom options -------------\n')
-
-		# Need to write the InDetRec Options Here:
-		job.write("\n")
-		job.write('##-------- Load Reconstruction --------------------\n')
-		job.write('include("'+str(self.RecoScript)+'") \n')
-
-		job.close()
-
-	def writeScript(self):
-		self.SCRIPTNAME = self.RunPath + '/' + self.SCRIPTNAME
-		script=open(self.SCRIPTNAME,'w')
-		script.write("#BSUB -J %s_%s_Part%02d \n" % (self.preName,self.dataName, self.j))
-		script.write("#BSUB -o %s/logs/%s_Part%02d.log \n" % (self.OutputPath,self.dataName,self.j))
-		script.write("#BSUB -e %s/logs/%s_Part%02d.err \n" % (self.OutputPath,self.dataName,self.j))
-					
-		script.write("#BSUB -q %s \n" % self.QUEUE)
-		script.write("\n")
-		script.write("#   setup the environment \n")
-		if self.ATHENACFG.atlasSetup() == "CMTHOME":
-			script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENACFG.Release(), self.ATHENACFG.Tags()))
-		elif "single" in self.ATHENACFG.AtlasSetupOptions():
-			script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s --single \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-		else:
-			script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-		script.write("export STAGE_SVCCLASS=atldata\n")
-		
-
-		script.write("cd %s \n" % self.RunPath)
-
-		for file in self.inputPoolFiles:
-			#if 'ESD' in file or 'AlignmentConstants' in file:
-			if 'AlignmentConstants' in file or 'ESD' in file:
-				script.write("pool_insertFileToCatalog "+ file + " \n")
-		
-		script.write("athena %s \n" % self.JOBNAME)
-		script.write("cd -")
-		script.close()
-		
-	def send(self,runmode):
-		os.system("chmod +x %s" % self.SCRIPTNAME)
-		print "----------------------------------------------"
-		if runmode == "batch":
-			os.system("bsub <%s" % self.SCRIPTNAME)
-		   
-			print "  Sending %s_%s_Part%02d job to LxBatch" % (self.preName,self.dataName, self.j)
-				  
-		elif runmode == "local":
-			print "  Running %s_%s_Part%02d job" % (self.preName,self.dataName,self.j)
-			os.system("sh %s | tee %s/logs/%s_Part%02d.log \n" % (self.SCRIPTNAME, self.OutputPath,self.dataName,self.j))
-
-			
-		print "----------------------------------------------"
-
-	def wait(self):
-		print "Processing in lxbatch..."
-		# Wait for signal
-		time.sleep(30)
-		while os.popen('bjobs -w').read().find(self.preName)!=-1:
-			time.sleep(30)
-			
-class mergeScriptEoverPMaps:
-	def __init__(self,
-		     OutputPath,
-		     preName,
-		     QUEUE,
-		     CMTDIR,
-		     ATHENACFG,
-		     SCRIPTNAME,
-		     JOBNAME
-		     ):
-		self.OutputPath = OutputPath
-		self.preName = preName
-		self.QUEUE=QUEUE
-		self.CMTDIR=CMTDIR
-		self.ATHENACFG=ATHENACFG
-		self.SCRIPTNAME=SCRIPTNAME
-		self.JOBNAME=JOBNAME
-
-	def write(self):
-		TempPath = self.OutputPath
-		self.SCRIPTNAME = TempPath + '/' + self.SCRIPTNAME
-		
-		# list of Files to be merged
-		mergeFilesName = TempPath + '/merge_Files.txt'
-		script=open(self.SCRIPTNAME,'w')
-		
-		script.write("#BSUB -J %s_Merge \n" % (self.preName))
-		script.write("#BSUB -o %s/logs/%s_Merge.log \n" % (self.OutputPath,self.preName))
-		script.write("#BSUB -e %s/logs/%s_Merge.err \n" % (self.OutputPath,self.preName))
-		
-		script.write("#BSUB -q %s \n" % self.QUEUE)
-		script.write("\n")
-		script.write("#   setup the environment \n")
-		if self.ATHENACFG.atlasSetup() == "CMTHOME":
-			script.write("source %s/setup.sh -tag=%s,%s \n" % (self.CMTDIR, self.ATHENACFG.Release(), self.ATHENACFG.Tags()))
-
-		elif "single" in self.ATHENACFG.AtlasSetupOptions():
-			script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s --single \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-
-		else:
-			script.write("source %s/scripts/asetup.sh %s --testarea=%s --tags=%s \n" % (self.ATHENACFG.AtlasSetupPath(),self.ATHENACFG.Release(),self.ATHENACFG.TestArea(), self.ATHENACFG.Tags()))
-		script.write("cd %s \n" % (self.OutputPath))
-		script.write("DQHistogramMerge.py %s ./eoverpValidationMerge.root True\n" %(mergeFilesName))
-		script.write("cd -")
-		script.close()
-		
-		mergeFiles=open(mergeFilesName,"w")
-		os.chdir(self.OutputPath)
-		files = os.popen("find -name 'eoverpValidationOut.root'").readlines()
-		for line in files:
-			mergeFiles.write("%s" % line)
-		mergeFiles.close()
-				
-
-	def send(self,runmode):
-		os.system("chmod +x %s" % self.SCRIPTNAME)
-		print "----------------------------------------------"
-		if runmode == "batch":
-			os.system("bsub <%s" % self.SCRIPTNAME)
-			
-			print "  Sending %s_Merge job " % self.preName
-			
-		elif runmode == "local":
-			print "  Running %s_Merge job" % self.preName
-			os.system("sh %s | tee %s/logs/Merge.log \n" % (self.SCRIPTNAME, self.OutputPath))
-			
-		print "----------------------------------------------"
-                       
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py
deleted file mode 100644
index e481fc5047722df325a1b756b1facc9e38032d29..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-class setupData:
-	def __init__ (self, name):
-		self.name = name
-		self.dataType = "IDTracks"
-		self.fileListName = self.name+"_"+self.dataType+".txt"
-		self.Runs = [0]
-		self.RecoTags = [""]
-		self.CPUs = [1,1,1]
-		self.Events = [100,100,100]
-		self.DetDescrVersion = ""
-		self.limitFiles = -1
-		self.GlobalTag = ""
-		self.ByteStream = True
-		self.STAGE_SVCCLASS = "default"
-		self.projectName = ""
-		self.AreCosmics = False
-		self.pixelDigitalClustering = False
-		self.thePtMin = 0
-	def setPtMin(self, newPtMin):
-		self.thePtMin = newPtMin
-	def getPtMin(self):
-		return self.thePtMin
-	def setDigitalClustering(self, digitalClustering):
-		self.pixelDigitalClustering = digitalClustering
-	def getDigitalClustering(self):
-		return self.pixelDigitalClustering
-	def setCosmic (self, cosmics):
-		self.AreCosmics = cosmics
-	def getCosmics(self):
-		return self.AreCosmics
-	def setProjectName (self, projectName):
-		self.projectName = projectName
-	def getProjectName(self):
-		return self.projectName
-	def setDataType(self, dataType):
-		self.dataType = dataType
-	def getDataType(self):
-		return self.dataType
-	def getName(self):
-		return self.name
-	def setByteStream(self, ByteStream):
-		self.ByteStream = ByteStream
-	def getByteStream(self):
-		return self.ByteStream
-	def setRuns(self, Runs):
-		self.Runs = Runs
-	def getRuns(self):
-		return self.Runs
-	def setRecoTags(self,RecoTags):
-		self.RecoTags = RecoTags
-	def getRecoTags(self,i):
-		return self.RecoTags[i]
-	def setCPUs(self,CPUs):
-		self.CPUs = CPUs
-	def getCPUs(self,i):
-		return self.CPUs[i]
-	def setEvents(self, Events):
-		self.Events = Events
-	def getEvents(self,i):
-		return self.Events[i]
-	def setLimitFiles(self,i):
-		self.limitFiles = i
-	def getEventsPerCPU(self,i):
-		if self.Events[i] == -1:
-			return -1
-		else:
-			return self.Events[i] / self.CPUs[i]
-	def setGlobalTag(self,GlobalTag):
-		self.GlobalTag = GlobalTag
-	def getGlobalTag(self):
-		return self.GlobalTag
-	def setDetDescrVersion(self,DetDescrVersion):
-		self.DetDescrVersion = DetDescrVersion	
-	def getDetDescrVersion(self):
-		return self.DetDescrVersion 
-	def CreateFileList(self):
-		import os
-		self.fileListName = self.name+"_"+self.dataType+".txt"
-		if os.path.isfile(self.fileListName):
-			print "The file ", self.fileListName, " exists, using the existing one."
-			return 0
-	
-		outputFile = open(self.fileListName, "w")
-		count = 0
-		for run in self.Runs:
-			run = int(run)
-			if "IDTracks" == self.dataType:
-				#path = "/castor/cern.ch/grid/atlas/DAQ/2010/%08d/calibration_IDTracks/" % run
-				if run < 170000:
-					path = "/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.%08d.calibration_IDTracks.daq.RAW/" % run
-				elif run < 200000:
-					path = "/castor/cern.ch/grid/atlas/DAQ/2011/%08d/calibration_IDTracks/" % run
-				else:
-					path = "/castor/cern.ch/grid/atlas/DAQ/2012/%08d/calibration_IDTracks/" % run
-
-				self.ByteStream = True
-			elif "MinBias" == self.dataType:
-				path = "/castor/cern.ch/grid/atlas/atlasdatadisk/data10_7TeV/ESD/%s/data10_7TeV.%08d.physics_MinBias.recon.ESD.%s/" % (self.RecoTags[count],run,self.RecoTags[count])
-				#path = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_7TeV/physics_MinBias/%07d/data10_7TeV.%08d.physics_MinBias.merge.RAW/" % (run,run)
-				self.ByteStream = False
-			elif "IDCosmics" == self.dataType:
-				#path = "/castor/cern.ch/grid/atlas/DAQ/merge/2010/%08d/physics_IDCosmic/" % (run)
-				#path = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_cos/physics_IDCosmic/%07d/data10_cos.%08d.physics_IDCosmic.merge.RAW/" % (run,run)
-				if run < 170000:
-					path = " /castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.%08d.physics_IDCosmic.merge.RAW/" % run
-				else:
-					path = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_7TeV/physics_IDCosmic/%08d/data11_7TeV.%08d.physics_IDCosmic.merge.RAW/" % (run,run)
-				self.ByteStream = True
-			elif "MC09_Multimuons" == self.dataType:
-				path = "/castor/cern.ch/grid/atlas/atlasgroupdisk/perf-idtracking/dq2/mc09_valid/ESD/e436_s561_r731/mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731_tid076491/"
-				self.ByteStream = False
-			elif "MC10_Singlemuons" == self.dataType:
-				path = "/eos/atlas/atlascerngroupdisk/perf-idtracking/rtt/mc10_7TeV.107233.singlepart_mu100.digit.RDO.e605_s933_s946_d369/"
-				self.ByteStream = False
-			elif "HeavyIons" == self.dataType:
-				path = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_hi/express_express/%07d/data10_hi.%08d.express_express.merge.RAW/" % (run,run)
-				self.ByteStream = True
-			elif "Express" == self.dataType:
-				if run > 170000:
-					path = "/castor/cern.ch/grid/atlas/atlasdatadisk/data11_7TeV/ESD/%s/data11_7TeV.%08d.express_express.recon.ESD.%s/" % (self.RecoTags[count],run,self.RecoTags[count])
-			elif "Egamma" == self.dataType:
-				path = "/eos/atlas/atlasdatadisk/data11_7TeV/DESD_SGLEL/%s/data11_7TeV.%08d.physics_Egamma.merge.DESD_SGLEL.%s/" % (self.RecoTags[count],run,self.RecoTags[count])
-			else:
-				print "Creation of the file list for this data type is not coded yet"
-				return 0
-			self.setSTAGE_SVCCLASS(path)
-			
-			print "Reading castor directory: ", path
-			if "castor" in path:
-				inputfiles = os.popen("rfdir "+ path).read().splitlines()
-			elif "eos" in path:
-				inputfiles = os.popen("/afs/cern.ch/project/eos/installation/0.2.31/bin/eos.select ls " + path).read().splitlines()
-				print "Reading input files from eos"
-				print inputfiles 
-			files = 0
-			print self.STAGE_SVCCLASS
-			for file in inputfiles:
-				if "eos" in path:
-					outputFile.write('root://eosatlas/'+path + '/' + file + '\n')
-				else:
-					check_staged = os.popen("stager_qry -S "+self.STAGE_SVCCLASS+" -M " + path + file.split()[8]).read()
-					if "STAGED" in check_staged or "CANBEMIGR" in check_staged:
-						if "atlascerngroupdisk" in path:
-							outputFile.write("root://castoratlas/"+path + file.split()[8] + '\t' + file.split()[4] + '\n')
-						elif "DESD" in path:
-							outputFile.write("rfio://"+path + file.split()[8] + '\t' + file.split()[4] + '\n')				
-						elif "castor" in path:
-							outputFile.write("root://castoratlas/"+path + file.split()[8] + '\t' + file.split()[4] + '\n')
-						
-						else:
-							outputFile.write(path + file.split()[8] + '\t' + file.split()[4] + '\n')
-						files = files + 1
-						if files >= self.limitFiles and self.limitFiles != -1:
-							break
-					else:
-						print "File ", file.split()[8], " no STAGED, skipping file"
-			count = count + 1
-		print "Created file " ,self.fileListName, " with the list of datafiles"
-	def getFileList(self):
-		return self.fileListName
-	def setCustomFileList(self,filelist):
-		self.fileListName = filelist
-	def getNFilesInList(self):
-		num_lines = sum(1 for line in open(self.fileListName))
-		return num_lines
-	def setSTAGE_SVCCLASS(self,path):
-		print path
-		if "atlasdatadisk" in path:
-			self.STAGE_SVCCLASS="atldata"
-		if "DAQ" in path or "tzero" in path:
-			self.STAGE_SVCCLASS="atlcal"
-		if "atlasgroupdisk" in path:
-			self.STAGE_SVCCLASS="atlasgroupdisk"
-		if "atlasscratchdisk" in path:
-			self.STAGE_SVCCLASS="atlasscratchdisk"
-		if "atlascerngroupdisk" in path:
-			self.STAGE_SVCCLASS="atlascerngroupdisk"
-			import os
-			os.environ["STAGE_HOST"] = "castoratlast3"
-		print "STAGE_SVCCLASS set to ", self.STAGE_SVCCLASS
-		import os
-		os.environ['STAGE_SVCCLASS']=self.STAGE_SVCCLASS
-
-	def Print(self):
-		print "---------------------------"
-		print "Dataset with name ", self.name
-		print "The data is: ", self.dataType
-		print "ProjectName: ", self.projectName
-		print "Is ByteStream? ", self.ByteStream
-		print "Are data Cosmics? ", self.AreCosmics
-		print "The list of files to use is in: ", self.fileListName
-		print "CPUs: ", self.CPUs
-		print "Events: ", self.Events
-		
-		
-		
-		
-		
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/__init__.py b/InnerDetector/InDetExample/InDetAlignExample/python/__init__.py
deleted file mode 100644
index e721513c95f401a24367e01c89f1abaf2ada4c1c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/python/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-__author__ = 'Grant Gorfine'
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/Accumulate_trf.py b/InnerDetector/InDetExample/InDetAlignExample/scripts/Accumulate_trf.py
deleted file mode 100644
index e23b13ca460015884592ec2b33e181822df06d89..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/Accumulate_trf.py
+++ /dev/null
@@ -1,250 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#########################################################################
-##
-## Accumulate trf for Tier-0: 
-##
-##  - input parameter: file containing a pickled dictionary consisting of the key/value pairs
-##     1) 'inputRAWData': python list 
-##         ['datasetname#filename1', 'datasetname#filename2', ...] (input dataset + file names) 
-##     2) 'inputAlignmentConstants':  string, input alignment constants, can be empty
-##         'alignmentconstantsname#filename.root' 
-##
-##     3) 'outputTFile': string, output TFile containing the matrix, vector...
-##         'name#AlignmentTFile.root'
-##     4) 'outputMonitoringFile': string, output root file with plots.
-##         'name#monitoring.root'
-##
-##  - assembles custom jobOptions file, runs athena
-##
-##########################################################################
-
-import sys, string, commands, os.path, os, pickle, time, pprint, xmlrpclib
-
-#########################################################################
-
-# Utility function
-
-def getFileMap(fname, dsname, nevts=0) :
-  if os.path.isfile(fname) :
-    sz = os.path.getsize(fname)
-    map = { 'lfn': fname,
-            'dataset' : dsname,
-            'size' : sz,
-            'events' : nevts
-          }
-  else : 
-    map = {}
-  return map
-
-#########################################################################
-
-        
-def runAthena(picklefile) :
-
-  t0 = time.time()
-  
-  print "\n##################################################################"
-  print   "##             ATLAS Tier-0 Alignment Processing                ##"
-  print   "##################################################################\n"
-
-  # extract parameters from pickle file
-  print "Using pickled file ", picklefile, " for input parameters"
-  f = open(picklefile, 'r')
-  parmap = pickle.load(f)
-  f.close()
-
-  print "\nFull Tier-0 run options:\n"
-  pprint.pprint(parmap)
-
-  inputfilelist = parmap.get('inputRAWData', [])
-  nfiles = len(inputfilelist) 
-  if not nfiles :   # problem with job definition or reading pickle file
-    dt = int(time.time() - t0) 
-    retcode = 1
-    acronym = 'TRF_NOINPUT'
-    txt = 'empty input file list'  
-    outmap = { 'prodsys': { 'trfCode': retcode,
-                            'trfAcronym': acronym,  
-                            'jobOutputs': [],
-                            'jobInputs': [],
-                            'nevents': 0,
-                            'more': { 'num1': 0, 'num2': dt, 'txt1': txt }
-                          }
-             }
-  
-  else : 
-    # assemble list of ['filename1', 'filename2', ...]
-    inflist = []
-    for val in parmap['inputRAWData']:
-      infname = val.split('#')[1]
-      inflist.append(infname)
-    
-    # alignment constants:
-    
-    try:
-      inputAlignmentConstants = (parmap['inputAlignmentConstants']).split('#')[1]
-    except:
-      inputAlignmentConstants = ""
-  
-	# output TFile                                                                                           
-    outdsname = (parmap['outputTFile']).split('#')[0]
-    outfile = (parmap['outputTFile']).split('#')[1]
-    outputTFile = (parmap['outputTFile']).split('#')[1]
-
-    
-    # output monitoring file
-    outputMonitoringFile = (parmap['outputMonitoringFile']).split('#')[1]
-    # assemble jobOptions fragment
-    (s,o) = commands.getstatusoutput('rm -f myJobOptions.py')
-    jOFile = open('myJobOptions.py', 'w')
-    cont = '''
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputFiles = %s
-inputAlignmentConstants = "%s"
-OutputTFileName = "%s"
-
-PathBinName = OutputTFileName[:OutputTFileName.rfind('/')+1]
-TFileName = OutputTFileName[OutputTFileName.rfind('/'):]
-
-##-------- Alignment Configuration --------------------
-WriteTFile = True
-runLocal	=	False
-sctAlignEndcaps	=	True
-ModCut	=	6
-sctAlignmentLevelEndcaps	=	-1
-pixelAlignmentLevel	=	1
-pixelAlignBarrel	=	True
-if len(inputAlignmentConstants)!=0:
-	readConstantsFromPool	=	True
-	inputPoolFiles	=	[inputAlignmentConstants]
-else:
-	readConstantsFromPool	=	False
-runAccumulate	=	True
-alignSCT	=	True
-pixelAlignmentLevelBarrel	=	-1
-alignPixel	=	True
-sctAlignmentLevel	=	1
-pixelAlignEndcaps	=	True
-solvingOption	=	1
-pixelAlignmentLevelEndcaps	=	-1
-trtAlignmentLevel	=	1
-sctAlignmentLevelBarrel	=	-1
-alignTRT	=	True
-runSolving	=	False
-sctAlignBarrel	=	True
-solveLocal	=	False
-
-##-------- Loading the Alignment Levels --------------------
-include("InDetAlignExample/NewInDetAlignLevels.py") 
-
-##-------- Reconstruction Configuration --------------------
-errorScalingTag	=	"TrkErrorScaling_7T_2010_03"
-numberOfEvents	=	100
-
-
-detectorDescription	=	"ATLAS-GEO-16-00-00"
-globalTag	=	"COMCOND-REPP-007-05"
-
-##-------- Extra Configuration --------------------
-ModCut	=	7
-beamSpotTag	=	"IndetBeampos-ES1-UPD2"
-doReadBS	=	True
-doBSConstraint	=	True
-useOldPreProcessor	=	False
-doPVConstraint	=	False
-doTrkNtuple	=	False
-doMonitoring	=	True
-
-##-------- End of custom options -------------
-
-##-------- Load Reconstruction --------------------
-include("InDetAlignExample/loadInDetRec_new.py") 
-svcMgr.PoolSvc.AttemptCatalogPatch = True	
-##-------- Load Alignment --------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py") 
-
-###############################################################
-  ''' % (str(inflist), inputAlignmentConstants, outputTFile)
-
-    jOFile.write(cont)
-    jOFile.close()
-
-    # run athena
-    cmd = "python -u `which athena.py` myJobOptions.py"
-	
-    print "\nRun command:"
-    print cmd
-    print "\nLogfile:"
-    print "------------------------------------------------------------------"
-    retcode = os.system(cmd)
-    print "------------------------------------------------------------------"
-    dt = int(time.time() - t0)
-
-    print "\n## athena.py finished with retcode = %s" % retcode
-    print   "## ... elapsed time: ", dt, " sec"
-
-    # move Monitoring file
-    os.system("mv monitoring.root %s" % outputMonitoringFile)
-    # assemble report pickle file
-    outfiles = []
-    infiles = []
-    nevts = 0
-    acronym = 'ALLOK'
-    txt = 'trf finished OK'  
-
-    # get info for report gpickle file
-    if retcode == 0 :
-      # one could determine the number of processed events here, e.g. by grep'ping in the logfile
-      fmap = getFileMap(outfile, outdsname, nevts=nevts)
-      outfiles = [fmap]
-    if retcode != 0 :
-      print "ERROR: athena.py execution problem!"
-      acronym = 'TRF_ATHENA_EXE'
-      txt = "athena.py execution problem"
-
-    # assemble job report map
-    outmap = { 'prodsys': { 'trfCode': retcode,
-                            'trfAcronym': acronym,
-                            'jobOutputs': outfiles,
-                            'jobInputs': infiles,
-                            'more': { 'num1': int(nevts), 'num2': int(dt), 'txt1': txt }
-                          }
-             }
-  
-  # pickle report map
-  f = open('jobReport.gpickle', 'w')
-  pickle.dump(outmap, f)
-  f.close()
-
-  print "\n##################################################################"
-  print   "## End of job."
-  print   "##################################################################\n"
-
-
-########################################
-## main()
-########################################
-
-if __name__ == "__main__":
-
-  if (len(sys.argv) != 2) and (not sys.argv[1].startswith('--argdict=')) :
-    print "Input format wrong --- use "
-    print "   --argdict=<pickled-dictionary containing input info> "
-    print "   with key/value pairs: "
-    print "     1) 'inputFiles': python list "
-    print "          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) "
-    print "     2) 'outputFile': string 'datasetname#filename' "
-    print "        (merged output dataset name + file) "
-    sys.exit(-1)
-  
-  else :
-    picklefile = sys.argv[1][len('--argdict='):]
-    runAthena(picklefile)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/ConstantsUploader.py b/InnerDetector/InDetExample/InDetAlignExample/scripts/ConstantsUploader.py
deleted file mode 100644
index decd3af7d9662ebc92be91d68962a58f0c0f67f9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/ConstantsUploader.py
+++ /dev/null
@@ -1,292 +0,0 @@
-#! /usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-# =====================================================================
-# Main script to run the upload constants to DB
-# =====================================================================
-import os
-import sys
-# =====================================================================
-#  Welcome print
-# =====================================================================
-print "\n ============================================="
-print "    ID Alignment constants uploader"
-print " =============================================\n"
-# =====================================================================
-#  Default values
-# =====================================================================
-Def_Do_Silicon = 1
-User_Do_Silicon = -1
-#
-Def_Do_TRT = 1
-User_Do_TRT = -1
-#
-Def_ConstantsFile = "IterX_AlignmentConstants"
-User_ConstantsFile = ""
-#
-Def_Mode = "Test"
-User_Mode = ""
-#
-Def_Comment = "This is a TEST" 
-User_Comment =""
-#
-Def_Tag = "new_tag"
-User_Tag = ""
-#
-Def_UPD4 = ""
-User_UPD4 = ""
-#
-Def_DBName = "COMP200"
-User_DBName = ""
-#
-Def_Conditions = "cond10_data.gen.COND"
-User_Conditions = ""
-#
-# =====================================================================
-#  Handling of run options
-# =====================================================================
-if len(sys.argv) > 1:
-    argNum = 1
-    argMax = len(sys.argv)-1
-    argCurr = -1 # jut to make that first time it points to 0 
-    #print ' >>> user input has %s arguments' % argMax
-    for arg in sys.argv:
-        argCurr += 1
-        #print ".. %s .." % arg
-        if arg in ("-h", "--help"):    
-            print ' >>> This is the help message of RunIterator.py'       
-            print ' NAME'
-            print '     RunIterator.py'
-            print ' '
-            print ' SYNOPSIS'
-            print '     python RunIterator.py [-r RunNumber] [-f ConstantsFile]' 
-            print ' '
-            print ' OPTIONS'
-            print '     The following options are recognized by RunIterator.py'
-            print ' '
-            print '     -db DBName'
-            print '          DB where the constants will be uploaded. The posible names are COMP200 and OFLP200. The default \n name is: %s' %Def_DBName
-            print ' '
-            print '     -f ConstantsFile'
-            print '          The constants .root and .db files taken are: ConstantsFile.root and ConstantsFile.db. The default \n\
-            files are {0}.root and {0}.db'.format(Def_ConstantsFile)
-            print ' '
-            print '     -exec'
-            print '           The constants will be effectively uploaded to the DB. Default mode is test mode when commands are just\n\
-            displayed but no executed, therefore no constants are uploaded.'
-            print ' '
-            print '     -c Comment'
-            print '           Set a comment (between quotes) in the DB entry next to the tag name. Default comment: \"{0}\"'.format(Def_Comment)
-            print ' '
-            print '     -silicon doSilicon'
-            print '           If doSilicon = 1 then silicon constants are uploaded (default).'           
-            print '           If doSilicon = 0 then silicon constants are not uploaded.' 
-            print '           default value: doSilicon = %d' %Def_Do_Silicon
-            print ' '
-            print '     -trt doTRT'
-            print '           If doTRT = 1 then TRT constants are uploaded.'           
-            print '           If doTRT = 0 then TRT constants are not uploaded (default)'           
-            print '           default value: doTRT = %d' %Def_Do_TRT
-            print ' '
-            print '     -tag Tag_Id'
-            print '           The extensions of the tag identifier are set for InDetAlign and TRTAlign. The default tag is: \"%s\"' %Def_Tag
-            print ' '
-            print '     -upd4'
-            print ' ' 
-            print ' \n 09/February/2011'
-            sys.exit()
-        elif arg in ("-f", "--file"):    
-            User_ConstantsFile = str(sys.argv[argCurr+1])
-            # 
-        elif arg in ("-t", "-tag", "--tag"):    
-            User_Tag = str(sys.argv[argCurr+1])
-            # 
-        elif arg in ("-db", "--db", "--DB"):    
-            User_DBName = str(sys.argv[argCurr+1])
-            #
-        elif arg in ("-cond", "--cond", "--COND"):    
-            User_Conditions = str(sys.argv[argCurr+1])
-            #
-        elif arg in ("--exec"):    
-            # This option activates the execution of the commands
-            User_Mode = "Exec"
-            #
-        elif arg in ("-silicon", "--silicon"):    
-            User_Do_Silicon = int(sys.argv[argCurr+1])
-            if (User_Do_Silicon > 1): 
-                User_Do_Silicon = 1;
-            elif (User_Do_Silicon <0):
-                User_Do_Silicon = 0
-            #
-        elif arg in ("-trt", "--trt"):    
-            User_Do_TRT = int(sys.argv[argCurr+1])
-            if (User_Do_TRT > 1): 
-                User_Do_TRT = 1;
-            elif (User_Do_TRT <0):
-                User_Do_TRT = 0
-            #
-        elif arg in ("-c", "--comment"):    
-            User_Comment = str(sys.argv[argCurr+1])
-            #
-        elif arg in ("-upd4","--upd4","--UPD4"):    
-            # This option activates the execution of the commands
-            User_UPD4 = "--ignoremode BackDoor"
-            #
-
-    if (1):
-        print '>>> ConstantsUploader >>> List of user input values:'
-        print '> User File Name = %s' % User_ConstantsFile 
-        print '> User Do_Silicon = %d' % User_Do_Silicon
-        print '> User Do_TRT = %d' % User_Do_TRT
-        print '> User Mode = %s' % User_Mode
-        print '> User tag = %s' %User_Tag
-        print '> User Comment = %s' %User_Comment
-        print '> User upd4 = %s' %User_UPD4
-        print '> User DB name = %s' %User_DBName
-        print '> User conditions file = %s' %User_Conditions
-        print '>>> End of input options processing <<< \n' 
-
-# ===============================
-# Handling of variables
-# ===============================
-#
-ConstantsFileName = Def_ConstantsFile 
-if (User_ConstantsFile): 
-    ConstantsFileName = User_ConstantsFile 
-#
-Upload_Mode = Def_Mode
-if (User_Mode):
-    Upload_Mode = "Exec"
-#
-TheNewTag = Def_Tag 
-if (User_Tag): 
-    TheNewTag = User_Tag 
-#
-DBName = Def_DBName 
-if (User_DBName): 
-    DBName = User_DBName 
-#
-ConditionsFile = Def_Conditions 
-if (User_Conditions): 
-    ConditionsFile = User_Conditions
-#
-Do_Silicon = Def_Do_Silicon
-if (User_Do_Silicon != -1): 
-    Do_Silicon = User_Do_Silicon
-#
-Do_TRT = Def_Do_TRT
-if (User_Do_TRT != -1):
-    Do_TRT = User_Do_TRT
-#
-DotDbFile = ConstantsFileName+".db"
-DotRootFile = ConstantsFileName+".root"
-OutputDbFile = ConstantsFileName+"_output.db"
-#
-CommentOnConstants = Def_Comment
-if (User_Comment):
- CommentOnConstants = User_Comment
-# 
-New_InDet_TagName = "InDetAlign_" + TheNewTag
-New_TRT_TagName = "TRTAlign_" + TheNewTag
-#
-CommandUPD4 = Def_UPD4
-if (User_UPD4):
- CommandUPD4 = User_UPD4
-
-
-
-if (1):
-    print '>>>>>>>>>>>> List of variables >>>>>>>>>>>>>>> '
-    print '> DotDbFile    = %s' %DotDbFile
-    print '> DotRootFile  = %s' %DotRootFile
-    print '> OutputDbFile = %s' %OutputDbFile
-    print '> DB Name      = %s' %DBName
-    print '> Conditions   = %s' %ConditionsFile
-    print '> Upload_Mode  = %s' %Upload_Mode
-    print '> InDet tag    = %s' %New_InDet_TagName
-    print '> TRT tag      = %s' %New_TRT_TagName
-    print '> Do_Silicon   = %d' %Do_Silicon
-    print '> Do_TRT       = %d' %Do_TRT
-    print '> Comment      = %s' %CommentOnConstants
-    print '> CommandUPD4  = %s' %CommandUPD4
-    print '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n '
-
-# ===============================
-# Common step
-# ===============================
-# this command line is the same for silicon and TRT
-CommandLine0 = "~atlcond/utils/registerFiles2 --wait " + ConditionsFile + " " + DotRootFile
-
-# ===============================
-# 1st step
-# ===============================
-
-# -- prepare the command 
-CommandLine1_Silicon = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /Indet/Align -outtag " + New_InDet_TagName + " -tl \""+ CommentOnConstants +"\" -alliov "+CommandUPD4
-
-CommandLine1_TRT = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /TRT/Align -outtag " + New_TRT_TagName +" -tl \""+ CommentOnConstants +"\" -alliov "+CommandUPD4
-
-TestCommand = "ls -l %s" %DotDbFile
-ExistsDotDb = os.system(TestCommand)
-if (ExistsDotDb !=0):
-    print '\n ** ERROR ** file %s does not exist ' % DotDbFile 
-    sys.exit()
-
-TestCommand = "ls -l %s" %DotRootFile
-ExistsDotRoot = os.system(TestCommand)
-if (ExistsDotRoot !=0):
-     print '\n ** ERROR ** file %s does not exist ' % DotRootFile 
-     sys.exit()
-
-
-# ===============================
-# 2nd step
-# ===============================
-CommandLine2_Silicon = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug  --batch --comment \""+CommentOnConstants+"\" --tag " + New_InDet_TagName + " --passopt='-ctl' --folder /Indet/Align "+ OutputDbFile +" COMP200 ATLAS_COOLWRITE ATLAS_COOLOFL_INDET_W WCOOLOFL4INDET1"
-
-CommandLine2_TRT = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug --batch --comment \""+CommentOnConstants+"\" --tag " + New_TRT_TagName + " --passopt='-ctl' --folder /TRT/Align "+ OutputDbFile +" COMP200 ATLAS_COOLWRITE ATLAS_COOLOFL_TRT_W WCOOLOFL4TRT2"
-
-#- 
-# ===============================
-# Upload
-# ===============================
-if Upload_Mode in ("Exec"):
-   print " \n == Excute upload !!!! == \n"
-
-   print " \n == step2 ==> " + CommandLine0 + "\n"
-   os.system(CommandLine0)
-
-   if (Do_Silicon == 1):
-       print ' =============> Uploading silicon constants ============'
-       print " == step1 ==> " + CommandLine1_Silicon + "\n"
-       os.system(CommandLine1_Silicon)
-       print " \n == step3 ==> " + CommandLine2_Silicon + "\n"
-       os.system(CommandLine2_Silicon)
-   if (Do_TRT == 1):
-       print ' =============> Uploading TRT constants ============'
-       print " == step1 ==> " + CommandLine1_TRT + "\n"
-       print os.system(CommandLine1_TRT)
-       print " \n == step3 ==> " + CommandLine2_TRT + "\n" 
-       print os.system(CommandLine2_TRT)
-   
-elif Upload_Mode in ("Test"):
-   print " \n == Test Mode !!!! == \n"
-   print " =========== Common ============= " 
-   print " == step1 ==> " + CommandLine0 + "\n\n"
-   print "   WARNING       first check the condXX_data_gen.COND to point with the following command:"
-   print "                 > ~atlcond/utils/registerFiles2 --list \n"
-   print " =========== Silicon ============= " 
-   print " == step2 ==> " + CommandLine1_Silicon + "\n"
-   print " == step3 ==> " + CommandLine2_Silicon + "\n\n"
-   print " ===========  TRT  ============= " 
-   print " == step2 ==> " + CommandLine1_TRT + "\n"
-   print " == step3 ==> " + CommandLine2_TRT + "\n" 
-
-   
-# ===============================
-# completed
-# ===============================
-print "\n ============================================="
-print "    GAME OVER.  INSERT COIN"
-print " =============================================\n"
-sys.exit()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/MergeMon_trf.py b/InnerDetector/InDetExample/InDetAlignExample/scripts/MergeMon_trf.py
deleted file mode 100644
index 0f33ca48fc6de6b9bb4594d5a9a487668268b8d2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/MergeMon_trf.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#########################################################################
-##
-## MergeMon trf for Tier-0: 
-##
-##  - input parameter: file containing a pickled dictionary consisting of the key/value pairs
-##     1) 'inputMonitoringFiles': python list 
-##         ['datasetname#filename1.root', 'datasetname#filename2.root', ...] 
-##     2) 'outputMonitoringMergedFile': string, output merged monitoring
-##         'name#TotalMonitoring.root'
-##
-##  - assembles custom jobOptions file, runs athena
-##
-##########################################################################
-
-import sys, string, commands, os.path, os, pickle, time, pprint, xmlrpclib
-
-#########################################################################
-
-# Utility function
-
-def getFileMap(fname, dsname, nevts=0) :
-  if os.path.isfile(fname) :
-    sz = os.path.getsize(fname)
-    map = { 'lfn': fname,
-            'dataset' : dsname,
-            'size' : sz,
-            'events' : nevts
-          }
-  else : 
-    map = {}
-  return map
-
-#########################################################################
-
-        
-def runAthena(picklefile) :
-
-  t0 = time.time()
-  
-  print "\n##################################################################"
-  print   "##             ATLAS Tier-0 Alignment Processing                ##"
-  print   "##################################################################\n"
-
-  # extract parameters from pickle file
-  print "Using pickled file ", picklefile, " for input parameters"
-  f = open(picklefile, 'r')
-  parmap = pickle.load(f)
-  f.close()
-
-  print "\nFull Tier-0 run options:\n"
-  pprint.pprint(parmap)
-
-  inputfilelist = parmap.get('inputMonitoringFiles', [])
-  nfiles = len(inputfilelist) 
-  if not nfiles :   # problem with job definition or reading pickle file
-    dt = int(time.time() - t0) 
-    retcode = 1
-    acronym = 'TRF_NOINPUT'
-    txt = 'empty input file list'  
-    outmap = { 'prodsys': { 'trfCode': retcode,
-                            'trfAcronym': acronym,  
-                            'jobOutputs': [],
-                            'jobInputs': [],
-                            'nevents': 0,
-                            'more': { 'num1': 0, 'num2': dt, 'txt1': txt }
-                          }
-             }
-  
-  else : 
-    # assemble list of ['filename1', 'filename2', ...]
-    inflist = []
-    for val in parmap['inputMonitoringFiles']:
-      infname = val.split('#')[1]
-      inflist.append(infname)
-    
-   
-  
-	# output merged Monitoring file                                                                                           
-    outdsname = (parmap['outputMonitoringMergedFile']).split('#')[0]
-    outfile = (parmap['outputMonitoringMergedFile']).split('#')[1]
-    outputmonFile = (parmap['outputMonitoringMergedFile']).split('#')[1]
-
-    
-    
-    # assemble jobOptions fragment
-    (s,o) = commands.getstatusoutput('rm -f filelist')
-    fileList = open('filelist.txt', 'w')
-    for name in inflist:
-    	fileList.write(name+'\n')
-    fileList.close()
-    
-    
-
-    # run athena
-    cmd = "DQHistogramMerge.py filelist.txt %s True" % outputmonFile
-	
-    print "\nRun command:"
-    print cmd
-    print "\nLogfile:"
-    print "------------------------------------------------------------------"
-    retcode = os.system(cmd)
-    print "------------------------------------------------------------------"
-    dt = int(time.time() - t0)
-
-    print "\n## DQHistogramMerge.py finished with retcode = %s" % retcode
-    print   "## ... elapsed time: ", dt, " sec"
-
-    # assemble report pickle file
-    outfiles = []
-    infiles = []
-    nevts = 0
-    acronym = 'ALLOK'
-    txt = 'trf finished OK'  
-
-    # get info for report gpickle file
-    if retcode == 0 :
-      # one could determine the number of processed events here, e.g. by grep'ping in the logfile
-      fmap = getFileMap(outfile, outdsname, nevts=nevts)
-      outfiles = [fmap]
-    if retcode != 0 :
-      print "ERROR: DQHistogramMerge execution problem!"
-      acronym = 'TRF_PYTHON_EXE'
-      txt = "DQHistogramMerge.py execution problem"
-
-    # assemble job report map
-    outmap = { 'prodsys': { 'trfCode': retcode,
-                            'trfAcronym': acronym,
-                            'jobOutputs': outfiles,
-                            'jobInputs': infiles,
-                            'more': { 'num1': int(nevts), 'num2': int(dt), 'txt1': txt }
-                          }
-             }
-  
-  # pickle report map
-  f = open('jobReport.gpickle', 'w')
-  pickle.dump(outmap, f)
-  f.close()
-
-  print "\n##################################################################"
-  print   "## End of job."
-  print   "##################################################################\n"
-
-
-########################################
-## main()
-########################################
-
-if __name__ == "__main__":
-
-  if (len(sys.argv) != 2) and (not sys.argv[1].startswith('--argdict=')) :
-    print "Input format wrong --- use "
-    print "   --argdict=<pickled-dictionary containing input info> "
-    print "   with key/value pairs: "
-    print "     1) 'inputFiles': python list "
-    print "          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) "
-    print "     2) 'outputFile': string 'datasetname#filename' "
-    print "        (merged output dataset name + file) "
-    sys.exit(-1)
-  
-  else :
-    picklefile = sys.argv[1][len('--argdict='):]
-    runAthena(picklefile)
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/Solve_trf.py b/InnerDetector/InDetExample/InDetAlignExample/scripts/Solve_trf.py
deleted file mode 100644
index f42a5e8d12a174174720884f5b6bfa05e02fe30b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/Solve_trf.py
+++ /dev/null
@@ -1,372 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-#########################################################################
-##
-## Solve trf for Tier-0: 
-##
-##  - input parameter: file containing a pickled dictionary consisting of the key/value pairs
-##     1) 'inputTFiles': python list, input TFiles 
-##         ['datasetname#filename1', 'datasetname#filename2', ...] 
-##     2) 'inputAlignmentConstants':  string, input alignment constants, can be empty
-##         'alignmentconstantsname#filename.root' 
-##
-##     3) 'outputAlignmentConstants': string, output alignment constants
-##         'name#AlignmentConstants.root'
-##     4) 'outputAlignmentConstants': string, output alignment constants, db file
-##         'name#AlignmentConstants.db'
-##  - assembles custom jobOptions file, runs athena
-##
-##########################################################################
-
-import sys, string, commands, os.path, os, pickle, time, pprint, xmlrpclib
-
-#########################################################################
-
-# Utility function
-
-def getFileMap(fname, dsname, nevts=0) :
-  if os.path.isfile(fname) :
-    sz = os.path.getsize(fname)
-    map = { 'lfn': fname,
-            'dataset' : dsname,
-            'size' : sz,
-            'events' : nevts
-          }
-  else : 
-    map = {}
-  return map
-
-#########################################################################
-
-        
-def runAthena(picklefile) :
-
-  t0 = time.time()
-  
-  print "\n##################################################################"
-  print   "##             ATLAS Tier-0 Alignment Processing                   ##"
-  print   "##################################################################\n"
-
-  # extract parameters from pickle file
-  print "Using pickled file ", picklefile, " for input parameters"
-  f = open(picklefile, 'r')
-  parmap = pickle.load(f)
-  f.close()
-
-  print "\nFull Tier-0 run options:\n"
-  pprint.pprint(parmap)
-
-  inputfilelist = parmap.get('inputTFiles', [])
-  nfiles = len(inputfilelist) 
-  if not nfiles :   # problem with job definition or reading pickle file
-    dt = int(time.time() - t0) 
-    retcode = 1
-    acronym = 'TRF_NOINPUT'
-    txt = 'empty input file list'  
-    outmap = { 'prodsys': { 'trfCode': retcode,
-                            'trfAcronym': acronym,  
-                            'jobOutputs': [],
-                            'jobInputs': [],
-                            'nevents': 0,
-                            'more': { 'num1': 0, 'num2': dt, 'txt1': txt }
-                          }
-             }
-  
-  else : 
-    # assemble list of ['filename1', 'filename2', ...]
-    inflist = []
-    indsname = (parmap['inputTFiles'][0]).split('#')[0]
-    for val in parmap['inputTFiles'] :
-      infname = val.split('#')[1]
-      inflist.append(infname) 
-    inputTFiles = inflist
-	
-         
-    # input alignment constants
-    try:
-      inputAlignmentConstants = (parmap['inputAlignmentConstants']).split('#')[1]
-    except:
-      inputAlignmentConstants = ""
-      
-    # output file
-    outdsname = (parmap['outputAlignmentConstants']).split('#')[0]
-    outfile = (parmap['outputAlignmentConstants']).split('#')[1]
-    ouputAlignmentConstants = outfile
-    
-    
-    # output db file
-    ouputAlignmentConstantsdb = (parmap['outputAlignmentConstantsdb']).split('#')[1]
-    
-    # assemble jobOptions fragment
-    (s,o) = commands.getstatusoutput('rm -f myJobOptions.py')
-    jOFile = open('myJobOptions.py', 'w')
-    cont = '''
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputTFiles = %s
-inputAlignmentConstants = "%s"
-outputPoolFile = "%s"
-
-
-
-##-------- Alignment Configuration --------------------
-WriteTFile = True
-sctAlignmentLevelEndcaps	=	-1
-pixelAlignmentLevel	=	1
-sctAlignmentLevel	=	1
-pixelAlignmentLevelBarrel	=	-1
-pixelAlignmentLevelEndcaps	=	-1
-sctAlignmentLevelBarrel	=	-1
-alignSCT	=	True
-if len(inputAlignmentConstants)!=0:
-	readConstantsFromPool	=	True
-	inputPoolFiles	=	[inputAlignmentConstants]
-else:
-	readConstantsFromPool	=	False
-	
-solveLocal	=	False
-sctAlignBarrel	=	True
-runAccumulate	=	False
-runLocal	=	False
-runSolving	=	True
-pixelAlignEndcaps	=	True
-alignPixel	=	True
-trtAlignmentLevel	=	1
-alignTRT	=	True
-#inputPoolFiles	=	['']
-readConstantsFromPool	=	False
-pixelAlignBarrel	=	True
-sctAlignEndcaps	=	True
-
-
-##-------- Loading the Alignment Levels --------------------
-include("InDetAlignExample/NewInDetAlignLevels.py") 
-
-##-------- Reconstruction Configuration --------------------
-
-detectorDescription	=	"ATLAS-GEO-16-00-00"
-globalTag	=	"COMCOND-REPP-007-05"
-
-##-------- Extra Configuration --------------------
-ModCut	=	7
-beamSpotTag	=	"IndetBeampos-ES1-UPD2"
-doReadBS	=	True
-doBSConstraint	=	True
-useOldPreProcessor	=	False
-doPVConstraint	=	False
-doTrkNtuple	=	False
-doMonitoring	=	True
-
-##-------- End of custom options -------------
-
-##-------- Load Reconstruction --------------------
-import os
-
-loadInDetRec_Options = {"detectorDescription" : "ATLAS-GEO-08-00-00"
-                       ,"doReadBS"            : False
-		       ,"realData"            : True
-		       ,"globalTag"           : ""
-	               ,"siAlignmentTag"      : ""
-	               ,"trtAlignmentTag"     : ""
-		       ,"beamSpotTag"         : ""
-		       ,"errorScalingTag"     : ""
-	 	       ,"TRTCalibTextFile"    : ""
-		       ,"useTRT"              : True
-		       ,"inputPoolFiles"      : ""
-		       }
-
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-	if var in dir():
-		loadInDetRec_Options[var] = eval(var)
-
-
-# To extract constants from the database select the appropriate database tag.
-from AthenaCommon.GlobalFlags import globalflags
-globalflags.DataSource='data'
-
-
-globalflags.DetDescrVersion = loadInDetRec_Options["detectorDescription"]
-globalflags.print_JobProperties()
-
-if len(globalflags.ConditionsTag())!=0:
-	from IOVDbSvc.CondDB import conddb
-	conddb.setGlobalTag(globalflags.ConditionsTag())
-
-if loadInDetRec_Options["globalTag"]:
-	from IOVDbSvc.CondDB import conddb
-	conddb.setGlobalTag(loadInDetRec_Options["globalTag"])
-
-
-
-# Setup geometry
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-from InDetRecExample.InDetJobProperties import InDetFlags
-
-
-from IOVDbSvc.CondDB import conddb
-
-
-
-    
-# Its normally OK to read in some database so this can be left True.
-# In case you want to force it not to read in anything you can set this to False.
-
-
-#if loadInDetRec_Options["inputPoolFiles"] : 
-#	os.system("pool_insertFileToCatalog *.root")
-
-
-if loadInDetRec_Options["siAlignmentTag"]:
-  conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-if loadInDetRec_Options["trtAlignmentTag"]:
-  conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-
-if len(loadInDetRec_Options["inputPoolFiles"]):
-    include ("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-    # block folders that you want to override
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-    print 'Loading initial alignment File'
-    print 'Loading: ', loadInDetRec_Options["inputPoolFiles"]
-    ServiceMgr.CondProxyProvider.InputCollections = loadInDetRec_Options["inputPoolFiles"]
-    ServiceMgr.CondProxyProvider.OutputLevel=INFO
-    print ServiceMgr.CondProxyProvider
-    IOVSvc = Service("IOVSvc")
-    IOVSvc.preLoadData = True
-    ServiceMgr.PoolSvc.AttemptCatalogPatch = True
-    
-if loadInDetRec_Options["errorScalingTag"]:
-  if ".db" in loadInDetRec_Options["errorScalingTag"]:
-    conddb.blockFolder("/Indet/TrkErrorScaling")
-    conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_cscasbuilt_00</tag>", force=True)
-  else:
-    conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_Options["errorScalingTag"])
-
-if loadInDetRec_Options["beamSpotTag"]:
-  conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-
-if loadInDetRec_Options["TRTCalibTextFile"]:
-  from AthenaCommon.AppMgr import ToolSvc
-  from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
-  TRTCalibDBSvc=TRT_CalDbSvc()
-  ServiceMgr+=TRTCalibDBSvc
-
-  conddb.blockFolder("/TRT/Calib/RT" )
-  conddb.blockFolder("/TRT/Calib/T0" )
-  TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-
-
-
-# Options for IOVRegistrationSvc
-# Select the following to delete and recreate the folders. Default is
-# NOT to recreate
-#import RegistrationServices.IOVRegistrationSvc
-#regSvc = svcMgr.IOVRegistrationSvc
-#regSvc.RecreateFolders = True
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-from AthenaCommon.AppMgr import ToolSvc
-
-
-
-
-
-##-------- Load Alignment --------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py") 
-
-###############################################################
-  ''' % (str(inflist), inputAlignmentConstants, ouputAlignmentConstants)
-
-    jOFile.write(cont)
-    jOFile.close()
-
-    # run athena
-    cmd = "python -u `which athena.py` myJobOptions.py"
-
-    print "\nRun command:"
-    print cmd
-    print "\nLogfile:"
-    print "------------------------------------------------------------------"
-    retcode = os.system(cmd)
-    print "------------------------------------------------------------------"
-    dt = int(time.time() - t0)
-
-    print "\n## athena.py finished with retcode = %s" % retcode
-    print   "## ... elapsed time: ", dt, " sec"
-
-    # Move alignment constants db file
-    os.system("mv mycool.db %s\n" % ouputAlignmentConstantsdb)
-    # assemble report pickle file
-    outfiles = []
-    infiles = []
-    nevts = 0
-    acronym = 'ALLOK'
-    txt = 'trf finished OK'  
-
-    # get info for report gpickle file
-    if retcode == 0 :
-      # one could determine the number of processed events here, e.g. by grep'ping in the logfile
-      fmap = getFileMap(outfile, outdsname, nevts=nevts)
-      outfiles = [fmap]
-    if retcode != 0 :
-      print "ERROR: athena.py execution problem!"
-      acronym = 'TRF_ATHENA_EXE'
-      txt = "athena.py execution problem"
-
-    # assemble job report map
-    outmap = { 'prodsys': { 'trfCode': retcode,
-                            'trfAcronym': acronym,
-                            'jobOutputs': outfiles,
-                            'jobInputs': infiles,
-                            'more': { 'num1': int(nevts), 'num2': int(dt), 'txt1': txt }
-                          }
-             }
-  
-  # pickle report map
-  f = open('jobReport.gpickle', 'w')
-  pickle.dump(outmap, f)
-  f.close()
-
-  print "\n##################################################################"
-  print   "## End of job."
-  print   "##################################################################\n"
-
-
-########################################
-## main()
-########################################
-
-if __name__ == "__main__":
-
-  if (len(sys.argv) != 2) and (not sys.argv[1].startswith('--argdict=')) :
-    print "Input format wrong --- use "
-    print "   --argdict=<pickled-dictionary containing input info> "
-    print "   with key/value pairs: "
-    print "     1) 'inputFiles': python list "
-    print "          ['datasetname#filename1','datasetname#filename2',...] (input dataset + file names) "
-    print "     2) 'outputFile': string 'datasetname#filename' "
-    print "        (merged output dataset name + file) "
-    sys.exit(-1)
-  
-  else :
-    picklefile = sys.argv[1][len('--argdict='):]
-    runAthena(picklefile)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/accumulate.pickle b/InnerDetector/InDetExample/InDetAlignExample/scripts/accumulate.pickle
deleted file mode 100644
index 30cc47d8f3af4f9b06f505906f8321e0ad69eb11..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/accumulate.pickle
+++ /dev/null
@@ -1,15 +0,0 @@
-(dp0
-S'outputFile'
-p1
-S'output#"monitoring.root"'
-p2
-sS'inputFiles'
-p3
-(lp4
-S'first#/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0001.data'
-p5
-asS'alignmentConstants'
-p6
-S'"Iter0_AlignmentConstants.root"'
-p7
-s.
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/alignment1.pickle b/InnerDetector/InDetExample/InDetAlignExample/scripts/alignment1.pickle
deleted file mode 100644
index 1cb73d5949b8e2c85829500767ed69332138f3d5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/alignment1.pickle
+++ /dev/null
@@ -1,15 +0,0 @@
-(dp0
-S'inputFiles'
-p1
-(lp2
-S'first#/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0001.data'
-p3
-asS'outputTFile'
-p4
-S'OutputTFileNumber0#/tmp/lacuesta/matrixTFile1.root'
-p5
-sS'inputAlignmentConstants'
-p6
-S'inputAlignmentConstants#'
-p7
-s.
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/alignment2.pickle b/InnerDetector/InDetExample/InDetAlignExample/scripts/alignment2.pickle
deleted file mode 100644
index 0b29ff4cfc16016e14410da7ff7d8e196ff08e0e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/alignment2.pickle
+++ /dev/null
@@ -1,15 +0,0 @@
-(dp0
-S'inputFiles'
-p1
-(lp2
-S'first#/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data'
-p3
-asS'outputTFile'
-p4
-S'OutputTFileNumber0#/tmp/lacuesta/matrixTFile2.root'
-p5
-sS'inputAlignmentConstants'
-p6
-S'inputAlignmentConstants#'
-p7
-s.
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/create_pickle.py b/InnerDetector/InDetExample/InDetAlignExample/scripts/create_pickle.py
deleted file mode 100755
index bb9bde64dc45b645172fa18233dd589899d96a82..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/create_pickle.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-# STEP 1
-# accumulating step
-
-import pickle
-f=open('reco1_01.pickle', 'w')
-dict={
-'inputRAWData': [ "first#/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0001.data" ], # has to be a list,
-'inputAlignmentConstants': "inputAlignmentConstants#",
-'outputTFile': "OutputTFileNumber1#/tmp/lacuesta/matrixTFile1.root",
-'outputMonitoringFile': "outputMonitoringFile1#/tmp/lacuesta/monitoringFile1.root"}
-pickle.dump(dict,f)
-f.close()
-
-f=open('reco1_02.pickle', 'w')
-dict={
-'inputRAWData': [ "first#/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data" ], # has to be a list
-'inputAlignmentConstants': "inputAlignmentConstants#",
-'outputTFile': "OutputTFileNumber2#/tmp/lacuesta/matrixTFile2.root", 
-'outputMonitoringFile': "outputMonitoringFile2#/tmp/lacuesta/monitoringFile2.root"
-}
-pickle.dump(dict,f)
-f.close()
-
-# STEP2 
-
-import pickle
-f=open('solve1.pickle', 'w')
-dict={
-'inputTFiles': [ "matrixInputTFile1#/tmp/lacuesta/matrixTFile1.root", "matrixInputTFile2#/tmp/lacuesta/matrixTFile2.root" ], 
-'inputAlignmentConstants': "inputAlignmentConstants#",
-'outputAlignmentConstants': "outputAlignmentConstants#/tmp/lacuesta/outputConstants.root",
-'outputAlignmentConstantsdb': "outputAlignmentConstants#/tmp/lacuesta/outputConstants.db"
-}
-pickle.dump(dict,f)
-f.close()
-
-f=open('merge1.pickle', 'w')
-dict={
-'inputMonitoringFiles': [ "OutputTFileNumber1#/tmp/lacuesta/matrixTFile1.root", "OutputTFileNumber2#/tmp/lacuesta/matrixTFile2.root" ], 
-'outputMonitoringMergedFile': "monitoringname#TotalMonitoring.root"
-}
-pickle.dump(dict,f)
-f.close()
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/myJobOptions.py b/InnerDetector/InDetExample/InDetAlignExample/scripts/myJobOptions.py
deleted file mode 100644
index f2bc84ee74121625817944f440a1d158c89f5891..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/myJobOptions.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-###############################################################
-#
-#  Custom configuration jobOptions file
-#
-###############################################################
-
-inputFiles=['/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0001.data', '/castor/cern.ch/grid/atlas/atlasscratchdisk/data10_7TeV/RAW/other/data10_7TeV.00165591.calibration_IDTracks.daq.RAW/data10_7TeV.00165591.calibration_IDTracks.daq.RAW._lb0000._SFO-10._0002.data']
-inputTFiles = ['/tmp/lacuesta/matrixTFile1.root', '/tmp/lacuesta/matrixTFile2.root']
-inputalignmentConstants = ""
-outputPoolFile = "outputConstants.root"
-
-PathBinName = ""
-
-
-##-------- Alignment Configuration --------------------
-WriteTFile = True
-sctAlignmentLevelEndcaps	=	-1
-pixelAlignmentLevel	=	1
-sctAlignmentLevel	=	1
-pixelAlignmentLevelBarrel	=	-1
-pixelAlignmentLevelEndcaps	=	-1
-sctAlignmentLevelBarrel	=	-1
-alignSCT	=	True
-if len(inputalignmentConstants)!=0:
-	readConstantsFromPool	=	True
-	inputPoolFiles	=	[inputalignmentConstants]
-else:
-	readConstantsFromPool	=	False
-	
-solveLocal	=	False
-sctAlignBarrel	=	True
-runAccumulate	=	False
-runLocal	=	False
-runSolving	=	True
-pixelAlignEndcaps	=	True
-alignPixel	=	True
-trtAlignmentLevel	=	1
-alignTRT	=	True
-#inputPoolFiles	=	['']
-readConstantsFromPool	=	False
-pixelAlignBarrel	=	True
-sctAlignEndcaps	=	True
-
-
-##-------- Loading the Alignment Levels --------------------
-include("InDetAlignExample/NewInDetAlignLevels.py") 
-
-##-------- Reconstruction Configuration --------------------
-numberOfEvents	=	1
-inputFiles	=	inputFiles
-detectorDescription	=	"ATLAS-GEO-16-00-00"
-globalTag	=	"COMCOND-REPP-007-05"
-
-##-------- Extra Configuration --------------------
-ModCut	=	7
-beamSpotTag	=	"IndetBeampos-ES1-UPD2"
-doReadBS	=	True
-doBSConstraint	=	True
-useOldPreProcessor	=	False
-doPVConstraint	=	False
-doTrkNtuple	=	False
-doMonitoring	=	True
-
-##-------- End of custom options -------------
-
-##-------- Load Reconstruction --------------------
-include("InDetAlignExample/loadInDetRec_new.py") 
-
-##-------- Load Alignment --------------------
-include("InDetAlignExample/NewInDetAlignAlgSetup.py") 
-
-###############################################################
-  
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/scripts/runBeamspotOnESD b/InnerDetector/InDetExample/InDetAlignExample/scripts/runBeamspotOnESD
deleted file mode 100755
index 558834596fb8f7e5cec77fd0f9642c6ca1bc1fd8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/scripts/runBeamspotOnESD
+++ /dev/null
@@ -1,105 +0,0 @@
-#! /usr/bin/env python
-# Run beam spot determination on a set of ESD files using JobRunner
-#
-# Written by Juerg Beringer in July 2008.
-
-import sys
-import glob
-import os
-import re
-from PyUtils import castor
-from InDetAlignExample.InDetAlignJobRunner import InDetAlignJobRunner as JobRunner
-from InDetAlignExample.InDetAlignJobRunner import InDetAlignJobRunnerError as JobRunnerError
-
-if len(sys.argv)<=2:
-    print "Usage: runBeamspotOnESD name castorpath [alignmentConstantFile]"
-    exit(1)
-name = sys.argv[1]
-castorPath = sys.argv[2]
-if len(sys.argv)>2:
-    alignmentConstantFile = sys.argv[3]
-else:
-    alignmentConstantFile = ''
-
-workdir = name
-mycmthome = '$HOME/athena/14.2.X.rel_5/'
-myrelease = '14.2.X,val,rel_5,saved,opt,32,setup,runtime'
-mylogmail = 'beringer,lacuesta'
-
-try:
-    esdFiles = []
-    castorFiles = castor.nsls(castorPath)
-    pattern = re.compile('.*ESD.*')
-    for f in castorFiles:
-        if pattern.search(f):
-            esdFiles.append('rfio:'+f)
-    #print "Input file(s) =", esdFiles
-
-    print
-    print "Running over ESD files ..."
-    aodrunner = JobRunner(startdirTemplate=workdir+'/%(jobname)s',
-                          batchType='LSF',
-                          batchQueue='atlasidali',
-                          logmail=mylogmail,
-                          EvtMax=-1,
-                          alignmentFile=alignmentConstantFile,
-                          DetDescrVersion="ATLAS-CSC-02-00-00",
-                          #GlobalTag="OFLCOND-FDR-02-01-00",   # Not used when running on ESD
-                          release=myrelease,
-                          cmthome=mycmthome,
-                          jobnameTemplate='bsaod%(jobnr)03i',
-                          joboptionPath=os.getcwd()+'/InDetAlignBeamspotESDtoAOD.py')
-
-    aodrunner.addFiles(esdFiles)
-    aodrunner.setOption('filesPerJob', 1)
-
-    if alignmentConstantFile:
-        scriptTemplate = """#!/bin/sh
-source %(cmthome)s/setup.sh -tag=%(release)s
-mkdir -p %(rundir)s
-cd %(rundir)s
-pool_insertFileToCatalog %(alignmentFile)s
-athena.py %(configfile)s %(joboptionPath)s
-"""
-        aodrunner.setOption('scriptTemplate',scriptTemplate)
-
-    aodrunner.showOptions()
-    aodrunner.run()
-    aodrunner.wait()
-    outputFiles = aodrunner.getOutputFiles()
-    print
-    print "The following AOD files were produced:"
-    print outputFiles
-
-    #
-    # Determine beamspot using AOD files (single job over all AOD files)
-    #
-    print
-    print "Calculating beamspot on AOD files..."
-    finder = JobRunner(startdirTemplate=workdir,
-                       outputfileTemplate='%(startdir)s/vtxbeamspot.db',
-                       histfileTemplate='%(startdir)s/vtxbeamspot.root',
-                       batchType='LSF',
-                       batchQueue='atlasidali',
-                       logmail=mylogmail,
-                       EvtMax=-1,
-                       release=myrelease,
-                       vertexContainer='NewVxPrimaryCandidate',
-                       useNLumiBlocksPerBeamspot=10,
-                       maxCountPerBeamspot=-1,
-                       cmthome=mycmthome,
-                       jobnameTemplate='vtxbeamspot',
-                       joboptionPath=os.getcwd()+'/InDetAlignBeamspotVertexFinder.py')
-
-    finder.addFiles(outputFiles)
-    finder.setOption('filesPerJob', len(outputFiles))
-    finder.run()
-    finder.wait()
-
-except JobRunnerError, err:
-    print '\nERROR:',err
-    print
-    exit(1)
-
-print
-os.system('ls -l %s' % workdir)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/AlignmentATNSimple.py b/InnerDetector/InDetExample/InDetAlignExample/share/AlignmentATNSimple.py
deleted file mode 100644
index 936b0d37d2089aaaceb87dd7cb9b7c73c9cd05f0..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/AlignmentATNSimple.py
+++ /dev/null
@@ -1,351 +0,0 @@
-#
-# This jobOption file allows to run a single standalone alignment job.
-# It contains mostly used  of the steering jobOptions for setting up
-# the alignment geometry, solving etc. Further jobOptions can be found
-# by reading through
-#   NewInDetAlignAlgSetup.py and
-#   NewInDetAlignGeometrySetup.py.
-#
-# This is a good example for beginners to start with. It loads file
-# loadInDetRec*.py for setting up the reconstruction options and file
-# NewInDetAlignAlgSetup.py for the actual alignment processing.
-#
-# author: Daniel Kollar <daniel.kollar@cern.ch>
-#
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==          Settings for the simple ATN alignment test           ==
-## ==                                                               ==
-## message level for the alignment
-## INFO, DEBUG, ...
-outputLevel=INFO
-#
-## track collection to process
-trackCollection = "Tracks"
-
-#
-useOldPreProcessor = False
-
-#
-#
-##
-## if readConstantsFromPool is set to true the initial alignment constants
-## are read in from the pool file, otherwise they are taken from the DB
-## according to the global tag
-##
-readConstantsFromPool = False
-readSilicon = True
-readTRT = True
-#inputPoolFiles = [ "alignment_input.pool.root" ]
-#inputPoolFiles = [ "IDalignment_nominal.pool.root" ]
-ErrorScaling = False
-#
-##
-## write final alignment constants to pool file
-writeConstantsToPool = False
-writeSilicon = True
-writeTRT = True
-outputPoolFile = "alignment_output.pool.root"
-tagSi = "IndetAlign_test"
-tagTRT = "TRTAlign_test"
-writeTextFiles = False
-siliconTextFile = "OutputSiAlignment.txt"
-trtTextFile = "OutputTRTAlignment.txt"
-#
-## write initial alignment constants into text file
-writeOldConstants = False
-#
-##
-## What to align?
-alignInDet = True
-alignSilicon = True
-alignPixel = True
-alignSCT = True
-alignTRT = True
-
-#
-##
-## TRT alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   0 - L0
-##   1 - L1
-##   2 - L2
-trtAlignmentLevel = 1
-#
-## TRT barrel alignment
-## overwrite trtAlignmentLevel if present
-##  -1 - take setup from trtAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-trtAlignmentLevelBarrel = -1
-#
-## TRT barrel alignment
-## overwrite trtAlignmentLevel if present
-##  -1 - take setup from trtAlignmentLevel
-##   1 - L1
-##   2 - L2
-## 200 - L2 old setup
-trtAlignmentLevelEndcaps = -1
-#
-## alignment geometry
-trtAlignBarrel  = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = True
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = True
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-#
-## Pixel alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevel = 1
-#
-## Pixel barrel alignment
-## overwrite pixelAlignmentLevel if present
-##  -1 - take setup from pixelAlignmentLevel
-##  15 - L15: 2 halfs
-##   2 - L2
-##  22 - L22: 6 half-layers
-##   3 - L3
-pixelAlignmentLevelBarrel = -1
-#
-## Pixel barrel alignment
-## overwrite pixelAlignmentLevel if present
-##  -1 - take setup from pixelAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevelEndcaps = -1
-#
-## Pixel alignment DoFs
-pixelAlignBarrel  = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = True
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = True
-pixelAlignEndcapRotX = True
-pixelAlignEndcapRotY = True
-pixelAlignEndcapRotZ = True
-#
-## SCT alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   0 - L0
-##   1 - L1
-##   2 - L2
-##   3 - L3
-sctAlignmentLevel = 1
-#
-## SCT barrel alignment
-## overwrite sctAlignmentLevel if present
-##  -1 - take setup from sctAlignmentLevel
-##   2 - L2
-##   3 - L3
-sctAlignmentLevelBarrel = -1
-#
-## SCT barrel alignment
-## overwrite sctAlignmentLevel if present
-##  -1 - take setup from sctAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-sctAlignmentLevelEndcaps = -1
-#
-## SCT alignment DoFs
-sctAlignBarrel  = True
-sctAlignEndcaps = True
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = True
-sctAlignBarrelZ = True
-sctAlignBarrelRotX = True
-sctAlignBarrelRotY = True
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = True
-sctAlignEndcapRotX = True
-sctAlignEndcapRotY = True
-sctAlignEndcapRotZ = True
-#
-## Silicon alignment
-## -1 - use standalone Pixel and SCT setup
-##  0 - L0
-siAlignmentLevel = -1
-#
-## alignment parameters
-siAlignX = True
-siAlignY = True
-siAlignZ = True
-siAlignRotX = True
-siAlignRotY = True
-siAlignRotZ = True
-#
-## InDet alignment
-## -1 - use standalone Silicon and TRT setup
-##  0 - L0
-indetAlignmentLevel = -1
-#
-## alignment parameters
-indetAlignX = True
-indetAlignY = True
-indetAlignZ = True
-indetAlignRotX = True
-indetAlignRotY = True
-indetAlignRotZ = True
-#
-## do module selection using identifiers
-doModuleSelection = False
-## list of identifiers for selected modules
-moduleSelection = []
-#
-####################################################################
-##
-## Accumulate and Solving
-##
-runAccumulate = True
-runSolving = True
-#
-## if we only run solving we need the list of files from
-## which to accumulate
-inputMatrixFiles = [ "matrix.bin" ]
-inputVectorFiles = [ "vector.bin" ]
-#
-#####################################
-####### Full Local Chi2 method ######
-# by default the global method is run
-# if you want to include the full local method
-# set runLocal to True
-runLocal = False
-#
-# for full local method one can also setup different kinds of residuals
-# (will be ignored if runLocal==False)
-# 0 - hit-only (biased) residuals
-# 1 - unbiased
-#residualType = 0
-#
-# for full local method one can also switch off refitting of tracks
-# (will be ignored if runLocal==False)
-#refitTracks = False
-#
-######################################
-####### Full Global Chi2 method ######
-## solving option
-##   0 - No global solving
-##   1 - Lapack
-##   2 - Eigen
-##   6 - ROOT
-##   7 - CLHEP
-solvingOption = 1
-
-##
-## Don't write out matrices and vectors for the ATN test
-writeMatrixFile = False
-writeHitmap = False
-writeEigenMat = False
-
-#
-####
-## run local solving
-## this option is automatically set to True if runLocal is selected
-solveLocal = True
-#
-## if diagonalization is set to false the matrix inversion is run
-## only applies to CLHEP
-runDiagonalization = True
-## number of smallest eigenvalues (global movements) to cut
-ModCut = 7
-## cut on eigenvalue for diagonalization
-eigenvalueCut = 0.
-#
-############################
-###### common options ######
-## minimum number of hits per module for solving
-## is ignored if runAccumulate=False
-minHits = 1
-#
-## options of the track refit needed to obtain the derivatives
-## and the full covariance matrix of the track
-##
-## run outlier removal when refitting the track
-runOutlier     = True
-## particle hypothesis when refitting the track
-##   0 - non-interacting
-particleNumber = 0
-#
-## write special alignment ntuple
-#writeAlignNtuple = True
-##
-## store derivatives of residuals wrt. alignment parameters
-## in the ntuple
-#writeDerivatives = True
-##
-## ==                                                               ==
-## ==            End of settings for the alignment                  ==
-## ==                                                               ==
-## ===================================================================
-## ===================================================================
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==             Settings for the Reconstruction                   ==
-## ==                                                               ==
-
-# The following options are the defaults for configuring InnerDetector reconstruction.
-# They may be changed by uncommenting the lines and specifying the appropriate input.
-# ========================================
-
-# ID Reconstruction  Options
-# ==========================
-
-detectorDescription = "ATLAS-GEO-16-00-00"
-realData = False
-globalTag = "OFLCOND-SDR-BS7T-04-02"
-#doTrkNtuple = False
-doMonitoring = False
-#siPoolFile = ""
-#siAlignmentTag = "InDet_Cosmic_2008_6"
-#errorScalingTag = ""
-#TRTCalibTextFile = ""
-numberOfEvents = 250
-# MC09 multimuon Monte Carlo
-inputFiles = [ "root://eosatlas//eos/atlas/atlascerngroupdisk/perf-idtracking/rtt/mc10_7TeV.107233.singlepart_mu100.digit.RDO.e605_s933_s946_d369//RDO.19711\
-7._000005.pool.root.1" ]
-
-Cosmics = False
-
-# Run collision reconstruction
-# ==========================
-# (Collision Specific Options)
-#doReadBS = False
-include("InDetAlignExample/jobOption_RecExCommon.py")
-include("InDetAlignExample/jobOption_ConditionsOverrider.py")
-
-# Run Alignment
-# ========================
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/BuildGeoForMatrixSolving.py b/InnerDetector/InDetExample/InDetAlignExample/share/BuildGeoForMatrixSolving.py
deleted file mode 100644
index 46cf33464a717d86ebb9eedefb9aa78a5b478b08..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/BuildGeoForMatrixSolving.py
+++ /dev/null
@@ -1,115 +0,0 @@
-
-import os
-
-loadInDetRec_Options = {"detectorDescription" : ""
-                       ,"doReadBS"            : True
-		       ,"globalTag"           : ""
-	               ,"siAlignmentTag"      : ""
-	               ,"trtAlignmentTag"     : ""
-		       ,"beamSpotTag"         : ""
-		       ,"errorScalingTag"     : ""
-	 	       ,"TRTCalibTextFile"    : ""
-		       ,"useTRT"              : True
-		       ,"inputPoolFiles"      : ""
-		       }
-
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-	if var in dir():
-		loadInDetRec_Options[var] = eval(var)
-
-
-# To extract constants from the database select the appropriate database tag.
-from AthenaCommon.GlobalFlags import globalflags
-
-if ( 'COMCOND' in loadInDetRec_Options["globalTag"]) :
-	globalflags.DataSource	=	'data'
-else :
-	globalflags.DataSource	= 	'geant4'
-
-
-
-if len(loadInDetRec_Options["globalTag"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-	
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-
-from AthenaCommon.GlobalFlags import globalflags
-if len(globalflags.ConditionsTag())!=0:
-	from IOVDbSvc.CondDB import conddb
-	conddb.setGlobalTag(globalflags.ConditionsTag())
-
-
-globalflags.print_JobProperties()
-
-
-
-# Setup geometry
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-from InDetRecExample.InDetJobProperties import InDetFlags
-
-#include("InDetRecExample/InDetRec_all.py")
-
-#include ("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-
-from IOVDbSvc.CondDB import conddb
-
-# Its normally OK to read in some database so this can be left True.
-# In case you want to force it not to read in anything you can set this to False.
-
-
-#if loadInDetRec_Options["inputPoolFiles"] : 
-#	os.system("pool_insertFileToCatalog *.root")
-
-
-if loadInDetRec_Options["siAlignmentTag"]:
-  conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-if loadInDetRec_Options["trtAlignmentTag"]:
-  conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-
-
-if loadInDetRec_Options["errorScalingTag"]:
-  if ".db" in loadInDetRec_Options["errorScalingTag"]:
-    conddb.blockFolder("/Indet/TrkErrorScaling")
-    conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_cscasbuilt_00</tag>", force=True)
-  else:
-    conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_Options["errorScalingTag"])
-
-if loadInDetRec_Options["beamSpotTag"]:
-  conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-
-if loadInDetRec_Options["TRTCalibTextFile"]:
-  from AthenaCommon.AppMgr import ToolSvc
-  from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
-  TRTCalibDBSvc=TRT_CalDbSvc()
-  ServiceMgr+=TRTCalibDBSvc
-
-  conddb.blockFolder("/TRT/Calib/RT" )
-  conddb.blockFolder("/TRT/Calib/T0" )
-  TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-
-
-
-# Options for IOVRegistrationSvc
-# Select the following to delete and recreate the folders. Default is
-# NOT to recreate
-#import RegistrationServices.IOVRegistrationSvc
-#regSvc = svcMgr.IOVRegistrationSvc
-#regSvc.RecreateFolders = True
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-from AthenaCommon.AppMgr import ToolSvc
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsBuilder.py b/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsBuilder.py
deleted file mode 100644
index 1a0e2917c6dc23cf00cdf20ee8d1918e9a85fb57..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsBuilder.py
+++ /dev/null
@@ -1,254 +0,0 @@
-#! /usr/bin/env python
-# =====================================================================
-# Main script to run the upload constants to DB
-# =====================================================================
-import os
-import sys
-# =====================================================================
-#  Welcome print
-# =====================================================================
-print "\n ============================================="
-print "    ID Alignment constants uploader"
-print " =============================================\n"
-# =====================================================================
-#  Default values
-# =====================================================================
-Do_Silicon = 1
-#
-Do_TRT = 1
-#
-Def_Mode = "Test" #Def_Mode = "Exec"
-User_Mode = ""
-#
-Def_Comment = "Constants derived using 2010 data and 2012 baseline  d0, z0 and p have been corrected using data from Z->mumu events" 
-User_Comment =""
-#
-TheNewTag = "Repro2010_d0z0p_constrained"
-
-constantsDefault= "155073"
-
-# =======================================
-# constantsGenRun is a list containing each folder that contains the 
-# Iter*/Iter*_AlignmentConstants.root & Iter*/mycool.db files to upload
-# =======================================
-constantsGenRun = [ "155073",  "155112",  "155160",  "155569",  "155634", "155697",  "156682",
-"158116", "158269", "158392",  "158548",  "158582",  "158632",  "158801", "158975",  "159041",
-"159086", "159113", "159179",  "159202",  "159203",  "159224",  "160472", "160530",  "160801",
-"160879", "160954", "160958",  "161118",  "161379",  "161407",  "161520", "161562",  "161948",
-"162347", "162526", "162576",  "162623",  "162690",  "162764",  "162843", "162882",  "165591",
-"165632", "165732", "165767",  "165818",  "165821",  "166097",  "166142", "166198",  "166383",
-"166466", "166658", "166786",  "166924",  "166927",  "167576",  "167607", "167680",  "167776",  "167844"]
-# =======================================
-# constantsValidRun is a list containing a run number for each element in constantsGenRun. This run
-# number is the started run where the corrections stored in constantsGenRun[i] are valid, untill the
-# the next run number
-# =======================================
-constantsValidRun = list(constantsGenRun)
-
-iteration = 1 # iteration number-> Iter**, must be an integer
-constantsPath = "/afs/cern.ch/user/a/atlidali/w1/users/spedraza/repro/"
-
-ConstantsFileName = "2010-Test2"
-#
-DBName = "COMP200"
-#
-ConditionsFile = "cond12_data.gen.COND"
-#
-# =====================================================================
-#  Handling of run options
-# =====================================================================
-if len(sys.argv) > 1:
-    argNum = 1
-    argMax = len(sys.argv)-1
-    argCurr = -1 # just to make that first time it points to 0 
-    #print ' >>> user input has %s arguments' % argMax
-    for arg in sys.argv:
-        argCurr += 1
-        #print ".. %s .." % arg
-        if arg in ("-h", "--help"):    
-            print ' >>> This is the help message of RunIterator.py'       
-            print '     -exec'
-            print '           The constants will be effectively uploaded to the DB. Default mode is test mode when commands are just\n\
-            displayed but no executed, therefore no constants are uploaded.'
-            sys.exit()
-            #
-        elif arg in ("--exec"):    
-            # This option activates the execution of the commands
-            User_Mode = "Exec"
-            #
-            #
-
-    if (1):
-        print '>>> ConstantsUploader >>> List of user input values:'
-        print '> User Mode = %s' %User_Mode
-        print '>>> End of input options processing <<< \n' 
-
-# ===============================
-# Handling of variables
-# ===============================
-#
-#
-Upload_Mode = Def_Mode
-if (User_Mode):
-    Upload_Mode = "Exec"
-#
-#
-DotDbFile = ConstantsFileName+".db"
-DotRootFile = ConstantsFileName+".root"
-OutputDbFile = ConstantsFileName+"_output.db"
-#
-CommentOnConstants = Def_Comment
-if (User_Comment):
- CommentOnConstants = User_Comment
-# 
-New_InDet_TagName = "InDetAlign_" + TheNewTag
-New_TRT_TagName = "TRTAlign_" + TheNewTag
-#
-
-
-
-if (1):
-    print '>>>>>>>>>>>> List of variables >>>>>>>>>>>>>>> '
-    print '> Upload_Mode  = %s' %Upload_Mode
-    print '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n '
-
-
-
-baselinePath =  constantsPath + constantsDefault + "/Iter%i/" %(iteration)
-DotRootFile = baselinePath + "Iter%i_AlignmentConstants.root" %(iteration)
-DotDbFile   = baselinePath + "mycool.db"
-
-# ===============================
-# To understand next steps see https://twiki.cern.ch/twiki/bin/viewauth/Atlas/AtlCoolCopy
-# ===============================
-# ===============================
-# Common step
-# ===============================
-# this command line is the same for silicon and TRT
-CommandLine0 = "~atlcond/utils/registerFiles2 --wait " + ConditionsFile + " " + DotRootFile
-
-# ===============================
-# 1st step
-# ===============================
-
-# -- prepare the command 
-CommandLine1_Silicon = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /Indet/Align -outtag " + New_InDet_TagName + " -tl \""+ CommentOnConstants +"\" -alliov "
-
-CommandLine1_TRT = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /TRT/Align -outtag " + New_TRT_TagName +" -tl \""+ CommentOnConstants +"\" -alliov "
-
-TestCommand = "ls -l %s" %DotDbFile
-ExistsDotDb = os.system(TestCommand)
-if (ExistsDotDb !=0):
-    print '\n ** ERROR ** file %s does not exist ' % DotDbFile 
-    sys.exit()
-
-TestCommand = "ls -l %s" %DotRootFile
-ExistsDotRoot = os.system(TestCommand)
-if (ExistsDotRoot !=0):
-     print '\n ** ERROR ** file %s does not exist ' % DotRootFile 
-     sys.exit()
-
-UpdateDB_Si = []
-UpdateDB_TRT = []
-LoadFiles = []
-for i in range( len(constantsGenRun)):
-
-  baselinePath =  constantsPath +constantsGenRun[i]+"/Iter%i/" %(iteration)
-  DotRootFile = baselinePath + "Iter%i_AlignmentConstants.root" %(iteration)
-  DotDbFile   = baselinePath + "mycool.db"
-
-  TestCommand = "ls -l %s" %DotDbFile
-  ExistsDotDb = os.system(TestCommand)
-  if (ExistsDotDb !=0):
-    print '\n ** ERROR ** file %s does not exist ' % DotDbFile
-    sys.exit()
-
-  TestCommand = "ls -l %s" %DotRootFile
-  ExistsDotRoot = os.system(TestCommand)
-  if (ExistsDotRoot !=0):
-     print '\n ** ERROR ** file %s does not exist ' % DotRootFile
-     sys.exit()
-
-
-
-  LoadFiles.append( "~atlcond/utils/registerFiles2 --wait " + ConditionsFile + " " + DotRootFile)
-  
-  UpdateDB_Si.append( "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /Indet/Align -outtag " + New_InDet_TagName + " -tl \""+ CommentOnConstants +"\" -rs "+ constantsValidRun[i] +  " -truncate")
-  UpdateDB_TRT.append( "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /TRT/Align -outtag " + New_TRT_TagName + " -tl \""+ CommentOnConstants +"\" -rs "+ constantsValidRun[i] + " -truncate")
-
-
-
-
-
-# ===============================
-# 2nd step
-# ===============================
-CommandLine2_Silicon = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug  --batch --comment \""+CommentOnConstants+"\" --tag " + New_InDet_TagName + " --passopt='-ctl' --folder /Indet/Align "+ OutputDbFile +" "+DBName+" ATLAS_COOLWRITE ATLAS_COOLOFL_INDET_W WCOOLOFL4INDET1"
-
-CommandLine2_TRT = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug --batch --comment \""+CommentOnConstants+"\" --tag " + New_TRT_TagName + " --passopt='-ctl' --folder /TRT/Align "+ OutputDbFile +" "+DBName+" ATLAS_COOLWRITE ATLAS_COOLOFL_TRT_W WCOOLOFL4TRT2"
-
-#- 
-# ===============================
-# Upload
-# ===============================
-if Upload_Mode in ("Exec"):
-   print " \n == Excute upload !!!! == \n"
-
-   print " \n == step0 ==> " + CommandLine0 + "\n"
-   os.system(CommandLine0)
-   for i in range( len(LoadFiles)):
-     print "== step0.X ==> " +LoadFiles[i]
-     os.system( LoadFiles[i] )
-
-
-
-   if (Do_Silicon == 1):
-       print ' =============> Uploading silicon constants ============'
-       print " == step1 ==> " + CommandLine1_Silicon + "\n"
-       os.system(CommandLine1_Silicon)
-       for i in range( len(constantsGenRun)):
-         #print "== step1.X ==> " +UpdateDB_Si[i]
-         os.system( UpdateDB_Si[i])  
-       #print " \n == step2 ==> " + CommandLine2_Silicon + "\n" 
-       #print os.system(CommandLine2_Silicon)
-
-   if (Do_TRT == 1):
-       print ' =============> Uploading TRT constants ============'
-       print " == step1 ==> " + CommandLine1_TRT + "\n"
-       print os.system(CommandLine1_TRT)
-       for i in range( len(constantsGenRun)):
-         #print "== step1.X ==> " +UpdateDB_TRT[i]
-         os.system( UpdateDB_TRT[i]) 
-       #print " \n == step2 ==> " + CommandLine2_TRT + "\n" 
-       #print os.system(CommandLine2_TRT)
- 
-   print "<===>Final step<===>"
-   print " \n == Silicon step2 ==> \n" + CommandLine2_Silicon + "\n"
-   print " \n == TRT step2     ==> \n" + CommandLine2_TRT + "\n"
-
-elif Upload_Mode in ("Test"):
-   print " \n == Test Mode !!!! == \n"
-   print " =========== Common ============= " 
-   print " == step0 ==> " + CommandLine0 + "\n\n"
-   print "   WARNING       first check the condXX_data_gen.COND to point with the following command:"
-   print "                 > ~atlcond/utils/registerFiles2 --list \n"
-   print " =========== Silicon ============= " 
-   print " == step1 ==> " + CommandLine1_Silicon + "\n"
-   print " == step2 ==> " + CommandLine2_Silicon + "\n\n"
-   #for i in range( len(constantsGenRun)):
-     #print LoadFiles[i]
-     #print UpdateDB_Si[i]
-     #print UpdateDB_TRT[i] 
-
-   print " ===========  TRT  ============= " 
-   print " == step1 ==> " + CommandLine1_TRT + "\n"
-   print " == step2 ==> " + CommandLine2_TRT + "\n" 
-
-   
-# ===============================
-# completed
-# ===============================
-print "\n ============================================="
-print "    GAME OVER.  INSERT COIN"
-print " =============================================\n"
-sys.exit()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsBuilder_RunII.py b/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsBuilder_RunII.py
deleted file mode 100644
index 1a0e2917c6dc23cf00cdf20ee8d1918e9a85fb57..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsBuilder_RunII.py
+++ /dev/null
@@ -1,254 +0,0 @@
-#! /usr/bin/env python
-# =====================================================================
-# Main script to run the upload constants to DB
-# =====================================================================
-import os
-import sys
-# =====================================================================
-#  Welcome print
-# =====================================================================
-print "\n ============================================="
-print "    ID Alignment constants uploader"
-print " =============================================\n"
-# =====================================================================
-#  Default values
-# =====================================================================
-Do_Silicon = 1
-#
-Do_TRT = 1
-#
-Def_Mode = "Test" #Def_Mode = "Exec"
-User_Mode = ""
-#
-Def_Comment = "Constants derived using 2010 data and 2012 baseline  d0, z0 and p have been corrected using data from Z->mumu events" 
-User_Comment =""
-#
-TheNewTag = "Repro2010_d0z0p_constrained"
-
-constantsDefault= "155073"
-
-# =======================================
-# constantsGenRun is a list containing each folder that contains the 
-# Iter*/Iter*_AlignmentConstants.root & Iter*/mycool.db files to upload
-# =======================================
-constantsGenRun = [ "155073",  "155112",  "155160",  "155569",  "155634", "155697",  "156682",
-"158116", "158269", "158392",  "158548",  "158582",  "158632",  "158801", "158975",  "159041",
-"159086", "159113", "159179",  "159202",  "159203",  "159224",  "160472", "160530",  "160801",
-"160879", "160954", "160958",  "161118",  "161379",  "161407",  "161520", "161562",  "161948",
-"162347", "162526", "162576",  "162623",  "162690",  "162764",  "162843", "162882",  "165591",
-"165632", "165732", "165767",  "165818",  "165821",  "166097",  "166142", "166198",  "166383",
-"166466", "166658", "166786",  "166924",  "166927",  "167576",  "167607", "167680",  "167776",  "167844"]
-# =======================================
-# constantsValidRun is a list containing a run number for each element in constantsGenRun. This run
-# number is the started run where the corrections stored in constantsGenRun[i] are valid, untill the
-# the next run number
-# =======================================
-constantsValidRun = list(constantsGenRun)
-
-iteration = 1 # iteration number-> Iter**, must be an integer
-constantsPath = "/afs/cern.ch/user/a/atlidali/w1/users/spedraza/repro/"
-
-ConstantsFileName = "2010-Test2"
-#
-DBName = "COMP200"
-#
-ConditionsFile = "cond12_data.gen.COND"
-#
-# =====================================================================
-#  Handling of run options
-# =====================================================================
-if len(sys.argv) > 1:
-    argNum = 1
-    argMax = len(sys.argv)-1
-    argCurr = -1 # just to make that first time it points to 0 
-    #print ' >>> user input has %s arguments' % argMax
-    for arg in sys.argv:
-        argCurr += 1
-        #print ".. %s .." % arg
-        if arg in ("-h", "--help"):    
-            print ' >>> This is the help message of RunIterator.py'       
-            print '     -exec'
-            print '           The constants will be effectively uploaded to the DB. Default mode is test mode when commands are just\n\
-            displayed but no executed, therefore no constants are uploaded.'
-            sys.exit()
-            #
-        elif arg in ("--exec"):    
-            # This option activates the execution of the commands
-            User_Mode = "Exec"
-            #
-            #
-
-    if (1):
-        print '>>> ConstantsUploader >>> List of user input values:'
-        print '> User Mode = %s' %User_Mode
-        print '>>> End of input options processing <<< \n' 
-
-# ===============================
-# Handling of variables
-# ===============================
-#
-#
-Upload_Mode = Def_Mode
-if (User_Mode):
-    Upload_Mode = "Exec"
-#
-#
-DotDbFile = ConstantsFileName+".db"
-DotRootFile = ConstantsFileName+".root"
-OutputDbFile = ConstantsFileName+"_output.db"
-#
-CommentOnConstants = Def_Comment
-if (User_Comment):
- CommentOnConstants = User_Comment
-# 
-New_InDet_TagName = "InDetAlign_" + TheNewTag
-New_TRT_TagName = "TRTAlign_" + TheNewTag
-#
-
-
-
-if (1):
-    print '>>>>>>>>>>>> List of variables >>>>>>>>>>>>>>> '
-    print '> Upload_Mode  = %s' %Upload_Mode
-    print '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n '
-
-
-
-baselinePath =  constantsPath + constantsDefault + "/Iter%i/" %(iteration)
-DotRootFile = baselinePath + "Iter%i_AlignmentConstants.root" %(iteration)
-DotDbFile   = baselinePath + "mycool.db"
-
-# ===============================
-# To understand next steps see https://twiki.cern.ch/twiki/bin/viewauth/Atlas/AtlCoolCopy
-# ===============================
-# ===============================
-# Common step
-# ===============================
-# this command line is the same for silicon and TRT
-CommandLine0 = "~atlcond/utils/registerFiles2 --wait " + ConditionsFile + " " + DotRootFile
-
-# ===============================
-# 1st step
-# ===============================
-
-# -- prepare the command 
-CommandLine1_Silicon = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /Indet/Align -outtag " + New_InDet_TagName + " -tl \""+ CommentOnConstants +"\" -alliov "
-
-CommandLine1_TRT = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /TRT/Align -outtag " + New_TRT_TagName +" -tl \""+ CommentOnConstants +"\" -alliov "
-
-TestCommand = "ls -l %s" %DotDbFile
-ExistsDotDb = os.system(TestCommand)
-if (ExistsDotDb !=0):
-    print '\n ** ERROR ** file %s does not exist ' % DotDbFile 
-    sys.exit()
-
-TestCommand = "ls -l %s" %DotRootFile
-ExistsDotRoot = os.system(TestCommand)
-if (ExistsDotRoot !=0):
-     print '\n ** ERROR ** file %s does not exist ' % DotRootFile 
-     sys.exit()
-
-UpdateDB_Si = []
-UpdateDB_TRT = []
-LoadFiles = []
-for i in range( len(constantsGenRun)):
-
-  baselinePath =  constantsPath +constantsGenRun[i]+"/Iter%i/" %(iteration)
-  DotRootFile = baselinePath + "Iter%i_AlignmentConstants.root" %(iteration)
-  DotDbFile   = baselinePath + "mycool.db"
-
-  TestCommand = "ls -l %s" %DotDbFile
-  ExistsDotDb = os.system(TestCommand)
-  if (ExistsDotDb !=0):
-    print '\n ** ERROR ** file %s does not exist ' % DotDbFile
-    sys.exit()
-
-  TestCommand = "ls -l %s" %DotRootFile
-  ExistsDotRoot = os.system(TestCommand)
-  if (ExistsDotRoot !=0):
-     print '\n ** ERROR ** file %s does not exist ' % DotRootFile
-     sys.exit()
-
-
-
-  LoadFiles.append( "~atlcond/utils/registerFiles2 --wait " + ConditionsFile + " " + DotRootFile)
-  
-  UpdateDB_Si.append( "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /Indet/Align -outtag " + New_InDet_TagName + " -tl \""+ CommentOnConstants +"\" -rs "+ constantsValidRun[i] +  " -truncate")
-  UpdateDB_TRT.append( "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /TRT/Align -outtag " + New_TRT_TagName + " -tl \""+ CommentOnConstants +"\" -rs "+ constantsValidRun[i] + " -truncate")
-
-
-
-
-
-# ===============================
-# 2nd step
-# ===============================
-CommandLine2_Silicon = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug  --batch --comment \""+CommentOnConstants+"\" --tag " + New_InDet_TagName + " --passopt='-ctl' --folder /Indet/Align "+ OutputDbFile +" "+DBName+" ATLAS_COOLWRITE ATLAS_COOLOFL_INDET_W WCOOLOFL4INDET1"
-
-CommandLine2_TRT = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug --batch --comment \""+CommentOnConstants+"\" --tag " + New_TRT_TagName + " --passopt='-ctl' --folder /TRT/Align "+ OutputDbFile +" "+DBName+" ATLAS_COOLWRITE ATLAS_COOLOFL_TRT_W WCOOLOFL4TRT2"
-
-#- 
-# ===============================
-# Upload
-# ===============================
-if Upload_Mode in ("Exec"):
-   print " \n == Excute upload !!!! == \n"
-
-   print " \n == step0 ==> " + CommandLine0 + "\n"
-   os.system(CommandLine0)
-   for i in range( len(LoadFiles)):
-     print "== step0.X ==> " +LoadFiles[i]
-     os.system( LoadFiles[i] )
-
-
-
-   if (Do_Silicon == 1):
-       print ' =============> Uploading silicon constants ============'
-       print " == step1 ==> " + CommandLine1_Silicon + "\n"
-       os.system(CommandLine1_Silicon)
-       for i in range( len(constantsGenRun)):
-         #print "== step1.X ==> " +UpdateDB_Si[i]
-         os.system( UpdateDB_Si[i])  
-       #print " \n == step2 ==> " + CommandLine2_Silicon + "\n" 
-       #print os.system(CommandLine2_Silicon)
-
-   if (Do_TRT == 1):
-       print ' =============> Uploading TRT constants ============'
-       print " == step1 ==> " + CommandLine1_TRT + "\n"
-       print os.system(CommandLine1_TRT)
-       for i in range( len(constantsGenRun)):
-         #print "== step1.X ==> " +UpdateDB_TRT[i]
-         os.system( UpdateDB_TRT[i]) 
-       #print " \n == step2 ==> " + CommandLine2_TRT + "\n" 
-       #print os.system(CommandLine2_TRT)
- 
-   print "<===>Final step<===>"
-   print " \n == Silicon step2 ==> \n" + CommandLine2_Silicon + "\n"
-   print " \n == TRT step2     ==> \n" + CommandLine2_TRT + "\n"
-
-elif Upload_Mode in ("Test"):
-   print " \n == Test Mode !!!! == \n"
-   print " =========== Common ============= " 
-   print " == step0 ==> " + CommandLine0 + "\n\n"
-   print "   WARNING       first check the condXX_data_gen.COND to point with the following command:"
-   print "                 > ~atlcond/utils/registerFiles2 --list \n"
-   print " =========== Silicon ============= " 
-   print " == step1 ==> " + CommandLine1_Silicon + "\n"
-   print " == step2 ==> " + CommandLine2_Silicon + "\n\n"
-   #for i in range( len(constantsGenRun)):
-     #print LoadFiles[i]
-     #print UpdateDB_Si[i]
-     #print UpdateDB_TRT[i] 
-
-   print " ===========  TRT  ============= " 
-   print " == step1 ==> " + CommandLine1_TRT + "\n"
-   print " == step2 ==> " + CommandLine2_TRT + "\n" 
-
-   
-# ===============================
-# completed
-# ===============================
-print "\n ============================================="
-print "    GAME OVER.  INSERT COIN"
-print " =============================================\n"
-sys.exit()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsUploader.py b/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsUploader.py
deleted file mode 100644
index 224a0d2d6f1df50ca060160c769c10cb20387804..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/ConstantsUploader.py
+++ /dev/null
@@ -1,290 +0,0 @@
-#! /usr/bin/env python
-# =====================================================================
-# Main script to run the upload constants to DB
-# =====================================================================
-import os
-import sys
-# =====================================================================
-#  Welcome print
-# =====================================================================
-print "\n ============================================="
-print "    ID Alignment constants uploader"
-print " =============================================\n"
-# =====================================================================
-#  Default values
-# =====================================================================
-Def_Do_Silicon = 1
-User_Do_Silicon = -1
-#
-Def_Do_TRT = 1
-User_Do_TRT = -1
-#
-Def_ConstantsFile = "IterX_AlignmentConstants"
-User_ConstantsFile = ""
-#
-Def_Mode = "Test"
-User_Mode = ""
-#
-Def_Comment = "This is a TEST" 
-User_Comment =""
-#
-Def_Tag = "new_tag"
-User_Tag = ""
-#
-Def_UPD4 = ""
-User_UPD4 = ""
-#
-Def_DBName = "COMP200"
-User_DBName = ""
-#
-Def_Conditions = "cond10_data.gen.COND"
-User_Conditions = ""
-#
-# =====================================================================
-#  Handling of run options
-# =====================================================================
-if len(sys.argv) > 1:
-    argNum = 1
-    argMax = len(sys.argv)-1
-    argCurr = -1 # jut to make that first time it points to 0 
-    #print ' >>> user input has %s arguments' % argMax
-    for arg in sys.argv:
-        argCurr += 1
-        #print ".. %s .." % arg
-        if arg in ("-h", "--help"):    
-            print ' >>> This is the help message of RunIterator.py'       
-            print ' NAME'
-            print '     RunIterator.py'
-            print ' '
-            print ' SYNOPSIS'
-            print '     python RunIterator.py [-r RunNumber] [-f ConstantsFile]' 
-            print ' '
-            print ' OPTIONS'
-            print '     The following options are recognized by RunIterator.py'
-            print ' '
-            print '     -db DBName'
-            print '          DB where the constants will be uploaded. The posible names are COMP200 and OFLP200. The default \n name is: %s' %Def_DBName
-            print ' '
-            print '     -f ConstantsFile'
-            print '          The constants .root and .db files taken are: ConstantsFile.root and ConstantsFile.db. The default \n\
-            files are {0}.root and {0}.db'.format(Def_ConstantsFile)
-            print ' '
-            print '     -exec'
-            print '           The constants will be effectively uploaded to the DB. Default mode is test mode when commands are just\n\
-            displayed but no executed, therefore no constants are uploaded.'
-            print ' '
-            print '     -c Comment'
-            print '           Set a comment (between quotes) in the DB entry next to the tag name. Default comment: \"{0}\"'.format(Def_Comment)
-            print ' '
-            print '     -silicon doSilicon'
-            print '           If doSilicon = 1 then silicon constants are uploaded (default).'           
-            print '           If doSilicon = 0 then silicon constants are not uploaded.' 
-            print '           default value: doSilicon = %d' %Def_Do_Silicon
-            print ' '
-            print '     -trt doTRT'
-            print '           If doTRT = 1 then TRT constants are uploaded.'           
-            print '           If doTRT = 0 then TRT constants are not uploaded (default)'           
-            print '           default value: doTRT = %d' %Def_Do_TRT
-            print ' '
-            print '     -tag Tag_Id'
-            print '           The extensions of the tag identifier are set for InDetAlign and TRTAlign. The default tag is: \"%s\"' %Def_Tag
-            print ' '
-            print '     -upd4'
-            print ' ' 
-            print ' \n 09/February/2011'
-            sys.exit()
-        elif arg in ("-f", "--file"):    
-            User_ConstantsFile = str(sys.argv[argCurr+1])
-            # 
-        elif arg in ("-t", "-tag", "--tag"):    
-            User_Tag = str(sys.argv[argCurr+1])
-            # 
-        elif arg in ("-db", "--db", "--DB"):    
-            User_DBName = str(sys.argv[argCurr+1])
-            #
-        elif arg in ("-cond", "--cond", "--COND"):    
-            User_Conditions = str(sys.argv[argCurr+1])
-            #
-        elif arg in ("--exec"):    
-            # This option activates the execution of the commands
-            User_Mode = "Exec"
-            #
-        elif arg in ("-silicon", "--silicon"):    
-            User_Do_Silicon = int(sys.argv[argCurr+1])
-            if (User_Do_Silicon > 1): 
-                User_Do_Silicon = 1;
-            elif (User_Do_Silicon <0):
-                User_Do_Silicon = 0
-            #
-        elif arg in ("-trt", "--trt"):    
-            User_Do_TRT = int(sys.argv[argCurr+1])
-            if (User_Do_TRT > 1): 
-                User_Do_TRT = 1;
-            elif (User_Do_TRT <0):
-                User_Do_TRT = 0
-            #
-        elif arg in ("-c", "--comment"):    
-            User_Comment = str(sys.argv[argCurr+1])
-            #
-        elif arg in ("-upd4","--upd4","--UPD4"):    
-            # This option activates the execution of the commands
-            User_UPD4 = "--ignoremode BackDoor"
-            #
-
-    if (1):
-        print '>>> ConstantsUploader >>> List of user input values:'
-        print '> User File Name = %s' % User_ConstantsFile 
-        print '> User Do_Silicon = %d' % User_Do_Silicon
-        print '> User Do_TRT = %d' % User_Do_TRT
-        print '> User Mode = %s' % User_Mode
-        print '> User tag = %s' %User_Tag
-        print '> User Comment = %s' %User_Comment
-        print '> User upd4 = %s' %User_UPD4
-        print '> User DB name = %s' %User_DBName
-        print '> User conditions file = %s' %User_Conditions
-        print '>>> End of input options processing <<< \n' 
-
-# ===============================
-# Handling of variables
-# ===============================
-#
-ConstantsFileName = Def_ConstantsFile 
-if (User_ConstantsFile): 
-    ConstantsFileName = User_ConstantsFile 
-#
-Upload_Mode = Def_Mode
-if (User_Mode):
-    Upload_Mode = "Exec"
-#
-TheNewTag = Def_Tag 
-if (User_Tag): 
-    TheNewTag = User_Tag 
-#
-DBName = Def_DBName 
-if (User_DBName): 
-    DBName = User_DBName 
-#
-ConditionsFile = Def_Conditions 
-if (User_Conditions): 
-    ConditionsFile = User_Conditions
-#
-Do_Silicon = Def_Do_Silicon
-if (User_Do_Silicon != -1): 
-    Do_Silicon = User_Do_Silicon
-#
-Do_TRT = Def_Do_TRT
-if (User_Do_TRT != -1):
-    Do_TRT = User_Do_TRT
-#
-DotDbFile = ConstantsFileName+".db"
-DotRootFile = ConstantsFileName+".root"
-OutputDbFile = ConstantsFileName+"_output.db"
-#
-CommentOnConstants = Def_Comment
-if (User_Comment):
- CommentOnConstants = User_Comment
-# 
-New_InDet_TagName = "InDetAlign_" + TheNewTag
-New_TRT_TagName = "TRTAlign_" + TheNewTag
-#
-CommandUPD4 = Def_UPD4
-if (User_UPD4):
- CommandUPD4 = User_UPD4
-
-
-
-if (1):
-    print '>>>>>>>>>>>> List of variables >>>>>>>>>>>>>>> '
-    print '> DotDbFile    = %s' %DotDbFile
-    print '> DotRootFile  = %s' %DotRootFile
-    print '> OutputDbFile = %s' %OutputDbFile
-    print '> DB Name      = %s' %DBName
-    print '> Conditions   = %s' %ConditionsFile
-    print '> Upload_Mode  = %s' %Upload_Mode
-    print '> InDet tag    = %s' %New_InDet_TagName
-    print '> TRT tag      = %s' %New_TRT_TagName
-    print '> Do_Silicon   = %d' %Do_Silicon
-    print '> Do_TRT       = %d' %Do_TRT
-    print '> Comment      = %s' %CommentOnConstants
-    print '> CommandUPD4  = %s' %CommandUPD4
-    print '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n '
-
-# ===============================
-# Common step
-# ===============================
-# this command line is the same for silicon and TRT
-CommandLine0 = "~atlcond/utils/registerFiles2 --wait " + ConditionsFile + " " + DotRootFile
-
-# ===============================
-# 1st step
-# ===============================
-
-# -- prepare the command 
-CommandLine1_Silicon = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /Indet/Align -outtag " + New_InDet_TagName + " -tl \""+ CommentOnConstants +"\" -alliov "+CommandUPD4
-
-CommandLine1_TRT = "AtlCoolCopy.exe \"sqlite://schema="+DotDbFile+";dbname="+DBName+"\" \"sqlite://;schema="+OutputDbFile+";dbname="+DBName+"\" -create -folder /TRT/Align -outtag " + New_TRT_TagName +" -tl \""+ CommentOnConstants +"\" -alliov "+CommandUPD4
-
-TestCommand = "ls -l %s" %DotDbFile
-ExistsDotDb = os.system(TestCommand)
-if (ExistsDotDb !=0):
-    print '\n ** ERROR ** file %s does not exist ' % DotDbFile 
-    sys.exit()
-
-TestCommand = "ls -l %s" %DotRootFile
-ExistsDotRoot = os.system(TestCommand)
-if (ExistsDotRoot !=0):
-     print '\n ** ERROR ** file %s does not exist ' % DotRootFile 
-     sys.exit()
-
-
-# ===============================
-# 2nd step
-# ===============================
-CommandLine2_Silicon = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug  --batch --comment \""+CommentOnConstants+"\" --tag " + New_InDet_TagName + " --passopt='-ctl' --folder /Indet/Align "+ OutputDbFile +" "+DBName+" ATLAS_COOLWRITE ATLAS_COOLOFL_INDET_W WCOOLOFL4INDET1"
-
-CommandLine2_TRT = "/afs/cern.ch/user/a/atlcond/utils/AtlCoolMerge.py --debug --batch --comment \""+CommentOnConstants+"\" --tag " + New_TRT_TagName + " --passopt='-ctl' --folder /TRT/Align "+ OutputDbFile +" "+DBName+" ATLAS_COOLWRITE ATLAS_COOLOFL_TRT_W WCOOLOFL4TRT2"
-
-#- 
-# ===============================
-# Upload
-# ===============================
-if Upload_Mode in ("Exec"):
-   print " \n == Excute upload !!!! == \n"
-
-   print " \n == step0 ==> " + CommandLine0 + "\n"
-   os.system(CommandLine0)
-
-   if (Do_Silicon == 1):
-       print ' =============> Uploading silicon constants ============'
-       print " == step1 ==> " + CommandLine1_Silicon + "\n"
-       os.system(CommandLine1_Silicon)
-       print " \n == step2 ==> " + CommandLine2_Silicon + "\n"
-       os.system(CommandLine2_Silicon)
-   if (Do_TRT == 1):
-       print ' =============> Uploading TRT constants ============'
-       print " == step1 ==> " + CommandLine1_TRT + "\n"
-       print os.system(CommandLine1_TRT)
-       print " \n == step2 ==> " + CommandLine2_TRT + "\n" 
-       print os.system(CommandLine2_TRT)
-   
-elif Upload_Mode in ("Test"):
-   print " \n == Test Mode !!!! == \n"
-   print " =========== Common ============= " 
-   print " == step0 ==> " + CommandLine0 + "\n\n"
-   print "   WARNING       first check the condXX_data_gen.COND to point with the following command:"
-   print "                 > ~atlcond/utils/registerFiles2 --list \n"
-   print " =========== Silicon ============= " 
-   print " == step1 ==> " + CommandLine1_Silicon + "\n"
-   print " == step2 ==> " + CommandLine2_Silicon + "\n\n"
-   print " ===========  TRT  ============= " 
-   print " == step1 ==> " + CommandLine1_TRT + "\n"
-   print " == step2 ==> " + CommandLine2_TRT + "\n" 
-
-   
-# ===============================
-# completed
-# ===============================
-print "\n ============================================="
-print "    GAME OVER.  INSERT COIN"
-print " =============================================\n"
-sys.exit()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/MakeFileList.py b/InnerDetector/InDetExample/InDetAlignExample/share/Data/MakeFileList.py
deleted file mode 100755
index cac609c5ec9d271c3146e02eb3b078ba458a80f0..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/MakeFileList.py
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-#################################################################
-#         Script to run obtain the events per file              #
-#                 only runs with root files                     #
-#################################################################
-import os
-import PyUtils.PoolFile as PF
-
-#inputPath = 'castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/FDR2_IDCalibStream/ESD/'
-inputPath = '/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/'
-
-subpaths = ["data09_900GeV.00141994.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102061_00",
-            "data09_900GeV.00142065.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102089_00",
-            "data09_900GeV.00142065.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105339_00",
-            "data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00",
-            "data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00",
-            "data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102169_00",
-            "data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00",
-            "data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00",
-            "data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00",
-            "data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00",
-            "data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00",
-            "data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00",
-            "data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00",
-            "data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102208_00",
-            "data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00",
-            "data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00",
-            "data09_900GeV.00142154.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102110_00",
-            "data09_900GeV.00142174.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102162_00"]
-
-ReadNEvents = False
-PoolFileCatalog = True
-numline = 1
-
-
-OutputFile = 'GoodRunList_900GeV.txt'
-
-if PoolFileCatalog:
-   OutputFile = 'FileToCatalog_GoodRunList_900GeV.xml'
-   
-outputText = open(OutputFile, "w")
-paths = []
-if "subpaths" in dir():
-   for SP in subpaths:
-      paths.append(inputPath+SP+"/")
-else:
-   paths.append(inputPath)
-	
-for Path in paths:
-   if "castor" in Path:
-      print "Reading castor directory. Please wait..."
-      inputfiles = os.popen("rfdir "+ Path).read().splitlines()
-   else:
-      print "Reading directory. Please wait..."
-      inputfiles = os.popen("ls -l "+ Path).read().splitlines()
-
-   for line in inputfiles:
-      filename = line.split()[8]
-      if "root" in filename or "ESD" in filename or "data" in filename:
-         fullFilename = Path+filename
-         try:
-            if ReadNEvents:
-               poolFile = PF.PoolFile(fullFilename)
-               numEvents = int(poolFile.dataHeader.nEntries)
-               print filename
-               print numEvents
-                  
-               if numEvents > EventCut:
-                  outputText.write(fullFilename + '\t' + str(numEvents) + '\n')
-               else:
-                  print "File with few events, skipping..."
-            else:
-               if not PoolFileCatalog :
-                  outputText.write(fullFilename + '\n') 
-               if PoolFileCatalog :
-                  print " Creating as PoolFileToCatalogue Please wait..."
-                  print "  pool_insertFileToCatalog ", fullFilename
-                  if numline==1:
-                     outputText.write(" pool_insertFileToCatalog "+ fullFilename + ' ')
-                  else:
-                     outputText.write( fullFilename + ' ')
-                             
-               numline=numline+1 
-				
-         except IOError:
-            print "problem reading file " + filename + ", skipping..."
-      else:
-         print filename + " is not a root file, skipping... "
-            
-outputText.close()
-
-
-
-####################################
-##    POOL FILE CATALOGUE         ##
-####################################
-if PoolFileCatalog:
-  outputText = open(OutputFile, "r")
-  command = outputText.read()  # store the content in a variable
-  print "command: ", command
-  os.system(command)
-  outputText.close()
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_2009_900GeV_atlasdatadisk.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_2009_900GeV_atlasdatadisk.txt
deleted file mode 100644
index 13d4b2ee40d83853fc1fad0b7c6c9a548c5a8ef7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_2009_900GeV_atlasdatadisk.txt
+++ /dev/null
@@ -1,294 +0,0 @@
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000016.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000024.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000025.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000026.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000027.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142166.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102148_00/DESD_COLLCAND.102148._000028.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000016.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142171.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102155_00/DESD_COLLCAND.102155._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142189.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105234_00/DESD_COLLCAND.105234._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141749.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102040_00/DESD_COLLCAND.102040._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00141811.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102054_00/DESD_COLLCAND.102054._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000016.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000024.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000025.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000026.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000027.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000028.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000029.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000030.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000031.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000032.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000033.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000034.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000035.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000036.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000037.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000038.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000039.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000040.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000041.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000042.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000043.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000044.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000045.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000046.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142165.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102141_00/DESD_COLLCAND.102141._000047.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000016.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000024.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000025.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000026.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000027.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000028.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000029.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000030.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000031.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000032.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000033.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000034.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000035.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000036.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000037.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000038.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000039.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000040.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000041.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000042.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000043.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000044.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000045.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000046.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000047.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000048.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000049.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000050.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142193.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102194_00/DESD_COLLCAND.102194._000051.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000016.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000024.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000025.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000026.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000027.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000028.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000029.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000030.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000031.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000032.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000033.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000034.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000035.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000036.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000037.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102217_00/DESD_COLLCAND.102217._000038.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000016.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000024.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000025.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000026.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000027.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000028.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000029.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000030.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000031.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142191.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102182_00/DESD_COLLCAND.102182._000032.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000011.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000012.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000013.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000014.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000015.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000016.root.1__DQ2-1262946747
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000017.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000018.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000019.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000020.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000021.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000022.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142195.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid105216_00/DESD_COLLCAND.105216._000023.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000005.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000006.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000007.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000008.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000009.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142149.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102103_00/DESD_COLLCAND.102103._000010.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142154.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102110_00/DESD_COLLCAND.102110._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142154.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102110_00/DESD_COLLCAND.102110._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142154.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102110_00/DESD_COLLCAND.102110._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142154.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102110_00/DESD_COLLCAND.102110._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142174.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102162_00/DESD_COLLCAND.102162._000001.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142174.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102162_00/DESD_COLLCAND.102162._000002.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142174.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102162_00/DESD_COLLCAND.102162._000003.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142174.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102162_00/DESD_COLLCAND.102162._000004.root.1
-/castor/cern.ch/grid/atlas/atlasdatadisk/data09_900GeV/DESD_COLLCAND/r988_p62/data09_900GeV.00142174.physics_MinBias.merge.DESD_COLLCAND.r988_p62_tid102162_00/DESD_COLLCAND.102162._000005.root.1
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CSC_CosmicsRel13_BFOff.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CSC_CosmicsRel13_BFOff.txt
deleted file mode 100644
index 232b4d55ea64532d8688798fb4c80f16b04243b8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CSC_CosmicsRel13_BFOff.txt
+++ /dev/null
@@ -1,624 +0,0 @@
-# ------------------------------------------------------------------------------------
-# Simulated Cosmics B OFF: ATLAS-CommNF-02-00-00 (102 files)
-# Else cosmics ( filtered TRT Vol)
-#"castor:/castor/cern.ch/user/l/lytken/cosmic_13010/digitization/NoField/TRTBarrel/misaligned/"
-# ------------------------------------------------------------------------------------
-
-#------------------------------
-# Old Production (rel13)
-# ATLAS-CommNF-02-00-00
-# Filtered TRT Barrel Volume
-#   ( 203 files)
-#------------------------------
-
-dig.trtbarrel_ma100.root
-dig.trtbarrel_ma1000.root
-dig.trtbarrel_ma1050.root
-dig.trtbarrel_ma1100.root
-dig.trtbarrel_ma1150.root
-dig.trtbarrel_ma1200.root
-dig.trtbarrel_ma1250.root
-dig.trtbarrel_ma1300.root
-dig.trtbarrel_ma1350.root
-dig.trtbarrel_ma1400.root
-dig.trtbarrel_ma1450.root
-dig.trtbarrel_ma150.root
-dig.trtbarrel_ma1500.root
-dig.trtbarrel_ma1550.root
-dig.trtbarrel_ma1600.root
-dig.trtbarrel_ma1650.root
-dig.trtbarrel_ma1700.root
-dig.trtbarrel_ma1750.root
-dig.trtbarrel_ma1800.root
-dig.trtbarrel_ma1850.root
-dig.trtbarrel_ma1900.root
-dig.trtbarrel_ma1950.root
-dig.trtbarrel_ma200.root
-dig.trtbarrel_ma2000.root
-dig.trtbarrel_ma2050.root
-dig.trtbarrel_ma2100.root
-dig.trtbarrel_ma2150.root
-dig.trtbarrel_ma2200.root
-dig.trtbarrel_ma2250.root
-dig.trtbarrel_ma2300.root
-dig.trtbarrel_ma2350.root
-dig.trtbarrel_ma2400.root
-dig.trtbarrel_ma2450.root
-dig.trtbarrel_ma250.root
-dig.trtbarrel_ma2500.root
-dig.trtbarrel_ma2550.root
-dig.trtbarrel_ma2600.root
-dig.trtbarrel_ma2650.root
-dig.trtbarrel_ma2700.root
-dig.trtbarrel_ma2750.root
-dig.trtbarrel_ma2800.root
-dig.trtbarrel_ma2850.root
-dig.trtbarrel_ma2900.root
-dig.trtbarrel_ma2950.root
-dig.trtbarrel_ma300.root
-dig.trtbarrel_ma3000.root
-dig.trtbarrel_ma3050.root
-dig.trtbarrel_ma3100.root
-dig.trtbarrel_ma3150.root
-dig.trtbarrel_ma3200.root
-dig.trtbarrel_ma3250.root
-dig.trtbarrel_ma3300.root
-dig.trtbarrel_ma3350.root
-dig.trtbarrel_ma3400.root
-dig.trtbarrel_ma3450.root
-dig.trtbarrel_ma350.root
-dig.trtbarrel_ma3500.root
-dig.trtbarrel_ma3550.root
-dig.trtbarrel_ma3600.root
-dig.trtbarrel_ma3650.root
-dig.trtbarrel_ma3700.root
-dig.trtbarrel_ma3750.root
-dig.trtbarrel_ma3800.root
-dig.trtbarrel_ma3850.root
-dig.trtbarrel_ma3900.root
-dig.trtbarrel_ma3950.root
-dig.trtbarrel_ma400.root
-dig.trtbarrel_ma4000.root
-dig.trtbarrel_ma4050.root
-dig.trtbarrel_ma4100.root
-dig.trtbarrel_ma4150.root
-dig.trtbarrel_ma4200.root
-dig.trtbarrel_ma4250.root
-dig.trtbarrel_ma4300.root
-dig.trtbarrel_ma4350.root
-dig.trtbarrel_ma4400.root
-dig.trtbarrel_ma4450.root
-dig.trtbarrel_ma450.root
-dig.trtbarrel_ma4500.root
-dig.trtbarrel_ma4550.root
-dig.trtbarrel_ma4600.root
-dig.trtbarrel_ma4650.root
-dig.trtbarrel_ma4700.root
-dig.trtbarrel_ma4750.root
-dig.trtbarrel_ma4800.root
-dig.trtbarrel_ma4850.root
-dig.trtbarrel_ma4900.root
-dig.trtbarrel_ma4950.root
-dig.trtbarrel_ma500.root
-dig.trtbarrel_ma5000.root
-dig.trtbarrel_ma5050.root
-dig.trtbarrel_ma5100.root
-dig.trtbarrel_ma5150.root
-dig.trtbarrel_ma5200.root
-dig.trtbarrel_ma550.root
-dig.trtbarrel_ma600.root
-dig.trtbarrel_ma650.root
-dig.trtbarrel_ma700.root
-dig.trtbarrel_ma750.root
-dig.trtbarrel_ma800.root
-dig.trtbarrel_ma850.root
-dig.trtbarrel_ma900.root
-dig.trtbarrel_ma950.root
-
-
-
-
-
-# Lauren cosmics (tracks withPIX hits)
-# Simulation High Pt
-
-#-------------------------------
-# LAUREN SIMULATION LOW Pt dig1
-#------------------------------
-# Old Production 
-# ATLAS-CommNF-02-00-00
-# Filtered PIX Barrel Volume
-#   ( 171 files; some of them are comment!)
-#------------------------------
-
-#"castor:/castor/cern.ch/user/m/moles/data/cosmic_csc/LowPt_PIXVol/dig1/"
-
-#TRT_Pix_1GeV_30GeV_1100.dig.root
-#TRT_Pix_1GeV_30GeV_1101.dig.root
-#TRT_Pix_1GeV_30GeV_1103.dig.root
-#TRT_Pix_1GeV_30GeV_1104.dig.root
-#TRT_Pix_1GeV_30GeV_1105.dig.root
-#TRT_Pix_1GeV_30GeV_1106.dig.root
-#TRT_Pix_1GeV_30GeV_1107.dig.root
-#TRT_Pix_1GeV_30GeV_1108.dig.root
-#TRT_Pix_1GeV_30GeV_1109.dig.root
-#TRT_Pix_1GeV_30GeV_1110.dig.root
-#TRT_Pix_1GeV_30GeV_1111.dig.root
-#TRT_Pix_1GeV_30GeV_1112.dig.root
-#TRT_Pix_1GeV_30GeV_1113.dig.root
-#TRT_Pix_1GeV_30GeV_1114.dig.root
-#TRT_Pix_1GeV_30GeV_1115.dig.root
-#TRT_Pix_1GeV_30GeV_1116.dig.root
-#TRT_Pix_1GeV_30GeV_1117.dig.root
-#TRT_Pix_1GeV_30GeV_1118.dig.root
-#TRT_Pix_1GeV_30GeV_1119.dig.root
-#TRT_Pix_1GeV_30GeV_1120.dig.root
-#TRT_Pix_1GeV_30GeV_1121.dig.root
-#TRT_Pix_1GeV_30GeV_1122.dig.root
-#TRT_Pix_1GeV_30GeV_1123.dig.root
-#TRT_Pix_1GeV_30GeV_1124.dig.root
-#TRT_Pix_1GeV_30GeV_1125.dig.root
-#TRT_Pix_1GeV_30GeV_1126.dig.root
-#TRT_Pix_1GeV_30GeV_1127.dig.root
-#TRT_Pix_1GeV_30GeV_1128.dig.root
-#TRT_Pix_1GeV_30GeV_1129.dig.root
-#TRT_Pix_1GeV_30GeV_1130.dig.root
-#TRT_Pix_1GeV_30GeV_1131.dig.root
-#TRT_Pix_1GeV_30GeV_1132.dig.root
-#TRT_Pix_1GeV_30GeV_1133.dig.root
-#TRT_Pix_1GeV_30GeV_1134.dig.root
-#TRT_Pix_1GeV_30GeV_1135.dig.root
-#TRT_Pix_1GeV_30GeV_1136.dig.root
-#TRT_Pix_1GeV_30GeV_1137.dig.root
-#TRT_Pix_1GeV_30GeV_1138.dig.root
-#TRT_Pix_1GeV_30GeV_1139.dig.root
-#TRT_Pix_1GeV_30GeV_1140.dig.root
-#TRT_Pix_1GeV_30GeV_1141.dig.root
-#TRT_Pix_1GeV_30GeV_1142.dig.root
-#TRT_Pix_1GeV_30GeV_1143.dig.root
-#TRT_Pix_1GeV_30GeV_1144.dig.root
-##TRT_Pix_1GeV_30GeV_1145.dig.root
-#TRT_Pix_1GeV_30GeV_1146.dig.root
-#TRT_Pix_1GeV_30GeV_1147.dig.root
-#TRT_Pix_1GeV_30GeV_1148.dig.root
-#TRT_Pix_1GeV_30GeV_1149.dig.root
-##TRT_Pix_1GeV_30GeV_1150.dig.root
-#TRT_Pix_1GeV_30GeV_1151.dig.root
-##TRT_Pix_1GeV_30GeV_1152.dig.root
-#TRT_Pix_1GeV_30GeV_1153.dig.root
-#TRT_Pix_1GeV_30GeV_1154.dig.root
-#TRT_Pix_1GeV_30GeV_1155.dig.root
-#TRT_Pix_1GeV_30GeV_1156.dig.root
-#TRT_Pix_1GeV_30GeV_1157.dig.root
-#TRT_Pix_1GeV_30GeV_1158.dig.root
-#TRT_Pix_1GeV_30GeV_1159.dig.root
-##TRT_Pix_1GeV_30GeV_1160.dig.root
-#TRT_Pix_1GeV_30GeV_1161.dig.root
-#TRT_Pix_1GeV_30GeV_1162.dig.root
-#TRT_Pix_1GeV_30GeV_1163.dig.root
-##TRT_Pix_1GeV_30GeV_1164.dig.root
-#TRT_Pix_1GeV_30GeV_1166.dig.root
-##TRT_Pix_1GeV_30GeV_1167.dig.root
-##TRT_Pix_1GeV_30GeV_1168.dig.root
-#TRT_Pix_1GeV_30GeV_1169.dig.root
-#TRT_Pix_1GeV_30GeV_1171.dig.root
-#TRT_Pix_1GeV_30GeV_1172.dig.root
-#TRT_Pix_1GeV_30GeV_1173.dig.root
-#TRT_Pix_1GeV_30GeV_1174.dig.root
-#TRT_Pix_1GeV_30GeV_1175.dig.root
-#TRT_Pix_1GeV_30GeV_1176.dig.root
-#TRT_Pix_1GeV_30GeV_1178.dig.root
-#TRT_Pix_1GeV_30GeV_1179.dig.root
-#TRT_Pix_1GeV_30GeV_1180.dig.root
-#TRT_Pix_1GeV_30GeV_1181.dig.root
-#TRT_Pix_1GeV_30GeV_1183.dig.root
-##TRT_Pix_1GeV_30GeV_1184.dig.root
-#TRT_Pix_1GeV_30GeV_1185.dig.root
-##TRT_Pix_1GeV_30GeV_1186.dig.root
-#TRT_Pix_1GeV_30GeV_1187.dig.root
-##TRT_Pix_1GeV_30GeV_1188.dig.root
-#TRT_Pix_1GeV_30GeV_1189.dig.root
-#TRT_Pix_1GeV_30GeV_1190.dig.root
-#TRT_Pix_1GeV_30GeV_1192.dig.root
-##TRT_Pix_1GeV_30GeV_1193.dig.root
-##TRT_Pix_1GeV_30GeV_1194.dig.root
-##TRT_Pix_1GeV_30GeV_1195.dig.root
-##TRT_Pix_1GeV_30GeV_1196.dig.root
-#TRT_Pix_1GeV_30GeV_1197.dig.root
-#TRT_Pix_1GeV_30GeV_1198.dig.root
-##TRT_Pix_1GeV_30GeV_1199.dig.root
-
-
-#************************************************************
-#"castor:/castor/cern.ch/user/m/moles/data/cosmic_csc/LowPt_PIXVol/dig2/"
-
-
-#TRT_Pix_1GeV_30GeV_1202.dig.root
-#TRT_Pix_1GeV_30GeV_1203.dig.root
-#TRT_Pix_1GeV_30GeV_1204.dig.root
-#TRT_Pix_1GeV_30GeV_1205.dig.root
-#TRT_Pix_1GeV_30GeV_1207.dig.root
-#TRT_Pix_1GeV_30GeV_1208.dig.root
-#TRT_Pix_1GeV_30GeV_1209.dig.root
-#TRT_Pix_1GeV_30GeV_1210.dig.root
-#TRT_Pix_1GeV_30GeV_1211.dig.root
-#TRT_Pix_1GeV_30GeV_1212.dig.root
-#TRT_Pix_1GeV_30GeV_1213.dig.root
-#TRT_Pix_1GeV_30GeV_1214.dig.root
-#TRT_Pix_1GeV_30GeV_1215.dig.root
-#TRT_Pix_1GeV_30GeV_1216.dig.root
-#TRT_Pix_1GeV_30GeV_1217.dig.root
-#TRT_Pix_1GeV_30GeV_1218.dig.root
-#TRT_Pix_1GeV_30GeV_1219.dig.root
-#TRT_Pix_1GeV_30GeV_1220.dig.root
-#TRT_Pix_1GeV_30GeV_1221.dig.root
-#TRT_Pix_1GeV_30GeV_1222.dig.root
-#TRT_Pix_1GeV_30GeV_1223.dig.root
-#TRT_Pix_1GeV_30GeV_1224.dig.root
-#TRT_Pix_1GeV_30GeV_1225.dig.root
-#TRT_Pix_1GeV_30GeV_1228.dig.root
-#TRT_Pix_1GeV_30GeV_1229.dig.root
-#TRT_Pix_1GeV_30GeV_1230.dig.root
-#TRT_Pix_1GeV_30GeV_1231.dig.root
-#TRT_Pix_1GeV_30GeV_1233.dig.root
-#TRT_Pix_1GeV_30GeV_1234.dig.root
-#TRT_Pix_1GeV_30GeV_1235.dig.root
-#TRT_Pix_1GeV_30GeV_1236.dig.root
-#TRT_Pix_1GeV_30GeV_1237.dig.root
-#TRT_Pix_1GeV_30GeV_1238.dig.root
-#TRT_Pix_1GeV_30GeV_1240.dig.root
-#TRT_Pix_1GeV_30GeV_1242.dig.root
-#TRT_Pix_1GeV_30GeV_1243.dig.root
-#TRT_Pix_1GeV_30GeV_1244.dig.root
-#TRT_Pix_1GeV_30GeV_1245.dig.root
-#TRT_Pix_1GeV_30GeV_1246.dig.root
-#TRT_Pix_1GeV_30GeV_1247.dig.root
-#TRT_Pix_1GeV_30GeV_1249.dig.root
-#TRT_Pix_1GeV_30GeV_1251.dig.root
-#TRT_Pix_1GeV_30GeV_1252.dig.root
-#TRT_Pix_1GeV_30GeV_1253.dig.root
-#TRT_Pix_1GeV_30GeV_1255.dig.root
-#TRT_Pix_1GeV_30GeV_1256.dig.root
-#TRT_Pix_1GeV_30GeV_1257.dig.root
-#TRT_Pix_1GeV_30GeV_1259.dig.root
-#TRT_Pix_1GeV_30GeV_1261.dig.root
-#TRT_Pix_1GeV_30GeV_1263.dig.root
-#TRT_Pix_1GeV_30GeV_1265.dig.root
-#TRT_Pix_1GeV_30GeV_1266.dig.root
-#TRT_Pix_1GeV_30GeV_1267.dig.root
-#TRT_Pix_1GeV_30GeV_1268.dig.root
-#TRT_Pix_1GeV_30GeV_1269.dig.root
-#TRT_Pix_1GeV_30GeV_1272.dig.root
-#TRT_Pix_1GeV_30GeV_1273.dig.root
-#TRT_Pix_1GeV_30GeV_1274.dig.root
-#TRT_Pix_1GeV_30GeV_1275.dig.root
-#TRT_Pix_1GeV_30GeV_1276.dig.root
-#TRT_Pix_1GeV_30GeV_1277.dig.root
-#TRT_Pix_1GeV_30GeV_1280.dig.root
-#TRT_Pix_1GeV_30GeV_1281.dig.root
-#TRT_Pix_1GeV_30GeV_1282.dig.root
-#TRT_Pix_1GeV_30GeV_1284.dig.root
-#TRT_Pix_1GeV_30GeV_1285.dig.root
-#TRT_Pix_1GeV_30GeV_1286.dig.root
-#TRT_Pix_1GeV_30GeV_1287.dig.root
-#TRT_Pix_1GeV_30GeV_1289.dig.root
-#TRT_Pix_1GeV_30GeV_1290.dig.root
-#TRT_Pix_1GeV_30GeV_1291.dig.root
-#TRT_Pix_1GeV_30GeV_1292.dig.root
-#TRT_Pix_1GeV_30GeV_1293.dig.root
-#TRT_Pix_1GeV_30GeV_1294.dig.root
-#TRT_Pix_1GeV_30GeV_1296.dig.root
-#TRT_Pix_1GeV_30GeV_1297.dig.root
-#TRT_Pix_1GeV_30GeV_1299.dig.root
-
-
-
-#-------------------------------
-# LAUREN SIMULATION HIGH Pt 
-#------------------------------
-# Old Production 
-# ATLAS-CommNF-02-00-00
-# Filtered PIX Barrel Volume
-#   ( 296 files)
-#----------------------------
-# Simulation High Pt
-# "castor:/castor/cern.ch/user/m/moles/data/cosmic_csc/HighPt_PIXVol/"
-         
-#TRT_Pix_30GeV_1000GeV_1000.dig.root
-#TRT_Pix_30GeV_1000GeV_1001.dig.root
-#TRT_Pix_30GeV_1000GeV_1002.dig.root
-#TRT_Pix_30GeV_1000GeV_1003.dig.root
-#TRT_Pix_30GeV_1000GeV_1004.dig.root
-#TRT_Pix_30GeV_1000GeV_1005.dig.root
-#TRT_Pix_30GeV_1000GeV_1006.dig.root
-#TRT_Pix_30GeV_1000GeV_1007.dig.root
-#TRT_Pix_30GeV_1000GeV_1008.dig.root
-#TRT_Pix_30GeV_1000GeV_1009.dig.root
-#TRT_Pix_30GeV_1000GeV_1010.dig.root
-#TRT_Pix_30GeV_1000GeV_1011.dig.root
-#TRT_Pix_30GeV_1000GeV_1012.dig.root
-#TRT_Pix_30GeV_1000GeV_1013.dig.root
-#TRT_Pix_30GeV_1000GeV_1014.dig.root
-#TRT_Pix_30GeV_1000GeV_1015.dig.root
-#TRT_Pix_30GeV_1000GeV_1016.dig.root
-#TRT_Pix_30GeV_1000GeV_1017.dig.root
-#TRT_Pix_30GeV_1000GeV_1018.dig.root
-#TRT_Pix_30GeV_1000GeV_1019.dig.root
-#TRT_Pix_30GeV_1000GeV_1020.dig.root
-#TRT_Pix_30GeV_1000GeV_1021.dig.root
-#TRT_Pix_30GeV_1000GeV_1022.dig.root
-#TRT_Pix_30GeV_1000GeV_1023.dig.root
-#TRT_Pix_30GeV_1000GeV_1024.dig.root
-#TRT_Pix_30GeV_1000GeV_1025.dig.root
-#TRT_Pix_30GeV_1000GeV_1026.dig.root
-#TRT_Pix_30GeV_1000GeV_1027.dig.root
-#TRT_Pix_30GeV_1000GeV_1028.dig.root
-#TRT_Pix_30GeV_1000GeV_1029.dig.root
-#TRT_Pix_30GeV_1000GeV_1030.dig.root
-#TRT_Pix_30GeV_1000GeV_1031.dig.root
-#TRT_Pix_30GeV_1000GeV_1032.dig.root
-#TRT_Pix_30GeV_1000GeV_1033.dig.root
-#TRT_Pix_30GeV_1000GeV_1034.dig.root
-#TRT_Pix_30GeV_1000GeV_1035.dig.root
-#TRT_Pix_30GeV_1000GeV_1036.dig.root
-#TRT_Pix_30GeV_1000GeV_1037.dig.root
-#TRT_Pix_30GeV_1000GeV_1038.dig.root
-#TRT_Pix_30GeV_1000GeV_1039.dig.root
-#TRT_Pix_30GeV_1000GeV_1040.dig.root
-#TRT_Pix_30GeV_1000GeV_1041.dig.root
-#TRT_Pix_30GeV_1000GeV_1042.dig.root
-#TRT_Pix_30GeV_1000GeV_1043.dig.root
-#TRT_Pix_30GeV_1000GeV_1044.dig.root
-#TRT_Pix_30GeV_1000GeV_1045.dig.root
-#TRT_Pix_30GeV_1000GeV_1046.dig.root
-#TRT_Pix_30GeV_1000GeV_1047.dig.root
-#TRT_Pix_30GeV_1000GeV_1048.dig.root
-#TRT_Pix_30GeV_1000GeV_1049.dig.root
-#TRT_Pix_30GeV_1000GeV_1050.dig.root
-#TRT_Pix_30GeV_1000GeV_1051.dig.root
-#TRT_Pix_30GeV_1000GeV_1052.dig.root
-#TRT_Pix_30GeV_1000GeV_1053.dig.root
-##TRT_Pix_30GeV_1000GeV_1054.dig.root
-##TRT_Pix_30GeV_1000GeV_1055.dig.root
-##TRT_Pix_30GeV_1000GeV_1056.dig.root
-##TRT_Pix_30GeV_1000GeV_1057.dig.root
-#TRT_Pix_30GeV_1000GeV_1058.dig.root
-#TRT_Pix_30GeV_1000GeV_1059.dig.root
-#TRT_Pix_30GeV_1000GeV_1060.dig.root
-#TRT_Pix_30GeV_1000GeV_1061.dig.root
-#TRT_Pix_30GeV_1000GeV_1062.dig.root
-#TRT_Pix_30GeV_1000GeV_1063.dig.root
-#TRT_Pix_30GeV_1000GeV_1064.dig.root
-#TRT_Pix_30GeV_1000GeV_1065.dig.root
-#TRT_Pix_30GeV_1000GeV_1066.dig.root
-#TRT_Pix_30GeV_1000GeV_1067.dig.root
-#TRT_Pix_30GeV_1000GeV_1068.dig.root
-#TRT_Pix_30GeV_1000GeV_1069.dig.root
-#TRT_Pix_30GeV_1000GeV_1070.dig.root
-#TRT_Pix_30GeV_1000GeV_1071.dig.root
-#TRT_Pix_30GeV_1000GeV_1072.dig.root
-#TRT_Pix_30GeV_1000GeV_1073.dig.root
-#TRT_Pix_30GeV_1000GeV_1074.dig.root
-#TRT_Pix_30GeV_1000GeV_1075.dig.root
-#TRT_Pix_30GeV_1000GeV_1076.dig.root
-#TRT_Pix_30GeV_1000GeV_1077.dig.root
-##TRT_Pix_30GeV_1000GeV_1078.dig.root
-##TRT_Pix_30GeV_1000GeV_1079.dig.root
-#TRT_Pix_30GeV_1000GeV_1080.dig.root
-#TRT_Pix_30GeV_1000GeV_1081.dig.root
-#TRT_Pix_30GeV_1000GeV_1082.dig.root
-#TRT_Pix_30GeV_1000GeV_1083.dig.root
-#TRT_Pix_30GeV_1000GeV_1084.dig.root
-#TRT_Pix_30GeV_1000GeV_1085.dig.root
-#TRT_Pix_30GeV_1000GeV_1086.dig.root
-#TRT_Pix_30GeV_1000GeV_1087.dig.root
-#TRT_Pix_30GeV_1000GeV_1088.dig.root
-#TRT_Pix_30GeV_1000GeV_1089.dig.root
-#TRT_Pix_30GeV_1000GeV_1090.dig.root
-#TRT_Pix_30GeV_1000GeV_1091.dig.root
-#TRT_Pix_30GeV_1000GeV_1092.dig.root
-#TRT_Pix_30GeV_1000GeV_1093.dig.root
-#TRT_Pix_30GeV_1000GeV_1094.dig.root
-#TRT_Pix_30GeV_1000GeV_1095.dig.root
-#TRT_Pix_30GeV_1000GeV_1096.dig.root
-#TRT_Pix_30GeV_1000GeV_1097.dig.root
-#TRT_Pix_30GeV_1000GeV_1098.dig.root
-#TRT_Pix_30GeV_1000GeV_1099.dig.root
-#TRT_Pix_30GeV_1000GeV_1101.dig.root
-#TRT_Pix_30GeV_1000GeV_1102.dig.root
-#TRT_Pix_30GeV_1000GeV_1103.dig.root
-#TRT_Pix_30GeV_1000GeV_1104.dig.root
-#TRT_Pix_30GeV_1000GeV_1105.dig.root
-#TRT_Pix_30GeV_1000GeV_1106.dig.root
-#TRT_Pix_30GeV_1000GeV_1107.dig.root
-#TRT_Pix_30GeV_1000GeV_1108.dig.root
-#TRT_Pix_30GeV_1000GeV_1109.dig.root
-#TRT_Pix_30GeV_1000GeV_1110.dig.root
-#TRT_Pix_30GeV_1000GeV_1111.dig.root
-#TRT_Pix_30GeV_1000GeV_1112.dig.root
-#TRT_Pix_30GeV_1000GeV_1113.dig.root
-#TRT_Pix_30GeV_1000GeV_1114.dig.root
-#TRT_Pix_30GeV_1000GeV_1115.dig.root
-#TRT_Pix_30GeV_1000GeV_1116.dig.root
-#TRT_Pix_30GeV_1000GeV_1117.dig.root
-#TRT_Pix_30GeV_1000GeV_1118.dig.root
-#TRT_Pix_30GeV_1000GeV_1119.dig.root
-#TRT_Pix_30GeV_1000GeV_1120.dig.root
-#TRT_Pix_30GeV_1000GeV_1121.dig.root
-#TRT_Pix_30GeV_1000GeV_1122.dig.root
-#TRT_Pix_30GeV_1000GeV_1123.dig.root
-#TRT_Pix_30GeV_1000GeV_1124.dig.root
-#TRT_Pix_30GeV_1000GeV_1125.dig.root
-#TRT_Pix_30GeV_1000GeV_1126.dig.root
-#TRT_Pix_30GeV_1000GeV_1127.dig.root
-#TRT_Pix_30GeV_1000GeV_1128.dig.root
-#TRT_Pix_30GeV_1000GeV_1129.dig.root
-#TRT_Pix_30GeV_1000GeV_1130.dig.root
-#TRT_Pix_30GeV_1000GeV_1131.dig.root
-#TRT_Pix_30GeV_1000GeV_1132.dig.root
-#TRT_Pix_30GeV_1000GeV_1133.dig.root
-#TRT_Pix_30GeV_1000GeV_1134.dig.root
-#TRT_Pix_30GeV_1000GeV_1135.dig.root
-#TRT_Pix_30GeV_1000GeV_1136.dig.root
-#TRT_Pix_30GeV_1000GeV_1137.dig.root
-#TRT_Pix_30GeV_1000GeV_1138.dig.root
-#TRT_Pix_30GeV_1000GeV_1139.dig.root
-#TRT_Pix_30GeV_1000GeV_1140.dig.root
-#TRT_Pix_30GeV_1000GeV_1141.dig.root
-#TRT_Pix_30GeV_1000GeV_1142.dig.root
-#TRT_Pix_30GeV_1000GeV_1143.dig.root
-#TRT_Pix_30GeV_1000GeV_1144.dig.root
-#TRT_Pix_30GeV_1000GeV_1145.dig.root
-#TRT_Pix_30GeV_1000GeV_1146.dig.root
-#TRT_Pix_30GeV_1000GeV_1147.dig.root
-#TRT_Pix_30GeV_1000GeV_1148.dig.root
-#TRT_Pix_30GeV_1000GeV_1149.dig.root
-#TRT_Pix_30GeV_1000GeV_1150.dig.root
-#TRT_Pix_30GeV_1000GeV_1151.dig.root
-#TRT_Pix_30GeV_1000GeV_1152.dig.root
-#TRT_Pix_30GeV_1000GeV_1153.dig.root
-#TRT_Pix_30GeV_1000GeV_1154.dig.root
-##TRT_Pix_30GeV_1000GeV_1155.dig.root
-##TRT_Pix_30GeV_1000GeV_1156.dig.root
-##TRT_Pix_30GeV_1000GeV_1157.dig.root
-##TRT_Pix_30GeV_1000GeV_1158.dig.root
-##TRT_Pix_30GeV_1000GeV_1159.dig.root
-##TRT_Pix_30GeV_1000GeV_1160.dig.root
-#TRT_Pix_30GeV_1000GeV_1161.dig.root
-#TRT_Pix_30GeV_1000GeV_1162.dig.root
-#TRT_Pix_30GeV_1000GeV_1163.dig.root
-#TRT_Pix_30GeV_1000GeV_1164.dig.root
-#TRT_Pix_30GeV_1000GeV_1165.dig.root
-#TRT_Pix_30GeV_1000GeV_1166.dig.root
-#TRT_Pix_30GeV_1000GeV_1167.dig.root
-#TRT_Pix_30GeV_1000GeV_1168.dig.root
-#TRT_Pix_30GeV_1000GeV_1169.dig.root
-#TRT_Pix_30GeV_1000GeV_1170.dig.root
-#TRT_Pix_30GeV_1000GeV_1171.dig.root
-#TRT_Pix_30GeV_1000GeV_1172.dig.root
-#TRT_Pix_30GeV_1000GeV_1173.dig.root
-#TRT_Pix_30GeV_1000GeV_1174.dig.root
-#TRT_Pix_30GeV_1000GeV_1175.dig.root
-#TRT_Pix_30GeV_1000GeV_1176.dig.root
-#TRT_Pix_30GeV_1000GeV_1177.dig.root
-#TRT_Pix_30GeV_1000GeV_1178.dig.root
-#TRT_Pix_30GeV_1000GeV_1179.dig.root
-#TRT_Pix_30GeV_1000GeV_1180.dig.root
-#TRT_Pix_30GeV_1000GeV_1181.dig.root
-#TRT_Pix_30GeV_1000GeV_1182.dig.root
-#TRT_Pix_30GeV_1000GeV_1183.dig.root
-#TRT_Pix_30GeV_1000GeV_1184.dig.root
-#TRT_Pix_30GeV_1000GeV_1185.dig.root
-#TRT_Pix_30GeV_1000GeV_1186.dig.root
-#TRT_Pix_30GeV_1000GeV_1187.dig.root
-#TRT_Pix_30GeV_1000GeV_1188.dig.root
-#TRT_Pix_30GeV_1000GeV_1189.dig.root
-#TRT_Pix_30GeV_1000GeV_1190.dig.root
-#TRT_Pix_30GeV_1000GeV_1191.dig.root
-#TRT_Pix_30GeV_1000GeV_1192.dig.root
-#TRT_Pix_30GeV_1000GeV_1193.dig.root
-#TRT_Pix_30GeV_1000GeV_1194.dig.root
-#TRT_Pix_30GeV_1000GeV_1195.dig.root
-#TRT_Pix_30GeV_1000GeV_1196.dig.root
-#TRT_Pix_30GeV_1000GeV_1197.dig.root
-#TRT_Pix_30GeV_1000GeV_1198.dig.root
-#TRT_Pix_30GeV_1000GeV_1200.dig.root
-#TRT_Pix_30GeV_1000GeV_1201.dig.root
-#TRT_Pix_30GeV_1000GeV_1202.dig.root
-#TRT_Pix_30GeV_1000GeV_1203.dig.root
-#TRT_Pix_30GeV_1000GeV_1204.dig.root
-#TRT_Pix_30GeV_1000GeV_1205.dig.root
-#TRT_Pix_30GeV_1000GeV_1206.dig.root
-#TRT_Pix_30GeV_1000GeV_1207.dig.root
-#TRT_Pix_30GeV_1000GeV_1208.dig.root
-#TRT_Pix_30GeV_1000GeV_1209.dig.root
-#TRT_Pix_30GeV_1000GeV_1210.dig.root
-#TRT_Pix_30GeV_1000GeV_1211.dig.root
-#TRT_Pix_30GeV_1000GeV_1212.dig.root
-#TRT_Pix_30GeV_1000GeV_1213.dig.root
-#TRT_Pix_30GeV_1000GeV_1214.dig.root
-#TRT_Pix_30GeV_1000GeV_1215.dig.root
-#TRT_Pix_30GeV_1000GeV_1216.dig.root
-#TRT_Pix_30GeV_1000GeV_1217.dig.root
-#TRT_Pix_30GeV_1000GeV_1218.dig.root
-#TRT_Pix_30GeV_1000GeV_1219.dig.root
-#TRT_Pix_30GeV_1000GeV_1220.dig.root
-#TRT_Pix_30GeV_1000GeV_1221.dig.root
-#TRT_Pix_30GeV_1000GeV_1222.dig.root
-#TRT_Pix_30GeV_1000GeV_1223.dig.root
-#TRT_Pix_30GeV_1000GeV_1224.dig.root
-#TRT_Pix_30GeV_1000GeV_1225.dig.root
-#TRT_Pix_30GeV_1000GeV_1226.dig.root
-#TRT_Pix_30GeV_1000GeV_1227.dig.root
-#TRT_Pix_30GeV_1000GeV_1228.dig.root
-#TRT_Pix_30GeV_1000GeV_1229.dig.root
-#TRT_Pix_30GeV_1000GeV_1230.dig.root
-#TRT_Pix_30GeV_1000GeV_1231.dig.root
-#TRT_Pix_30GeV_1000GeV_1232.dig.root
-#TRT_Pix_30GeV_1000GeV_1233.dig.root
-#TRT_Pix_30GeV_1000GeV_1234.dig.root
-#TRT_Pix_30GeV_1000GeV_1235.dig.root
-#TRT_Pix_30GeV_1000GeV_1236.dig.root
-#TRT_Pix_30GeV_1000GeV_1237.dig.root
-#TRT_Pix_30GeV_1000GeV_1238.dig.root
-#TRT_Pix_30GeV_1000GeV_1239.dig.root
-#TRT_Pix_30GeV_1000GeV_1240.dig.root
-#TRT_Pix_30GeV_1000GeV_1241.dig.root
-#TRT_Pix_30GeV_1000GeV_1242.dig.root
-#TRT_Pix_30GeV_1000GeV_1243.dig.root
-#TRT_Pix_30GeV_1000GeV_1244.dig.root
-#TRT_Pix_30GeV_1000GeV_1245.dig.root
-#TRT_Pix_30GeV_1000GeV_1246.dig.root
-#TRT_Pix_30GeV_1000GeV_1247.dig.root
-#TRT_Pix_30GeV_1000GeV_1248.dig.root
-#TRT_Pix_30GeV_1000GeV_1249.dig.root
-#TRT_Pix_30GeV_1000GeV_1250.dig.root
-#TRT_Pix_30GeV_1000GeV_1251.dig.root
-#TRT_Pix_30GeV_1000GeV_1252.dig.root
-#TRT_Pix_30GeV_1000GeV_1253.dig.root
-#TRT_Pix_30GeV_1000GeV_1254.dig.root
-#TRT_Pix_30GeV_1000GeV_1255.dig.root
-#TRT_Pix_30GeV_1000GeV_1256.dig.root
-#TRT_Pix_30GeV_1000GeV_1257.dig.root
-#TRT_Pix_30GeV_1000GeV_1258.dig.root
-#TRT_Pix_30GeV_1000GeV_1259.dig.root
-#TRT_Pix_30GeV_1000GeV_1260.dig.root
-#TRT_Pix_30GeV_1000GeV_1261.dig.root
-#TRT_Pix_30GeV_1000GeV_1262.dig.root
-#TRT_Pix_30GeV_1000GeV_1263.dig.root
-#TRT_Pix_30GeV_1000GeV_1264.dig.root
-#TRT_Pix_30GeV_1000GeV_1265.dig.root
-#TRT_Pix_30GeV_1000GeV_1266.dig.root
-#TRT_Pix_30GeV_1000GeV_1267.dig.root
-#TRT_Pix_30GeV_1000GeV_1268.dig.root
-#TRT_Pix_30GeV_1000GeV_1269.dig.root
-#TRT_Pix_30GeV_1000GeV_1270.dig.root
-#TRT_Pix_30GeV_1000GeV_1271.dig.root
-#TRT_Pix_30GeV_1000GeV_1272.dig.root
-#TRT_Pix_30GeV_1000GeV_1273.dig.root
-#TRT_Pix_30GeV_1000GeV_1274.dig.root
-#TRT_Pix_30GeV_1000GeV_1275.dig.root
-#TRT_Pix_30GeV_1000GeV_1276.dig.root
-#TRT_Pix_30GeV_1000GeV_1277.dig.root
-#TRT_Pix_30GeV_1000GeV_1279.dig.root
-#TRT_Pix_30GeV_1000GeV_1280.dig.root
-#TRT_Pix_30GeV_1000GeV_1281.dig.root
-#TRT_Pix_30GeV_1000GeV_1282.dig.root
-#TRT_Pix_30GeV_1000GeV_1283.dig.root
-#TRT_Pix_30GeV_1000GeV_1284.dig.root
-#TRT_Pix_30GeV_1000GeV_1286.dig.root
-#TRT_Pix_30GeV_1000GeV_1287.dig.root
-#TRT_Pix_30GeV_1000GeV_1288.dig.root
-#TRT_Pix_30GeV_1000GeV_1289.dig.root
-#TRT_Pix_30GeV_1000GeV_1290.dig.root
-#TRT_Pix_30GeV_1000GeV_1291.dig.root
-#TRT_Pix_30GeV_1000GeV_1292.dig.root
-#TRT_Pix_30GeV_1000GeV_1293.dig.root
-#TRT_Pix_30GeV_1000GeV_1294.dig.root
-#TRT_Pix_30GeV_1000GeV_1295.dig.root
-#TRT_Pix_30GeV_1000GeV_1296.dig.root
-#TRT_Pix_30GeV_1000GeV_1297.dig.root
-#TRT_Pix_30GeV_1000GeV_1298.dig.root
-#TRT_Pix_30GeV_1000GeV_1299.dig.root
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CSC_CosmicsRel13_BFOn.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CSC_CosmicsRel13_BFOn.txt
deleted file mode 100644
index f4c801fefe95e3dc7a37245d4b0e44c93e72b460..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CSC_CosmicsRel13_BFOn.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# ------------------------------------------------------------------------------------
-# Simulated Cosmics BF ON:
-# "castor:/castor/cern.ch/user/l/lytken/cosmic_13010/digitization/TRTBarrel/misaligned/"
-# ------------------------------------------------------------------------------------
-
-#------------------------------
-# Old Production (rel13)
-# ATLAS-Comm-02-00-00
-# Filtered TRT Barrel Volume
-#   (38 files)
-#------------------------------
-
-dig.trtbarrel_ma_B100.root
-dig.trtbarrel_ma_B1000.root
-dig.trtbarrel_ma_B1050.root
-dig.trtbarrel_ma_B1100.root
-dig.trtbarrel_ma_B1150.root
-dig.trtbarrel_ma_B1200.root
-dig.trtbarrel_ma_B125.root
-dig.trtbarrel_ma_B1250.root
-dig.trtbarrel_ma_B1300.root
-dig.trtbarrel_ma_B1350.root
-dig.trtbarrel_ma_B1400.root
-dig.trtbarrel_ma_B1450.root
-dig.trtbarrel_ma_B150.root
-dig.trtbarrel_ma_B1500.root
-dig.trtbarrel_ma_B1550.root
-dig.trtbarrel_ma_B1600.root
-dig.trtbarrel_ma_B1650.root
-dig.trtbarrel_ma_B1700.root
-dig.trtbarrel_ma_B175.root
-dig.trtbarrel_ma_B1750.root
-dig.trtbarrel_ma_B1800.root
-dig.trtbarrel_ma_B1850.root
-dig.trtbarrel_ma_B1900.root
-dig.trtbarrel_ma_B200.root
-dig.trtbarrel_ma_B225.root
-dig.trtbarrel_ma_B250.root
-dig.trtbarrel_ma_B275.root
-dig.trtbarrel_ma_B300.root
-dig.trtbarrel_ma_B350.root
-dig.trtbarrel_ma_B400.root
-dig.trtbarrel_ma_B450.root
-dig.trtbarrel_ma_B600.root
-dig.trtbarrel_ma_B650.root
-dig.trtbarrel_ma_B700.root
-dig.trtbarrel_ma_B750.root
-dig.trtbarrel_ma_B800.root
-dig.trtbarrel_ma_B850.root
-dig.trtbarrel_ma_B900.root
-dig.trtbarrel_ma_B950.root
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CalibrationStream.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CalibrationStream.txt
deleted file mode 100644
index acea3ecd8c7c8b1c96f870a47e3a940b8ac4a6aa..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CalibrationStream.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-/castor/cern.ch/grid/atlas/DAQ/2009/00119310/calibration_IDTracks/data_test.00119310.calibration_IDTracks.daq.RAW._lb0000._SFO-2._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119310/calibration_IDTracks/data_test.00119310.calibration_IDTracks.daq.RAW._lb0000._SFO-3._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119310/calibration_IDTracks/data_test.00119310.calibration_IDTracks.daq.RAW._lb0000._SFO-4._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119310/calibration_IDTracks/data_test.00119310.calibration_IDTracks.daq.RAW._lb0000._SFO-5._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119305/calibration_IDTracks/data_test.00119305.calibration_IDTracks.daq.RAW._lb0000._SFO-2._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119305/calibration_IDTracks/data_test.00119305.calibration_IDTracks.daq.RAW._lb0000._SFO-3._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119305/calibration_IDTracks/data_test.00119305.calibration_IDTracks.daq.RAW._lb0000._SFO-4._0001.data
-/castor/cern.ch/grid/atlas/DAQ/2009/00119305/calibration_IDTracks/data_test.00119305.calibration_IDTracks.daq.RAW._lb0000._SFO-5._0001.data
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicStream.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicStream.txt
deleted file mode 100644
index 45bec56ad364fe28a2f883f946bdb2cb6790a13b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicStream.txt
+++ /dev/null
@@ -1,128 +0,0 @@
-# ------------------------------------------------------------------------------------
-# Cosmic stream (Bytestream) (cosmics in the pit)
-# LOCALDIR = "rfio:/castor/cern.ch/user/s/sfyrla/91338_PEB/"
-# LOCALDIR = "rfio:/castor/cern.ch/user/s/sfyrla/91338_noPEB/"
-# "rfio:/castor/cern.ch/grid/atlas/DAQ/2008/90943/physics_IDCosmic/"
-# ------------------------------------------------------------------------------------
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0001.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0002.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0003.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0004.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0005.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0006.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0007.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-3._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-3._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-3._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-4._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-4._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-4._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-5._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-5._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0008.SFO-5._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-1._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-1._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-1._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-2._0001.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-2._0002.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-2._0003.data.out._0001.data
-daq.ATLAS.0091338.physics.IDCosmic.LB0009.SFO-3._0001.data.out._0001.data
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicsRel14_BFOff.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicsRel14_BFOff.txt
deleted file mode 100644
index c5d26c4a17b68ffba96cef87fd12744d31be9bd8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicsRel14_BFOff.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-# ------------------------------------------------------------------------------------
-# Simulated Cosmics B OFF: ATLAS-CommNF-02-00-00 (102 files)
-#  "castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEONF-04-00-00/"
-# ------------------------------------------------------------------------------------
-
-
-#-------------------------------------
-#  New Producction rel14
-#  No magnetic field
-#  ATLAS-GEONF-04-00-00
-#  Filtered TRT Barrel Volume
-#    ( 29 files )
-#------------------------------------
-
-dig.trtbarrel.200000.root
-dig.trtbarrel.200020.root
-dig.trtbarrel.200040.root
-dig.trtbarrel.200060.root
-dig.trtbarrel.200080.root
-dig.trtbarrel.200100.root
-dig.trtbarrel.200200.root
-dig.trtbarrel.200220.root
-dig.trtbarrel.200240.root
-dig.trtbarrel.200260.root
-dig.trtbarrel.200280.root
-dig.trtbarrel.200300.root
-dig.trtbarrel.200320.root
-dig.trtbarrel.200340.root
-dig.trtbarrel.200360.root
-dig.trtbarrel.200380.root
-dig.trtbarrel.200400.root
-dig.trtbarrel.200420.root
-dig.trtbarrel.200440.root
-dig.trtbarrel.200460.root
-dig.trtbarrel.200480.root
-dig.trtbarrel.200500.root
-dig.trtbarrel.200520.root
-dig.trtbarrel.200540.root
-dig.trtbarrel.200560.root
-dig.trtbarrel.200580.root
-dig.trtbarrel.200600.root
-dig.trtbarrel.200620.root
-dig.trtbarrel.200640.root
-dig.trtbarrel.200660.root
-dig.trtbarrel.200680.root
-dig.trtbarrel.200700.root
-dig.trtbarrel.200720.root
-dig.trtbarrel.200740.root
-dig.trtbarrel.200760.root
-dig.trtbarrel.200780.root
-dig.trtbarrel.200800.root
-dig.trtbarrel.200820.root
-dig.trtbarrel.200840.root
-
-
-#-------------------------------------
-#  New Producction rel14
-#  No magnetic field
-#  ATLAS-GEONF-04-00-00
-#  Filtered PIXEL Barrel Volume
-#    ( 36 files )
-#------------------------------------
-
-
-dig.pixelbarrel.500000.root
-dig.pixelbarrel.500010.root
-dig.pixelbarrel.500020.root
-dig.pixelbarrel.500030.root
-dig.pixelbarrel.500040.root
-dig.pixelbarrel.500050.root
-dig.pixelbarrel.500060.root
-dig.pixelbarrel.500070.root
-dig.pixelbarrel.500080.root
-dig.pixelbarrel.500090.root
-dig.pixelbarrel.500100.root
-dig.pixelbarrel.500110.root
-dig.pixelbarrel.500120.root
-dig.pixelbarrel.500130.root
-dig.pixelbarrel.500140.root
-dig.pixelbarrel.500150.root
-dig.pixelbarrel.500160.root
-dig.pixelbarrel.500170.root
-dig.pixelbarrel.500180.root
-dig.pixelbarrel.500190.root
-dig.pixelbarrel.500200.root
-dig.pixelbarrel.500210.root
-dig.pixelbarrel.500220.root
-dig.pixelbarrel.500230.root
-dig.pixelbarrel.500240.root
-dig.pixelbarrel.500250.root
-dig.pixelbarrel.500260.root
-dig.pixelbarrel.500270.root
-dig.pixelbarrel.500280.root
-dig.pixelbarrel.500290.root
-dig.pixelbarrel.500300.root
-dig.pixelbarrel.500310.root
-dig.pixelbarrel.500320.root
-dig.pixelbarrel.500330.root
-dig.pixelbarrel.500340.root
-dig.pixelbarrel.500350.root
-dig.pixelbarrel.500360.root
-dig.pixelbarrel.500370.root
-dig.pixelbarrel.500380.root
-dig.pixelbarrel.500390.root
-dig.pixelbarrel.500400.root
-dig.pixelbarrel.500410.root
-dig.pixelbarrel.500420.root
-dig.pixelbarrel.500430.root
-dig.pixelbarrel.500440.root
-dig.pixelbarrel.500470.root
-dig.pixelbarrel.500490.root
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicsRel14_BFOn.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicsRel14_BFOn.txt
deleted file mode 100644
index dd1b707a4e062f30e27111e47d5aa9240ac7ec3e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_CosmicsRel14_BFOn.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-# ------------------------------------------------------------------------------------
-# Simulated Cosmics BF ON:
-# "castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEO-03-00-00/dig/"
-# ------------------------------------------------------------------------------------
-
-
-
-#-------------------------------------
-#  New Producction rel14
-#  Toroid and solenoid On
-#  ATLAS-GEO-03-00-00
-#  Filtered TRT Barrel Volume
-#  ( 50 files )
-#------------------------------------
-
-dig.GEO-03-TRTBarrel.1.20.root
-dig.GEO-03-TRTBarrel.101.120.root
-dig.GEO-03-TRTBarrel.121.140.root
-dig.GEO-03-TRTBarrel.141.160.root
-dig.GEO-03-TRTBarrel.161.180.root
-dig.GEO-03-TRTBarrel.181.200.root
-dig.GEO-03-TRTBarrel.201.220.root
-dig.GEO-03-TRTBarrel.21.40.root
-dig.GEO-03-TRTBarrel.221.240.root
-dig.GEO-03-TRTBarrel.241.260.root
-dig.GEO-03-TRTBarrel.261.280.root
-dig.GEO-03-TRTBarrel.281.300.root
-dig.GEO-03-TRTBarrel.301.320.root
-dig.GEO-03-TRTBarrel.321.340.root
-dig.GEO-03-TRTBarrel.341.360.root
-dig.GEO-03-TRTBarrel.361.380.root
-dig.GEO-03-TRTBarrel.381.400.root
-dig.GEO-03-TRTBarrel.401.420.root
-dig.GEO-03-TRTBarrel.41.60.root
-dig.GEO-03-TRTBarrel.421.440.root
-dig.GEO-03-TRTBarrel.441.460.root
-dig.GEO-03-TRTBarrel.461.480.root
-dig.GEO-03-TRTBarrel.481.500.root
-dig.GEO-03-TRTBarrel.501.520.root
-dig.GEO-03-TRTBarrel.521.540.root
-dig.GEO-03-TRTBarrel.541.560.root
-dig.GEO-03-TRTBarrel.561.580.root
-dig.GEO-03-TRTBarrel.581.600.root
-dig.GEO-03-TRTBarrel.601.620.root
-dig.GEO-03-TRTBarrel.61.80.root
-dig.GEO-03-TRTBarrel.621.640.root
-dig.GEO-03-TRTBarrel.641.660.root
-dig.GEO-03-TRTBarrel.661.680.root
-dig.GEO-03-TRTBarrel.681.700.root
-dig.GEO-03-TRTBarrel.701.720.root
-dig.GEO-03-TRTBarrel.721.740.root
-dig.GEO-03-TRTBarrel.741.760.root
-dig.GEO-03-TRTBarrel.761.780.root
-dig.GEO-03-TRTBarrel.781.800.root
-dig.GEO-03-TRTBarrel.801.820.root
-dig.GEO-03-TRTBarrel.81.100.root
-dig.GEO-03-TRTBarrel.821.840.root
-dig.GEO-03-TRTBarrel.841.860.root
-dig.GEO-03-TRTBarrel.861.880.root
-dig.GEO-03-TRTBarrel.881.900.root
-dig.GEO-03-TRTBarrel.901.920.root
-dig.GEO-03-TRTBarrel.921.940.root
-dig.GEO-03-TRTBarrel.941.960.root
-dig.GEO-03-TRTBarrel.961.980.root
-dig.GEO-03-TRTBarrel.981.1000.root
-
-#-------------------------------------
-#  New Producction rel14
-#  Toroid and solenoid On
-#  ATLAS-GEO-03-00-00
-#  Filtered PIXEL Barrel Volume
-#    (40 files )
-#------------------------------------
-dig.pixelbarrel_B.400000.root
-dig.pixelbarrel_B.400003.root
-dig.pixelbarrel_B.400006.root
-dig.pixelbarrel_B.400009.root
-dig.pixelbarrel_B.400012.root
-dig.pixelbarrel_B.400015.root
-dig.pixelbarrel_B.400018.root
-dig.pixelbarrel_B.400021.root
-dig.pixelbarrel_B.400024.root
-dig.pixelbarrel_B.400027.root
-dig.pixelbarrel_B.400030.root
-dig.pixelbarrel_B.400033.root
-dig.pixelbarrel_B.400036.root
-dig.pixelbarrel_B.400039.root
-dig.pixelbarrel_B.400042.root
-dig.pixelbarrel_B.400045.root
-dig.pixelbarrel_B.400048.root
-dig.pixelbarrel_B.400050.root
-dig.pixelbarrel_B.400060.root
-dig.pixelbarrel_B.400070.root
-dig.pixelbarrel_B.400080.root
-dig.pixelbarrel_B.400090.root
-dig.pixelbarrel_B.400100.root
-dig.pixelbarrel_B.400110.root
-dig.pixelbarrel_B.400120.root
-dig.pixelbarrel_B.400130.root
-dig.pixelbarrel_B.400140.root
-dig.pixelbarrel_B.400150.root
-dig.pixelbarrel_B.400160.root
-dig.pixelbarrel_B.400170.root
-dig.pixelbarrel_B.400180.root
-dig.pixelbarrel_B.400190.root
-dig.pixelbarrel_B.400200.root
-dig.pixelbarrel_B.400210.root
-dig.pixelbarrel_B.400220.root
-dig.pixelbarrel_B.400230.root
-dig.pixelbarrel_B.400240.root
-dig.pixelbarrel_B.400250.root
-dig.pixelbarrel_B.400260.root
-dig.pixelbarrel_B.400270.root
-dig.pixelbarrel_B.400280.root
-dig.pixelbarrel_B.400290.root
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR09.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR09.txt
deleted file mode 100644
index 850c944c1432bcdc818fac9c304c7ed7a7ea809f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR09.txt
+++ /dev/null
@@ -1,115 +0,0 @@
-InDetRecESD_0001.root
-InDetRecESD_0002.root
-InDetRecESD_0003.root
-InDetRecESD_0004.root
-InDetRecESD_0005.root
-InDetRecESD_0006.root
-InDetRecESD_0007.root
-InDetRecESD_0008.root
-InDetRecESD_0009.root
-InDetRecESD_0010.root
-InDetRecESD_0011.root
-InDetRecESD_0012.root
-InDetRecESD_0013.root
-InDetRecESD_0014.root
-InDetRecESD_0015.root
-InDetRecESD_0016.root
-InDetRecESD_0017.root
-InDetRecESD_0018.root
-InDetRecESD_0019.root
-InDetRecESD_0020.root
-InDetRecESD_0021.root
-InDetRecESD_0022.root
-InDetRecESD_0023.root
-InDetRecESD_0024.root
-InDetRecESD_0025.root
-InDetRecESD_0026.root
-InDetRecESD_0027.root
-InDetRecESD_0028.root
-InDetRecESD_0029.root
-InDetRecESD_0030.root
-InDetRecESD_0031.root
-InDetRecESD_0032.root
-InDetRecESD_0033.root
-InDetRecESD_0034.root
-InDetRecESD_0035.root
-InDetRecESD_0036.root
-InDetRecESD_0037.root
-InDetRecESD_0038.root
-InDetRecESD_0039.root
-InDetRecESD_0040.root
-InDetRecESD_0041.root
-InDetRecESD_0042.root
-InDetRecESD_0043.root
-InDetRecESD_0044.root
-InDetRecESD_0045.root
-InDetRecESD_0046.root
-InDetRecESD_0047.root
-InDetRecESD_0048.root
-InDetRecESD_0049.root
-InDetRecESD_0050.root
-InDetRecESD_0051.root
-InDetRecESD_0052.root
-InDetRecESD_0053.root
-InDetRecESD_0054.root
-InDetRecESD_0055.root
-InDetRecESD_0056.root
-InDetRecESD_0057.root
-InDetRecESD_0058.root
-InDetRecESD_0059.root
-InDetRecESD_0060.root
-InDetRecESD_0061.root
-InDetRecESD_0062.root
-InDetRecESD_0063.root
-InDetRecESD_0064.root
-InDetRecESD_0065.root
-InDetRecESD_0066.root
-InDetRecESD_0067.root
-InDetRecESD_0068.root
-InDetRecESD_0069.root
-InDetRecESD_0070.root
-InDetRecESD_0071.root
-InDetRecESD_0072.root
-InDetRecESD_0073.root
-InDetRecESD_0074.root
-InDetRecESD_0075.root
-InDetRecESD_0076.root
-InDetRecESD_0077.root
-InDetRecESD_0078.root
-InDetRecESD_0079.root
-InDetRecESD_0080.root
-InDetRecESD_0081.root
-InDetRecESD_0082.root
-InDetRecESD_0083.root
-InDetRecESD_0084.root
-InDetRecESD_0085.root
-InDetRecESD_0086.root
-InDetRecESD_0087.root
-InDetRecESD_0088.root
-InDetRecESD_0089.root
-InDetRecESD_0090.root
-InDetRecESD_0091.root
-InDetRecESD_0092.root
-InDetRecESD_0093.root
-InDetRecESD_0094.root
-InDetRecESD_0095.root
-InDetRecESD_0096.root
-InDetRecESD_0097.root
-InDetRecESD_0098.root
-InDetRecESD_0099.root
-InDetRecESD_0100.root
-InDetRecESD_0101.root
-InDetRecESD_0102.root
-InDetRecESD_0103.root
-InDetRecESD_0104.root
-InDetRecESD_0105.root
-InDetRecESD_0106.root
-InDetRecESD_0107.root
-InDetRecESD_0108.root
-InDetRecESD_0109.root
-InDetRecESD_0110.root
-InDetRecESD_0111.root
-InDetRecESD_0112.root
-InDetRecESD_0113.root
-InDetRecESD_0114.root
-InDetRecESD_0115.root
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR1_idcalibstream.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR1_idcalibstream.txt
deleted file mode 100644
index be870fc13cfcc348ad1d049abf74e1200047eb39..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR1_idcalibstream.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-# -------------------------------------------------------------------------------------------------
-#     ID Calibration Stream FDR1 
-#     Sample Properties:
-#
-#     Location:	'tst01.ific.uv.es':/data1/cescobar/data/calibstream/fdr1/"                           
-#               "rfio:/castor/cern.ch/user/h/hawkings/calibstream/fdr1/"
-#--------------------------------------------------------------------------------------------------
-
-
-
-idcalib_5802_fdr1_0001.data
-idcalib_5802_fdr1_0003.data
-idcalib_5802_fdr1_0004.data
-idcalib_5802_fdr1_0005.data
-idcalib_5802_fdr1_0006.data
-idcalib_5802_fdr1_0007.data
-idcalib_5802_fdr1_0008.data
-idcalib_5802_fdr1_0009.data
-idcalib_5802_fdr1_0010.data
-idcalib_5802_fdr1_0011.data
-idcalib_5802_fdr1_0012.data
-idcalib_5802_fdr1_0013.data
-idcalib_5802_fdr1_0014.data
-idcalib_5802_fdr1_0015.data
-idcalib_5802_fdr1_0016.data
-idcalib_5802_fdr1_0017.data
-idcalib_5802_fdr1_0018.data
-idcalib_5802_fdr1_0019.data
-idcalib_5802_fdr1_0020.data
-idcalib_5802_fdr1_0021.data
-idcalib_5802_fdr1_0022.data
-idcalib_5802_fdr1_0023.data
-idcalib_5802_fdr1_0024.data
-idcalib_5802_fdr1_0025.data
-idcalib_5802_fdr1_0026.data
-idcalib_5802_fdr1_0027.data
-idcalib_5802_fdr1_0028.data
-idcalib_5802_fdr1_0029.data
-idcalib_5802_fdr1_0031.data
-idcalib_5802_fdr1_0033.data
-idcalib_5802_fdr1_0034.data
-idcalib_5802_fdr1_0035.data
-idcalib_5802_fdr1_0038.data
-idcalib_5802_fdr1_0039.data
-idcalib_5802_fdr1_0040.data
-idcalib_5802_fdr1_0041.data
-idcalib_5802_fdr1_0042.data
-idcalib_5802_fdr1_0043.data
-idcalib_5802_fdr1_0044.data
-idcalib_5802_fdr1_0045.data
-idcalib_5802_fdr1_0046.data
-idcalib_5802_fdr1_0047.data
-idcalib_5802_fdr1_0048.data
-idcalib_5802_fdr1_0049.data
-idcalib_5802_fdr1_0050.data
-idcalib_5802_fdr1_0051.data
-idcalib_5802_fdr1_0052.data
-idcalib_5802_fdr1_0053.data
-idcalib_5802_fdr1_0054.data
-idcalib_5802_fdr1_0055.data
-idcalib_5802_fdr1_0056.data
-idcalib_5802_fdr1_0057.data
-idcalib_5802_fdr1_0058.data
-idcalib_5802_fdr1_0059.data
-idcalib_5802_fdr1_0060.data
-idcalib_5802_fdr1_0061.data
-idcalib_5802_fdr1_0063.data
-idcalib_5802_fdr1_0064.data
-idcalib_5802_fdr1_0068.data
-idcalib_5802_fdr1_0069.data
-idcalib_5802_fdr1_0070.data
-idcalib_5802_fdr1_0072.data
-idcalib_5802_fdr1_0073.data
-idcalib_5802_fdr1_0074.data
-idcalib_5802_fdr1_0075.data
-idcalib_5802_fdr1_0076.data
-idcalib_5802_fdr1_0077.data
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR2_cosmicstream.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR2_cosmicstream.txt
deleted file mode 100644
index b55c44f8557f0281d5cc3c31245d945fc893fc99..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR2_cosmicstream.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# ------------------------------------------------------------------------------------
-# FDR2 calibration stream (Bytestream) (cosmics in the pit)
-#   "/castor/cern.ch/user/b/bvendapi/cosmics_fdr2/"
-# ------------------------------------------------------------------------------------
-
-
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel100.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel125.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel150.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel175.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel250.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel275.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel300.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel325.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel350.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel375.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel400.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel425.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel450.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel475.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel500.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel525.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel550.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel600.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel625.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel650.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel675.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel700.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel725.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel750.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel775.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel800.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel825.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel850.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel875.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel900.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel925.data
-daq..0000000.Single.Stream.LB0000.Offline._0001_trtbarrel950.data
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR2_idcalibstream.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR2_idcalibstream.txt
deleted file mode 100644
index 0dc1b7b8b750708408c058dd032c27639d9c71f0..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_FDR2_idcalibstream.txt
+++ /dev/null
@@ -1,193 +0,0 @@
-# ------------------------------------------------------------------------------------
-# FDR2 calibration stream (single pions, pT=[10,50] GeV/c and eta=[-2.5,2.5])
-#  "/castor/cern.ch/user/b/bvendapi/FDR2_Pi/BS_files/CalibStream/"
-# ------------------------------------------------------------------------------------
-
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_100_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_150_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_150_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_150_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_150_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_150_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_150_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_200_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_250_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_300_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_350_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_400_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_400_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_400_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_400_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_400_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_450_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_450_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_450_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_450_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_450_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_450_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_500_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_500_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_500_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_500_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_500_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_500_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_50_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_50_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_50_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_50_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_50_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_50_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_550_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_550_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_550_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_550_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_550_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_550_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_600_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_650_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_650_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_650_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_650_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_650_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_700_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_700_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_700_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_700_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_700_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_750_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_750_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_750_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_750_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_750_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_750_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_800_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_800_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_800_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_800_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_800_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_800_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_850_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_900_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_900_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_900_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_900_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_900_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_900_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_950_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_950_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_950_3.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_950_4.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_950_5.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1050_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1100_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1150_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1200_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1250_5_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_1_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_1_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_2_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_2_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_3_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_3_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_4_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_4_2.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_5_1.data
-CSC.007422.singlepart_singlepi_pt10_50_Calib_1300_5_2.data
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_91800.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_91800.txt
deleted file mode 100644
index 6d9f1113ff4e0e1ef6438ba5c189d6721b773847..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_91800.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-# -------------------------------------------------------------------------------------------------
-#     M8plus Cosmic ( BF On )
-#--------------------------------------------------------------------------------------------------
-
-InDetESD_91800_lb1.root
-InDetESD_91800_lb10.root
-InDetESD_91800_lb11.root
-InDetESD_91800_lb12.root 
-InDetESD_91800_lb13.root
-InDetESD_91800_lb14.root
-InDetESD_91800_lb15.root
-InDetESD_91800_lb16.root
-InDetESD_91800_lb17.root
-InDetESD_91800_lb18.root
-InDetESD_91800_lb19.root
-InDetESD_91800_lb2.root
-InDetESD_91800_lb20.root
-InDetESD_91800_lb3.root
-InDetESD_91800_lb4.root 
-InDetESD_91800_lb5.root
-InDetESD_91800_lb6.root 
-InDetESD_91800_lb6.root
-InDetESD_91800_lb7.root
-InDetESD_91800_lb8.root
-InDetESD_91800_lb9.root
-InDetESD_91900_lb1.root
-InDetESD_91900_lb10.root
-InDetESD_91900_lb11.root
-InDetESD_91900_lb12.root
-InDetESD_91900_lb13.root
-InDetESD_91900_lb14.root
-InDetESD_91900_lb15.root
-InDetESD_91900_lb16.root
-InDetESD_91900_lb17.root
-InDetESD_91900_lb18.root
-InDetESD_91900_lb19.root
-InDetESD_91900_lb2.root 
-InDetESD_91900_lb20.root
-InDetESD_91900_lb21.root
-InDetESD_91900_lb22.root
-InDetESD_91900_lb23.root
-InDetESD_91900_lb24.root
-InDetESD_91900_lb25.root
-InDetESD_91900_lb26.root
-InDetESD_91900_lb27.root
-InDetESD_91900_lb28.root
-InDetESD_91900_lb29.root
-InDetESD_91900_lb3.root
-InDetESD_91900_lb30.root
-InDetESD_91900_lb31.root
-InDetESD_91900_lb32.root
-InDetESD_91900_lb33.root
-InDetESD_91900_lb34.root
-InDetESD_91900_lb35.root 
-InDetESD_91900_lb36.root
-InDetESD_91900_lb37.root
-InDetESD_91900_lb38.root
-InDetESD_91900_lb39.root
-InDetESD_91900_lb4.root
-InDetESD_91900_lb40.root
-InDetESD_91900_lb41.root
-InDetESD_91900_lb42.root
-InDetESD_91900_lb43.root
-InDetESD_91900_lb44.root 
-InDetESD_91900_lb45.root
-InDetESD_91900_lb46.root
-InDetESD_91900_lb47.root
-InDetESD_91900_lb48.root
-InDetESD_91900_lb49.root
-InDetESD_91900_lb5.root
-InDetESD_91900_lb50.root
-InDetESD_91900_lb6.root
-InDetESD_91900_lb7.root
-InDetESD_91900_lb8.root
-InDetESD_91900_lb9.root
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_BField.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_BField.txt
deleted file mode 100644
index 574c103fd5de4d20be8d80896bb7e8c8637033a3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_BField.txt
+++ /dev/null
@@ -1,845 +0,0 @@
-# -------------------------------------------------------------------------------------------------
-#     M8plus Cosmic ( BF On )
-#--------------------------------------------------------------------------------------------------
-
-#InDetESD_90246.root
-#InDetESD_90247.root
-#InDetESD_90248.root
-#InDetESD_90251.root
-#InDetESD_90258.root
-#InDetESD_90260_0.root
-#InDetESD_90260_1.root
-#InDetESD_90262_0.root
-#InDetESD_90262_1.root 
-#InDetESD_90262_2.root
-#InDetESD_90262_3.root
-#InDetESD_90264_1.root
-#InDetESD_90264_2.root
-#InDetESD_90264_3.root
-#InDetESD_90269.root
-#InDetESD_90270_0.root
-#InDetESD_90270_1.root 
-#InDetESD_90270_2.root 
-#InDetESD_90270_3.root 
-#InDetESD_90270_4.root
-#InDetESD_90272_0.root
-#InDetESD_90272_1.root
-#InDetESD_90272_10.root
-#InDetESD_90272_11.root
-#InDetESD_90272_13.root
-#InDetESD_90272_14.root
-#InDetESD_90272_15.root
-#InDetESD_90272_16.root
-#InDetESD_90272_2.root 
-#InDetESD_90272_3.root 
-#InDetESD_90272_4.root
-#InDetESD_90272_5.root
-#InDetESD_90272_6.root
-#InDetESD_90272_7.root
-#InDetESD_90272_8.root
-#InDetESD_90272_9.root
-#InDetESD_90275_0.root 
-#InDetESD_90275_1.root
-#InDetESD_90275_10.root
-#InDetESD_90275_11.root 
-#InDetESD_90275_13.root 
-#InDetESD_90275_2.root
-#InDetESD_90275_3.root
-#InDetESD_90275_4.root
-#InDetESD_90275_5.root 
-#InDetESD_90275_6.root
-#InDetESD_90275_7.root 
-#InDetESD_90275_8.root
-#InDetESD_90275_9.root
-#InDetESD_90345_0.root
-#InDetESD_90345_1.root
-#InDetESD_90345_2.root
-#InDetESD_90413_0.root
-#InDetESD_90413_1.root
-#InDetESD_90413_2.root 
-#InDetESD_90413_3.root 
-#InDetESD_90415.root 
-#InDetESD_90524.root 
-#InDetESD_90525_0.root
-#InDetESD_90525_1.root
-#InDetESD_90525_2.root 
-#InDetESD_90525_3.root
-#InDetESD_90631.root
-#InDetESD_90633_0.root
-#InDetESD_90633_1.root
-#InDetESD_90635.root 
-#InDetESD_90637.root 
-#InDetESD_90639.root 
-#InDetESD_90640.root 
-#InDetESD_90641.root
-#InDetESD_90642.root
-#InDetESD_90645.root
-#InDetESD_90646.root
-#InDetESD_90662.root
-#InDetESD_90668.root 
-#InDetESD_90692.root 
-#InDetESD_90702.root 
-#InDetESD_90711.root 
-#InDetESD_90719.root
-#InDetESD_90721.root
-#InDetESD_90724.root
-#InDetESD_90725.root
-#InDetESD_90731_0.root
-#InDetESD_90731_1.root 
-#InDetESD_90731_2.root 
-#InDetESD_90732_0.root 
-#InDetESD_90732_1.root
-#InDetESD_90733_0.root 
-#InDetESD_90733_1.root
-#InDetESD_90733_10.root
-#InDetESD_90733_11.root
-#InDetESD_90733_12.root
-#InDetESD_90733_13.root
-#InDetESD_90733_14.root
-#InDetESD_90733_15.root 
-#InDetESD_90733_16.root 
-#InDetESD_90733_17.root 
-#InDetESD_90733_18.root
-#InDetESD_90733_19.root 
-#InDetESD_90733_20.root
-#InDetESD_90733_21.root
-#InDetESD_90733_22.root
-#InDetESD_90733_2.root
-#InDetESD_90733_3.root 
-#InDetESD_90733_4.root 
-#InDetESD_90733_5.root 
-#InDetESD_90733_6.root
-#InDetESD_90733_7.root
-#InDetESD_90733_8.root
-#InDetESD_90733_9.root
-#InDetESD_90755.root 
-#InDetESD_90757.root 
-#InDetESD_90782.root
-#InDetESD_90785.root
-#InDetESD_90792.root
-#InDetESD_91330.root
-#InDetESD_91335.root
-#InDetESD_91336.root
-#InDetESD_91338_0.root
-#InDetESD_91338_1.root
-#InDetESD_91338_2.root
-#InDetESD_91338_3.root
-#InDetESD_91338_4.root
-#InDetESD_91338_5.root
-#InDetESD_91338_6.root
-#InDetESD_91338_7.root
-#InDetESD_91354.root
-#InDetESD_91359_0.root 
-#InDetESD_91359_1.root
-#InDetESD_91361_0.root
-#InDetESD_91361_11.root
-#InDetESD_91361_12.root
-#InDetESD_91361_3.root 
-#InDetESD_91361_5.root
-#InDetESD_91361_6.root
-#InDetESD_91361_7.root
-#InDetESD_91361_8.root 
-#InDetESD_91387_0.root
-#InDetESD_91387_1.root
-#InDetESD_91387_10.root
-#InDetESD_91387_11.root
-#InDetESD_91387_12.root
-#InDetESD_91387_13.root
-#InDetESD_91387_14.root
-#InDetESD_91387_15.root
-#InDetESD_91387_16.root
-#InDetESD_91387_17.root
-#InDetESD_91387_18.root
-#InDetESD_91387_19.root
-#InDetESD_91387_2.root
-#InDetESD_91387_20.root 
-#InDetESD_91387_21.root
-#InDetESD_91387_3.root
-#InDetESD_91387_4.root
-#InDetESD_91387_5.root
-#InDetESD_91387_6.root
-#InDetESD_91387_7.root
-#InDetESD_91387_8.root
-#InDetESD_91387_9.root
-#InDetESD_91389_0.root
-#InDetESD_91389_2.root 
-#InDetESD_91389_3.root
-#InDetESD_91389_4.root
-#InDetESD_91389_5.root
-#InDetESD_91389_6.root
-#InDetESD_91390_0.root
-#InDetESD_91390_1.root
-#InDetESD_91391_lb1.root
-#InDetESD_91391_lb10.root
-#InDetESD_91391_lb11.root 
-#InDetESD_91391_lb12.root
-#InDetESD_91391_lb13.root
-#InDetESD_91391_lb14.root
-#InDetESD_91391_lb15.root
-#InDetESD_91391_lb16.root
-#InDetESD_91391_lb17.root
-#InDetESD_91391_lb18.root
-#InDetESD_91391_lb19.root
-#InDetESD_91391_lb2.root
-#InDetESD_91391_lb20.root 
-#InDetESD_91391_lb21.root
-#InDetESD_91391_lb22.root
-#InDetESD_91391_lb23.root
-#InDetESD_91391_lb24.root
-#InDetESD_91391_lb25.root
-#InDetESD_91391_lb26.root
-#InDetESD_91391_lb27.root
-#InDetESD_91391_lb28.root
-#InDetESD_91391_lb29.root
-#InDetESD_91391_lb3.root 
-#InDetESD_91391_lb30.root
-#InDetESD_91391_lb31.root
-#InDetESD_91391_lb32.root
-#InDetESD_91391_lb33.root
-#InDetESD_91391_lb34.root
-#InDetESD_91391_lb4.root
-#InDetESD_91391_lb5.root
-#InDetESD_91391_lb6.root
-#InDetESD_91391_lb7.root
-#InDetESD_91391_lb8.root 
-#InDetESD_91391_lb9.root
-#InDetESD_91398_lb1.root
-#InDetESD_91398_lb2.root
-#InDetESD_91398_lb3.root
-#InDetESD_91398_lb4.root 
-#InDetESD_91398_lb5.root
-#InDetESD_91398_lb6.root
-#InDetESD_91398_lb7.root
-#InDetESD_91399_lb1.root 
-#InDetESD_91400_lb1.root
-#InDetESD_91400_lb10.root
-#InDetESD_91400_lb11.root
-#InDetESD_91400_lb12.root
-#InDetESD_91400_lb2.root
-#InDetESD_91400_lb3.root 
-#InDetESD_91400_lb4.root
-#InDetESD_91400_lb5.root
-#InDetESD_91400_lb6.root
-#InDetESD_91400_lb7.root 
-#InDetESD_91400_lb8.root
-#InDetESD_91400_lb9.root
-#InDetESD_91464_lb1.root
-#InDetESD_91464_lb10.root
-#InDetESD_91464_lb11.root
-#InDetESD_91464_lb13.root
-#InDetESD_91464_lb2.root
-#InDetESD_91464_lb3.root
-#InDetESD_91464_lb4.root 
-#InDetESD_91464_lb5.root
-#InDetESD_91464_lb6.root
-#InDetESD_91464_lb7.root
-#InDetESD_91464_lb8.root
-#InDetESD_91464_lb9.root
-#InDetESD_91561_lb1.root
-#InDetESD_91561_lb2.root 
-#InDetESD_91561_lb3.root
-#InDetESD_91561_lb4.root 
-#InDetESD_91561_lb5.root
-#InDetESD_91561_lb6.root
-#InDetESD_91561_lb7.root
-#InDetESD_91561_lb8.root
-#InDetESD_91613_lb1.root
-#InDetESD_91613_lb2.root
-#InDetESD_91627_lb1.root
-#InDetESD_91627_lb3.root 
-#InDetESD_91636_lb1.root 
-#InDetESD_91636_lb10.root
-#InDetESD_91636_lb11.root
-#InDetESD_91636_lb12.root
-#InDetESD_91636_lb13.root
-#InDetESD_91636_lb14.root
-#InDetESD_91636_lb15.root
-#InDetESD_91636_lb16.root
-#InDetESD_91636_lb17.root
-#InDetESD_91636_lb18.root
-#InDetESD_91636_lb19.root 
-#InDetESD_91636_lb2.root
-#InDetESD_91636_lb3.root
-#InDetESD_91636_lb4.root
-#InDetESD_91636_lb5.root
-#InDetESD_91636_lb6.root
-#InDetESD_91636_lb7.root
-#InDetESD_91636_lb8.root
-#InDetESD_91636_lb9.root
-#InDetESD_91639_lb1.root 
-#InDetESD_91639_lb10.root 
-#InDetESD_91639_lb11.root
-#InDetESD_91639_lb12.root
-#InDetESD_91639_lb13.root
-#InDetESD_91639_lb14.root
-#InDetESD_91639_lb15.root
-#InDetESD_91639_lb16.root
-#InDetESD_91639_lb17.root
-#InDetESD_91639_lb18.root
-#InDetESD_91639_lb19.root
-#InDetESD_91639_lb2.root 
-#InDetESD_91639_lb20.root
-#InDetESD_91639_lb21.root
-#InDetESD_91639_lb22.root
-#InDetESD_91639_lb23.root
-#InDetESD_91639_lb24.root
-#InDetESD_91639_lb25.root
-#InDetESD_91639_lb26.root
-#InDetESD_91639_lb27.root
-#InDetESD_91639_lb28.root
-#InDetESD_91639_lb29.root
-#InDetESD_91639_lb3.root
-#InDetESD_91639_lb30.root
-#InDetESD_91639_lb31.root
-#InDetESD_91639_lb32.root
-#InDetESD_91639_lb33.root
-#InDetESD_91639_lb34.root
-#InDetESD_91639_lb35.root
-#InDetESD_91639_lb36.root
-#InDetESD_91639_lb37.root
-#InDetESD_91639_lb38.root
-#InDetESD_91639_lb39.root
-#InDetESD_91639_lb4.root
-#InDetESD_91639_lb40.root
-#InDetESD_91639_lb41.root
-#InDetESD_91639_lb43.root
-#InDetESD_91639_lb44.root
-#InDetESD_91639_lb45.root
-#InDetESD_91639_lb46.root
-#InDetESD_91639_lb47.root
-#InDetESD_91639_lb48.root
-#InDetESD_91639_lb49.root
-#InDetESD_91639_lb5.root
-#InDetESD_91639_lb50.root
-#InDetESD_91639_lb51.root
-#InDetESD_91639_lb52.root
-#InDetESD_91639_lb53.root
-#InDetESD_91639_lb6.root
-#InDetESD_91639_lb7.root
-#InDetESD_91639_lb8.root 
-#InDetESD_91639_lb9.root
-#InDetESD_91790_lb1.root
-#InDetESD_91790_lb2.root
-#InDetESD_91799_lb1.root
-#InDetESD_91799_lb2.root
-#InDetESD_91800_lb1.root
-#InDetESD_91800_lb10.root
-#InDetESD_91800_lb11.root
-#InDetESD_91800_lb12.root 
-#InDetESD_91800_lb13.root
-#InDetESD_91800_lb14.root
-#InDetESD_91800_lb15.root
-#InDetESD_91800_lb16.root
-#InDetESD_91800_lb17.root
-#InDetESD_91800_lb18.root
-#InDetESD_91800_lb19.root
-#InDetESD_91800_lb2.root
-#InDetESD_91800_lb20.root
-#InDetESD_91800_lb3.root
-#InDetESD_91800_lb4.root 
-#InDetESD_91800_lb5.root
-#InDetESD_91800_lb6.root 
-#InDetESD_91800_lb6.root
-#InDetESD_91800_lb7.root
-#InDetESD_91800_lb8.root
-#InDetESD_91800_lb9.root
-#InDetESD_91801_lb1.root
-#InDetESD_91801_lb10.root
-#InDetESD_91801_lb11.root 
-#InDetESD_91801_lb12.root
-#InDetESD_91801_lb13.root
-#InDetESD_91801_lb2.root
-#InDetESD_91801_lb3.root
-#InDetESD_91801_lb4.root
-#InDetESD_91801_lb5.root
-#InDetESD_91801_lb6.root
-#InDetESD_91801_lb7.root
-#InDetESD_91801_lb8.root
-#InDetESD_91801_lb9.root 
-#InDetESD_91802_lb1.root 
-#InDetESD_91802_lb2.root
-#InDetESD_91802_lb3.root
-#InDetESD_91803_lb1.root
-#InDetESD_91803_lb2.root
-#InDetESD_91803_lb3.root
-#InDetESD_91803_lb4.root
-#InDetESD_91803_lb5.root
-#InDetESD_91803_lb6.root
-#InDetESD_91803_lb7.root 
-#InDetESD_91803_lb8.root 
-#InDetESD_91808_lb1.root
-#InDetESD_91808_lb2.root
-#InDetESD_91808_lb3.root
-#InDetESD_91808_lb4.root
-#InDetESD_91808_lb5.root
-#InDetESD_91808_lb6.root
-#InDetESD_91808_lb7.root
-#InDetESD_91808_lb8.root
-#InDetESD_91808_lb9.root
-#InDetESD_91828_lb1.root 
-#InDetESD_91828_lb3.root
-#InDetESD_91828_lb4.root
-#InDetESD_91828_lb5.root 
-#InDetESD_91860_lb1.root
-#InDetESD_91860_lb10.root
-#InDetESD_91860_lb11.root
-#InDetESD_91860_lb12.root
-#InDetESD_91860_lb13.root
-#InDetESD_91860_lb14.root
-#InDetESD_91860_lb15.root
-#InDetESD_91860_lb2.root
-#InDetESD_91860_lb3.root
-#InDetESD_91860_lb4.root 
-#InDetESD_91860_lb5.root
-#InDetESD_91860_lb6.root
-#InDetESD_91860_lb7.root
-#InDetESD_91860_lb8.root
-#InDetESD_91860_lb9.root
-#InDetESD_91861_lb1.root
-#InDetESD_91861_lb10.root
-#InDetESD_91861_lb2.root
-#InDetESD_91861_lb3.root
-#InDetESD_91861_lb4.root 
-#InDetESD_91861_lb5.root
-#InDetESD_91861_lb6.root
-#InDetESD_91861_lb7.root
-#InDetESD_91861_lb8.root
-#InDetESD_91861_lb9.root
-#InDetESD_91862_lb1.root
-#InDetESD_91862_lb10.root
-#InDetESD_91862_lb11.root
-#InDetESD_91862_lb12.root
-#InDetESD_91862_lb13.root 
-#InDetESD_91862_lb14.root
-#InDetESD_91862_lb15.root
-#InDetESD_91862_lb16.root
-#InDetESD_91862_lb17.root
-#InDetESD_91862_lb18.root
-#InDetESD_91862_lb19.root
-#InDetESD_91862_lb2.root 
-#InDetESD_91862_lb20.root
-#InDetESD_91862_lb21.root
-#InDetESD_91862_lb22.root 
-#InDetESD_91862_lb23.root
-#InDetESD_91862_lb24.root
-#InDetESD_91862_lb25.root
-#InDetESD_91862_lb26.root
-#InDetESD_91862_lb27.root
-#InDetESD_91862_lb28.root
-#InDetESD_91862_lb29.root
-#InDetESD_91862_lb3.root
-#InDetESD_91862_lb30.root
-#InDetESD_91862_lb4.root
-#InDetESD_91862_lb5.root
-#InDetESD_91862_lb6.root
-#InDetESD_91862_lb7.root
-#InDetESD_91862_lb8.root
-#InDetESD_91862_lb9.root
-#InDetESD_91884_lb1.root 
-#InDetESD_91885_lb1.root 
-#InDetESD_91885_lb10.root
-#InDetESD_91885_lb11.root 
-#InDetESD_91885_lb12.root
-#InDetESD_91885_lb13.root
-#InDetESD_91885_lb14.root
-#InDetESD_91885_lb15.root
-#InDetESD_91885_lb16.root
-#InDetESD_91885_lb17.root
-#InDetESD_91885_lb18.root
-#InDetESD_91885_lb19.root
-#InDetESD_91885_lb2.root
-#InDetESD_91885_lb20.root 
-#InDetESD_91885_lb21.root
-#InDetESD_91885_lb22.root
-#InDetESD_91885_lb23.root
-#InDetESD_91885_lb24.root
-#InDetESD_91885_lb25.root
-#InDetESD_91885_lb26.root
-#InDetESD_91885_lb27.root
-#InDetESD_91885_lb28.root
-#InDetESD_91885_lb29.root
-#InDetESD_91885_lb30.root
-#InDetESD_91885_lb31.root
-#InDetESD_91885_lb32.root
-#InDetESD_91885_lb33.root
-#InDetESD_91885_lb4.root
-#InDetESD_91885_lb5.root
-#InDetESD_91885_lb6.root 
-#InDetESD_91885_lb7.root 
-#InDetESD_91885_lb8.root
-#InDetESD_91885_lb9.root 
-#InDetESD_91888_lb10.root
-#InDetESD_91888_lb11.root
-#InDetESD_91888_lb12.root
-#InDetESD_91888_lb13.root
-#InDetESD_91888_lb14.root
-#InDetESD_91888_lb15.root
-#InDetESD_91888_lb16.root
-#InDetESD_91888_lb17.root
-#InDetESD_91888_lb18.root 
-#InDetESD_91888_lb19.root
-#InDetESD_91888_lb2.root
-#InDetESD_91888_lb20.root
-#InDetESD_91888_lb21.root
-#InDetESD_91888_lb22.root
-#InDetESD_91888_lb23.root
-#InDetESD_91888_lb24.root
-#InDetESD_91888_lb25.root
-#InDetESD_91888_lb26.root
-#InDetESD_91888_lb3.root 
-#InDetESD_91888_lb4.root
-#InDetESD_91888_lb5.root
-#InDetESD_91888_lb6.root
-#InDetESD_91888_lb7.root
-#InDetESD_91888_lb8.root
-#InDetESD_91888_lb9.root
-#InDetESD_91890_lb1.root
-#InDetESD_91890_lb10.root
-#InDetESD_91890_lb11.root
-#InDetESD_91890_lb12.root
-#InDetESD_91890_lb13.root
-#InDetESD_91890_lb14.root
-#InDetESD_91890_lb15.root
-#InDetESD_91890_lb16.root
-#InDetESD_91890_lb17.root
-#InDetESD_91890_lb18.root
-#InDetESD_91890_lb19.root
-#InDetESD_91890_lb2.root
-#InDetESD_91890_lb20.root
-#InDetESD_91890_lb21.root
-#InDetESD_91890_lb22.root
-#InDetESD_91890_lb23.root
-#InDetESD_91890_lb24.root
-#InDetESD_91890_lb25.root
-#InDetESD_91890_lb26.root
-#InDetESD_91890_lb27.root
-#InDetESD_91890_lb28.root
-#InDetESD_91890_lb29.root
-#InDetESD_91890_lb3.root 
-#InDetESD_91890_lb30.root
-#InDetESD_91890_lb31.root
-#InDetESD_91890_lb32.root
-#InDetESD_91890_lb33.root
-#InDetESD_91890_lb34.root
-#InDetESD_91890_lb35.root
-#InDetESD_91890_lb4.root
-#InDetESD_91890_lb5.root
-#InDetESD_91890_lb6.root
-#InDetESD_91890_lb7.root 
-#InDetESD_91890_lb8.root
-#InDetESD_91890_lb9.root
-#InDetESD_91891_lb1.root
-#InDetESD_91891_lb10.root
-#InDetESD_91891_lb11.root
-#InDetESD_91891_lb12.root
-#InDetESD_91891_lb13.root
-#InDetESD_91891_lb14.root
-#InDetESD_91891_lb15.root
-#InDetESD_91891_lb16.root
-#InDetESD_91891_lb17.root
-#InDetESD_91891_lb18.root
-#InDetESD_91891_lb19.root
-#InDetESD_91891_lb2.root
-#InDetESD_91891_lb20.root
-#InDetESD_91891_lb21.root
-#InDetESD_91891_lb22.root
-#InDetESD_91891_lb23.root
-#InDetESD_91891_lb24.root
-#InDetESD_91891_lb3.root 
-#InDetESD_91891_lb4.root
-#InDetESD_91891_lb5.root
-#InDetESD_91891_lb6.root
-#InDetESD_91891_lb7.root
-#InDetESD_91891_lb8.root
-#InDetESD_91891_lb9.root
-#InDetESD_91893_lb1.root
-#InDetESD_91897_lb2.root
-#InDetESD_91900_lb1.root
-#InDetESD_91900_lb10.root
-#InDetESD_91900_lb11.root
-#InDetESD_91900_lb12.root
-#InDetESD_91900_lb13.root
-#InDetESD_91900_lb14.root
-#InDetESD_91900_lb15.root
-#InDetESD_91900_lb16.root
-#InDetESD_91900_lb17.root
-#InDetESD_91900_lb18.root
-#InDetESD_91900_lb19.root
-#InDetESD_91900_lb2.root 
-#InDetESD_91900_lb20.root
-#InDetESD_91900_lb21.root
-#InDetESD_91900_lb22.root
-#InDetESD_91900_lb23.root
-#InDetESD_91900_lb24.root
-#InDetESD_91900_lb25.root
-#InDetESD_91900_lb26.root
-#InDetESD_91900_lb27.root
-#InDetESD_91900_lb28.root
-#InDetESD_91900_lb29.root
-#InDetESD_91900_lb3.root
-#InDetESD_91900_lb30.root
-#InDetESD_91900_lb31.root
-#InDetESD_91900_lb32.root
-#InDetESD_91900_lb33.root
-#InDetESD_91900_lb34.root
-#InDetESD_91900_lb35.root 
-#InDetESD_91900_lb36.root
-#InDetESD_91900_lb37.root
-#InDetESD_91900_lb38.root
-#InDetESD_91900_lb39.root
-#InDetESD_91900_lb4.root
-#InDetESD_91900_lb40.root
-#InDetESD_91900_lb41.root
-#InDetESD_91900_lb42.root
-#InDetESD_91900_lb43.root
-#InDetESD_91900_lb44.root 
-#InDetESD_91900_lb45.root
-#InDetESD_91900_lb46.root
-#InDetESD_91900_lb47.root
-#InDetESD_91900_lb48.root
-#InDetESD_91900_lb49.root
-#InDetESD_91900_lb5.root
-#InDetESD_91900_lb50.root
-#InDetESD_91900_lb6.root
-#InDetESD_91900_lb7.root
-#InDetESD_91900_lb8.root
-#InDetESD_91900_lb9.root
-#InDetESD_92065_lb1.root
-#InDetESD_92065_lb2.root 
-#InDetESD_92065_lb3.root
-#InDetESD_92069_lb1.root
-#InDetESD_92069_lb2.root
-#InDetESD_92069_lb3.root
-#InDetESD_92069_lb4.root
-#InDetESD_92072_lb1.root
-#InDetESD_92072_lb2.root
-#InDetESD_92072_lb3.root
-#InDetESD_92074_lb1.root
-#InDetESD_92074_lb2.root 
-#InDetESD_92074_lb3.root
-#InDetESD_92077_lb1.root
-#InDetESD_92077_lb2.root
-#InDetESD_92077_lb3.root
-#InDetESD_92078_lb2.root
-#InDetESD_92078_lb3.root
-#InDetESD_92078_lb4.root
-#InDetESD_92078_lb5.root
-#InDetESD_92079_lb1.root
-#InDetESD_92080_lb1.root 
-#InDetESD_92081_lb1.root
-#InDetESD_92081_lb2.root 
-#InDetESD_92081_lb3.root
-#InDetESD_92082_lb1.root
-#InDetESD_92082_lb10.root
-#InDetESD_92082_lb11.root
-#InDetESD_92082_lb12.root
-#InDetESD_92082_lb13.root
-#InDetESD_92082_lb14.root
-#InDetESD_92082_lb15.root
-#InDetESD_92082_lb16.root
-#InDetESD_92082_lb17.root 
-#InDetESD_92082_lb18.root
-#InDetESD_92082_lb19.root
-#InDetESD_92082_lb2.root
-#InDetESD_92082_lb3.root
-#InDetESD_92082_lb4.root
-#InDetESD_92082_lb5.root
-#InDetESD_92082_lb6.root
-#InDetESD_92082_lb7.root
-#InDetESD_92082_lb8.root
-#InDetESD_92082_lb9.root 
-#InDetESD_92092_lb2.root
-#InDetESD_92092_lb3.root
-#InDetESD_92095_lb1.root
-#InDetESD_92095_lb2.root
-#InDetESD_92095_lb3.root
-#InDetESD_92095_lb4.root
-#InDetESD_92098_lb1.root 
-#InDetESD_92098_lb2.root
-#InDetESD_92098_lb3.root
-#InDetESD_92098_lb4.root
-#InDetESD_92099_lb1.root
-#InDetESD_92099_lb2.root
-#InDetESD_92099_lb3.root
-#InDetESD_92100_lb1.root
-#InDetESD_92100_lb2.root
-#InDetESD_92100_lb3.root
-#InDetESD_92100_lb4.root 
-#InDetESD_92107_lb1.root
-#InDetESD_92107_lb2.root
-#InDetESD_92107_lb3.root
-#InDetESD_92107_lb4.root
-#InDetESD_92107_lb5.root
-#InDetESD_92107_lb6.root
-#InDetESD_92107_lb7.root
-#InDetESD_92112_lb1.root
-#InDetESD_92112_lb10.root
-#InDetESD_92112_lb11.root 
-#InDetESD_92112_lb12.root 
-#InDetESD_92112_lb13.root
-#InDetESD_92112_lb14.root
-#InDetESD_92112_lb15.root
-#InDetESD_92112_lb16.root
-#InDetESD_92112_lb17.root
-#InDetESD_92112_lb18.root
-#InDetESD_92112_lb19.root
-#InDetESD_92112_lb2.root
-#InDetESD_92112_lb20.root 
-#InDetESD_92112_lb21.root 
-#InDetESD_92112_lb22.root
-#InDetESD_92112_lb23.root
-#InDetESD_92112_lb24.root
-#InDetESD_92112_lb25.root
-#InDetESD_92112_lb26.root
-#InDetESD_92112_lb27.root
-#InDetESD_92112_lb28.root
-#InDetESD_92112_lb29.root
-#InDetESD_92112_lb3.root 
-#InDetESD_92112_lb30.root 
-#InDetESD_92112_lb31.root
-#InDetESD_92112_lb4.root
-#InDetESD_92112_lb5.root
-#InDetESD_92112_lb6.root
-#InDetESD_92112_lb7.root
-#InDetESD_92112_lb8.root
-#InDetESD_92112_lb9.root
-#InDetESD_92134_lb1.root
-#InDetESD_92134_lb2.root 
-#InDetESD_92134_lb3.root
-#InDetESD_92134_lb4.root
-#InDetESD_92157_lb1.root
-#InDetESD_92157_lb2.root
-#InDetESD_92157_lb3.root
-#InDetESD_92157_lb4.root
-#InDetESD_92157_lb5.root 
-#InDetESD_92157_lb6.root
-#InDetESD_92157_lb7.root
-#InDetESD_92157_lb8.root
-#InDetESD_92157_lb9.root 
-#InDetESD_92159_lb2.root
-#InDetESD_92160_lb1.root
-#InDetESD_92160_lb10.root
-#InDetESD_92160_lb11.root
-#InDetESD_92160_lb12.root
-#InDetESD_92160_lb13.root
-#InDetESD_92160_lb14.root
-#InDetESD_92160_lb15.root
-#InDetESD_92160_lb16.root
-#InDetESD_92160_lb17.root
-#InDetESD_92160_lb18.root
-#InDetESD_92160_lb19.root
-#InDetESD_92160_lb2.root
-#InDetESD_92160_lb20.root
-#InDetESD_92160_lb21.root
-#InDetESD_92160_lb22.root
-#InDetESD_92160_lb23.root
-#InDetESD_92160_lb24.root
-#InDetESD_92160_lb25.root
-#InDetESD_92160_lb26.root
-#InDetESD_92160_lb27.root
-#InDetESD_92160_lb28.root
-#InDetESD_92160_lb29.root
-#InDetESD_92160_lb3.root
-#InDetESD_92160_lb30.root
-#InDetESD_92160_lb31.root
-#InDetESD_92160_lb32.root
-#InDetESD_92160_lb33.root
-#InDetESD_92160_lb34.root
-#InDetESD_92160_lb35.root
-#InDetESD_92160_lb36.root
-#InDetESD_92160_lb37.root
-#InDetESD_92160_lb38.root
-#InDetESD_92160_lb39.root
-#InDetESD_92160_lb4.root
-#InDetESD_92160_lb40.root
-#InDetESD_92160_lb41.root
-#InDetESD_92160_lb42.root
-#InDetESD_92160_lb43.root
-#InDetESD_92160_lb44.root
-#InDetESD_92160_lb45.root
-#InDetESD_92160_lb46.root
-#InDetESD_92160_lb47.root
-#InDetESD_92160_lb48.root
-#InDetESD_92160_lb49.root 
-#InDetESD_92160_lb5.root
-#InDetESD_92160_lb50.root
-#InDetESD_92160_lb51.root
-#InDetESD_92160_lb52.root
-#InDetESD_92160_lb53.root
-#InDetESD_92160_lb54.root
-#InDetESD_92160_lb55.root
-#InDetESD_92160_lb56.root
-#InDetESD_92160_lb57.root
-#InDetESD_92160_lb58.root 
-#InDetESD_92160_lb59.root
-#InDetESD_92160_lb6.root
-#InDetESD_92160_lb60.root
-#InDetESD_92160_lb61.root
-#InDetESD_92160_lb62.root
-#InDetESD_92160_lb63.root
-#InDetESD_92160_lb64.root
-#InDetESD_92160_lb65.root
-#InDetESD_92160_lb66.root
-#InDetESD_92160_lb67.root 
-#InDetESD_92160_lb68.root
-#InDetESD_92160_lb69.root
-#InDetESD_92160_lb7.root
-#InDetESD_92160_lb70.root
-#InDetESD_92160_lb8.root 
-#InDetESD_92160_lb9.root
-#InDetESD_92223_lb1.root
-#InDetESD_92223_lb2.root
-#InDetESD_92226_lb1.root
-#InDetESD_92226_lb10.root 
-#InDetESD_92226_lb11.root
-#InDetESD_92226_lb12.root
-#InDetESD_92226_lb13.root
-#InDetESD_92226_lb14.root
-#InDetESD_92226_lb15.root
-#InDetESD_92226_lb16.root
-#InDetESD_92226_lb17.root
-#InDetESD_92226_lb18.root
-#InDetESD_92226_lb19.root
-#InDetESD_92226_lb2.root 
-#InDetESD_92226_lb20.root
-#InDetESD_92226_lb21.root
-#InDetESD_92226_lb22.root
-#InDetESD_92226_lb23.root
-#InDetESD_92226_lb24.root
-#InDetESD_92226_lb25.root
-#InDetESD_92226_lb26.root
-#InDetESD_92226_lb27.root
-#InDetESD_92226_lb28.root
-#InDetESD_92226_lb29.root 
-#InDetESD_92226_lb3.root
-#InDetESD_92226_lb30.root
-#InDetESD_92226_lb31.root
-#InDetESD_92226_lb32.root
-#InDetESD_92226_lb33.root
-#InDetESD_92226_lb34.root
-#InDetESD_92226_lb35.root
-#InDetESD_92226_lb36.root
-#InDetESD_92226_lb37.root
-#InDetESD_92226_lb38.root
-#InDetESD_92226_lb39.root
-#InDetESD_92226_lb4.root
-#InDetESD_92226_lb40.root
-#InDetESD_92226_lb41.root
-#InDetESD_92226_lb42.root
-#InDetESD_92226_lb43.root
-#InDetESD_92226_lb44.root
-#InDetESD_92226_lb45.root
-#InDetESD_92226_lb46.root
-#InDetESD_92226_lb47.root 
-#InDetESD_92226_lb48.root
-#InDetESD_92226_lb49.root
-#InDetESD_92226_lb5.root
-#InDetESD_92226_lb50.root
-#InDetESD_92226_lb51.root
-#InDetESD_92226_lb52.root
-#InDetESD_92226_lb53.root
-#InDetESD_92226_lb54.root
-#InDetESD_92226_lb6.root
-#InDetESD_92226_lb7.root 
-#InDetESD_92226_lb8.root
-#InDetESD_92226_lb9.root 
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_NoBField_Reprocessed.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_NoBField_Reprocessed.txt
deleted file mode 100644
index e39f7935b81dd31a995b1f881a3ed658e6d57b2c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_M8plus_Cosmic_NoBField_Reprocessed.txt
+++ /dev/null
@@ -1,258 +0,0 @@
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00008.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089740.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051064/DPD_SCTCOMM.051064._00010.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089851.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051076/DPD_SCTCOMM.051076._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00008.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00010.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00011.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00012.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00013.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00014.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00015.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00016.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00017.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00018.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00019.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00020.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00021.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00089956.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051088/DPD_SCTCOMM.051088._00022.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090233.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051106/DPD_SCTCOMM.051106._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090941.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051141/DPD_SCTCOMM.051141._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090941.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051141/DPD_SCTCOMM.051141._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00008.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00009.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00011.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00013.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00014.pool.root.9
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00015.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00017.pool.root.4
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00019.pool.root.5
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00020.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00021.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00022.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00090943.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051150/DPD_SCTCOMM.051150._00023.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051176/DPD_SCTCOMM.051176._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051176/DPD_SCTCOMM.051176._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00008.pool.root.3
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00011.pool.root.13
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00012.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00013.pool.root.4
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00014.pool.root.7
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00015.pool.root.3
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00019.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00021.pool.root.3
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00091060.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051185/DPD_SCTCOMM.051185._00022.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092058.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051287/DPD_SCTCOMM.051287._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092058.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051287/DPD_SCTCOMM.051287._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092058.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051287/DPD_SCTCOMM.051287._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092058.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051287/DPD_SCTCOMM.051287._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092063.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051303/DPD_SCTCOMM.051303._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092063.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051303/DPD_SCTCOMM.051303._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00004.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00005.pool.root.3
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00008.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00010.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00011.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00012.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00013.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00014.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00015.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00016.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00017.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00018.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00019.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00020.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00021.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00022.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00023.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00024.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00025.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00026.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00027.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00028.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00029.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00030.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00031.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00032.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051260/DPD_SCTCOMM.051260._00033.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00034.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00035.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00036.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00037.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00038.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00039.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00040.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00041.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00042.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00043.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00044.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00045.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00046.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00047.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00048.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00049.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00050.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00051.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00052.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00053.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00054.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00055.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00056.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00057.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00058.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00059.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00060.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00061.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00062.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00063.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00064.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051261/DPD_SCTCOMM.051261._00065.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00066.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00067.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00068.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00069.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00070.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00071.pool.root.3
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00072.pool.root.3
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00073.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00074.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00075.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00076.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00077.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00078.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00079.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00080.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00081.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00082.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00083.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00084.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00085.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00086.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00087.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00088.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00089.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00008.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00010.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00011.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00012.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00013.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00014.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00015.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00016.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00017.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00018.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00019.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00020.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00021.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00022.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00023.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00024.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00025.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00026.pool.root.2
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051220/DPD_SCTCOMM.051220._00027.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00008.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00010.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00011.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00012.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00013.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00014.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00015.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00016.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00017.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00018.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00019.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00020.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00021.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00022.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00023.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00024.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00025.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051232/DPD_SCTCOMM.051232._00026.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051295/DPD_SCTCOMM.051295._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051295/DPD_SCTCOMM.051295._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051295/DPD_SCTCOMM.051295._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051295/DPD_SCTCOMM.051295._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051295/DPD_SCTCOMM.051295._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00003.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00004.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00005.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00006.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00007.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00008.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00009.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00010.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00011.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00012.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00013.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00014.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00015.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00016.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00017.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00018.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051244/DPD_SCTCOMM.051244._00019.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r653_p26_tid051262/DPD_SCTCOMM.051262._00090.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092045.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r663_p31_tid066867/DPD_SCTCOMM.066867._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092048.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r663_p31_tid066873/DPD_SCTCOMM.066873._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092051.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r663_p31_tid066877/DPD_SCTCOMM.066877._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r663_p31_tid066881/DPD_SCTCOMM.066881._00001.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092057.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r663_p31_tid066881/DPD_SCTCOMM.066881._00002.pool.root.1
-castor:/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/DPD_SCTCOMM/data08_cos.00092059.physics_IDCosmic.merge.DPD_SCTCOMM.o4_r663_p31_tid066886/DPD_SCTCOMM.066886._00001.pool.root.1
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_beamgas_digits.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_beamgas_digits.txt
deleted file mode 100644
index f685ead408527224f976888e4f1144bca39230eb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_beamgas_digits.txt
+++ /dev/null
@@ -1,475 +0,0 @@
-# Beam Gas O
-LOCALDIR = "rfio:/castor/cern.ch/user/s/stradlin/BeamGas_1.1/digit/hijing.O.digit/"
-
-
-
-hijing.O.digit._00001.pool.root
-hijing.O.digit._00002.pool.root
-hijing.O.digit._00003.pool.root
-hijing.O.digit._00004.pool.root
-hijing.O.digit._00005.pool.root
-hijing.O.digit._00006.pool.root
-hijing.O.digit._00007.pool.root
-hijing.O.digit._00008.pool.root
-hijing.O.digit._00009.pool.root
-hijing.O.digit._00010.pool.root
-hijing.O.digit._00011.pool.root
-hijing.O.digit._00012.pool.root
-hijing.O.digit._00013.pool.root
-hijing.O.digit._00014.pool.root
-hijing.O.digit._00015.pool.root
-hijing.O.digit._00016.pool.root
-hijing.O.digit._00017.pool.root
-hijing.O.digit._00019.pool.root
-hijing.O.digit._00020.pool.root
-hijing.O.digit._00021.pool.root
-hijing.O.digit._00022.pool.root
-hijing.O.digit._00023.pool.root
-hijing.O.digit._00024.pool.root
-hijing.O.digit._00025.pool.root
-hijing.O.digit._00026.pool.root
-hijing.O.digit._00027.pool.root
-hijing.O.digit._00028.pool.root
-hijing.O.digit._00029.pool.root
-hijing.O.digit._00030.pool.root
-hijing.O.digit._00031.pool.root
-hijing.O.digit._00032.pool.root
-hijing.O.digit._00033.pool.root
-hijing.O.digit._00034.pool.root
-hijing.O.digit._00035.pool.root
-hijing.O.digit._00036.pool.root
-hijing.O.digit._00037.pool.root
-hijing.O.digit._00038.pool.root
-hijing.O.digit._00039.pool.root
-hijing.O.digit._00040.pool.root
-hijing.O.digit._00041.pool.root
-hijing.O.digit._00042.pool.root
-hijing.O.digit._00043.pool.root
-hijing.O.digit._00044.pool.root
-hijing.O.digit._00045.pool.root
-hijing.O.digit._00046.pool.root
-hijing.O.digit._00047.pool.root
-hijing.O.digit._00048.pool.root
-hijing.O.digit._00049.pool.root
-hijing.O.digit._00050.pool.root
-hijing.O.digit._00051.pool.root
-hijing.O.digit._00052.pool.root
-hijing.O.digit._00053.pool.root
-hijing.O.digit._00054.pool.root
-hijing.O.digit._00056.pool.root
-hijing.O.digit._00057.pool.root
-hijing.O.digit._00058.pool.root
-hijing.O.digit._00059.pool.root
-hijing.O.digit._00060.pool.root
-hijing.O.digit._00061.pool.root
-hijing.O.digit._00062.pool.root
-hijing.O.digit._00063.pool.root
-hijing.O.digit._00064.pool.root
-hijing.O.digit._00065.pool.root
-hijing.O.digit._00066.pool.root
-hijing.O.digit._00067.pool.root
-hijing.O.digit._00068.pool.root
-hijing.O.digit._00069.pool.root
-hijing.O.digit._00070.pool.root
-hijing.O.digit._00071.pool.root
-hijing.O.digit._00072.pool.root
-hijing.O.digit._00073.pool.root
-hijing.O.digit._00074.pool.root
-hijing.O.digit._00075.pool.root
-hijing.O.digit._00076.pool.root
-hijing.O.digit._00077.pool.root
-hijing.O.digit._00078.pool.root
-hijing.O.digit._00079.pool.root
-hijing.O.digit._00080.pool.root
-hijing.O.digit._00081.pool.root
-hijing.O.digit._00082.pool.root
-hijing.O.digit._00083.pool.root
-hijing.O.digit._00084.pool.root
-hijing.O.digit._00085.pool.root
-hijing.O.digit._00086.pool.root
-hijing.O.digit._00087.pool.root
-hijing.O.digit._00088.pool.root
-hijing.O.digit._00089.pool.root
-hijing.O.digit._00090.pool.root
-hijing.O.digit._00091.pool.root
-hijing.O.digit._00092.pool.root
-hijing.O.digit._00093.pool.root
-hijing.O.digit._00094.pool.root
-hijing.O.digit._00095.pool.root
-hijing.O.digit._00096.pool.root
-hijing.O.digit._00097.pool.root
-hijing.O.digit._00098.pool.root
-hijing.O.digit._00099.pool.root
-hijing.O.digit._00100.pool.root
-hijing.O.digit._00101.pool.root
-hijing.O.digit._00102.pool.root
-hijing.O.digit._00103.pool.root
-hijing.O.digit._00104.pool.root
-hijing.O.digit._00105.pool.root
-hijing.O.digit._00106.pool.root
-hijing.O.digit._00107.pool.root
-hijing.O.digit._00108.pool.root
-hijing.O.digit._00109.pool.root
-hijing.O.digit._00110.pool.root
-hijing.O.digit._00111.pool.root
-hijing.O.digit._00112.pool.root
-hijing.O.digit._00113.pool.root
-hijing.O.digit._00114.pool.root
-hijing.O.digit._00115.pool.root
-hijing.O.digit._00116.pool.root
-hijing.O.digit._00117.pool.root
-hijing.O.digit._00118.pool.root
-hijing.O.digit._00119.pool.root
-hijing.O.digit._00120.pool.root
-hijing.O.digit._00121.pool.root
-hijing.O.digit._00122.pool.root
-hijing.O.digit._00123.pool.root
-hijing.O.digit._00124.pool.root
-hijing.O.digit._00125.pool.root
-hijing.O.digit._00126.pool.root
-hijing.O.digit._00127.pool.root
-hijing.O.digit._00128.pool.root
-hijing.O.digit._00129.pool.root
-hijing.O.digit._00130.pool.root
-hijing.O.digit._00131.pool.root
-hijing.O.digit._00132.pool.root
-hijing.O.digit._00133.pool.root
-hijing.O.digit._00134.pool.root
-hijing.O.digit._00135.pool.root
-hijing.O.digit._00136.pool.root
-hijing.O.digit._00137.pool.root
-hijing.O.digit._00138.pool.root
-hijing.O.digit._00139.pool.root
-hijing.O.digit._00140.pool.root
-hijing.O.digit._00141.pool.root
-hijing.O.digit._00142.pool.root
-hijing.O.digit._00143.pool.root
-hijing.O.digit._00144.pool.root
-hijing.O.digit._00145.pool.root
-hijing.O.digit._00146.pool.root
-hijing.O.digit._00147.pool.root
-hijing.O.digit._00148.pool.root
-hijing.O.digit._00149.pool.root
-hijing.O.digit._00150.pool.root
-hijing.O.digit._00151.pool.root
-hijing.O.digit._00152.pool.root
-hijing.O.digit._00153.pool.root
-hijing.O.digit._00154.pool.root
-hijing.O.digit._00155.pool.root
-hijing.O.digit._00156.pool.root
-hijing.O.digit._00157.pool.root
-hijing.O.digit._00158.pool.root
-hijing.O.digit._00159.pool.root
-hijing.O.digit._00160.pool.root
-hijing.O.digit._00161.pool.root
-hijing.O.digit._00162.pool.root
-hijing.O.digit._00163.pool.root
-hijing.O.digit._00164.pool.root
-hijing.O.digit._00165.pool.root
-hijing.O.digit._00166.pool.root
-hijing.O.digit._00167.pool.root
-hijing.O.digit._00168.pool.root
-hijing.O.digit._00169.pool.root
-hijing.O.digit._00170.pool.root
-hijing.O.digit._00171.pool.root
-hijing.O.digit._00172.pool.root
-hijing.O.digit._00173.pool.root
-hijing.O.digit._00174.pool.root
-hijing.O.digit._00175.pool.root
-hijing.O.digit._00176.pool.root
-hijing.O.digit._00177.pool.root
-hijing.O.digit._00178.pool.root
-hijing.O.digit._00179.pool.root
-hijing.O.digit._00180.pool.root
-hijing.O.digit._00181.pool.root
-hijing.O.digit._00182.pool.root
-hijing.O.digit._00184.pool.root
-hijing.O.digit._00185.pool.root
-hijing.O.digit._00186.pool.root
-hijing.O.digit._00187.pool.root
-hijing.O.digit._00188.pool.root
-hijing.O.digit._00189.pool.root
-hijing.O.digit._00190.pool.root
-hijing.O.digit._00191.pool.root
-hijing.O.digit._00192.pool.root
-hijing.O.digit._00193.pool.root
-hijing.O.digit._00194.pool.root
-hijing.O.digit._00195.pool.root
-hijing.O.digit._00196.pool.root
-hijing.O.digit._00197.pool.root
-hijing.O.digit._00198.pool.root
-hijing.O.digit._00199.pool.root
-hijing.O.digit._00200.pool.root
-hijing.O.digit._00201.pool.root
-hijing.O.digit._00202.pool.root
-hijing.O.digit._00203.pool.root
-hijing.O.digit._00204.pool.root
-hijing.O.digit._00205.pool.root
-hijing.O.digit._00206.pool.root
-hijing.O.digit._00207.pool.root
-hijing.O.digit._00208.pool.root
-hijing.O.digit._00209.pool.root
-hijing.O.digit._00210.pool.root
-hijing.O.digit._00211.pool.root
-hijing.O.digit._00212.pool.root
-hijing.O.digit._00213.pool.root
-hijing.O.digit._00214.pool.root
-hijing.O.digit._00215.pool.root
-hijing.O.digit._00216.pool.root
-hijing.O.digit._00217.pool.root
-hijing.O.digit._00218.pool.root
-hijing.O.digit._00219.pool.root
-hijing.O.digit._00220.pool.root
-hijing.O.digit._00221.pool.root
-hijing.O.digit._00222.pool.root
-hijing.O.digit._00223.pool.root
-hijing.O.digit._00224.pool.root
-hijing.O.digit._00225.pool.root
-hijing.O.digit._00226.pool.root
-hijing.O.digit._00227.pool.root
-hijing.O.digit._00228.pool.root
-hijing.O.digit._00229.pool.root
-hijing.O.digit._00230.pool.root
-hijing.O.digit._00231.pool.root
-hijing.O.digit._00232.pool.root
-hijing.O.digit._00233.pool.root
-hijing.O.digit._00234.pool.root
-hijing.O.digit._00235.pool.root
-hijing.O.digit._00236.pool.root
-hijing.O.digit._00237.pool.root
-hijing.O.digit._00238.pool.root
-hijing.O.digit._00239.pool.root
-hijing.O.digit._00240.pool.root
-hijing.O.digit._00241.pool.root
-hijing.O.digit._00242.pool.root
-hijing.O.digit._00243.pool.root
-hijing.O.digit._00244.pool.root
-hijing.O.digit._00245.pool.root
-hijing.O.digit._00246.pool.root
-hijing.O.digit._00247.pool.root
-hijing.O.digit._00248.pool.root
-hijing.O.digit._00249.pool.root
-hijing.O.digit._00250.pool.root
-hijing.O.digit._00251.pool.root
-hijing.O.digit._00252.pool.root
-hijing.O.digit._00253.pool.root
-hijing.O.digit._00254.pool.root
-hijing.O.digit._00255.pool.root
-hijing.O.digit._00256.pool.root
-hijing.O.digit._00257.pool.root
-hijing.O.digit._00258.pool.root
-hijing.O.digit._00259.pool.root
-hijing.O.digit._00260.pool.root
-hijing.O.digit._00261.pool.root
-hijing.O.digit._00262.pool.root
-hijing.O.digit._00263.pool.root
-hijing.O.digit._00264.pool.root
-hijing.O.digit._00265.pool.root
-hijing.O.digit._00266.pool.root
-hijing.O.digit._00267.pool.root
-hijing.O.digit._00268.pool.root
-hijing.O.digit._00269.pool.root
-hijing.O.digit._00270.pool.root
-hijing.O.digit._00271.pool.root
-hijing.O.digit._00272.pool.root
-hijing.O.digit._00273.pool.root
-hijing.O.digit._00274.pool.root
-hijing.O.digit._00275.pool.root
-hijing.O.digit._00276.pool.root
-hijing.O.digit._00277.pool.root
-hijing.O.digit._00278.pool.root
-hijing.O.digit._00279.pool.root
-hijing.O.digit._00280.pool.root
-hijing.O.digit._00281.pool.root
-hijing.O.digit._00282.pool.root
-hijing.O.digit._00283.pool.root
-hijing.O.digit._00284.pool.root
-hijing.O.digit._00285.pool.root
-hijing.O.digit._00286.pool.root
-hijing.O.digit._00287.pool.root
-hijing.O.digit._00288.pool.root
-hijing.O.digit._00289.pool.root
-hijing.O.digit._00290.pool.root
-hijing.O.digit._00291.pool.root
-hijing.O.digit._00292.pool.root
-hijing.O.digit._00293.pool.root
-hijing.O.digit._00294.pool.root
-hijing.O.digit._00295.pool.root
-hijing.O.digit._00296.pool.root
-hijing.O.digit._00297.pool.root
-hijing.O.digit._00298.pool.root
-hijing.O.digit._00299.pool.root
-hijing.O.digit._00300.pool.root
-hijing.O.digit._00302.pool.root
-hijing.O.digit._00303.pool.root
-hijing.O.digit._00304.pool.root
-hijing.O.digit._00305.pool.root
-hijing.O.digit._00306.pool.root
-hijing.O.digit._00307.pool.root
-hijing.O.digit._00308.pool.root
-hijing.O.digit._00309.pool.root
-hijing.O.digit._00310.pool.root
-hijing.O.digit._00311.pool.root
-hijing.O.digit._00312.pool.root
-hijing.O.digit._00313.pool.root
-hijing.O.digit._00314.pool.root
-hijing.O.digit._00315.pool.root
-hijing.O.digit._00316.pool.root
-hijing.O.digit._00317.pool.root
-hijing.O.digit._00318.pool.root
-hijing.O.digit._00319.pool.root
-hijing.O.digit._00320.pool.root
-hijing.O.digit._00322.pool.root
-hijing.O.digit._00323.pool.root
-hijing.O.digit._00324.pool.root
-hijing.O.digit._00325.pool.root
-hijing.O.digit._00326.pool.root
-hijing.O.digit._00327.pool.root
-hijing.O.digit._00328.pool.root
-hijing.O.digit._00329.pool.root
-hijing.O.digit._00331.pool.root
-hijing.O.digit._00332.pool.root
-hijing.O.digit._00334.pool.root
-hijing.O.digit._00336.pool.root
-hijing.O.digit._00337.pool.root
-hijing.O.digit._00338.pool.root
-hijing.O.digit._00339.pool.root
-hijing.O.digit._00340.pool.root
-hijing.O.digit._00341.pool.root
-hijing.O.digit._00343.pool.root
-hijing.O.digit._00344.pool.root
-hijing.O.digit._00345.pool.root
-hijing.O.digit._00346.pool.root
-hijing.O.digit._00348.pool.root
-hijing.O.digit._00349.pool.root
-hijing.O.digit._00350.pool.root
-hijing.O.digit._00351.pool.root
-hijing.O.digit._00352.pool.root
-hijing.O.digit._00353.pool.root
-hijing.O.digit._00354.pool.root
-hijing.O.digit._00355.pool.root
-hijing.O.digit._00362.pool.root
-hijing.O.digit._00369.pool.root
-hijing.O.digit._00378.pool.root
-hijing.O.digit._00379.pool.root
-hijing.O.digit._00380.pool.root
-hijing.O.digit._00381.pool.root
-hijing.O.digit._00382.pool.root
-hijing.O.digit._00383.pool.root
-hijing.O.digit._00384.pool.root
-hijing.O.digit._00385.pool.root
-hijing.O.digit._00386.pool.root
-hijing.O.digit._00387.pool.root
-hijing.O.digit._00388.pool.root
-hijing.O.digit._00389.pool.root
-hijing.O.digit._00390.pool.root
-hijing.O.digit._00391.pool.root
-hijing.O.digit._00392.pool.root
-hijing.O.digit._00393.pool.root
-hijing.O.digit._00394.pool.root
-hijing.O.digit._00395.pool.root
-hijing.O.digit._00396.pool.root
-hijing.O.digit._00397.pool.root
-hijing.O.digit._00398.pool.root
-hijing.O.digit._00399.pool.root
-hijing.O.digit._00400.pool.root
-hijing.O.digit._00401.pool.root
-hijing.O.digit._00402.pool.root
-hijing.O.digit._00403.pool.root
-hijing.O.digit._00404.pool.root
-hijing.O.digit._00405.pool.root
-hijing.O.digit._00406.pool.root
-hijing.O.digit._00407.pool.root
-hijing.O.digit._00408.pool.root
-hijing.O.digit._00409.pool.root
-hijing.O.digit._00410.pool.root
-hijing.O.digit._00411.pool.root
-hijing.O.digit._00413.pool.root
-hijing.O.digit._00414.pool.root
-hijing.O.digit._00415.pool.root
-hijing.O.digit._00416.pool.root
-hijing.O.digit._00417.pool.root
-hijing.O.digit._00419.pool.root
-hijing.O.digit._00420.pool.root
-hijing.O.digit._00421.pool.root
-hijing.O.digit._00422.pool.root
-hijing.O.digit._00423.pool.root
-hijing.O.digit._00424.pool.root
-hijing.O.digit._00425.pool.root
-hijing.O.digit._00426.pool.root
-hijing.O.digit._00427.pool.root
-hijing.O.digit._00428.pool.root
-hijing.O.digit._00429.pool.root
-hijing.O.digit._00430.pool.root
-hijing.O.digit._00431.pool.root
-hijing.O.digit._00432.pool.root
-hijing.O.digit._00433.pool.root
-hijing.O.digit._00434.pool.root
-hijing.O.digit._00435.pool.root
-hijing.O.digit._00436.pool.root
-hijing.O.digit._00437.pool.root
-hijing.O.digit._00438.pool.root
-hijing.O.digit._00439.pool.root
-hijing.O.digit._00440.pool.root
-hijing.O.digit._00441.pool.root
-hijing.O.digit._00442.pool.root
-hijing.O.digit._00443.pool.root
-hijing.O.digit._00444.pool.root
-hijing.O.digit._00445.pool.root
-hijing.O.digit._00446.pool.root
-hijing.O.digit._00447.pool.root
-hijing.O.digit._00448.pool.root
-hijing.O.digit._00449.pool.root
-hijing.O.digit._00450.pool.root
-hijing.O.digit._00451.pool.root
-hijing.O.digit._00452.pool.root
-hijing.O.digit._00453.pool.root
-hijing.O.digit._00454.pool.root
-hijing.O.digit._00455.pool.root
-hijing.O.digit._00456.pool.root
-hijing.O.digit._00457.pool.root
-hijing.O.digit._00458.pool.root
-hijing.O.digit._00459.pool.root
-hijing.O.digit._00460.pool.root
-hijing.O.digit._00461.pool.root
-hijing.O.digit._00462.pool.root
-hijing.O.digit._00463.pool.root
-hijing.O.digit._00464.pool.root
-hijing.O.digit._00465.pool.root
-hijing.O.digit._00466.pool.root
-hijing.O.digit._00467.pool.root
-hijing.O.digit._00468.pool.root
-hijing.O.digit._00469.pool.root
-hijing.O.digit._00470.pool.root
-hijing.O.digit._00471.pool.root
-hijing.O.digit._00472.pool.root
-hijing.O.digit._00473.pool.root
-hijing.O.digit._00474.pool.root
-hijing.O.digit._00475.pool.root
-hijing.O.digit._00476.pool.root
-hijing.O.digit._00477.pool.root
-hijing.O.digit._00478.pool.root
-hijing.O.digit._00479.pool.root
-hijing.O.digit._00480.pool.root
-hijing.O.digit._00481.pool.root
-hijing.O.digit._00482.pool.root
-hijing.O.digit._00483.pool.root
-hijing.O.digit._00484.pool.root
-hijing.O.digit._00485.pool.root
-hijing.O.digit._00486.pool.root
-hijing.O.digit._00487.pool.root
-hijing.O.digit._00488.pool.root
-hijing.O.digit._00489.pool.root
-hijing.O.digit._00490.pool.root
-hijing.O.digit._00491.pool.root
-hijing.O.digit._00492.pool.root
-hijing.O.digit._00493.pool.root
-hijing.O.digit._00494.pool.root
-hijing.O.digit._00495.pool.root
-hijing.O.digit._00496.pool.root
-hijing.O.digit._00497.pool.root
-hijing.O.digit._00498.pool.root
-hijing.O.digit._00499.pool.root
-hijing.O.digit._00500.pool.root
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_halo_digits.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_halo_digits.txt
deleted file mode 100644
index 4c98adcee39c9f67c9c3af8914e1b3bca1f9eca4..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_halo_digits.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-#--------------------------------------------------------
-# Beam Halo fast simulation from Thijs (only 8.3k events)
-#----------------------------------------------------------
-
-
-
-FatrasESD.root
-
-
-# Beam Halo from Alden
-## LOCALDIR = "rfio:/castor/cern.ch/user/s/stradlin/BeamHalo/simul/pup.008850.halo_A_fluka/"
-## FileName=[]
-## #FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00001.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00002.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00003.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00004.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00005.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00006.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00007.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00008.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00009.pool.root"]
-## FileName+=[ LOCALDIR+"pup.008850.halo_A_fluka.digit.RDO._00010.pool.root"]
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_minbias.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_minbias.txt
deleted file mode 100644
index 6ddde3ca06a7b3b0b36ebf441408f909e6c60016..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_minbias.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-ESD.079146._000001.pool.root.1
-ESD.079146._000002.pool.root.1
-ESD.079146._000003.pool.root.1
-ESD.079146._000004.pool.root.1
-ESD.079146._000005.pool.root.1
-ESD.079146._000006.pool.root.1
-ESD.079146._000007.pool.root.1
-ESD.079146._000008.pool.root.1
-ESD.079146._000009.pool.root.1
-ESD.079146._000010.pool.root.1
-ESD.079146._000011.pool.root.1
-ESD.079146._000012.pool.root.1
-ESD.079146._000013.pool.root.1
-ESD.079146._000014.pool.root.1
-ESD.079146._000015.pool.root.1
-ESD.079146._000016.pool.root.1
-ESD.079146._000017.pool.root.1
-ESD.079146._000018.pool.root.1
-ESD.079146._000019.pool.root.1
-ESD.079146._000020.pool.root.1
-ESD.079146._000021.pool.root.1
-ESD.079146._000022.pool.root.1
-ESD.079146._000023.pool.root.1
-ESD.079146._000024.pool.root.1
-ESD.079146._000025.pool.root.1
-ESD.079146._000026.pool.root.1
-ESD.079146._000027.pool.root.1
-ESD.079146._000028.pool.root.1
-ESD.079146._000029.pool.root.1
-ESD.079146._000030.pool.root.1
-ESD.079146._000031.pool.root.1
-ESD.079146._000032.pool.root.1
-ESD.079146._000033.pool.root.1
-ESD.079146._000034.pool.root.1
-ESD.079146._000035.pool.root.1
-ESD.079146._000036.pool.root.1
-ESD.079146._000037.pool.root.1
-ESD.079146._000038.pool.root.1
-ESD.079146._000039.pool.root.1
-ESD.079146._000040.pool.root.1
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_multimuons09.txt b/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_multimuons09.txt
deleted file mode 100644
index 375333471602b15d593c192bccf5230b76185135..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/Data/inputData_multimuons09.txt
+++ /dev/null
@@ -1,737 +0,0 @@
-ESD.076491._000002.pool.root.1
-ESD.076491._000003.pool.root.1
-ESD.076491._000004.pool.root.1
-ESD.076491._000005.pool.root.1
-ESD.076491._000007.pool.root.1
-ESD.076491._000008.pool.root.1
-ESD.076491._000009.pool.root.1
-ESD.076491._000012.pool.root.1
-ESD.076491._000013.pool.root.1
-ESD.076491._000014.pool.root.1
-ESD.076491._000015.pool.root.1
-ESD.076491._000017.pool.root.1
-ESD.076491._000021.pool.root.1
-ESD.076491._000023.pool.root.1
-ESD.076491._000024.pool.root.1
-ESD.076491._000025.pool.root.1
-ESD.076491._000026.pool.root.1
-ESD.076491._000028.pool.root.1
-ESD.076491._000029.pool.root.1
-ESD.076491._000030.pool.root.1
-ESD.076491._000031.pool.root.1
-ESD.076491._000032.pool.root.1
-ESD.076491._000034.pool.root.1
-ESD.076491._000035.pool.root.1
-ESD.076491._000036.pool.root.1
-ESD.076491._000037.pool.root.1
-ESD.076491._000038.pool.root.1
-ESD.076491._000039.pool.root.1
-ESD.076491._000041.pool.root.1
-ESD.076491._000042.pool.root.1
-ESD.076491._000043.pool.root.1
-ESD.076491._000044.pool.root.1
-ESD.076491._000046.pool.root.1
-ESD.076491._000047.pool.root.1
-ESD.076491._000049.pool.root.1
-ESD.076491._000050.pool.root.1
-ESD.076491._000051.pool.root.1
-ESD.076491._000054.pool.root.1
-ESD.076491._000056.pool.root.1
-ESD.076491._000057.pool.root.1
-ESD.076491._000058.pool.root.1
-ESD.076491._000059.pool.root.1
-ESD.076491._000060.pool.root.1
-ESD.076491._000061.pool.root.1
-ESD.076491._000063.pool.root.1
-ESD.076491._000066.pool.root.1
-ESD.076491._000067.pool.root.1
-ESD.076491._000068.pool.root.1
-ESD.076491._000069.pool.root.1
-ESD.076491._000070.pool.root.1
-ESD.076491._000071.pool.root.1
-ESD.076491._000072.pool.root.1
-ESD.076491._000073.pool.root.1
-ESD.076491._000074.pool.root.1
-ESD.076491._000076.pool.root.1
-ESD.076491._000078.pool.root.1
-ESD.076491._000079.pool.root.1
-ESD.076491._000080.pool.root.1
-ESD.076491._000081.pool.root.1
-ESD.076491._000082.pool.root.1
-ESD.076491._000083.pool.root.1
-ESD.076491._000084.pool.root.1
-ESD.076491._000085.pool.root.1
-ESD.076491._000086.pool.root.1
-ESD.076491._000087.pool.root.1
-ESD.076491._000088.pool.root.1
-ESD.076491._000089.pool.root.1
-ESD.076491._000090.pool.root.1
-ESD.076491._000094.pool.root.1
-ESD.076491._000096.pool.root.1
-ESD.076491._000098.pool.root.1
-ESD.076491._000101.pool.root.1
-ESD.076491._000102.pool.root.1
-ESD.076491._000103.pool.root.1
-ESD.076491._000104.pool.root.1
-ESD.076491._000105.pool.root.1
-ESD.076491._000107.pool.root.1
-ESD.076491._000108.pool.root.1
-ESD.076491._000109.pool.root.1
-ESD.076491._000112.pool.root.1
-ESD.076491._000113.pool.root.1
-ESD.076491._000115.pool.root.1
-ESD.076491._000116.pool.root.1
-ESD.076491._000117.pool.root.1
-ESD.076491._000118.pool.root.1
-ESD.076491._000119.pool.root.1
-ESD.076491._000120.pool.root.1
-ESD.076491._000123.pool.root.1
-ESD.076491._000124.pool.root.1
-ESD.076491._000125.pool.root.1
-ESD.076491._000126.pool.root.1
-ESD.076491._000127.pool.root.1
-ESD.076491._000128.pool.root.1
-ESD.076491._000129.pool.root.1
-ESD.076491._000130.pool.root.1
-ESD.076491._000131.pool.root.1
-ESD.076491._000134.pool.root.1
-ESD.076491._000135.pool.root.1
-ESD.076491._000136.pool.root.1
-ESD.076491._000137.pool.root.1
-ESD.076491._000138.pool.root.1
-ESD.076491._000139.pool.root.1
-ESD.076491._000140.pool.root.1
-ESD.076491._000142.pool.root.1
-ESD.076491._000143.pool.root.1
-ESD.076491._000144.pool.root.1
-ESD.076491._000146.pool.root.1
-ESD.076491._000148.pool.root.1
-ESD.076491._000149.pool.root.1
-ESD.076491._000150.pool.root.1
-ESD.076491._000151.pool.root.1
-ESD.076491._000152.pool.root.1
-ESD.076491._000155.pool.root.1
-ESD.076491._000156.pool.root.1
-ESD.076491._000157.pool.root.1
-ESD.076491._000159.pool.root.1
-ESD.076491._000160.pool.root.1
-ESD.076491._000161.pool.root.1
-ESD.076491._000162.pool.root.1
-ESD.076491._000164.pool.root.1
-ESD.076491._000167.pool.root.1
-ESD.076491._000168.pool.root.1
-ESD.076491._000170.pool.root.1
-ESD.076491._000172.pool.root.1
-ESD.076491._000173.pool.root.1
-ESD.076491._000174.pool.root.1
-ESD.076491._000175.pool.root.1
-ESD.076491._000176.pool.root.1
-ESD.076491._000177.pool.root.1
-ESD.076491._000178.pool.root.1
-ESD.076491._000179.pool.root.1
-ESD.076491._000180.pool.root.1
-ESD.076491._000181.pool.root.1
-ESD.076491._000182.pool.root.1
-ESD.076491._000183.pool.root.1
-ESD.076491._000184.pool.root.1
-ESD.076491._000186.pool.root.1
-ESD.076491._000189.pool.root.1
-ESD.076491._000190.pool.root.1
-ESD.076491._000191.pool.root.1
-ESD.076491._000192.pool.root.1
-ESD.076491._000194.pool.root.1
-ESD.076491._000195.pool.root.1
-ESD.076491._000196.pool.root.1
-ESD.076491._000197.pool.root.1
-ESD.076491._000198.pool.root.1
-ESD.076491._000199.pool.root.1
-ESD.076491._000200.pool.root.1
-ESD.076491._000201.pool.root.1
-ESD.076491._000202.pool.root.1
-ESD.076491._000204.pool.root.1
-ESD.076491._000205.pool.root.1
-ESD.076491._000206.pool.root.1
-ESD.076491._000208.pool.root.1
-ESD.076491._000211.pool.root.1
-ESD.076491._000212.pool.root.1
-ESD.076491._000213.pool.root.1
-ESD.076491._000214.pool.root.1
-ESD.076491._000216.pool.root.1
-ESD.076491._000217.pool.root.1
-ESD.076491._000218.pool.root.1
-ESD.076491._000220.pool.root.1
-ESD.076491._000221.pool.root.1
-ESD.076491._000225.pool.root.1
-ESD.076491._000226.pool.root.1
-ESD.076491._000227.pool.root.1
-ESD.076491._000228.pool.root.1
-ESD.076491._000229.pool.root.1
-ESD.076491._000230.pool.root.1
-ESD.076491._000231.pool.root.1
-ESD.076491._000232.pool.root.1
-ESD.076491._000234.pool.root.1
-ESD.076491._000236.pool.root.1
-ESD.076491._000237.pool.root.1
-ESD.076491._000238.pool.root.1
-ESD.076491._000240.pool.root.1
-ESD.076491._000242.pool.root.1
-ESD.076491._000244.pool.root.1
-ESD.076491._000245.pool.root.1
-ESD.076491._000248.pool.root.1
-ESD.076491._000249.pool.root.1
-ESD.076491._000250.pool.root.1
-ESD.076491._000251.pool.root.1
-ESD.076491._000252.pool.root.1
-ESD.076491._000254.pool.root.1
-ESD.076491._000255.pool.root.1
-ESD.076491._000256.pool.root.1
-ESD.076491._000258.pool.root.1
-ESD.076491._000259.pool.root.1
-ESD.076491._000260.pool.root.1
-ESD.076491._000261.pool.root.1
-ESD.076491._000263.pool.root.1
-ESD.076491._000265.pool.root.1
-ESD.076491._000266.pool.root.1
-ESD.076491._000267.pool.root.1
-ESD.076491._000269.pool.root.1
-ESD.076491._000270.pool.root.1
-ESD.076491._000272.pool.root.1
-ESD.076491._000274.pool.root.1
-ESD.076491._000275.pool.root.1
-ESD.076491._000277.pool.root.1
-ESD.076491._000279.pool.root.1
-ESD.076491._000280.pool.root.1
-ESD.076491._000281.pool.root.1
-ESD.076491._000282.pool.root.1
-ESD.076491._000284.pool.root.1
-ESD.076491._000286.pool.root.1
-ESD.076491._000287.pool.root.1
-ESD.076491._000288.pool.root.1
-ESD.076491._000289.pool.root.1
-ESD.076491._000290.pool.root.1
-ESD.076491._000291.pool.root.1
-ESD.076491._000293.pool.root.1
-ESD.076491._000294.pool.root.1
-ESD.076491._000295.pool.root.1
-ESD.076491._000296.pool.root.1
-ESD.076491._000298.pool.root.1
-ESD.076491._000299.pool.root.1
-ESD.076491._000300.pool.root.1
-ESD.076491._000301.pool.root.1
-ESD.076491._000302.pool.root.1
-ESD.076491._000303.pool.root.1
-ESD.076491._000304.pool.root.1
-ESD.076491._000305.pool.root.1
-ESD.076491._000307.pool.root.1
-ESD.076491._000310.pool.root.1
-ESD.076491._000311.pool.root.1
-ESD.076491._000312.pool.root.1
-ESD.076491._000313.pool.root.1
-ESD.076491._000314.pool.root.1
-ESD.076491._000315.pool.root.1
-ESD.076491._000316.pool.root.1
-ESD.076491._000317.pool.root.1
-ESD.076491._000318.pool.root.1
-ESD.076491._000319.pool.root.1
-ESD.076491._000320.pool.root.1
-ESD.076491._000321.pool.root.1
-ESD.076491._000322.pool.root.1
-ESD.076491._000323.pool.root.1
-ESD.076491._000324.pool.root.1
-ESD.076491._000325.pool.root.1
-ESD.076491._000326.pool.root.1
-ESD.076491._000327.pool.root.1
-ESD.076491._000328.pool.root.1
-ESD.076491._000329.pool.root.1
-ESD.076491._000330.pool.root.1
-ESD.076491._000331.pool.root.1
-ESD.076491._000332.pool.root.1
-ESD.076491._000333.pool.root.1
-ESD.076491._000334.pool.root.1
-ESD.076491._000336.pool.root.1
-ESD.076491._000337.pool.root.2
-ESD.076491._000338.pool.root.1
-ESD.076491._000339.pool.root.1
-ESD.076491._000340.pool.root.1
-ESD.076491._000342.pool.root.1
-ESD.076491._000344.pool.root.1
-ESD.076491._000345.pool.root.1
-ESD.076491._000346.pool.root.1
-ESD.076491._000347.pool.root.1
-ESD.076491._000348.pool.root.1
-ESD.076491._000349.pool.root.1
-ESD.076491._000350.pool.root.1
-ESD.076491._000352.pool.root.1
-ESD.076491._000353.pool.root.1
-ESD.076491._000354.pool.root.1
-ESD.076491._000356.pool.root.1
-ESD.076491._000357.pool.root.1
-ESD.076491._000358.pool.root.1
-ESD.076491._000359.pool.root.1
-ESD.076491._000360.pool.root.1
-ESD.076491._000362.pool.root.1
-ESD.076491._000363.pool.root.1
-ESD.076491._000364.pool.root.1
-ESD.076491._000365.pool.root.1
-ESD.076491._000366.pool.root.1
-ESD.076491._000369.pool.root.1
-ESD.076491._000370.pool.root.1
-ESD.076491._000371.pool.root.1
-ESD.076491._000373.pool.root.1
-ESD.076491._000374.pool.root.1
-ESD.076491._000375.pool.root.1
-ESD.076491._000377.pool.root.1
-ESD.076491._000379.pool.root.1
-ESD.076491._000380.pool.root.1
-ESD.076491._000383.pool.root.1
-ESD.076491._000384.pool.root.1
-ESD.076491._000385.pool.root.1
-ESD.076491._000386.pool.root.1
-ESD.076491._000387.pool.root.1
-ESD.076491._000389.pool.root.1
-ESD.076491._000391.pool.root.1
-ESD.076491._000392.pool.root.1
-ESD.076491._000394.pool.root.1
-ESD.076491._000395.pool.root.1
-ESD.076491._000396.pool.root.1
-ESD.076491._000397.pool.root.1
-ESD.076491._000398.pool.root.1
-ESD.076491._000399.pool.root.1
-ESD.076491._000401.pool.root.1
-ESD.076491._000403.pool.root.1
-ESD.076491._000404.pool.root.1
-ESD.076491._000405.pool.root.1
-ESD.076491._000406.pool.root.1
-ESD.076491._000407.pool.root.1
-ESD.076491._000408.pool.root.1
-ESD.076491._000410.pool.root.1
-ESD.076491._000411.pool.root.1
-ESD.076491._000412.pool.root.1
-ESD.076491._000413.pool.root.1
-ESD.076491._000415.pool.root.1
-ESD.076491._000416.pool.root.1
-ESD.076491._000417.pool.root.1
-ESD.076491._000420.pool.root.1
-ESD.076491._000421.pool.root.1
-ESD.076491._000422.pool.root.1
-ESD.076491._000423.pool.root.1
-ESD.076491._000425.pool.root.1
-ESD.076491._000426.pool.root.1
-ESD.076491._000427.pool.root.1
-ESD.076491._000428.pool.root.1
-ESD.076491._000430.pool.root.1
-ESD.076491._000431.pool.root.1
-ESD.076491._000432.pool.root.1
-ESD.076491._000435.pool.root.1
-ESD.076491._000437.pool.root.1
-ESD.076491._000439.pool.root.1
-ESD.076491._000440.pool.root.1
-ESD.076491._000442.pool.root.1
-ESD.076491._000443.pool.root.1
-ESD.076491._000444.pool.root.1
-ESD.076491._000445.pool.root.1
-ESD.076491._000447.pool.root.1
-ESD.076491._000448.pool.root.1
-ESD.076491._000449.pool.root.1
-ESD.076491._000450.pool.root.1
-ESD.076491._000451.pool.root.1
-ESD.076491._000452.pool.root.1
-ESD.076491._000453.pool.root.1
-ESD.076491._000454.pool.root.1
-ESD.076491._000455.pool.root.1
-ESD.076491._000456.pool.root.1
-ESD.076491._000458.pool.root.1
-ESD.076491._000459.pool.root.1
-ESD.076491._000460.pool.root.1
-ESD.076491._000461.pool.root.1
-ESD.076491._000462.pool.root.1
-ESD.076491._000463.pool.root.1
-ESD.076491._000464.pool.root.1
-ESD.076491._000466.pool.root.1
-ESD.076491._000469.pool.root.1
-ESD.076491._000470.pool.root.1
-ESD.076491._000473.pool.root.1
-ESD.076491._000474.pool.root.1
-ESD.076491._000475.pool.root.1
-ESD.076491._000477.pool.root.1
-ESD.076491._000478.pool.root.1
-ESD.076491._000479.pool.root.1
-ESD.076491._000480.pool.root.1
-ESD.076491._000483.pool.root.1
-ESD.076491._000484.pool.root.1
-ESD.076491._000485.pool.root.1
-ESD.076491._000486.pool.root.1
-ESD.076491._000487.pool.root.1
-ESD.076491._000488.pool.root.1
-ESD.076491._000489.pool.root.1
-ESD.076491._000490.pool.root.1
-ESD.076491._000492.pool.root.1
-ESD.076491._000493.pool.root.1
-ESD.076491._000494.pool.root.1
-ESD.076491._000495.pool.root.1
-ESD.076491._000497.pool.root.1
-ESD.076491._000499.pool.root.1
-ESD.076491._000500.pool.root.1
-ESD.076491._000501.pool.root.1
-ESD.076491._000502.pool.root.1
-ESD.076491._000503.pool.root.1
-ESD.076491._000504.pool.root.1
-ESD.076491._000505.pool.root.1
-ESD.076491._000506.pool.root.1
-ESD.076491._000509.pool.root.1
-ESD.076491._000510.pool.root.1
-ESD.076491._000511.pool.root.1
-ESD.076491._000513.pool.root.1
-ESD.076491._000514.pool.root.1
-ESD.076491._000515.pool.root.1
-ESD.076491._000517.pool.root.1
-ESD.076491._000518.pool.root.1
-ESD.076491._000520.pool.root.1
-ESD.076491._000521.pool.root.1
-ESD.076491._000522.pool.root.1
-ESD.076491._000523.pool.root.1
-ESD.076491._000525.pool.root.1
-ESD.076491._000528.pool.root.1
-ESD.076491._000530.pool.root.1
-ESD.076491._000531.pool.root.1
-ESD.076491._000532.pool.root.1
-ESD.076491._000533.pool.root.1
-ESD.076491._000534.pool.root.1
-ESD.076491._000535.pool.root.1
-ESD.076491._000536.pool.root.1
-ESD.076491._000537.pool.root.1
-ESD.076491._000540.pool.root.1
-ESD.076491._000541.pool.root.1
-ESD.076491._000543.pool.root.1
-ESD.076491._000545.pool.root.1
-ESD.076491._000546.pool.root.1
-ESD.076491._000547.pool.root.1
-ESD.076491._000548.pool.root.1
-ESD.076491._000550.pool.root.1
-ESD.076491._000551.pool.root.1
-ESD.076491._000552.pool.root.1
-ESD.076491._000554.pool.root.1
-ESD.076491._000555.pool.root.1
-ESD.076491._000556.pool.root.1
-ESD.076491._000558.pool.root.1
-ESD.076491._000559.pool.root.1
-ESD.076491._000562.pool.root.1
-ESD.076491._000564.pool.root.1
-ESD.076491._000567.pool.root.1
-ESD.076491._000568.pool.root.1
-ESD.076491._000569.pool.root.1
-ESD.076491._000570.pool.root.1
-ESD.076491._000571.pool.root.1
-ESD.076491._000572.pool.root.1
-ESD.076491._000573.pool.root.1
-ESD.076491._000574.pool.root.1
-ESD.076491._000575.pool.root.1
-ESD.076491._000576.pool.root.1
-ESD.076491._000577.pool.root.1
-ESD.076491._000579.pool.root.1
-ESD.076491._000580.pool.root.1
-ESD.076491._000582.pool.root.1
-ESD.076491._000584.pool.root.1
-ESD.076491._000585.pool.root.1
-ESD.076491._000591.pool.root.1
-ESD.076491._000592.pool.root.1
-ESD.076491._000594.pool.root.1
-ESD.076491._000595.pool.root.1
-ESD.076491._000596.pool.root.1
-ESD.076491._000597.pool.root.1
-ESD.076491._000598.pool.root.1
-ESD.076491._000599.pool.root.1
-ESD.076491._000600.pool.root.1
-ESD.076491._000604.pool.root.1
-ESD.076491._000605.pool.root.1
-ESD.076491._000606.pool.root.1
-ESD.076491._000607.pool.root.1
-ESD.076491._000608.pool.root.1
-ESD.076491._000609.pool.root.1
-ESD.076491._000610.pool.root.1
-ESD.076491._000613.pool.root.1
-ESD.076491._000614.pool.root.1
-ESD.076491._000615.pool.root.1
-ESD.076491._000616.pool.root.1
-ESD.076491._000618.pool.root.1
-ESD.076491._000619.pool.root.1
-ESD.076491._000620.pool.root.1
-ESD.076491._000621.pool.root.1
-ESD.076491._000622.pool.root.1
-ESD.076491._000623.pool.root.1
-ESD.076491._000624.pool.root.1
-ESD.076491._000626.pool.root.1
-ESD.076491._000627.pool.root.1
-ESD.076491._000628.pool.root.1
-ESD.076491._000629.pool.root.1
-ESD.076491._000631.pool.root.1
-ESD.076491._000632.pool.root.1
-ESD.076491._000633.pool.root.1
-ESD.076491._000634.pool.root.1
-ESD.076491._000635.pool.root.1
-ESD.076491._000636.pool.root.1
-ESD.076491._000637.pool.root.1
-ESD.076491._000640.pool.root.1
-ESD.076491._000642.pool.root.1
-ESD.076491._000643.pool.root.1
-ESD.076491._000644.pool.root.1
-ESD.076491._000645.pool.root.1
-ESD.076491._000647.pool.root.1
-ESD.076491._000648.pool.root.1
-ESD.076491._000649.pool.root.1
-ESD.076491._000653.pool.root.1
-ESD.076491._000655.pool.root.1
-ESD.076491._000656.pool.root.1
-ESD.076491._000657.pool.root.1
-ESD.076491._000658.pool.root.1
-ESD.076491._000659.pool.root.1
-ESD.076491._000660.pool.root.1
-ESD.076491._000662.pool.root.1
-ESD.076491._000663.pool.root.1
-ESD.076491._000664.pool.root.1
-ESD.076491._000665.pool.root.1
-ESD.076491._000666.pool.root.1
-ESD.076491._000667.pool.root.1
-ESD.076491._000668.pool.root.1
-ESD.076491._000669.pool.root.1
-ESD.076491._000670.pool.root.1
-ESD.076491._000671.pool.root.1
-ESD.076491._000672.pool.root.1
-ESD.076491._000673.pool.root.1
-ESD.076491._000674.pool.root.1
-ESD.076491._000675.pool.root.1
-ESD.076491._000676.pool.root.1
-ESD.076491._000678.pool.root.1
-ESD.076491._000680.pool.root.1
-ESD.076491._000681.pool.root.1
-ESD.076491._000682.pool.root.1
-ESD.076491._000683.pool.root.1
-ESD.076491._000684.pool.root.1
-ESD.076491._000685.pool.root.1
-ESD.076491._000686.pool.root.1
-ESD.076491._000687.pool.root.1
-ESD.076491._000688.pool.root.1
-ESD.076491._000689.pool.root.1
-ESD.076491._000690.pool.root.1
-ESD.076491._000691.pool.root.1
-ESD.076491._000692.pool.root.1
-ESD.076491._000694.pool.root.1
-ESD.076491._000695.pool.root.1
-ESD.076491._000696.pool.root.1
-ESD.076491._000699.pool.root.1
-ESD.076491._000702.pool.root.1
-ESD.076491._000703.pool.root.1
-ESD.076491._000704.pool.root.1
-ESD.076491._000705.pool.root.1
-ESD.076491._000706.pool.root.1
-ESD.076491._000707.pool.root.1
-ESD.076491._000708.pool.root.1
-ESD.076491._000710.pool.root.1
-ESD.076491._000711.pool.root.1
-ESD.076491._000712.pool.root.1
-ESD.076491._000713.pool.root.1
-ESD.076491._000714.pool.root.1
-ESD.076491._000715.pool.root.1
-ESD.076491._000716.pool.root.1
-ESD.076491._000717.pool.root.1
-ESD.076491._000718.pool.root.1
-ESD.076491._000720.pool.root.1
-ESD.076491._000722.pool.root.1
-ESD.076491._000724.pool.root.1
-ESD.076491._000725.pool.root.1
-ESD.076491._000726.pool.root.1
-ESD.076491._000727.pool.root.1
-ESD.076491._000728.pool.root.1
-ESD.076491._000729.pool.root.1
-ESD.076491._000733.pool.root.1
-ESD.076491._000734.pool.root.1
-ESD.076491._000735.pool.root.1
-ESD.076491._000736.pool.root.1
-ESD.076491._000737.pool.root.1
-ESD.076491._000738.pool.root.1
-ESD.076491._000739.pool.root.1
-ESD.076491._000740.pool.root.1
-ESD.076491._000741.pool.root.1
-ESD.076491._000742.pool.root.1
-ESD.076491._000743.pool.root.1
-ESD.076491._000744.pool.root.1
-ESD.076491._000745.pool.root.1
-ESD.076491._000746.pool.root.1
-ESD.076491._000747.pool.root.1
-ESD.076491._000748.pool.root.1
-ESD.076491._000750.pool.root.1
-ESD.076491._000751.pool.root.1
-ESD.076491._000753.pool.root.1
-ESD.076491._000755.pool.root.1
-ESD.076491._000756.pool.root.1
-ESD.076491._000757.pool.root.1
-ESD.076491._000758.pool.root.1
-ESD.076491._000759.pool.root.1
-ESD.076491._000761.pool.root.1
-ESD.076491._000763.pool.root.1
-ESD.076491._000765.pool.root.1
-ESD.076491._000766.pool.root.1
-ESD.076491._000768.pool.root.1
-ESD.076491._000769.pool.root.1
-ESD.076491._000771.pool.root.1
-ESD.076491._000772.pool.root.1
-ESD.076491._000773.pool.root.1
-ESD.076491._000774.pool.root.1
-ESD.076491._000776.pool.root.1
-ESD.076491._000778.pool.root.1
-ESD.076491._000779.pool.root.1
-ESD.076491._000780.pool.root.1
-ESD.076491._000781.pool.root.1
-ESD.076491._000783.pool.root.1
-ESD.076491._000786.pool.root.1
-ESD.076491._000787.pool.root.1
-ESD.076491._000788.pool.root.1
-ESD.076491._000791.pool.root.1
-ESD.076491._000792.pool.root.1
-ESD.076491._000793.pool.root.1
-ESD.076491._000794.pool.root.1
-ESD.076491._000795.pool.root.1
-ESD.076491._000796.pool.root.1
-ESD.076491._000797.pool.root.1
-ESD.076491._000798.pool.root.1
-ESD.076491._000800.pool.root.1
-ESD.076491._000803.pool.root.1
-ESD.076491._000804.pool.root.1
-ESD.076491._000805.pool.root.1
-ESD.076491._000806.pool.root.1
-ESD.076491._000807.pool.root.1
-ESD.076491._000808.pool.root.1
-ESD.076491._000809.pool.root.1
-ESD.076491._000810.pool.root.1
-ESD.076491._000811.pool.root.1
-ESD.076491._000813.pool.root.1
-ESD.076491._000814.pool.root.1
-ESD.076491._000815.pool.root.1
-ESD.076491._000816.pool.root.1
-ESD.076491._000817.pool.root.1
-ESD.076491._000818.pool.root.1
-ESD.076491._000819.pool.root.1
-ESD.076491._000822.pool.root.1
-ESD.076491._000823.pool.root.1
-ESD.076491._000826.pool.root.1
-ESD.076491._000827.pool.root.1
-ESD.076491._000828.pool.root.1
-ESD.076491._000830.pool.root.1
-ESD.076491._000831.pool.root.1
-ESD.076491._000832.pool.root.1
-ESD.076491._000833.pool.root.1
-ESD.076491._000834.pool.root.1
-ESD.076491._000837.pool.root.1
-ESD.076491._000838.pool.root.1
-ESD.076491._000839.pool.root.1
-ESD.076491._000842.pool.root.1
-ESD.076491._000843.pool.root.1
-ESD.076491._000844.pool.root.1
-ESD.076491._000845.pool.root.1
-ESD.076491._000846.pool.root.1
-ESD.076491._000847.pool.root.1
-ESD.076491._000848.pool.root.1
-ESD.076491._000849.pool.root.1
-ESD.076491._000850.pool.root.1
-ESD.076491._000851.pool.root.1
-ESD.076491._000853.pool.root.1
-ESD.076491._000856.pool.root.1
-ESD.076491._000857.pool.root.1
-ESD.076491._000858.pool.root.1
-ESD.076491._000859.pool.root.1
-ESD.076491._000862.pool.root.1
-ESD.076491._000863.pool.root.1
-ESD.076491._000864.pool.root.1
-ESD.076491._000865.pool.root.1
-ESD.076491._000867.pool.root.1
-ESD.076491._000868.pool.root.1
-ESD.076491._000869.pool.root.1
-ESD.076491._000870.pool.root.1
-ESD.076491._000871.pool.root.1
-ESD.076491._000873.pool.root.1
-ESD.076491._000874.pool.root.1
-ESD.076491._000875.pool.root.1
-ESD.076491._000876.pool.root.1
-ESD.076491._000879.pool.root.1
-ESD.076491._000880.pool.root.1
-ESD.076491._000881.pool.root.1
-ESD.076491._000882.pool.root.1
-ESD.076491._000883.pool.root.1
-ESD.076491._000884.pool.root.1
-ESD.076491._000885.pool.root.1
-ESD.076491._000886.pool.root.1
-ESD.076491._000887.pool.root.1
-ESD.076491._000889.pool.root.1
-ESD.076491._000890.pool.root.1
-ESD.076491._000891.pool.root.1
-ESD.076491._000892.pool.root.1
-ESD.076491._000894.pool.root.1
-ESD.076491._000895.pool.root.1
-ESD.076491._000897.pool.root.1
-ESD.076491._000898.pool.root.1
-ESD.076491._000899.pool.root.1
-ESD.076491._000900.pool.root.1
-ESD.076491._000901.pool.root.1
-ESD.076491._000902.pool.root.1
-ESD.076491._000905.pool.root.1
-ESD.076491._000908.pool.root.1
-ESD.076491._000909.pool.root.1
-ESD.076491._000911.pool.root.1
-ESD.076491._000912.pool.root.1
-ESD.076491._000913.pool.root.1
-ESD.076491._000914.pool.root.1
-ESD.076491._000915.pool.root.1
-ESD.076491._000917.pool.root.1
-ESD.076491._000919.pool.root.1
-ESD.076491._000920.pool.root.1
-ESD.076491._000922.pool.root.1
-ESD.076491._000925.pool.root.1
-ESD.076491._000926.pool.root.1
-ESD.076491._000928.pool.root.1
-ESD.076491._000929.pool.root.1
-ESD.076491._000931.pool.root.1
-ESD.076491._000932.pool.root.1
-ESD.076491._000933.pool.root.1
-ESD.076491._000934.pool.root.1
-ESD.076491._000935.pool.root.1
-ESD.076491._000936.pool.root.1
-ESD.076491._000937.pool.root.1
-ESD.076491._000938.pool.root.1
-ESD.076491._000940.pool.root.1
-ESD.076491._000941.pool.root.1
-ESD.076491._000943.pool.root.1
-ESD.076491._000944.pool.root.1
-ESD.076491._000945.pool.root.1
-ESD.076491._000948.pool.root.1
-ESD.076491._000949.pool.root.1
-ESD.076491._000951.pool.root.1
-ESD.076491._000954.pool.root.1
-ESD.076491._000955.pool.root.1
-ESD.076491._000958.pool.root.1
-ESD.076491._000959.pool.root.1
-ESD.076491._000961.pool.root.1
-ESD.076491._000962.pool.root.1
-ESD.076491._000963.pool.root.1
-ESD.076491._000964.pool.root.1
-ESD.076491._000965.pool.root.1
-ESD.076491._000966.pool.root.1
-ESD.076491._000967.pool.root.1
-ESD.076491._000969.pool.root.1
-ESD.076491._000971.pool.root.1
-ESD.076491._000972.pool.root.1
-ESD.076491._000975.pool.root.1
-ESD.076491._000977.pool.root.1
-ESD.076491._000980.pool.root.1
-ESD.076491._000983.pool.root.1
-ESD.076491._000987.pool.root.1
-ESD.076491._000988.pool.root.1
-ESD.076491._000990.pool.root.1
-ESD.076491._000992.pool.root.1
-ESD.076491._000993.pool.root.1
-ESD.076491._000994.pool.root.1
-ESD.076491._000995.pool.root.1
-ESD.076491._000996.pool.root.1
-ESD.076491._000997.pool.root.1
-ESD.076491._000998.pool.root.1
-ESD.076491._000999.pool.root.1
-ESD.076491._001000.pool.root.1
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py b/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py
deleted file mode 100755
index 4089e5b019abebf503829123f8466864cfabeb47..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py
+++ /dev/null
@@ -1,345 +0,0 @@
-####  Load Tracking Tools
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-globalflags.DataSource = 'geant4'
-globalflags.InputFormat = 'pool'
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AppMgr import ToolSvc,theApp,ServiceMgr
-from AthenaCommon.AthenaCommonFlags  import athenaCommonFlags
-from AthenaCommon.BeamFlags import jobproperties
-
-topSequence = AlgSequence()
-
-
-###############################################################################
-###############################################################################
-#######                  Tracking Realted Packaages                    ########
-###############################################################################
-###############################################################################
-#
-# load SCT ROT creator, we overwrite the defaults for it
-#
-from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__SCT_ClusterOnTrackTool
-SCT_ClusterOnTrackTool = InDet__SCT_ClusterOnTrackTool ("SCT_ClusterOnTrackTool",
-                                                          CorrectionStrategy = 0,  # do correct position bias
-                                                          ErrorStrategy      = 2)  # do use phi dependent errors
-from AthenaCommon.AppMgr import ToolSvc
-ToolSvc += SCT_ClusterOnTrackTool
-#
-# default ROT creator, not smart !
-#
-from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator
-ElectronRotCreator = Trk__RIO_OnTrackCreator(name            = 'ElectronRotCreator',
-                                       ToolSCT_Cluster = SCT_ClusterOnTrackTool,
-                                       Mode            = 'indet')
-ToolSvc += ElectronRotCreator      
-#
-# load error scaling
-#
-from IOVDbSvc.CondDB import conddb
-if not conddb.folderRequested('Indet/TrkErrorScaling'):
-    conddb.addFolder("INDET","/Indet/TrkErrorScaling")
-
-###############################################################################
-###############################################################################
-#######          Trk     Extraplotor Related Packaages                 ########
-###############################################################################
-###############################################################################   
- #
-# declare the extrapolator
-#
-from TrkMagFieldTools.TrkMagFieldToolsConf import Trk__MagneticFieldTool
-ElectronTrkMagField = Trk__MagneticFieldTool('ElectronTrkMagField')
-ToolSvc += ElectronTrkMagField
-#
-# set up geometry
-#
-include('TrkDetDescrSvc/AtlasTrackingGeometrySvc.py')
-from __main__ import AtlasTrackingGeometrySvc
-#
-# get propagator
-#
-from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as Propagator
-#
-ElectronTrkPropagator = Propagator(name = 'ElectronTrkPropagator')
-ElectronTrkPropagator.AccuracyParameter = 0.0001
-ToolSvc += ElectronTrkPropagator
-
-from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator as StepPropagator
-ElectronTrkStepPropagator = StepPropagator(name = 'ElectronTrkStepPropagator')
-ToolSvc += ElectronTrkStepPropagator
-#
-# Setup the Navigator (default, could be removed)
-#
-from TrkExTools.TrkExToolsConf import Trk__Navigator
-ElectronTrkNavigator = Trk__Navigator(name = 'ElectronTrkNavigator',
-                                #TrackingGeometrySvc = AtlasTrackingGeometrySvc
-                                )
-ToolSvc += ElectronTrkNavigator
-#
-# Setup the MaterialEffectsUpdator
-#
-from TrkExTools.TrkExToolsConf import Trk__MaterialEffectsUpdator
-ElectronTrkMaterialUpdator = Trk__MaterialEffectsUpdator(name = "ElectronTrkMaterialEffectsUpdator")
-ToolSvc += ElectronTrkMaterialUpdator
-
-# CONFIGURE PROPAGATORS/UPDATORS ACCORDING TO GEOMETRY SIGNATURE
-
-ElectronTrkSubPropagators = []
-ElectronTrkSubUpdators = []
-
-# -------------------- set it depending on the geometry ----------------------------------------------------
-# default for ID is (Rk,Mat)
-ElectronTrkSubPropagators += [ ElectronTrkPropagator.name() ]
-ElectronTrkSubUpdators    += [ ElectronTrkMaterialUpdator.name() ]
-
-# default for Calo is (Rk,MatLandau)
-ElectronTrkSubPropagators += [ ElectronTrkPropagator.name() ]
-ElectronTrkSubUpdators    += [ ElectronTrkMaterialUpdator.name() ]
-
-# default for MS is (STEP,Mat)
-ElectronTrkSubPropagators += [ ElectronTrkStepPropagator.name() ]
-ElectronTrkSubUpdators    += [ ElectronTrkMaterialUpdator.name() ]
-# ----------------------------------------------------------------------------------------------------------            
-
-#
-# set up extrapolator
-#
-from TrkExTools.TrkExToolsConf import Trk__Extrapolator
-ElectronTrkExtrapolator = Trk__Extrapolator(name                    = 'ElectronTrkExtrapolator',
-                                      Propagators             = [ ElectronTrkPropagator, ElectronTrkStepPropagator ],
-                                      MaterialEffectsUpdators = [ ElectronTrkMaterialUpdator ],
-                                      Navigator               = ElectronTrkNavigator,
-                                      SubPropagators          = ElectronTrkSubPropagators,
-                                      SubMEUpdators           = ElectronTrkSubUpdators,
-                                      DoCaloDynamic           = False)
-ToolSvc += ElectronTrkExtrapolator
-
- 
-
-###############################################################################
-###############################################################################
-#######                     GSF Realted Packaages                      ########
-###############################################################################
-###############################################################################
-
-from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GsfMaterialMixtureConvolution
-GsfMaterialUpdator = Trk__GsfMaterialMixtureConvolution (name = 'GsfMaterialUpdator')
-ToolSvc += GsfMaterialUpdator
-print      GsfMaterialUpdator
-#
-# component Reduction
-#
-from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__QuickCloseComponentsMultiStateMerger
-GsfComponentReduction = Trk__QuickCloseComponentsMultiStateMerger (name = 'GsfComponentReduction',
-                                                              MaximumNumberOfComponents = 12)
-ToolSvc += GsfComponentReduction
-print      GsfComponentReduction
-
-
-from TrkMeasurementUpdator.TrkMeasurementUpdatorConf import Trk__KalmanUpdator as ConfiguredKalmanUpdator
-ElectronUpdator = ConfiguredKalmanUpdator('ElectronUpdator')
-ToolSvc += ElectronUpdator
-   
-from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GsfMeasurementUpdator
-GsfMeasurementUpdator = Trk__GsfMeasurementUpdator( name    = 'GsfMeasurementUpdator',
-                                                  Updator = ElectronUpdator )
-ToolSvc += GsfMeasurementUpdator
-        
-
-
-from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GsfExtrapolator
-GsfExtrapolator = Trk__GsfExtrapolator(name                          = 'GsfExtrapolator',
-                                       Propagators                   = [ ElectronTrkPropagator ],
-                                       SearchLevelClosestParameters  = 10,
-                                       StickyConfiguration           = True,
-                                       Navigator                     = ElectronTrkNavigator,
-                                       GsfMaterialConvolution        = GsfMaterialUpdator,
-                                       ComponentMerger               = GsfComponentReduction,
-                                       SurfaceBasedMaterialEffects   = False )
-ToolSvc += GsfExtrapolator
-
-
-from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__BremFind
-BremFind = Trk__BremFind(name = 'BremFind',
-                         UseCalibration = True,
-                         ValidationMode = True )
-                         
-
-ToolSvc += BremFind
-
-from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GaussianSumFitter
-GSFTrackFitter = Trk__GaussianSumFitter(name                    = 'GSFTrackFitter',
-                                          ToolForExtrapolation    = GsfExtrapolator,
-                                          MeasurementUpdatorType  = GsfMeasurementUpdator,
-                                          ToolForROTCreation      = ElectronRotCreator,
-                                          ReintegrateOutliers     = True,
-                                          MakePerigee             = True,
-                                          RefitOnMeasurementBase  = True,
-                                          DoHitSorting            = True,
-                                          ValidationMode          = False,
-                                          BremFind                = BremFind,
-                                          runBremFinder           = False,
-                                          OutputLevel = 3)
-# --- end of fitter loading
-ToolSvc += GSFTrackFitter
-
-
-
-###############################################################################
-###############################################################################
-#######                     DNA Realted Packaages                      ########
-###############################################################################
-###############################################################################
-
-from InDetCompetingRIOsOnTrackTool.InDetCompetingRIOsOnTrackToolConf import InDet__CompetingPixelClustersOnTrackTool as IDCPCOTT
-ElectronCompetingPixelTool = IDCPCOTT(name='ElectronKalmanCompetingPixelClustersTool',
-                                WeightCutValueBarrel = 5.5,
-                                WeightCutValueEndCap = 5.5)
-ToolSvc+=ElectronCompetingPixelTool
-
-from InDetCompetingRIOsOnTrackTool.InDetCompetingRIOsOnTrackToolConf import InDet__CompetingSCT_ClustersOnTrackTool as IDCSCOTT
-ElectronCompetingSctTool = IDCSCOTT(name='ElectronKalmanCompetingSCT_ClustersTool',
-                              WeightCutValueBarrel = 5.5,
-                              WeightCutValueEndCap = 5.5)
-ToolSvc+=ElectronCompetingSctTool
-
-from TrkCompetingRIOsOnTrackTool.TrkCompetingRIOsOnTrackToolConf import Trk__CompetingRIOsOnTrackTool as CompRotTool
-ElectronKalmanCompetingROT_Tool = CompRotTool(name='ElectronKalmanCompetingRIOsTool',
-                                        ToolForCompPixelClusters = ElectronCompetingPixelTool,
-                                        ToolForCompSCT_Clusters = ElectronCompetingSctTool)
-ToolSvc += ElectronKalmanCompetingROT_Tool
-
-from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanPiecewiseAnnealingFilter as KPAF
-ElectronKalmanInternalDAF = KPAF(name = 'ElectronKalmanInternalDAF',
-                           CompetingRIOsOnTrackCreator = ElectronKalmanCompetingROT_Tool)
-ToolSvc += ElectronKalmanInternalDAF
-
-from TrkKalmanFitter.TrkKalmanFitterConf import Trk__MeasRecalibSteeringTool
-ElectronMeasRecalibST = Trk__MeasRecalibSteeringTool(name='ElectronMeasRecalibST')
-ToolSvc += ElectronMeasRecalibST
-
-from TrkDynamicNoiseAdjustor.TrkDynamicNoiseAdjustorConf import Trk__InDetDynamicNoiseAdjustment
-ElectronDNAdjustor = Trk__InDetDynamicNoiseAdjustment(name       = 'ElectronDNAdjustor')
-                                                #signifmin  = 0,
-                                                #lambdaxmin = 0)
-ToolSvc += ElectronDNAdjustor
-
-# Load Kalman Filter tools
-from TrkKalmanFitter.TrkKalmanFitterConf import Trk__ForwardKalmanFitter as PublicFKF
-ElectronFKF = PublicFKF(name                  = 'ElectronFKF',
-                  StateChi2PerNDFPreCut = 30.0)
-ToolSvc += ElectronFKF
-
-from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanSmoother as PublicBKS
-ElectronBKS = PublicBKS(name                        = 'ElectronBKS',
-                  InitialCovarianceSeedFactor = 200.)
-ToolSvc += ElectronBKS
-
-from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanOutlierLogic as PublicKOL
-ElectronKOL = PublicKOL(name               = 'ElectronKOL',
-                  TrackChi2PerNDFCut = 17.0,
-                  StateChi2PerNDFCut = 12.5,
-                  #BroadPixelClusterHandle = BroadPixelClusterOnTrackTool
-                  )
-ToolSvc += ElectronKOL
-
-from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanFitter as ConfiguredKalmanFitter
-DNATrackFitter = ConfiguredKalmanFitter(name                             = 'DNATrackFitter',
-                                        ExtrapolatorHandle             = ElectronTrkExtrapolator,
-                                        MeasurementUpdatorHandle       = ElectronUpdator,
-                                        ForwardKalmanFitterHandle      = ElectronFKF,
-                                        KalmanSmootherHandle           = ElectronBKS,
-                                        KalmanOutlierLogicHandle       = ElectronKOL,
-                                        DynamicNoiseAdjustorHandle     = ElectronDNAdjustor,
-                                        BrempointAnalyserHandle        = None,
-                                        AlignableSurfaceProviderHandle = None,
-                                        RIO_OnTrackCreatorHandle       = ElectronRotCreator,
-                                        #RecalibratorHandle             = ElectronMeasRecalibST,
-                                        RecalibratorHandle             = None,
-                                        InternalDAFHandle              = None#ElectronKalmanInternalDAF
-                                        )
-
-ToolSvc += DNATrackFitter
-
-
-
-###############################################################################
-###############################################################################
-#######                     GX2 Realted Packaages                      ########
-###############################################################################
-###############################################################################
-
-from TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf import Trk__GlobalChi2Fitter
-GX2TrackFitter = Trk__GlobalChi2Fitter(name                  = 'GX2TrackFitter',
-                                         OutputLevel = 4, 
-																				 ExtrapolationTool     = ElectronTrkExtrapolator,
-                                         NavigatorTool         = ElectronTrkNavigator,
-                                         PropagatorTool        = ElectronTrkPropagator,
-                                         RotCreatorTool        = ElectronRotCreator,
-                                         BroadRotCreatorTool   = None,
-                                         MeasurementUpdateTool = ElectronUpdator,
-                                         MagneticFieldTool     = ElectronTrkMagField,
-                                         StraightLine          = not InDetFlags.solenoidOn(),
-                                         OutlierCut            = 4,
-                                         SignedDriftRadius     = True,
-                                         ReintegrateOutliers   = False,
-                                         RecalibrateSilicon    = False,
-                                         RecalibrateTRT        = False,
-                                         TRTTubeHitCut         = 2.5,
-                                         MaxIterations         = 40,
-                                         Acceleration          = True,
-                                         RecalculateDerivatives= InDetFlags.doCosmics() or InDetFlags.doBeamHalo(),
-                                         TRTExtensionCuts      = True,
-                                         TrackChi2PerNDFCut    = 10)
-
-ToolSvc += GX2TrackFitter
-
-###############################################################################
-###############################################################################
-#######                    Refitting the Electrons                     ########
-###############################################################################
-###############################################################################
-
-
-job = AlgSequence()
-
-
-#######                 Loading egammaTrkRefitterTool                  ########
-
-
-from egammaTrackTools.egammaTrackToolsConf import egammaTrkRefitterTool
-## ElectronRefitterTool = egammaTrkRefitterTool(name = 'ElectronRefitterTool',
-## #                                            FitterTool = GSFTrackFitter,
-##                                             FitterTool = GX2TrackFitter,
-## #                                            RemoveTRTHits = True,
-##                                             matEffects = 1,
-##                                             minNoSiHits = -1,
-##                                             useBeamSpot = False,
-##                                             OutputLevel =4)
-## ToolSvc += ElectronRefitterTool
-ElectronRefitterTool = egammaTrkRefitterTool(name = 'ElectronRefitterTool',
-                                             FitterTool = GX2TrackFitter,
-                                             matEffects = 3,
-                                            RemoveTRTHits = True,
-                                             minNoSiHits = -1,
-                                              useBeamSpot = False,
-                                              OutputLevel =4)
-ToolSvc += ElectronRefitterTool
-
-ElectronRefitterTool2 = egammaTrkRefitterTool(name = 'ElectronRefitterTool2',
-                                             FitterTool = GX2TrackFitter,
-                                             matEffects = 3,
- #                                            RemoveTRTHits = True,
-                                             minNoSiHits = -1,
-                                              useBeamSpot = False,
-                                              OutputLevel =4)
-ToolSvc += ElectronRefitterTool2
-
-
-GSFTrackCollection = "GSFTracks"
-DNATrackCollection = "DNATracks"
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/GenericTracks.py b/InnerDetector/InDetExample/InDetAlignExample/share/GenericTracks.py
deleted file mode 100644
index 0716c1e49c1c0b3de8314a1a813f0c225155a9c7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/GenericTracks.py
+++ /dev/null
@@ -1,573 +0,0 @@
-################################
-# setup of alignment monitoring
-
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-
-InDetAlignMonManager = AthenaMonManager( name                = "InDetAlignMonManager",
-                                         FileKey             = DQMonFlags.monManFileKey(),
-                                         ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                         DataType            = DQMonFlags.monManDataType(),
-                                         Environment         = DQMonFlags.monManEnvironment(),
-                                         ManualRunLBSetup    = DQMonFlags.monManManualRunLBSetup(),
-                                         Run                 = DQMonFlags.monManRun(),
-                                         LumiBlock           = DQMonFlags.monManLumiBlock())
-
-tracks = InDetKeys.xAODTrackParticleContainer()
-
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMon__TrackSelectionTool
-from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-
-# Tracks For LoosePrimary Selection
-
-# All tracks selection
-m_allSelection = InDetAlignMon__TrackSelectionTool(
-    name = "InDetAlignMonTrackSelectionTool",
-    PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-    PassAllTracks = True, ## Uncomment this line to bypass track slection
-)
-
-
-m_TrackSelectorTool_LoosePrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoosePrimary",
-                                                                  UseTrkTrackTools = True,
-                                                                  minPt = 5000,
-                                                                  maxD0 = 100000,
-                                                                  maxZ0SinTheta = 150,
-                                                                  minNTrtHits = 0,
-                                                                  CutLevel = "LoosePrimary",
-                                                                  TrackSummaryTool    = InDetTrackSummaryTool,
-                                                                  Extrapolator        = InDetExtrapolator)
-ToolSvc += m_allSelection
-ToolSvc += m_TrackSelectorTool_LoosePrimary
-
-
-#m_TrackSelectorTool_AlignTracks = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorAlignTracks",
-#                                                                 UseTrkTrackTools = True,
-#                                                                 minPt = newInDetAlignAlg_Options["PtCut"],
-#                                                                 maxD0 = 500,
-#                                                                 maxZ0 = 500,
-#                                                                 minNPixelHits = 1,
-#                                                                 minNPixelHitsPhysical = 1,
-#                                                                 minNSiHits = 5,
-#                                                                 minNSiHitsPhysical = 7,
-#                                                                 minNTrtHits  = 25,
-#                                                                 CutLevel = "Loose",
-#                                                                 TrackSummaryTool    = InDetTrackSummaryTool,
-#                                                                 Extrapolator        = InDetExtrapolator)
-
-#if Cosmics:
-#    m_TrackSelectorTool_AlignTracks = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorAlignTracks",
-#                                                                     UseTrkTrackTools = True,
-#                                                                     minPt = newInDetAlignAlg_Options["PtCut"],
-#                                                                     maxD0 = 9999.,
-#                                                                     maxZ0 = 9999.,
-#                                                                     minNPixelHits = 1,
-#                                                                     minNSctHits = 8,
-#                                                                     minNSiHitsModTop = 2,
-#                                                                     minNSiHitsModBottom = 2,
-#                                                                     minNTrtHits = 25,
-#                                                                     CutLevel = "Loose",
-#                                                                     TrackSummaryTool    = InDetTrackSummaryTool,
-#                                                                     Extrapolator        = InDetExtrapolator)
-#
-#ToolSvc += m_TrackSelectorTool_AlignTracks
-
-
-
-
-LPSelection = InDetAlignMon__TrackSelectionTool(
-    name = "InDetAlignMonTracksSelectionTool_LP",
-    PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-    UseIDTrackSelectionTool = True,
-    IDTrackSelectionTool = m_TrackSelectorTool_LoosePrimary)
-ToolSvc += LPSelection
-
-
-#AlignSelection = InDetAlignMon__TrackSelectionTool(
-#    name = "InDetAlignMonTracksSelectionTool_AlignSelection",
-#    PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-#    UseIDTrackSelectionTool = True,
-#    IDTrackSelectionTool = m_TrackSelectorTool_AlignTracks)
-#ToolSvc += AlignSelection
-
-# Align tracks selection
-if newInDetAlignAlg_Options["useTrackSelector"]:
-    alignTrackSelection = InDetAlignMon__TrackSelectionTool(
-                            name = "InDetAlignMonAlignTrackSelectionTool",
-                            PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-                            UseIDTrackSelectionTool = True,
-                            #PassAllTracks = True, ## Uncomment this line to bypass track slection
-                            IDTrackSelectionTool = trackSelectorNew)
-                            
-    ToolSvc += alignTrackSelection
-
-
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonResiduals
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonEfficiencies
-
-
-InDetAlignMonResiduals = IDAlignMonResiduals(
-    name = "InDetAlignMonResiduals_AlignSel",
-    trackSelection = alignTrackSelection,
-    #tracksName = "ExtendedTracks",
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    useExtendedPlots = True,
-    doClusterSizeHistos = True,
-    triggerChainName = "AlignSel",
-    Pixel_Manager = InDetKeys.PixelManager(),
-    SCT_Manager = InDetKeys.SCT_Manager(),
-    TRT_Manager = InDetKeys.TRT_Manager(),
-    minPIXResXFillRange = -0.2,
-    maxPIXResXFillRange =  0.2,
-    minPIXResYFillRange = -0.5,
-    maxPIXResYFillRange =  0.5,
-    minSCTResFillRange  = -0.2,
-    maxSCTResFillRange =   0.2,
-    minTRTResidualWindow =-2.0,
-    maxTRTResidualWindow = 2.0,
-    NSplitMap  = 3,
-    RangeOfPullHistos  =   5.0,
-    OutputLevel=0
-    )
-print InDetAlignMonResiduals
-
-ToolSvc += InDetAlignMonResiduals
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-    name = "InDetAlignMonGenericTracks_AlignSel",
-    trackSelection = alignTrackSelection,
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    useExtendedPlots = True,
-    triggerChainName = "AlignSel",
-    d0Range = 5,
-    z0Range = 200,
-    #NTracksRange = 10,
-    VxPrimContainerName = InDetKeys.xAODVertexContainer()
-    )
-ToolSvc += InDetAlignMonGenericTracks
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-if Cosmics:
-    InDetAlignMonGenericTracks.d0Range = 500
-    InDetAlignMonGenericTracks.z0Range = 1000
-
-InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-    name = "InDetAlignMonEfficiencies_AlignSel",
-    #doHoleSearch = False,
-    trackSelection = alignTrackSelection,
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    triggerChainName = "AlignSel",
-    #HoleSearch = InDetExtendedHoleSearchTool,
-    Pixel_Manager = InDetKeys.PixelManager(),
-    SCT_Manager = InDetKeys.SCT_Manager(),
-    TRT_Manager = InDetKeys.TRT_Manager()
-    )
-
-ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-
-
-InDetAlignMonResiduals = IDAlignMonResiduals(
-    name = "InDetAlignMonResiduals_LoosePrimary",
-    trackSelection = m_allSelection,
-    #tracksName = "ExtendedTracks",
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    useExtendedPlots = True,
-    doClusterSizeHistos = True,
-    triggerChainName = "LoosePrimary",
-    Pixel_Manager = InDetKeys.PixelManager(),
-    SCT_Manager = InDetKeys.SCT_Manager(),
-    TRT_Manager = InDetKeys.TRT_Manager(),
-    minPIXResXFillRange = -0.2,
-    maxPIXResXFillRange =  0.2,
-    minPIXResYFillRange = -0.5,
-    maxPIXResYFillRange =  0.5,
-    minSCTResFillRange  = -0.2,
-    maxSCTResFillRange =   0.2,
-    minTRTResidualWindow =-2.0,
-    maxTRTResidualWindow = 2.0,
-    NSplitMap  = 3,
-    RangeOfPullHistos  =   5.0,
-    OutputLevel=0
-    )
-print InDetAlignMonResiduals
-
-ToolSvc += InDetAlignMonResiduals
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-    name = "InDetAlignMonGenericTracks_LoosePrimary",
-    trackSelection = LPSelection,
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    useExtendedPlots = True,
-    triggerChainName = "LoosePrimary",
-    d0Range = 5,
-    z0Range = 200,
-    #NTracksRange = 10,
-    VxPrimContainerName = InDetKeys.xAODVertexContainer()
-    )
-ToolSvc += InDetAlignMonGenericTracks
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-if Cosmics:
-    InDetAlignMonGenericTracks.d0Range = 500
-    InDetAlignMonGenericTracks.z0Range = 1000
-
-InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-    name = "InDetAlignMonEfficiencies_LoosePrimary",
-    #doHoleSearch = False,
-    trackSelection = LPSelection,
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    triggerChainName = "LoosePrimary",
-    #HoleSearch = InDetExtendedHoleSearchTool,
-    Pixel_Manager = InDetKeys.PixelManager(),
-    SCT_Manager = InDetKeys.SCT_Manager(),
-    TRT_Manager = InDetKeys.TRT_Manager()
-    )
-
-ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-
-
-InDetAlignMonResiduals = IDAlignMonResiduals(
-    name = "InDetAlignMonResiduals_all",
-    trackSelection = m_allSelection,
-    #tracksName = "ExtendedTracks",
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    useExtendedPlots = True,
-    doClusterSizeHistos = True,
-    triggerChainName = "all",
-    Pixel_Manager = InDetKeys.PixelManager(),
-    SCT_Manager = InDetKeys.SCT_Manager(),
-    TRT_Manager = InDetKeys.TRT_Manager(),
-    minPIXResXFillRange = -0.2,
-    maxPIXResXFillRange =  0.2,
-    minPIXResYFillRange = -0.5,
-    maxPIXResYFillRange =  0.5,
-    minSCTResFillRange  = -0.2,
-    maxSCTResFillRange =   0.2,
-    minTRTResidualWindow =-2.0,
-    maxTRTResidualWindow = 2.0,
-    NSplitMap  = 3,
-    RangeOfPullHistos  =   5.0,
-    OutputLevel=0
-    )
-print InDetAlignMonResiduals
-
-ToolSvc += InDetAlignMonResiduals
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-    name = "InDetAlignMonGenericTracks_all",
-    trackSelection = m_allSelection,
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    useExtendedPlots = True,
-    triggerChainName = "all",
-    d0Range = 5,
-    z0Range = 200,
-    #NTracksRange = 10,
-    VxPrimContainerName = InDetKeys.xAODVertexContainer()
-    )
-ToolSvc += InDetAlignMonGenericTracks
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-if Cosmics:
-    InDetAlignMonGenericTracks.d0Range = 500
-    InDetAlignMonGenericTracks.z0Range = 1000
-
-InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-    name = "InDetAlignMonEfficiencies_all",
-    #doHoleSearch = False,
-    trackSelection = m_allSelection,
-    tracksName = InDetKeys.xAODTrackParticleContainer(),
-    triggerChainName = "all",
-    #HoleSearch = InDetExtendedHoleSearchTool,
-    Pixel_Manager = InDetKeys.PixelManager(),
-    SCT_Manager = InDetKeys.SCT_Manager(),
-    TRT_Manager = InDetKeys.TRT_Manager()
-    )
-
-ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-#TriggerChainName is only the name passed to the monitoring folder
-
-if not Cosmics:
-    from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot
-    InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name                           = "InDetAlignMonBeamSpot_noTrig",
-                                                          extrapolator                   = InDetExtrapolator,
-                                                          vxContainerName                = InDetKeys.PrimaryVertices(),
-                                                          vxContainerWithBeamConstraint  = InDetFlags.useBeamConstraint())
-    ToolSvc += InDetAlignMonBeamSpot_noTrig
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonBeamSpot_noTrig ]
-
-###############################################    
-# trying to implement the track segments for cosmics
-
-if Cosmics:
-    from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool
-    from InDetTrackValidation.InDetTrackValidationConf import InDet__InDetSplittedTracksCreator 
-    from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonTrackSegments
-    
-    #----- tools for track splliting ---- START ----
-    splittertoolcomb= InDet__InDetTrackSplitterTool(name="VARO_SplitterTool",
-                                                    TrackFitter           = InDetTrackFitter, #InDetTrackFitter,
-                                                    OutputUpperTracksName = "TracksUpperSplit",
-                                                    OutputLowerTracksName = "TracksLowerSplit",
-                                                    OutputLevel = INFO) 
-    ToolSvc += splittertoolcomb
-    print splittertoolcomb
-
-    # tool to convert to xAOD::TrackParticles 
-    from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool
-    InDetxAODSplitParticleCreatorTool = Trk__TrackParticleCreatorTool(name = "InDetSplitxAODParticleCreatorTool", 
-                                                                      Extrapolator            = InDetExtrapolator,
-                                                                      TrackSummaryTool        = InDetTrackSummaryToolSharedHits,
-                                                                      ForceTrackSummaryUpdate = False,
-                                                                      KeepParameters          = True, 
-                                                                      OutputLevel = DEBUG)
-    ToolSvc += InDetxAODSplitParticleCreatorTool
-    #----- tools for track splliting ---- COMPLETED ----
-
-    #
-    #### first task #### prepare the segment track selectors
-    #
-    
-    #--> needed ? InDetAlignMonManager.DataType = "cosmics"
-    m_alignMonTrackSelectorTool  = []
-    m_alignMonTrackSelectionTool = []
-
-    m_trackSelectorToolName       = ["AlignTracksTrackSelectorTool", "CombinedTracksTrackSelectorTool"]
-
-    m_nHitBLayer                   = [ 0,  0]
-    m_nHitPix                      = [ 1,  1]
-    m_nHitSct                      = [ 7,  7]
-    m_nHitSi                       = [ 9,  9]
-    m_nHitTrt                      = [25, 25]
-
-    m_alignMonTrackSelectionToolName = ["AlignTracksTrackSelectionTool", "CombinedTracksSelectionTool"]
-
-    from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-    for i in range(len(m_alignMonTrackSelectionToolName)):
-        print " <NewInDetAlignMonitoring> step ",i," --> setting track SELECTOR:", m_trackSelectorToolName[i]    
-        m_alignMonTrackSelectorTool.append(InDet__InDetDetailedTrackSelectorTool(name            = m_trackSelectorToolName[i],
-                                                                                pTMin            = 1000,#1 GeV
-                                                                                IPd0Max          = 1000.0,#no cut on d0 yet
-                                                                                IPz0Max          = 1200.0,#actual cut is on sin(theta)*z0
-                                                                                nHitBLayer       = m_nHitBLayer[i],
-                                                                                nHitPix          = m_nHitPix[i],
-                                                                                nHitSct          = m_nHitSct[i],
-                                                                                nHitSi           = m_nHitSi[i],
-                                                                                nHitTrt          = m_nHitTrt[i],
-                                                                                nSharedSct       = 0,
-                                                                                TrackSummaryTool = InDetTrackSummaryTool,
-                                                                                Extrapolator     = InDetExtrapolator))
-        ToolSvc += m_alignMonTrackSelectorTool[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_alignMonTrackSelectorTool[i]
-    
-           
-        m_alignMonTrackSelectionTool.append(InDetAlignMon__TrackSelectionTool(name              = m_alignMonTrackSelectionToolName[i],
-                                                                              ## Uncomment this line to bypass track slection
-                                                                              #PassAllTracks      = True,
-                                                                              #DoEventPhaseCut  = True,
-                                                                              TrackSelectorTool   = m_alignMonTrackSelectorTool[i]))
-
-        ToolSvc += m_alignMonTrackSelectionTool[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print " <NewInDetAlignMonitoring> ** SELECTION ** m_alignMonTrackSelectionTool[",i,"] =",  m_alignMonTrackSelectionToolName[i]
-            print m_alignMonTrackSelectionTool[i]
-
-    
-    #
-    ##### second task #### define the input track collections and the output segment collections
-    #
-    m_trackSplitter       = []
-    m_trackSplitterName   = ["TrackSplitterTool_AlignTracks","TrackSplitterTool_Combined"]
-    m_upperTracksName     = ["AlignTracks_Upper",            "Combined_Upper"]
-    m_lowerTracksName     = ["AlignTracks_Lower",            "Combined_Lower"]
-    #m_Splitter            = []
-    
-    m_trackSegmentsUpLow     = []
-    m_trackSegmentsUpLowName = ["InDetAlignMonTrackSegment_AlignTracks", "InDetAlignMonTrackSegments_Combined"]
-    
-    m_inputTracksUpLow    = ["AlignTracks", "CombinedInDetTracks"]
-    m_d0Range             = [ 200.0, 200.0]
-    m_deltaD0             = [  0.25,  0.25]
-    m_deltaD02D           = [   1.0,   1.0]
-    m_deltaPhi            = [ 0.002, 0.002]
-    m_deltaPhi2D          = [  0.02,  0.02]
-    m_deltaQoverPt        = [ 0.010, 0.010]
-    m_deltaQoverPt2D      = [  0.05,  0.05]
-
-    for i in range(len(m_trackSplitterName)):
-        print " <NewInDetAlignMonitoring> Setting track splitter",i,":", m_trackSplitterName[i], " for upper:",m_upperTracksName[i]," and lower:",  m_lowerTracksName[i] 
-        m_trackSplitter.append(InDet__InDetTrackSplitterTool(name                  = m_trackSplitterName[i],
-                                                             TrackFitter           = InDetTrackFitter,
-                                                             OutputUpperTracksName = m_upperTracksName[i],
-                                                             OutputLowerTracksName = m_lowerTracksName[i],
-                                                             OutputLevel = INFO))
-        ToolSvc += m_trackSplitter[i] # add the track splitter to the ToolSvc
-        if (InDetFlags.doPrintConfigurables()): print m_trackSplitter[i]
-        print " "
-        print " **** WARNING **** "
-        print " * "
-        print " *  in case of crash due to AttributeError: InDet__InDetSplittedTracksCreator object has no attribute takeUpperSegment "
-        print " *  please check out the following package: InnerDetector/InDetValidation/InDetTrackValidation "
-        print " *"
-        print " *  thanks for your understanding"    
-        print " "
-        print " ***************** "
-
-            
-        # monitoring part of the track segments matchinv
-        m_trackSegmentsUpLow.append(IDAlignMonTrackSegments(name                = m_trackSegmentsUpLowName[i],
-                                                            InputTracksName     = m_inputTracksUpLow[i],
-                                                            UpperTracksName     = m_upperTracksName[i],
-                                                            LowerTracksName     = m_lowerTracksName[i],
-                                                            UseCTBSplitTracks   = False, # if True -> tracks were split somewhere else. if False -> tracks splitted here
-                                                            TrackSplitter       = m_trackSplitter[i], #Need the even ones
-                                                            trackSelectionUp    = m_alignMonTrackSelectionTool[i],#[2*i+1],
-                                                            trackSelectionLow   = m_alignMonTrackSelectionTool[i],#[2*i+1],
-                                                            trackSumTool        = InDetTrackSummaryTool,
-                                                            DeltaD0Range        = m_deltaD0[i],
-                                                            DeltaD0Range2D      = m_deltaD02D[i],
-                                                            DeltaPhiRange       = m_deltaPhi[i],
-                                                            DeltaPhiRange2D     = m_deltaPhi2D[i],
-                                                            DeltaQoverPtRange   = m_deltaQoverPt[i],
-                                                            DeltaQoverPtRange2D = m_deltaQoverPt2D[i],
-                                                            D0Range             = m_d0Range[i],
-                                                            OutputLevel = WARNING))
-
-        ToolSvc += m_trackSegmentsUpLow[i]
-        InDetAlignMonManager.AthenaMonTools += [ m_trackSegmentsUpLow[i] ]
-        print " <NewInDetAlignMonitoring> step ",i, m_trackSegmentsUpLowName[i]," added to the ToolSvc"
-
-    #
-    #### third task #### define monitoring histograms for each cosmic ray track segment 
-    #
-    # 1) create and fill the track-collections list
-    m_trkcolls = []
-    for i in range(len(m_trackSplitterName)):
-        m_trkcolls.append(m_upperTracksName[i]+"Split") 
-        m_trkcolls.append(m_lowerTracksName[i]+"Split")
-
-        # 2) convert the tracks to xAOD
-        # 2.1 ) upper track segments
-        splitter_TakeUpper=InDet__InDetSplittedTracksCreator(name=m_inputTracksUpLow[i]+'_Splitter_TakeUpper',
-                                                   TrackSplitterTool     = splittertoolcomb,
-                                                   TrackCollection       = m_inputTracksUpLow[i], #"Tracks",
-                                                   OutputTrackCollection = m_upperTracksName[i]+"Split", #"Tracks_split",
-                                                   takeUpperSegment      = True,
-                                                   takeLowerSegment      = False,
-                                                   OutputLevel = INFO)
-        topSequence += splitter_TakeUpper
-        print splitter_TakeUpper
-
-        xAODSplitTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg(name=m_inputTracksUpLow[i]+'_Splitter_TakeUpper_xAOD',#name = 'InDetSplitTrackParticles',
-                                                                      xAODContainerName ="xAOD::TrackParticleContainer", #'InDetSplitTrackParticles',
-                                                                      xAODTrackParticlesFromTracksContainerName =  m_upperTracksName[i]+"Split",#'InDetSplitTrackParticles',
-                                                                      TrackParticleCreator = InDetxAODSplitParticleCreatorTool,
-                                                                      TrackContainerName = m_upperTracksName[i]+"Split", #'Tracks_split',
-                                                                      ConvertTrackParticles = False,
-                                                                      ConvertTracks = True,
-                                                                      AddTruthLink = False,
-                                                                      PrintIDSummaryInfo = True, 
-                                                                      OutputLevel = INFO)
-        topSequence += xAODSplitTrackParticleCnvAlg
-        
-        # 2.2 ) lower track segments (same as above)
-        splitter_TakeLower=InDet__InDetSplittedTracksCreator(name=m_inputTracksUpLow[i]+'_Splitter_TakeLower',
-                                                   TrackSplitterTool     = splittertoolcomb,
-                                                   TrackCollection       = m_inputTracksUpLow[i], #"Tracks",
-                                                   OutputTrackCollection = m_lowerTracksName[i]+"Split", 
-                                                   takeUpperSegment      = False,
-                                                   takeLowerSegment      = True,
-                                                   OutputLevel = INFO)
-        topSequence += splitter_TakeLower
-        print splitter_TakeLower
-
-        xAODSplitTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg(name=m_inputTracksUpLow[i]+'_Splitter_TakeLower_xAOD',
-                                                                      xAODContainerName ="xAOD::TrackParticleContainer", 
-                                                                      xAODTrackParticlesFromTracksContainerName =  m_lowerTracksName[i]+"Split",
-                                                                      TrackParticleCreator = InDetxAODSplitParticleCreatorTool,
-                                                                      TrackContainerName = m_lowerTracksName[i]+"Split",
-                                                                      ConvertTrackParticles = False,
-                                                                      ConvertTracks = True,
-                                                                      AddTruthLink = False,
-                                                                      PrintIDSummaryInfo = True, 
-                                                                      OutputLevel = INFO)
-        topSequence += xAODSplitTrackParticleCnvAlg
-
-        
-    # 3) now create the monitoring histos
-    for i in range(len(m_trkcolls)):
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonResiduals for track collection: ", m_trkcolls[i]
-        InDetAlignMonResiduals = IDAlignMonResiduals(
-            name = "InDetAlignMonResiduals_"+m_trkcolls[i],
-            trackSelection = m_allSelection,
-            tracksName = m_trkcolls[i],
-            useExtendedPlots = True,
-            doClusterSizeHistos = True,
-            triggerChainName = "all",
-            Pixel_Manager = InDetKeys.PixelManager(),
-            SCT_Manager = InDetKeys.SCT_Manager(),
-            TRT_Manager = InDetKeys.TRT_Manager(),
-            minPIXResXFillRange = -0.40,
-            maxPIXResXFillRange =  0.40,
-            minPIXResYFillRange = -0.80,
-            maxPIXResYFillRange =  0.80,
-            minSCTResFillRange  = -0.4,
-            maxSCTResFillRange =   0.4,
-            minTRTResidualWindow =-2.5,
-            maxTRTResidualWindow = 2.5,
-            NSplitMap  = 1,
-            RangeOfPullHistos  =   5.00,
-            OutputLevel = WARNING
-            )
-        ToolSvc += InDetAlignMonResiduals
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-        InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-            name = "InDetAlignMonGenericTracks_"+m_trkcolls[i],
-            trackSelection = m_allSelection,
-            tracksName = m_trkcolls[i],
-            useExtendedPlots = True,
-            triggerChainName = "all",
-            d0Range = 500,
-            z0Range = 1000,
-            VxPrimContainerName = InDetKeys.xAODVertexContainer()
-            )
-        ToolSvc += InDetAlignMonGenericTracks
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-        
-        InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-            name = "InDetAlignMonEfficiencies_"+m_trkcolls[i],
-            trackSelection = m_allSelection,
-            tracksName = m_trkcolls[i],
-            #doHoleSearch = False,
-            triggerChainName = "all",
-            #HoleSearch = InDetExtendedHoleSearchTool,
-            Pixel_Manager = InDetKeys.PixelManager(),
-            SCT_Manager = InDetKeys.SCT_Manager(),
-            TRT_Manager = InDetKeys.TRT_Manager()
-            )
-        ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-        
-
-###############################################    
-if not hasattr(ServiceMgr, 'THistSvc'):
-    from GaudiSvc.GaudiSvcConf import THistSvc
-    ServiceMgr += THistSvc()
-
-
-#include("AthenaMonitoring/DQMonFlagsConfig_jobOptions.py")
-THistSvc         = Service( "THistSvc" )
-#histOutput       = DQMonFlags.monManFileKey()+" DATAFILE='monitoring.root' OPT='RECREATE'"
-histOutput       = "IDAlignMon DATAFILE='./monitoring.root' OPT='RECREATE'"
-THistSvc.Output += [histOutput]
-InDetAlignMonManager.FileKey = "IDAlignMon"
-topSequence += InDetAlignMonManager
-print InDetAlignMonManager
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/GetRunFiles.py b/InnerDetector/InDetExample/InDetAlignExample/share/GetRunFiles.py
deleted file mode 100644
index c8d5b09d919cdcf8f9985fa87158a3aff1c02eeb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/GetRunFiles.py
+++ /dev/null
@@ -1,84 +0,0 @@
-##--------------------------
-# usage:
-#
-# GetRunFiles.py RunNumber
-#
-##--------------------------
-
-import sys, os, fileinput
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-	from optparse import OptionParser
-	parser = OptionParser()
-	parser.add_option("--DaqMerge", dest="inputDaqMerge", help="folder type name where the files stand: either daq or merge", default="merge") 
-	parser.add_option("--Label", dest="inputLabel", help="suffix label for the output file", default="") 
-	parser.add_option("--Project", dest="inputProject", help="define the data project. Necessary to search for the files (default data15_13TeV)", default= "data15_13TeV")
-	parser.add_option("--Run", dest="inputRun", help="run number", default="")
-	parser.add_option("--Stream", dest="inputStream", help="wanted data stream (default calibration_IDTracks)", default= "calibration_IDTracks")
-	
-	(config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-	return config
-	
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputRun = config.inputRun
-FileLabel = config.inputLabel
-DataProject = config.inputProject
-DataStream = config.inputStream
-daqmerge = config.inputDaqMerge
-
-#in case only one argument is given, it is taken as the run number
-if (len(inputRun) == 0): 
-    RunNumber =  sys.argv[1]
-else:
-    RunNumber = inputRun
-
-
-##########################################################
-#               other variables
-##########################################################
-#if ("IDTracks" in DataStream): daqmerge = "daq"
-
-#######################
-tempOutputFile = "Run_"+RunNumber+"_temp.txt"
-
-OutputFile = "Run_" + RunNumber + ".txt"
-if (len(FileLabel)>1): 
-    OutputFile = "Run_" + RunNumber + "_" + FileLabel + ".txt"
-
-print " <GetRunFiles> RunNumber    = ", RunNumber
-print " <GetRunFiles> Project      = ", DataProject
-print " <GetRunFiles> Stream       = ", DataStream
-print " <GetRunFiles> DaqMerge     = ", daqmerge
-print " <GetRunFiles> FileLabel    = ", FileLabel
-print " <GetRunFiles> OutputFile   = ", OutputFile
- 
-#os.system("ls -l ~/eos/atlas/atlastier0/rucio/%s/%s/00%s/data15_comm.00%s.%s.merge.RAW" %(DataProject, DataStream,  RunNumber, RunNumber,  DataStream))
-os.system("ls -l  ~/eos/atlas/atlastier0/rucio/%s/%s/00%s/%s.00%s.%s.%s.RAW | gawk \'{print \"root://eosatlas.cern.ch//eos/atlas/atlastier0/rucio/%s/%s/00%s/%s.00%s.%s.%s.RAW/\"$9}\' > %s"  %(DataProject, DataStream,  RunNumber, DataProject, RunNumber,  DataStream, daqmerge, DataProject, DataStream, RunNumber, DataProject, RunNumber, DataStream, daqmerge, tempOutputFile)) 
-
-outputf = open(OutputFile, 'w')
-count=0
-with open (tempOutputFile,'rb') as f:
-    for line in f:
-        count+=1
-        if (count > 1):
-            #print " line: ", count, "  = ",line
-            outputf.write(line)
-        
-outputf.close()
-
-os.system("rm -f %s" %tempOutputFile)
- 
-print " File --> ", OutputFile, " has ", count-1, " lines"
-if (count == 0):
-    print " <GetRunFiles> WARNING: when selecting files make sure what type of folder contains the files: either daq or merge suffix"
-
-    
-print " <GetRunFiles> GAME OVER. INSERT COIN. "
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/GetRunFiles_fromScratchdisk.sh b/InnerDetector/InDetExample/InDetAlignExample/share/GetRunFiles_fromScratchdisk.sh
deleted file mode 100755
index 7aebc58f038362f65dd723738672cd8a7e5b9873..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/GetRunFiles_fromScratchdisk.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-#
-
-Run=$1
-stream=$2   #calibration_IDTracks
-path=$3 
-eosheader="root://eosatlas.cern.ch"
-daqmerge="daq"
-
-echo " Run =  ${Run}"
-if [ -z "$path" ]
-then 
-    echo " Empty input path. Setting it to ./data/"
-    if [ ! -d "data" ]
-	then
-	mkdir ./data
-    fi
-    
-    path="./data/"
-fi
-
-
-if [ -z "$stream" ] 
-then 
-    echo " Empty stream. Setting it to calibration_IDTracks"
-    stream="calibration_IDTracks"
-fi
-
-DISK="SCRATCHDISK"
-#outputFile="List_${Run}_${stream}.list"
-outputFile="Run_${Run}_${stream}.txt"
-echo " Ouptut file -> ${outputFile}"
-rucio list-file-replicas data15_13TeV:data15_13TeV.00$Run.${stream}.${daqmerge}.RAW | grep $DISK | cut -d ':' -f3,4,5 | cut -d '=' -f2 > $path$outputFile
-#rucio list-file-replicas data15_13TeV:data15_13TeV.00$Run.${stream}.merge.DESDM_ZMUMU.f628_m1453_f628_m1501 | grep $DISK | cut -d ':' -f3,4,5 | c#ut -d '=' -f2 > $path$outputFile
-sed -i -e 's/^/root:\/\/eosatlas\//g' $path$outputFile
-
-nfiles=`wc ${path}${outputFile} | cut -d '.' -f1`
-#cat $path$outputFile
-echo " Run: ${Run} saved in ${path}${outputfile} with ${nfiles} lines"
\ No newline at end of file
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignAlgSetup_DBM.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignAlgSetup_DBM.py
deleted file mode 100644
index 74cd5bc82ebcc07fcb3275031d6810b104a387df..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignAlgSetup_DBM.py
+++ /dev/null
@@ -1,620 +0,0 @@
-##############################################################################
-#
-#  Main alignment script which sets up all tools and algorithms to run global
-#  or local chi2 alignment using analytical derivatives.
-#
-#  Started:  Daniel Kollar <daniel.kollar@cern.ch> (09/2009)
-#
-##############################################################################
-#
-# The Following options can be specified seperately in a file that include this one
-#
-# General Alignemnt Options and their defaults
-newInDetAlignAlg_Options = {
-	"outputLevel" 			: INFO          		     #  output level for log messages for all tools and algs
-	,"trackCollection" 		: "Tracks"   			     #  track collection to process
-	,"readConstantsFromPool" 	: False  			     #  whether to read initial alignment constants from pool file
-	,"readSilicon" 			: True             		     #  whether to read initial Si alignment constants from pool file
-	,"readTRT" 			: True          	             #  whether to read initial TRT alignment constnats from pool file
-	,"readTRTL3" 			: False        	             #  whether to read initial TRT L3 alignment constnats from pool file
-	,"inputPoolFiles" 		: ["IDalignment_nominal.pool.root"]  #  pool files to read the constants from
-	,"writeConstantsToPool" 	: True     			     #  whether to write final alignment constants to pool file
-	,"writeSilicon" 		: True           		     #  whether to write final Si constants to pool file
-	,"writeTRT" 			: True               		     #  whether to write final TRT constants to pool file
-	,"writeTRTL3" 			: False               		     #  whether to write final TRT L3 constants to pool file	
-	,"outputPoolFile" 		: "alignment_output.pool.root" 	     #  pool file to write the final constants
-	,"tagSi" 			: "IndetAlign_test"    		     #  DB tag to use for final Si constants
-	,"tagTRT" 			: "TRTAlign_test"        	     #  DB tag to use for final TRT constnats
-	,"runAccumulate" 		: True            		     #  whether to run the event/track processing
-	,"runSolving"   	        : True              		     #  whether to run the solving
-	,"runLocal" 			: False                		     #  whether to runlocal or global Chi2 method
-	,"residualType" 		: 0             		     #  type of residual to use in local method 0 - hit-only (biased), 1 - unbiased
-	,"usePixelErrors" 		: True           		     #  whether to use real Pixel errors (only for local method)
-	,"useSCTErrors" 		: True          	  	     #  whether to use real SCT errors (only for local method)
-	,"useTRTErrors" 		: True            		     #  whether to use real TRT errors (only for local method)
-	,"inputMatrixFiles" 	        : [ "matrix.bin" ] 		     #  list of matrix files when solving only
-	,"inputVectorFiles" 	        : [ "vector.bin" ]    		     #  list of vector files when solving only
-	,"inputTFiles"			: ["AlignmentTFile.root"]	     # list of the Alignment TFiles, used only if WriteTFile is True
-	,"solvingOption" 	        : 3              		     #  which global solver to run 0-none, 1-Lapack, 2-Eigen, 6-ROOT, 7-CLHEP
-	,"solveLocal" 		        : True            		     #  whether to run locaal solving
-	,"writeMatrixFile" 	        : True      			     #  whether to write matrix to file before solving
-	,"writeMatrixFileTxt"           : True     			     #  whether to write matrix to text file
-	,"WriteTFile"			: False	        		     #  use ROOT files for store the matrix
-	,"TFileName"			:"AlignmentTFile.root"               #  Output TFile name, used only if WriteTFile is True
-	,"PathBinName"			:"./"				     #  path for the output AlignmentTFile 
-	,"runDiagonalization"           : True     			     #  whether to run diagonalization (Lapack, CLHEP)
-	,"eigenvalueCut"	        : 0.             		     #  minimal size of eigenvalue for diagonalization
-	,"ModCut"		        : 6                    		     #  nomber of modes to cut for diagonalization
-	,"useSparse"		        : False              		     #  whether to use sparse or symmetric matrix representation
-	,"softModeCut"		        : 0.             		     #  soft-mode-cut for all DoF
-	,"minHits" 		        : 10                  		     #  minimal number of hits in module to do the solving
-	,"scaleMatrix" 		        : True                               #  whethwe to normalize the matrix to number of hits before solving (Lapack)
-	,"calculateFullCovariance"      : True  			     #  whether to calculate the full covariance matrix of the alignment parameters
-	,"refitTracks" 		        : True              		     #  whether to refit tracks before processing
-	,"runOutlier" 		        : True             		     #  whether to refit tracks with outlier removal
-	,"particleNumber" 	        : 3       		             #  particle hypothesis to use in the refit
-	,"useTrackSelector" 	        : True        			     #  whether to use track selector
-	,"writeAlignNtuple"	        : False      			     #  whether to write an alignment specific ntuple
-	,"alignNtupleName"              : "newIDalign.root" 		     #  name of the ntuple file
-	,"writeDerivatives" 	        : False        		 	     #  whether to store dr/da in the ntuple
-	,"writeHitmap" 		        : True              		     #  whether to store the hitmap
-	,"writeHitmapTxt" 	        : True           		     #  whether to store the hitmap in a text file
-	,"writeEigenMat" 	        : False        			     #  whether to write the eigenspectrum/eigenvectors into files
-	,"writeEigenMatTxt" 	        : False       			     #  whether to write the eigenspectrum/eigenvectors into text files
-	,"inputHitmapFiles" 	        : [ "hitmap.bin" ]  		     #  list of hitmap files when solving only
-	,"readHitmaps"		        : True             	             #  whether to use the hitmap information when solve only
-	,"doMonitoring" 	        : True             		     #  whether to run the monitoring scripts
-	,"Cosmics" 		        : False                	 	     #  whether to use special cosmic track selection
-	,"useTRT" 		        : True                  	     #  whether to use TRT for track selection
-
-	,"useOldPreProcessor"           : True                               #  temporary option, new preProcessor with beam-spot constraint is
-	                                   				     #  available only from tag TrkAlignGenTools-01-07-08 which didn't
-	                                   				     #  make it into 15.6.9, once in the release, old preProcessor will
-	                                   				     #  be removed
-	,"doBSConstraint"               : True	         	 	     #  run with beam-spot constraint
-	,"doPVConstraint"		: False				     #  run with primary vertex constraint
-        ,"doFullVertex"                 : False                              #  run with the full GX vertex constraint
-	,"doBSTrackSelection"           : True      			     #  run BS constraint only for tracks which pass tighter track selection
-	,"doBSAssociatedToPVSelection"  : False  			     #  run BS constraint only for tracks associated to primary vertex
-	,"beamspotScalingFactor"        : 1.      			     #  factor to scale the size of the beam spot
-	,"eoverpmapconstraint"		: ""                                 #  sagitta bias map for momentum constraint(could be E/P or Z->mumu method )
-	,"z0mapconstraint"		: ""                                 #  z0 bias map for IP constraint
-	,"d0mapconstraint"		: ""				     #  d0 bias map for IP constraint
-	,"PtCut"			: 10000				     #  Pt cut for the reconstruction [MeV]
-}
-
-##############################################################################
-## If the variables are defined use thier values.
-## If not defined the defaults given above are used
-for var in newInDetAlignAlg_Options:
-	if var in dir():
-		newInDetAlignAlg_Options[var] = eval(var)
-# If Cosmics, switch off Beamspot / Vtx constraint 
-
-if newInDetAlignAlg_Options["Cosmics"]:
-	newInDetAlignAlg_Options["doBSConstraint"] = False
-	newInDetAlignAlg_Options["doPVConstraint"] = False
-	newInDetAlignAlg_Options["doFullVertex"] = False
-	newInDetAlignAlg_Options["doBSTrackSelection"] = False
-	newInDetAlignAlg_Options["doBSAssociatedToPVSelection"] = False
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==               Settings for the alignment                      ==
-## ==                                                               ==
-if not newInDetAlignAlg_Options["runAccumulate"] and not newInDetAlignAlg_Options["runSolving"]:
-	print 'ERROR: Both event processing and solving switched off. Nothing to be done.'
-	exit(10)
-
-# if we're running full local method we have to adjust some parameters
-# if we're running Global, we need to refit tracks to get matrices from the fitter
-if newInDetAlignAlg_Options["runLocal"]:
-	newInDetAlignAlg_Options["solveLocal"] = True
-	newInDetAlignAlg_Options["solvingOption"] = 0
-	newInDetAlignAlg_Options["useSparse"] = True
-else :
-	newInDetAlignAlg_Options["refitTracks"] = True
-	# residual type different that hit-only (biased)
-	# doesn't mane sense for global chi2 method
-	newInDetAlignAlg_Options["residualType"] = 0
-
-# if we're not solving ...
-if not newInDetAlignAlg_Options["runSolving"]:
-	# don't run global
-	newInDetAlignAlg_Options["solvingOption"] = 0
-	# don't run local
-	newInDetAlignAlg_Options["solveLocal"] = False
-	# don't update constants
-	updateConstants = False
-
-# if we're not writing the alignment ntuple we also don't store the derivatives
-if not newInDetAlignAlg_Options["writeAlignNtuple"]:
-	newInDetAlignAlg_Options["writeDerivatives"] = False
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==       Below is the detailed setup of the alignment job        ==
-## ==                                                               ==
-
-ToolSvc = Service('ToolSvc')
-
-#######################
-# global chi2 alignment
-#######################
-
-
-################################
-# use InDetTrackFitter as defined in the ID reconstruction
-# it is a Global Chi2 fitter and only needed when run accumulation
-if newInDetAlignAlg_Options["runAccumulate"]:
-
-	if not newInDetAlignAlg_Options["runLocal"]:
-		InDetTrackFitter.FillDerivativeMatrix = True
-
-	trackFitter = InDetTrackFitter
-	if newInDetAlignAlg_Options["refitTracks"]:
-		if newInDetAlignAlg_Options["particleNumber"] == 0:
-			trackFitter.GetMaterialFromTrack = False
-		else:
-			trackFitter.GetMaterialFromTrack = True
-
-################################
-# create AlignModuleTool
-# this will be most likely overwritten with detector specific alignModuleTool
-# during geometry setup but it is a reasonable default
-from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignModuleTool
-alignModuleTool = Trk__AlignModuleTool(
-	name = "AlignModuleTool",
-	OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-	
-)
-ToolSvc += alignModuleTool
-print alignModuleTool
-
-################################
-#
-# include geometry setup
-#
-include("InDetAlignExample/NewInDetAlignGeometrySetup.py")
-
-################################
-# Read in constants from Pool file
-if newInDetAlignAlg_Options["readConstantsFromPool"]:
-	from IOVDbSvc.CondDB import conddb
-
-	if newInDetAlignAlg_Options["readSilicon"]:
-		conddb.blockFolder("/Indet/Align")
-
-	if newInDetAlignAlg_Options["readTRT"]:
-		conddb.blockFolder("/TRT/Align")
-
-	if newInDetAlignAlg_Options["readTRTL3"]:
-		conddb.blockFolder("/TRT/Calib/DX")
-
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	# set this to the file containing AlignableTransform objects
-	ServiceMgr.CondProxyProvider.InputCollections += newInDetAlignAlg_Options["inputPoolFiles"]
-	ServiceMgr.CondProxyProvider.OutputLevel = DEBUG
-	print ServiceMgr.CondProxyProvider
-
-	# this preload causes callbacks for read in objects to be activated,
-	# allowing GeoModel to pick up the transforms
-	ServiceMgr.IOVSvc.preLoadData = True
-	ServiceMgr.IOVSvc.OutputLevel = INFO
-
-################################
-# make GlobalChi2AlignTool
-from TrkGlobalChi2AlignTools.TrkGlobalChi2AlignToolsConf import Trk__GlobalChi2AlignTool
-globalChi2AlignTool = Trk__GlobalChi2AlignTool(
-	name = 'GlobalChi2AlignTool',
-	AlignModuleTool = alignModuleTool,
-	StoreLocalDerivOnly = (newInDetAlignAlg_Options["solveLocal"] and newInDetAlignAlg_Options["solvingOption"]==0), # If we're running local later, we want to store ony local derivs
-	SecondDerivativeCut = -1e-3, # this is just for the moment :(
-	OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-)
-ToolSvc += globalChi2AlignTool
-
-# setup MatrixTool
-matrixTool = globalChi2AlignTool.MatrixTool
-matrixTool.OutputLevel 		= newInDetAlignAlg_Options["outputLevel"]
-matrixTool.AlignModuleTool 	= alignModuleTool
-matrixTool.UseSparse 		= newInDetAlignAlg_Options["useSparse"]
-matrixTool.SolveOption 		= newInDetAlignAlg_Options["solvingOption"]
-matrixTool.MinNumHitsPerModule 	= newInDetAlignAlg_Options["minHits"]
-matrixTool.Diagonalize 		= newInDetAlignAlg_Options["runDiagonalization"]
-matrixTool.EigenvalueThreshold 	= newInDetAlignAlg_Options["eigenvalueCut"]
-matrixTool.RunLocalMethod      	= newInDetAlignAlg_Options["solveLocal"]
-matrixTool.WriteMat 		= newInDetAlignAlg_Options["writeMatrixFile"]
-matrixTool.WriteMatTxt 		= newInDetAlignAlg_Options["writeMatrixFileTxt"]
-matrixTool.WriteEigenMat 	= newInDetAlignAlg_Options["writeEigenMat"]
-matrixTool.WriteEigenMatTxt 	= newInDetAlignAlg_Options["writeEigenMatTxt"]
-matrixTool.ModCut 		= newInDetAlignAlg_Options["ModCut"]
-matrixTool.InputMatrixFiles 	= newInDetAlignAlg_Options["inputMatrixFiles"]
-matrixTool.InputVectorFiles 	= newInDetAlignAlg_Options["inputVectorFiles"]
-matrixTool.WriteHitmap 		= newInDetAlignAlg_Options["writeHitmap"]
-matrixTool.WriteHitmapTxt 	= newInDetAlignAlg_Options["writeHitmapTxt"]
-matrixTool.ReadHitmaps 		= newInDetAlignAlg_Options["readHitmaps"]
-matrixTool.InputHitmapFiles 	= newInDetAlignAlg_Options["inputHitmapFiles"]
-matrixTool.SoftEigenmodeCut 	= newInDetAlignAlg_Options["softModeCut"]
-matrixTool.ScaleMatrix 		= newInDetAlignAlg_Options["scaleMatrix"]
-matrixTool.PathBinName 		= newInDetAlignAlg_Options["PathBinName"]
-
-if newInDetAlignAlg_Options["WriteTFile"]:
-	matrixTool.WriteTFile 	= True
-	matrixTool.ReadTFile 	= True
-	matrixTool.WriteMat 	= False
-	matrixTool.WriteHitmap 	= False
-	matrixTool.TFileName 		= newInDetAlignAlg_Options["TFileName"]
-	matrixTool.InputTFiles 		= newInDetAlignAlg_Options["inputTFiles"]
-
-if not newInDetAlignAlg_Options["runLocal"]: 
-	# we want to set 'reasonable' defaults for global L3 solving
-	if (
-			("sctAlignmentLevel" in dir() 		and sctAlignmentLevel==3) or
-			("sctAlignmentLevelBarrel" in dir() 	and sctAlignmentLevelBarrel==3) or
-			("sctAlignmentLevelEndcaps" in dir() 	and sctAlignmentLevelEndcaps==3) or 
-			("pixelAlignmentLevel" in dir() 	and pixelAlignmentLevel==3) or 
-			("pixelAlignmentLevelBarrel" in dir() 	and pixelAlignmentLevelBarrel==3) or
-			("pixelAlignmentLevelEndcaps" in dir() 	and pixelAlignmentLevelEndcaps==3)
-		):
-		matrixTool.WriteEigenMat = False
-		matrixTool.UseSparse = True
-		matrixTool.SolveOption = 2 # run Eigen for L3 by default
-		matrixTool.WriteMatTxt = False
-		matrixTool.WriteHitmapTxt = False
-		matrixTool.CalculateFullCovariance = False
-	# but the defaults can still be overwritten if explicitely requested
-	if 'useSparse' in dir():
-		matrixTool.UseSparse 			= newInDetAlignAlg_Options["useSparse"]
-	if 'solvingOption' in dir():
-		matrixTool.SolveOption 			= newInDetAlignAlg_Options["solvingOption"]
-	if 'writeMatrixFileTxt' in dir():
-		matrixTool.WriteMatTxt 			= newInDetAlignAlg_Options["writeMatrixFileTxt"]
-	if 'writeHitmapTxt' in dir():
-		matrixTool.WriteHitmapTxt 		= newInDetAlignAlg_Options["writeMatrixFileTxt"]
-	if 'writeEigenMat' in dir():
-		matrixTool.WriteEigenMat 		= newInDetAlignAlg_Options["writeEigenMat"]
-	if 'writeEigenMatTxt' in dir():
-		matrixTool.WriteEigenMatTxt 		= newInDetAlignAlg_Options["writeEigenMatTxt"]
-	if 'calculateFullCovariance' in dir():
-		matrixTool.CalculateFullCovariance 	= newInDetAlignAlg_Options["calculateFullCovariance"]
-
-print matrixTool
-print globalChi2AlignTool
-
-##################################################
-##
-##	Setup all tools needed for event processing
-##
-if newInDetAlignAlg_Options["runAccumulate"]:
-	################################
-	# create AlignTrackSelector
-	if newInDetAlignAlg_Options["useTrackSelector"]:
-		from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetTrtDriftCircleCutTool
-		trtDCtool = InDet__InDetTrtDriftCircleCutTool(
-			name = "TrtHitsEtaCutTool",
-			OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-			UseNewParameterization = True,
-			UseActiveFractionSvc = False
-		)
-		ToolSvc += trtDCtool
-		print trtDCtool
-		if not newInDetAlignAlg_Options["Cosmics"] :
-			## Matthias: Reduce requirements for DBM, might need further adjustments
-			from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-			trackSelector = InDet__InDetDetailedTrackSelectorTool(
-				name = "TrackSelector",
-				OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-				#OutputLevel = DEBUG,
-				TrackSummaryTool = "InDetTrackSummaryTool",
-				pTMin = newInDetAlignAlg_Options["PtCut"],
-				IPd0Max = 5000.,
-				IPz0Max = 5000.,
-				#nHitSct = 4,
-				nHitPix = 1,
-				nHitPixPhysical = 1,
-				nHitBLayerPlusPix = 0,
-				nHitBLayer = 0,
-				nHitSi = 3,
-				nHitSiPhysical = 3,
-				nHitTrt = 0,
-				#useEtaDepententMinHitTrt = True,
-				TrtDCCutTool = trtDCtool,
-				addToMinHitTrt = -3
-			)
-			if newInDetAlignAlg_Options["useTRT"]:
-				trackSelector.useEtaDepententMinHitTrt = True
-		else:
-			from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetCosmicTrackSelectorTool
-			trackSelector = InDet__InDetCosmicTrackSelectorTool(
-				name = "TrackSelector",
-				OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-				#OutputLevel = DEBUG,
-				numberOfTRTHits = 0,
-				TrackSummaryTool = "InDetTrackSummaryTool",
-				numberOfSiliconHits = 12,
-				maxD0 = 9999.,
-				maxZ0 = 9999.
-			)
-		ToolSvc += trackSelector
-		print trackSelector
-
-	###############################
-	# create AlignTrackPreProcessor
-	if newInDetAlignAlg_Options["useOldPreProcessor"] :
-		from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackPreProcessor
-		preProcessor = Trk__AlignTrackPreProcessor(
-			name = "AlignTrackPreProcessor",
-			OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-			RefitTracks = newInDetAlignAlg_Options["refitTracks"],
-			TrackFitterTool = trackFitter,
-			SLTrackFitterTool = trackFitter,
-			UseSingleFitter = True,
-			ParticleHypothesis = newInDetAlignAlg_Options["particleNumber"],
-			RunOutlierRemoval = newInDetAlignAlg_Options["runOutlier"]
-		)
-		# don't store matrices when running local
-		if newInDetAlignAlg_Options["runLocal"]:
-			preProcessor.StoreFitMatricesAfterRefit = False
-
-		if newInDetAlignAlg_Options["useTrackSelector"]:
-			preProcessor.SelectTracks = True
-			preProcessor.TrackSelectorTool = trackSelector
-
-	else :
-		# tighter track selection for the beam-spot constraint
-		BStrackSelector = ""
-		if newInDetAlignAlg_Options["doBSTrackSelection"] :
-			from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-			BStrackSelector = InDet__InDetDetailedTrackSelectorTool(
-				name 		  = "BeamSpotTrackSelector",
-				OutputLevel 	  = newInDetAlignAlg_Options["outputLevel"],
-				#OutputLevel 	  = DEBUG,
-				TrackSummaryTool  = "InDetTrackSummaryTool",
-				pTMin 		  = 1000.,
-				IPd0Max 	  = 500.,
-				IPz0Max 	  = 500.,
-				#nHitSct 	  = 4,
-				#nHitPix 	  = 3,
-				nHitBLayerPlusPix = 0,
-				nHitBLayer 	  = 0,
-				nHitSi 		  = 7,
-				nHitSiPhysical    = 7,
-				nHitTrt           = 0,
-				TrtDCCutTool 	  = trtDCtool,
-				addToMinHitTrt 	  = -3
-			)
-			if newInDetAlignAlg_Options["useTRT"]:
-				BStrackSelector.useEtaDepententMinHitTrt = True
-			ToolSvc += BStrackSelector
-			print BStrackSelector
-
-		from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__BeamspotVertexPreProcessor
-		preProcessor = Trk__BeamspotVertexPreProcessor(
-			name 			  = "BeamspotVertexPreProcessor",
-			OutputLevel 		  = newInDetAlignAlg_Options["outputLevel"],
-			RefitTracks 		  = newInDetAlignAlg_Options["refitTracks"],
-			TrackFitter    		  = trackFitter,
-			AlignModuleTool           = alignModuleTool,
-			UseSingleFitter 	  = True,
-			ParticleNumber 		  = newInDetAlignAlg_Options["particleNumber"],
-			RunOutlierRemoval 	  = newInDetAlignAlg_Options["runOutlier"],
-			DoBSConstraint 		  = newInDetAlignAlg_Options["doBSConstraint"],
-			#DoPVConstraint		   = newInDetAlignAlg_Options["doPVConstraint"],
-			#DoFullVertex              = newInDetAlignAlg_Options["doFullVertex"],
-			#DoAssociatedToPVSelection = newInDetAlignAlg_Options["doBSAssociatedToPVSelection"],
-			BeamspotScalingFactor     = newInDetAlignAlg_Options["beamspotScalingFactor"],
-			DoBSTrackSelection 	  = newInDetAlignAlg_Options["doBSTrackSelection"],
-			BSConstraintTrackSelector = BStrackSelector
-		)
-		# don't store matrices when running local
-		if newInDetAlignAlg_Options["runLocal"]:
-			preProcessor.StoreFitMatrices = False
-
-		if newInDetAlignAlg_Options["useTrackSelector"]:
-			preProcessor.TrackSelector = trackSelector
-
-	ToolSvc += preProcessor
-	print preProcessor
-
-	################################
-	# create AlignResidualCalculator
-	from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignResidualCalculator
-	alignResidualCalculator = Trk__AlignResidualCalculator(
-		name = "AlignResidualCalculator",
-		OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-		ResidualType = newInDetAlignAlg_Options["residualType"],
-		IncludeScatterers = False
-	)
-	ToolSvc += alignResidualCalculator
-	print alignResidualCalculator
-
-	################################
-	# create AlignTrackCreator
-	from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackCreator
-	alignTrackCreator = Trk__AlignTrackCreator(
-		name = "AlignTrackCreator",
-		OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-		AlignModuleTool = alignModuleTool,
-		ResidualCalculator = alignResidualCalculator,
-		IncludeScatterers = False,
-		RemoveATSOSNotInAlignModule = True,
-		WriteEventList = False,
-		RequireOverlap = False
-	)
-	ToolSvc += alignTrackCreator
-	print alignTrackCreator
-
-	################################
-	# create AnalyticalDerivCalcTool
-	from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AnalyticalDerivCalcTool
-	derivCalcTool = Trk__AnalyticalDerivCalcTool(
-		name = "AnalyticalDerivCalcTool",
-		OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-		StoreDerivatives = newInDetAlignAlg_Options["writeDerivatives"],
-		AlignModuleTool = alignModuleTool
-	)
-	# some extra settings when running local
-	if newInDetAlignAlg_Options["runLocal"]:
-		derivCalcTool.UseLocalSetting = True
-		derivCalcTool.UseIntrinsicPixelError = not newInDetAlignAlg_Options["usePixelErrors"]
-		derivCalcTool.UseIntrinsicSCTError = not newInDetAlignAlg_Options["useSCTErrors"]
-		derivCalcTool.UseIntrinsicTRTError = not newInDetAlignAlg_Options["useTRTErrors"]
-	else:
-		derivCalcTool.UseLocalSetting = False
-	ToolSvc += derivCalcTool
-	print derivCalcTool
-
-	################################
-	# create AlignTrackDresser that uses AnalyticalDerivCalcTool
-	from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackDresser
-	alignTrackDresser = Trk__AlignTrackDresser(
-		name = "AlignTrackDresser",
-		OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-		DerivCalcTool = derivCalcTool
-	)
-	ToolSvc += alignTrackDresser
-	print alignTrackDresser
-
-	################################
-	# Ntuple filling tool
-	ntupleTool = ""
-	if newInDetAlignAlg_Options["writeAlignNtuple"]:
-		from InDetAlignNtupleTools.InDetAlignNtupleToolsConf import InDet__SimpleIDNtupleTool
-		ntupleTool = InDet__SimpleIDNtupleTool(
-			name = "SimpleIDNtupleTool",
-			OutputLevel = INFO,
-			TrackSummaryTool = InDetTrackSummaryTool,
-			AlignModuleTool = alignModuleTool,
-			StoreDerivatives = newInDetAlignAlg_Options["writeDerivatives"]
-		)
-		ToolSvc += ntupleTool
-		print ntupleTool
-
-	###############################
-	###############################
-	# Track Collection Provider
-	if newInDetAlignAlg_Options["Cosmics"]:
-		newInDetAlignAlg_Options["trackCollection"] = "CombinedInDetTracks"
-
-
-	if len(newInDetAlignAlg_Options["eoverpmapconstraint"]) == 0:
-		from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__TrackCollectionProvider
-		trackCollectionProvider=Trk__TrackCollectionProvider("TrackCollectionProvider2",								
-								OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-								InputTrkCol = newInDetAlignAlg_Options["trackCollection"])
-	else:
-		from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__ConstrainedTrackProvider
-		trackCollectionProvider=Trk__ConstrainedTrackProvider("TrackCollectionProvider",
-								      OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-								      InputTracksCollection= newInDetAlignAlg_Options["trackCollection"],
-								      MinPt = 9,
-								      MaxPt = 250,
-								      MomentumConstraintFileName = newInDetAlignAlg_Options["eoverpmapconstraint"],
-								      MomentumConstraintHistName = "LambdaCorrectionVsEtaPhi", #"FinalCorrections",
-								      DeltaScaling = 1.2,
-								      ReduceConstraintUncertainty = 10.,
-								      CorrectZ0 = True,
-								      z0ConstraintFileName =  newInDetAlignAlg_Options["z0mapconstraint"],
-								      z0ConstraintHistName = "z0CorrectionVsEtaPhi",
-								      CorrectD0 = True,
-								      d0ConstraintFileName =  newInDetAlignAlg_Options["d0mapconstraint"],
-								      d0ConstraintHistName = "d0CorrectionVsEtaPhi",
-								      UseConstraintError =  False,
-								      UseConstrainedTrkOnly= True,
-								      TrackFitter = trackFitter   )
-		print "Z->MUMU SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
-		print trackCollectionProvider
-	ToolSvc += trackCollectionProvider
-
-	################################
-	################################
-	# build GlobalAlign algorithm
-	#
-	from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
-	InDetGlobalAlign =	Trk__AlignAlg(
-		"InDetGlobalAlign",
-		OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-		TrackCollectionProvider = trackCollectionProvider,
-		AlignTrackCreator = alignTrackCreator,
-		AlignTrackDresser = alignTrackDresser,
-		AlignTrackPreProcessor = preProcessor,
-		GeometryManagerTool = trkAlignGeoManagerTool,
-		FillNtupleTool = ntupleTool,
-		WriteNtuple = newInDetAlignAlg_Options["writeAlignNtuple"],
-		FileName = newInDetAlignAlg_Options["alignNtupleName"],
-		AlignTool = globalChi2AlignTool,
-		AlignDBTool = trkAlignDBTool
-	)
-
-	topSequence += InDetGlobalAlign
-	print InDetGlobalAlign
-
-##################################################
-##
-##	Setup solving from accumulated files
-##
-else:
-	################################
-	# build GlobalAlign algorithm
-	#
-	from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
-	InDetGlobalSolve =	Trk__AlignAlg(
-		"InDetGlobalSolve",
-		OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-		GeometryManagerTool = trkAlignGeoManagerTool,
-		AlignTool = globalChi2AlignTool,
-		AlignDBTool = trkAlignDBTool,
-		SolveOnly = True,
-		WriteNtuple = False
-	)
-
-	topSequence += InDetGlobalSolve
-	print InDetGlobalSolve
-
-
-################################
-# Write constants to Pool file
-# the OutputConditionsAlg has to be set up at the end
-# so that it runs last and picks up the latest version
-# of constants from memory
-if newInDetAlignAlg_Options["runSolving"] and newInDetAlignAlg_Options["writeConstantsToPool"]:
-	objectList = []
-	tagList = []
-
-	if newInDetAlignAlg_Options["writeSilicon"]:
-		objectList += [ "AlignableTransformContainer#/Indet/Align" ]
-		tagList += [ newInDetAlignAlg_Options["tagSi"] ]
-	if newInDetAlignAlg_Options["writeTRT"]:
-		objectList += [ "AlignableTransformContainer#/TRT/Align" ]
-		tagList += [ newInDetAlignAlg_Options["tagTRT"] ]
-	if newInDetAlignAlg_Options["writeTRTL3"]:
-		objectList += [ "TRTCond::StrawDxContainer#/TRT/Calib/DX"]
-
-	from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-	myOCA = OutputConditionsAlg(outputFile = newInDetAlignAlg_Options["outputPoolFile"])
-	myOCA.ObjectList = objectList
-	myOCA.IOVTagList = tagList
-
-################################
-# build AlignTrack collection splitter algorithm
-from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignTrackCollSplitter
-AlignTrackCollSplitter = Trk__AlignTrackCollSplitter(
-	"AlignTrackCollSplitter",
-	OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-)
-
-topSequence += AlignTrackCollSplitter
-print AlignTrackCollSplitter
-
-
-################################ 
-
-if newInDetAlignAlg_Options["doMonitoring"] and not newInDetAlignAlg_Options["runSolving"]:
-	include("InDetAlignExample/NewInDetAlignMonitoring.py")
-	
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignCog.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignCog.py
deleted file mode 100644
index ed2efe8266418c0055e4a86aea353b5833ee2370..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignCog.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# --- setup flags with default values
-##############################################################
-#
-# Algorithm to calculate centre-of-gravity of ID
-#
-# Sergio Gonzalez-Sevilla
-# segonzal@ific.uv.es
-# version II:
-# Pawel Bruckman de Renstrom
-# bruckman@cern.ch
-###############################################################
-
-if "ReadAlignmentConstants" not in dir():
-	ReadAlignmentConstants = True
-
-#------------------------------------------------
-# input file with Si and TRT constants 
-#------------------------------------------------
-if "inputfilename" not in dir():
-	inputfilename = 'TestConstants.root'
-#------------------------------------------------
-# output files with Si and TRT constants after cog shift
-#------------------------------------------------
-if "outFilename" not in dir():
-	outFilename    = 'TestConstantsOut.root'
-	outdbFilename  = 'TestConstantsOut.db'
-	outTxtFilename = 'TestConstantsOut.txt'
-
-if "onlySilicon" not in dir():
-	onlySilicon = False
-
-# To extract constants from the database select the appropriate database tag.
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.DataSource='geant4'
-globalflags.DataSource='data'
-
-# Select the geometry version. 
-globalflags.DetDescrVersion = 'ATLAS-GEO-03-00-00'      
-print globalflags.DetDescrVersion()
-
-from IOVDbSvc.CondDB import conddb
-conddb.setGlobalTag("COMCOND-REPC-002-13")
-#conddb.setGlobalTag("OFLCOND-CSC-00-02-00")
-#conddb.setGlobalTag("COMCOND-HLTC-000-00")
-
-# Setup geometry
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-if onlySilicon:
-	DetFlags.TRT_setOff()
-	DetFlags.detdescr.TRT_setOn()
-#------------------------------------------------
-# GeoModel stuff
-#------------------------------------------------
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-from IOVDbSvc.CondDB import conddb
-
-
-if ReadAlignmentConstants:
-	conddb.blockFolder("/Indet/Align")
-	conddb.blockFolder("/TRT/Align")
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	print 'Loading initial alignment File',inputfilename
-	ServiceMgr.CondProxyProvider.InputCollections = [ inputfilename ]
-	ServiceMgr.PoolSvc.AttemptCatalogPatch = True
-	ServiceMgr.CondProxyProvider.OutputLevel=INFO
-	print ServiceMgr.CondProxyProvider
-	ServiceMgr.IOVSvc.preLoadData = True
-else:
-	conddb.addOverride("/Indet/Align","InDet_Cosmic_2008_05_03" )
-	conddb.addOverride("/TRT/Align","TRT_Cosmic_2008_10_03" )
-	
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-from AthenaCommon.AppMgr import ToolSvc	
-
-#------------------------------------------------
-# Alignment tools
-#------------------------------------------------
-from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignDBTool
-ToolSvc += InDetAlignDBTool()
-
-from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_AlignDbSvc
-ServiceMgr += TRT_AlignDbSvc()
-
-# Needed for database-, Pool- and AlignableTransforms-Handling
-include ( "DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-from OutputStreamAthenaPool.OutputStreamAthenaPoolConf import AthenaPoolOutputStreamTool
-InDetCondStream = AthenaPoolOutputStreamTool( name="CondStream1",OutputFile=outFilename )
-ToolSvc += InDetCondStream
-print InDetCondStream
-
-# To produced a local SQLite DB with new Alignment Parameters
-include( "RegistrationServices/IOVRegistrationSvc_jobOptions.py" )
-regSvc = Service( "IOVRegistrationSvc" )
-regSvc.RecreateFolders = False
-IOVDbSvc = Service( "IOVDbSvc" )
-IOVDbSvc.dbConnection = "sqlite://;schema=%s;dbname=OFLP200" % outdbFilename
-
-#------------------------------------------------
-# InDetAlignCog algorithm
-#------------------------------------------------
-from InDetAlignGenAlgs.InDetAlignGenAlgsConf import InDetAlignCog
-InDetAlignCog = InDetAlignCog(name = 'InDetAlignCog',
-#                              Det              = 2,
-#                              SiBec            = 0,
-#                              SiLayer          = 1,
-#                              TRT_Bec          = -2,
-#                              TRT_Layer        = 99,
-#                              PrintFullMatrix  = True,
-#                              PrintDB          = True,
-                              ErrorTranslation = 1,
-                              ErrorRotation    = 10,
-                              SiTextOutput     = True,
-                              SiTextFile       = outTxtFilename,
-#                              SQLiteTag        = "cog_tag", 
-                              TRT_TextOutput   = True,
-			      DoCoG            = True,
-			      DoL1             = False,
-			      TraX             = 0.0,
-                              TraY             = 0.0,
-                              TraZ             = 0.0,
-                              RotX             = 0.0,
-			      RotY             = 0.0,
-			      RotZ             = 0.0,
-			      OutputLevel      = 3)
-
-topSequence += InDetAlignCog
-print topSequence.InDetAlignCog
-if onlySilicon:
-    InDetAlignCog.Det = 12    # no TRT
-#    InDetAlignCog.SiBec = 0
-    
-#------------------------------------------------
-# output level
-#------------------------------------------------
-ServiceMgr.MessageSvc.OutputLevel  = 3
-ServiceMgr.MessageSvc.Format       = "% F%30W%S%7W%R%T %0W%M"
-ServiceMgr.MessageSvc.defaultLimit = 9999999
-ServiceMgr.IOVDbSvc.OutputLevel=INFO
-ServiceMgr.IOVSvc.OutputLevel=INFO
-ServiceMgr.IOVDbSvc.forceRunNumber = 52280
-theApp.EvtMax = 1
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignExampleFlags/InDetAlignExample_CosmicFlags.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignExampleFlags/InDetAlignExample_CosmicFlags.py
deleted file mode 100644
index a416cecb5b33531029fa1e950cfbbfacd72dcd70..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignExampleFlags/InDetAlignExample_CosmicFlags.py
+++ /dev/null
@@ -1,106 +0,0 @@
-print 'Loading default InDetAlignExample_CosmicFlags'
-include.block("InDetAlignExample/InDetAlignExample_CosmicFlags.py")
-
-# Default options 
-class InDetAlignExampleFlags:
-
-    # -------------------------------------
-    # Setup
-    # -------------------------------------
-    Iteration = 0
-  
-    # Number of events to be processed
-    EvtMax = 50
-    SkipEvents = 0
-
-    challenge  = 'M8plus'
-    # challenge = 'CSC'
-    # challenge = 'CosmicsRel14'
-    
-    # Geometry Description
-    # - True :: Use Nominal Silicon Geometry (misalignment unknown)
-    # - False :: Use Misaligned Silicon Geometry (misalignment known)
-    SiNominal  = True
-    TRTNominal = False
-    Aligned = False
-    
-    # Read Alignment Constants (if True, SiNominal flag will be ignored)
-    ReadAlignmentConstants = False
-    AlignConstsPath        = os.environ['PWD']
-    WritePrefixName        = "Iter0_"
-    ReadPrefixName         = "Iter0_"
-
-    # Beam spot
-    doReadBeamSpot   = False
-    doBeamSpotReader = False
-
-    # TRT Constraint (RA)
-    doTRTConstraint = False
-
-    # Error Scaling
-    ErrorScalingFromFile = True
-    
-    # -------------------------------------
-    # Input Files    
-    # -------------------------------------
-    Files = ["/afs/cern.ch/atlas/maxidisk/d158/alignment/InDetESD_90413_3.root"]                                    # Test file 
-    # Files = ["castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_90413_3.root"]                                  # M8plus cosmics with BField
-    # Files = ["castor:/castor/cern.ch/user/l/lytken/cosmic_13010/digitization/NoField/TRTBarrel/misaligned/dig.trtbarrel_ma100.root"]     # CSC Cosmics without BField
-    # Files = ["castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEO-03-00-00/dig/dig.GEO-03-TRTBarrel.1.20.root"] # CosmicsR14 cosmics with BField
-    
-
-    Magnet          =  True
-    # Magnet          = False
-
-    Cosmics         =  True
-    BeamHalo        =  False
-    BeamGas         =  False
-    
-    # -------------------------------------
-    # Reconstruct data
-    # -------------------------------------
-    onlyPixel  = False
-    onlySCT    = False
-    doTRT    = False
-
-
-    # -------------------------------------
-    # Output stream
-    # -------------------------------------
-    OutputPath = os.environ['PWD']+"/"
-    
-    # -------------------------------------
-    # Cog Flags
-    # -------------------------------------
-    InputConstants     = 'Iter0_AlignmentConstants.root'
-    OutputConstants    = 'Cog_AlignmentConstants.root'
-    OutputDbConstants  = 'Cog_AlignmentConstants.db'
-    OutputTxtConstants = 'Cog_AlignmentConstants.txt'
-    OnlySCTCog         = True
-        
-    # -------------------------------------
-    # Alignment Algorithms 
-    # -------------------------------------
-    
-    # --- GlobalChi2 alignment
-    doGlobalChi2Align       = True
-    if doGlobalChi2Align:
-        AlignLevel = 1
-        SolveOption         = 0 # None=0, Solve=1, SolveFast=2, DirectSolve=3, DirectSolveFast=4, DirectSolveCluster=5
-
-   
-    # --- Local chi2 alignment
-    doLocalChi2Align        = False
-    
-    # --- Robust alignment 
-    doRobustAlign           = False
-    if doRobustAlign:
-        SolveOption             = 0
-        SetTextFileWriteIndex   = 1
-        SetTextFileReadEndIndex = 1
-    
-    # -------------------------------------
-    # EOF
-    # -------------------------------------
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignExampleFlags/InDetAlignExample_Flags.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignExampleFlags/InDetAlignExample_Flags.py
deleted file mode 100644
index 0a3167afdd9ea05bf8ef5a788474f8fcda6b816f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignExampleFlags/InDetAlignExample_Flags.py
+++ /dev/null
@@ -1,111 +0,0 @@
-
-print 'Loading default InDetAlignExample_Flags'
-include.block("InDetAlignExample/InDetAlignExample_Flags.py")
-
-# Default options 
-class InDetAlignExampleFlags:
-
-    # -------------------------------------
-    # Setup
-    # -------------------------------------
-    Iteration = 0
-  
-    # Number of events to be processed
-    EvtMax = 50
-    SkipEvents = 0
-
-    #challenge = 'ID_FDR_09'
-    challenge = 'MC09'
-    #challenge = 'CSC'
-    #challenge = 'FDR1'
-    #challenge = 'FDR2'
-    
-    # Geometry Description
-    # - True :: Use Nominal Silicon Geometry (misalignment unknown)
-    # - False :: Use Misaligned Silicon Geometry (misalignment known)
-    SiNominal  = True
-    TRTNominal = False
-    Aligned = False
-    
-    # Read Alignment Constants (if True, SiNominal flag will be ignored)
-    ReadAlignmentConstants = False
-    AlignConstsPath        = os.environ['PWD']
-    WritePrefixName        = "Iter0_"
-    ReadPrefixName         = "Iter0_"
-    # Beam spot
-    doReadBeamSpot   = False
-    #doBeamSpotReader = False
-
-    # Si+TRT Aligned (if True, SiNominal and ReadAlignmentConstants flags will be ignored)
-
-    # Error Scaling
-    ErrorScalingFromFile = False
-    
-    # TRT Constraint (RA)
-    doTRTConstraint = False
-
-    # -------------------------------------
-    # Input Files    
-    # -------------------------------------
-    Files = ["castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/perf-idtracking/dq2/mc09_valid/ESD/e436_s561_r731/mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731_tid076491/ESD.076491._000155.pool.root.1"]
-    #Files = ["/afs/cern.ch/atlas/maxidisk/d158/alignment/misal1_mc12.007270.MultiMuonsGeneration.digit.RDO.v12003102_tid003678._00001.pool.root.2"]
-    #    Files = ["castor:/castor/cern.ch/grid/atlas/dq2/misal1_mc12/misal1_mc12.007270.MultiMuonsGeneration.digit.RDO.v12003102_tid003678/misal1_mc12.007270.MultiMuonsGeneration.digit.RDO.v12003102_tid003678._00001.pool.root.2"]   # CSC multimuons
-
-    #    Files = ["rfio:/castor/cern.ch/user/h/hawkings/calibstream/fdr1/idcalib_5802_fdr1_0001.data"] # FDR 1 data - doesn't work with Rel 15 :(
-    #    Files = ["rfio:/castor/cern.ch/user/b/bvendapi/FDR2_Pi/BS_files/CalibStream/CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_1.data"]  # FDR 2 data - doesn't work with Rel 15 :(
-
-    if challenge == 'ID_FDR_09':
-        Files = ["/afs/cern.ch/user/t/tcorneli/public/InDetRecESD.root"]
-
-    Cosmics         =  False
-    BeamHalo        =  False
-    BeamGas         =  False
-    
-    # -------------------------------------
-    # Reconstruct data
-    # -------------------------------------
-    doPixel  = True
-    doSCT    = True
-    doTRT    = False
-
-
-    # -------------------------------------
-    # Output stream
-    # -------------------------------------
-    OutputPath = os.environ['PWD']+"/"
-    
-    # -------------------------------------
-    # Cog Flags
-    # -------------------------------------
-    InputConstants     = 'Iter0_AlignmentConstants.root'
-    OutputConstants    = 'Cog_AlignmentConstants.root'
-    OutputDbConstants  = 'Cog_AlignmentConstants.db'
-    OutputTxtConstants = 'Cog_AlignmentConstants.txt'
-    OnlySCTCog         = True
-        
-    # -------------------------------------
-    # Alignment Algorithms 
-    # -------------------------------------
-    
-    # --- GlobalChi2 alignment
-    doGlobalChi2Align       = True
-    if doGlobalChi2Align:
-        AlignLevel = 1
-        SolveOption         = 0 # None=0, Solve=1, SolveFast=2, DirectSolve=3, DirectSolveFast=4, DirectSolveCluster=5
-
-   
-    # --- Local chi2 alignment
-    doLocalChi2Align        = False
-    
-    # --- Robust alignment 
-    doRobustAlign           = False
-    if doRobustAlign:
-        SolveOption             = 0
-        SetTextFileWriteIndex   = 1
-        SetTextFileReadEndIndex = 1
-    
-    # -------------------------------------
-    # EOF
-    # -------------------------------------
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignable.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignable.py
deleted file mode 100755
index 18cf2cebb5f7470a36cecb5df5eeb8a9b16ace2d..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignable.py
+++ /dev/null
@@ -1,21 +0,0 @@
-
-#Job options needed to enable alignment for Inner Detector
-
-# load converters for AlignableTransforms
-include ( "DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-
-# Alignment folders
-IOVDbSvc = Service( "IOVDbSvc" )
-IOVDbSvc.Folders+=[ CondDBCool.INDET + "/Indet/Align"]
-IOVDbSvc.Folders+=[ CondDBCool.TRT   + "/TRT/Align"]
-
-# Eventually there will be a central mechanism to override tags, but in the meantime
-# just replace the above lines with a specific tag like in the following lines:
-#IOVDbSvc.Folders+=[ CondDBCool.INDET + "/Indet/Align" + "<tag>InDetAlign_CSC_02</tag>"]
-#IOVDbSvc.Folders+=[ CondDBCool.TRT   + "/TRT/Align"   + "<tag>TRTAlign_CSC_01</tag>"]
-#
-# Or alternatively include InDetAlignExample/InDetAlignableOveride.py before the geometry initialization
-# and then specify the folders in your job options.
-
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignableOverride.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignableOverride.py
deleted file mode 100755
index 2d1e182459eb35d9a5599919060b15ecfc07fa82..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignableOverride.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# This job options shows examples of how to override conditions database folders
-# See https://twiki.cern.ch/twiki/bin/view/Atlas/CoolIOVDbSvcConfigurable
-
-from IOVDbSvc.CondDB import conddb
-
-# To block folders. This is needed if you use the CondProxyProvider or can also
-# be used to disable the alignments. It is also needed to override with a
-# local sqlite file (see below)
-#conddb.blockFolder("/Indet/Align")
-#conddb.blockFolder("/TRT/Align")
-
-## Default alignments
-## If GlobalTag is not set it will use the same tags as used in the simulation.
-## If GlobalTag is set then it will use the set associated with that tag
-## This is not needed as it is the default
-#conddb.setGlobalTag("")
-
-## CSC As-built misalignments
-#conddb.setGlobalTag("OFLCOND-CSC-00-01-00")
-
-## Null alignment set
-#conddb.setGlobalTag("OFLCOND-CSC-00-00-00")
-
-## To override the folder tags.
-#conddb.addOverride('/Indet/Align','newfoldertag')
-#conddb.addOverride('/TRT/Align','newfoldertag')
-
-# Some example
-#conddb.addOverride('/Indet/Align','InDetAlign_CSC_02')
-#conddb.addOverride('/TRT/Align','TRTAlign_CSC_01')
-
-#conddb.addOverride('/Indet/Align','InDetAlign_ResIniPix_00')
-#conddb.addOverride('/Indet/Align','InDetAlign_CSC_02_ResIniPix_00')
-#conddb.addOverride('/Indet/Align','InDetAlign_ResFinalPix_00')
-#conddb.addOverride('/Indet/Align','InDetAlign_CSC_02_ResFinalPix_00')
-
-## or from an sqlite file mycool.db (the force=True is need because of the blockFolder command)
-#conddb.blockFolder("/XYZ/myfolder") 
-#conddb.addFolderWithTag("LOCAL","/XYZ/myfolder","mytag",force=True)
-
-## eg
-#conddb.blockFolder("/Indet/Align")
-#conddb.addFolderWithTag("LOCAL","/Indet/Align","mytag",force=True)
-#conddb.blockFolder("/TRT/Align")
-#conddb.addFolderWithTag("LOCAL","/TRT/Align","mytag",force=True)
-
-
-## or if you need to specify another SQLITE file you can use
-#conddb.blockFolder("/my/folder") 
-#conddb.addFolder("","<dbConnection>sqlite://;schema=myfile.db;dbname=OFLP200</dbConnection> /my/folder" +
-#                 "<tag>mytag</tag>", force=True)
-
-## eg
-#conddb.blockFolder("/Indet/Align")
-#conddb.addFolder("","<dbConnection>qlite://;schema=myfile.db;dbname=OFLP200</dbConnection> /Indet/Align" +
-#                 "<tag>mytag</tag>", force=True)
-#conddb.blockFolder("/TRT/Align")
-#conddb.addFolder("","<dbConnection>sqlite://;schema=myfile.db;dbname=OFLP200</dbConnection> /TRT/Align" +
-#                 "<tag>mytag</tag>", force=True)
-
-
-
-
-
-
-
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetMonitoringAlignment_TRTAlignTracks.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetMonitoringAlignment_TRTAlignTracks.py
deleted file mode 100644
index 8fcb4c46ed419b5ac68b1ac4dcf9e02d5bde0d2a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/InDetMonitoringAlignment_TRTAlignTracks.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Note: this assumes the alignment monitoring has already been added to the topSequence
-# 
-InDetAlignMonResidualsTRTAlign = IDAlignMonResiduals (name = 'InDetAlignMonResidualsTRTAlign', 
-                                                      Pixel_Manager = InDetKeys.PixelManager(), 
-                                                      SCT_Manager = InDetKeys.SCT_Manager(), 
-                                                      tracksName = 'TRTAlignTracks', 
-                                                      OutputLevel = ERROR, 
-                                                      trackSelection = InDetAlignMonTrackSelectionTool, 
-                                                      TRT_Manager = InDetKeys.TRT_Manager())  
- 
-ToolSvc += InDetAlignMonResidualsTRTAlign 
-if (InDetFlags.doPrintConfigurables()): 
-    print InDetAlignMonResidualsTRTAlign 
-     
-InDetAlignMonEfficienciesTRTAlign = IDAlignMonEfficiencies (name = 'InDetAlignMonEfficienciesTRTAlign', 
-                                                            HoleSearch = InDetExtendedHoleSearchTool, 
-                                                            Pixel_Manager = InDetKeys.PixelManager(), 
-                                                            SCT_Manager = InDetKeys.SCT_Manager(), 
-                                                            tracksName = 'TRTAlignTracks', 
-                                                            trackSelection = InDetAlignMonTrackSelectionTool, 
-                                                            OutputLevel = ERROR,
-                                                            TRT_Manager = InDetKeys.TRT_Manager())     
- 
-ToolSvc += InDetAlignMonEfficienciesTRTAlign 
-if (InDetFlags.doPrintConfigurables()): 
-    print InDetAlignMonEfficienciesTRTAlign 
- 
-InDetAlignMonGenericTracksTRTAlign = IDAlignMonGenericTracks (name = 'InDetAlignMonGenericTracksTRTAlign', 
-                                                              tracksName= 'TRTAlignTracks', 
-                                                              trackSelection = InDetAlignMonTrackSelectionTool, 
-                                                              VxPrimContainerName = InDetKeys.PrimaryVertices())    
- 
-ToolSvc += InDetAlignMonGenericTracksTRTAlign 
-if (InDetFlags.doPrintConfigurables()): 
-    print InDetAlignMonGenericTracksTRTAlign 
- 
-InDetTrackSplitterToolTRTAlign = InDet__InDetTrackSplitterTool(name = 'TrackSplitterTool_TRTAlign', 
-                                                               TrackFitter = InDetTrackFitter, 
-                                                               OutputUpperTracksName = 'TRTAlign_Upper', 
-                                                               OutputLowerTracksName = 'TRTAlign_Lower', 
-                                                               OutputLevel = ERROR)  
- 
-ToolSvc += InDetTrackSplitterToolTRTAlign 
-if (InDetFlags.doPrintConfigurables()): 
-    print InDetTrackSplitterToolTRTAlign 
-     
-InDetAlignMonTrackSegmentsTRTAlign = IDAlignMonTrackSegments ( name = 'InDetAlignMonTrackSegmentsTRTAlign', 
-                                                               InputTracksName = 'TRTAlignTracks', 
-                                                               UpperTracksName = 'TRTAlign_Upper', 
-                                                               LowerTracksName = 'TRTAlign_Lower', 
-                                                               UseCTBSplitTracks = False, 
-                                                               TrackSplitter =  InDetTrackSplitterToolTRTAlign, 
-                                                               trackSelectionUp = InDetAlignMonTrackSelectionTool, 
-                                                               trackSelectionLow = InDetAlignMonTrackSelectionTool, 
-                                                               DeltaD0Range = 8, 
-                                                               DeltaD0Range2D = 10, 
-                                                               DeltaPhiRange = 0.01, 
-                                                               DeltaPhiRange2D = 0.05, 
-                                                               OutputLevel = ERROR, 
-                                                               D0Range = 800 ) 
-ToolSvc += InDetAlignMonTrackSegmentsTRTAlign 
-if (InDetFlags.doPrintConfigurables()): 
-    print InDetAlignMonTrackSegmentsTRTAlign 
-
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResidualsTRTAlign ] 
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonEfficienciesTRTAlign ] 
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracksTRTAlign ] 
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonTrackSegmentsTRTAlign ] 
-
-topSequence += InDetAlignMonManager
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignMonManager
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/IteratorGrid.py b/InnerDetector/InDetExample/InDetAlignExample/share/IteratorGrid.py
deleted file mode 100644
index 3cbdd06b6243ad5b6c60254e00107703f95f6416..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/IteratorGrid.py
+++ /dev/null
@@ -1,934 +0,0 @@
-#################################################################
-#    Script for running ATLAS ID alignment jobs on Grid resources
-#    Authors: Jike Wang      (jike.wang@cern.ch)
-#             Song-Ming Wang (smwang@phys.sinica.edu.tw)
-#################################################################
-
-import os, string, time, datetime
-import sys, glob
-
-# ===================================================================================================
-# ===================================================================================================
-#  End of User Options, DO NOT modify the lines in below unless you really know what you are doing!!!  
-# ===================================================================================================
-# ===================================================================================================
-
-from InDetAlignExample.IteratorGridClasses import *
-
-nowtime = datetime.datetime.now()
-thisJobDir = "%04d%02d%02d%02d%02d%02d" % (nowtime.year,nowtime.month,nowtime.day,nowtime.hour,nowtime.minute,nowtime.second)
-
-
-if GridOptions["submitOnlyOneJobset"] :
-	ystr = './%s*' % str(nowtime.year)
-	ret  = glob.glob(ystr)
-	for rundir in ret : 
-		os.system("mv %s  %s "   % ( rundir, GridOptions["TmpWorkDir"])  )
-
-#os.system("mv IteratorGrid.py %s " % GridOptions["TmpWorkDir"])
-
-os.mkdir(thisJobDir)
-
-if ('removeFileList' in GridOptions) and  GridOptions['removeFileList'] != "" : 
-	if os.path.isfile('%s' % GridOptions['removeFileList']) :
-		os.system(" mv  %s  %s "% (GridOptions['removeFileList'] , thisJobDir))
-
-
-
-if ('extraFileList'  in GridOptions) and GridOptions["extraFileList"] != "" : 
-	if os.path.isfile('%s' % GridOptions['extraFileList'])  :
-		os.system(" cp  %s  %s "% (GridOptions['extraFileList'] , thisJobDir))
-
-
-os.chdir(thisJobDir)
-
-
-
-os.system(" get_files -jo InDetAlignExample/NewInDetAlignAlgSetup.py  > /dev/null ")
-print"current path:", (os.getcwd())
-cpath = os.getcwd()
-
-GridAccSubJobID          = 'GridAccSubJobID.txt'
-GridAccSubInfo           = 'GridAccSubInfo.txt'
-GridAccOutDS             = 'GridAccOutDS.txt'
-GridTotalAccOutDS        = 'GridTotalAccOutDS.txt'
-GridSolvingOutDS         = 'GridSolvingOutDS.txt'
-
-#print GridAccSubJobID
-#print GridAccSubInfo
-
-
-# Prepare number of files and events per CPU
-CPUs = {}
-FilesByCPU = {}
-Events = {}
-Collision = {}
-CosmicsBon = {}
-CosmicsBoff = {}
-
-
-print
-if not os.path.isdir(OutputPath):
-	os.mkdir(OutputPath)
-
-info=open(OutputPath+"/info.txt",'w')
-info.write("----------------------------------------------\n")
-info.write("\t\t%s      \n" % datetime.date.today() )
-info.write("----------------------------------------------\n")
-#info.write("Release %s\n" % ATHENAREL)
-info.write("Output stored in %s\n\n" % OutputPath)
-
-print "Info stored in: " +OutputPath+"/info.txt"
-
-
-print
-info.write("\n")
-StartTime=time.time()   # Start the total time counter
-info.close()
-
-
-
-#  Loop over iterations
-for iteration in range(FirstIteration, FirstIteration+Iterations):
-	IterStartTime=time.time()
-
-
-	os.system("rm -f %s\n" % GridAccSubJobID)
-	os.system("rm -f %s\n" % GridAccSubInfo)
-	os.system("rm -f %s\n" % GridAccOutDS)
-	os.system("rm -f %s\n" % GridSolvingOutDS)
-
-
-
-	#prepareForThisIter(iteration, GridFileOptions)
-
-
-	if (iteration == 0) and not inputAlignmentPoolFile:
-		ReadAlignmentConstants = False
-	else:
-		ReadAlignmentConstants = True
-
-	print '\n'
-	print " ---> Iteration "+repr(iteration)
-	print '\n'
-	info=open(OutputPath+"/info.txt",'a')
-	info.write('\n')
-	info.write("---> Iteration "+repr(iteration))
-	info.write('\n')
-
-
-	# Protect existing directories
-	if os.path.isdir("%s/Iter%02d" % (OutputPath, iteration)):
-		countdir=0
-		while os.path.isdir("%s/Iter%02d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)):
-			countdir += 1
-		os.rename("%s/Iter%02d" % (OutputPath, iteration),("%s/Iter%02d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)))
-
-		print "WARNING: %s/Iter%02d directory exists" % (OutputPath, iteration)
-		print "Renamed to %s/Iter%02d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)
-
-	# Make OutputPaths
-	os.mkdir(OutputPath+'/Iter%02d' % iteration )
-
-	# Settup up a local copy of the alignment levels
-	os.system("get_files -jo InDetAlignExample/NewInDetAlignLevels.py >/dev/null")
-	#os.system("cp NewInDetAlignLevels.py .")
-	alignLevels = "InDetAlignExample/NewInDetAlignLevels.py"
-
-	os.system("get_files -jo InDetAlignExample/BuildGeoForMatrixSolving.py >/dev/null")
-	solveJO    = "BuildGeoForMatrixSolving.py"	
-
-
-	os.mkdir('%s/Iter%02d/logs/' %  (OutputPath, iteration) )
-	if GridOptions["ColCPUs"][iteration]         > 0:
-		os.mkdir('%s/Iter%02d/Collision/'       % (OutputPath, iteration) )
-	if GridOptions["CosBoffCPUs"][iteration] > 0:
-		os.mkdir('%s/Iter%02d/CosmicsBoff/' % (OutputPath, iteration) )
-	if GridOptions["CosBonCPUs"][iteration]   > 0:
-		os.mkdir('%s/Iter%02d/CosmicsBon/'   % (OutputPath, iteration) )
-
-	print "Processing..."
-
-			
-		
-	####################### Loop over different data topology #############################################################################################
-
-
-	outputTarFileNames = {}
-	JOBNAMES = {}
-
-	if doAccumulate:
-		RecoOptions = {}
-		# Get the Reconstruction Options
-		if ErrorScaling[iteration]:
-			RecoOptions["errorScalingTag"] = errorScalingTag
-
-		RecoOptions["numberOfEvents"]      = -1
-
-		#if (Datasets.containType("900GeV") or Datasets.containType("SingleBeam") or Datasets.containType("7TeV")) and  Datasets.stream() == "IDTracks" : 
-		#	extraOptions["doReadBS"]   = True
-		#else:
-		#	extraOptions["doReadBS"]   = False
-			
-
-		########### start set the Alignment Options ############################################################################################
-		AlignmentOptions = {}
-
-		if AlignmentMethod == "GX2":
-			AlignmentOptions["runLocal"     ] = False
-			AlignmentOptions["solveLocal"   ] = False
-			AlignmentOptions["solvingOption"] = 1
-			AlignmentOptions["ModCut"       ] = 6
-		else:
-			AlignmentOptions["runLocal"     ] = True
-			AlignmentOptions["solvingOption"] = 0			
-
-		AlignmentOptions["readConstantsFromPool"] = ReadAlignmentConstants
-		if ReadAlignmentConstants:
-			if iteration == 0:
-
-				if False == os.path.isfile('%s' % inputAlignmentPoolFile):
-					print "Error: the inputAlignmentPoolFile not exit ..."
-					sys.exit()
-				else:
-					os.system("cp %s initial_AlignmentConstants.root " % inputAlignmentPoolFile)
-					AlignmentOptions["inputPoolFiles"] = ["initial_AlignmentConstants.root"] 
-
-			else:
-				tmpStr = "Iter%02d_AlignmentConstants.root" % ( iteration-1 )
-				AlignmentOptions["inputPoolFiles"] = [tmpStr]
-
-		tmpStr = "Iter%02d_AlignmentConstants.root" % ( iteration )
-		AlignmentOptions["outputPoolFile"            ] = tmpStr
-
-
-		AlignmentOptions["alignTRT"                  ]  = AlignTRT[iteration]
-		if AlignTRT[iteration]:
-			AlignmentOptions["trtAlignmentLevel" ]  = TRTAlignmentLevel[iteration]
-
-		AlignmentOptions["alignSCT"                  ]  = AlignSCT[iteration]
-		#if AlignSCTBarrel[iteration]:
-		AlignmentOptions["sctAlignmentLevel"         ]  = SCTAlignmentLevel[iteration]
-
-		AlignmentOptions["sctAlignBarrel"            ]  = AlignSCTBarrel[iteration]
-		#if AlignSCTBarrel[iteration]:
-		AlignmentOptions["sctAlignmentLevelBarrel"   ]  = SCTAlignmentLevelBarrel[iteration]
-
-		AlignmentOptions["sctAlignEndcaps"           ]  = AlignSCTEndcaps[iteration]
-		#if AlignSCTEndcaps[iteration]:
-		AlignmentOptions["sctAlignmentLevelEndcaps"  ]  = SCTAlignmentLevelEndcaps[iteration]
-
-		AlignmentOptions["alignPixel"                ]  = AlignPixel[iteration]
-		#if AlignSCTBarrel[iteration]:
-		AlignmentOptions["pixelAlignmentLevel"       ]  = PixelAlignmentLevel[iteration]
-
-		AlignmentOptions["pixelAlignBarrel"          ]  = AlignPixelBarrel[iteration]
-		#if AlignPixelBarrel[iteration]:
-		AlignmentOptions["pixelAlignmentLevelBarrel" ]  = PixelAlignmentLevelBarrel[iteration]
-
-		AlignmentOptions["pixelAlignEndcaps"         ]  = AlignPixelEndcaps[iteration]
-		#if AlignPixelEndcaps[iteration]:
-		AlignmentOptions["pixelAlignmentLevelEndcaps"]  = PixelAlignmentLevelEndcaps[iteration]
-
-		AlignmentOptions["runSolving"                ]  = False
-		AlignmentOptions["runAccumulate"             ]  = True
-		AlignmentOptions["WriteTFile"		     ] =  useTFile
-
-
-
-                ############## finish set the Alignment Options ######################################################################
-
-
-		if Datasets.containType("Customed") : 
-			if DatasetsOptions["doDetailedTagsConfig"] :
-
-				JOBNAMES["Customed"] = []
-				outputTarFileNames["Customed"] = []
-				Datasets.configDatasetTags("Customed")
-
-				for i in range(len(DatasetsOptions["CustomedDatasetsNameList"])) :
-					thisJobName   = "%s_Iter%02d_Accumulate_Customed_Part%02d_%s.py" % (preName, iteration, i, thisJobDir) 
-					JOBNAMES["Customed"].append(thisJobName)				
-					thisOutDSName = "%s.%s.Iter%02d_Accumulate_outDS_Customed_Part%02d_%s" % (GridOptions["userIDnum"], GridOptions["userIDname"], iteration, i, thisJobDir)
-					outputTarFileNames["Customed"].append(thisOutDSName)
-					os.system("echo %s >> %s\n" % (thisOutDSName, GridAccOutDS))
-					os.system("echo %s >> %s\n" % (thisOutDSName, GridTotalAccOutDS))
-					
-					if 'Cos' in DatasetsOptions["CustomedDatasetsNameList"][i] : 
-						RecoOptions["Cosmics"] = True
-					else : 
-						RecoOptions["Cosmics"] = False
-
-					print " detDescrVersion Customed " ,  Datasets.detDescrVersion("Customed", i)
-
-					if Datasets.detDescrVersion("Customed", i) : 
-						RecoOptions["detectorDescription"] = Datasets.detDescrVersion("Customed", i)
-
-					RecoScript       	                   = Datasets.recoScript("Customed", i)
-
-
-					print " global tag Customed " , Datasets.globalTag("Customed", i)
-					if Datasets.globalTag("Customed", i) :
-						RecoOptions["globalTag"]  	   = Datasets.globalTag("Customed", i )
-
-					currentjob = writeJobGrid(OutputPath       = OutputPath,
-								  CosmicsBoff      = False,
-								  CosmicsBon       = False,
-								  iter             = iteration,
-								  part             = "Accumulate",
-								  JOBNAME          = thisJobName,
-								  RecoOptions      = RecoOptions,
-								  extraOptions     = extraOptions,
-								  AlignmentOptions = AlignmentOptions,
-								  RecoScript       = RecoScript,
-								  AlignmentLevels  = alignLevels,
-								  MonitoringScript = MonitoringScript
-								 )
-					currentjob.write()
-
-			### not do detailed tags configuration, submit one job with long inDS list
-			else : 
-				print "....."
-				Datasets.configDatasetTags("Customed")
-				thisJobName   = "%s_Iter%02d_Accumulate_Customed_%s.py" % (preName, iteration, thisJobDir)
-				JOBNAMES["Customed"] = thisJobName
-				thisOutDSName = "%s.%s.Iter%02d_Accumulate_outDS_Customed_%s" % (GridOptions["userIDnum"], GridOptions["userIDname"], iteration, thisJobDir)
-				outputTarFileNames["Customed"] = thisOutDSName
-				os.system("echo %s >> %s\n" % (thisOutDSName, GridAccOutDS))
-				os.system("echo %s >> %s\n" % (thisOutDSName, GridTotalAccOutDS))
-
-				print " detDescrVersion Customed " ,  Datasets.detDescrVersion("Customed")
-				if Datasets.detDescrVersion("Customed") :
-					RecoOptions["detectorDescription"] = Datasets.detDescrVersion("Customed")
-				RecoScript                                 = Datasets.recoScript("Customed")
-				print " global tag Customed " , Datasets.globalTag("Customed")
-				if Datasets.globalTag("Customed") :
-					RecoOptions["globalTag"]           = Datasets.globalTag("Customed")
-
-
-				currentjob = writeJobGrid(OutputPath       = OutputPath,
-							  CosmicsBoff      = False,
-							  CosmicsBon       = False,
-							  iter             = iteration,
-							  part             = "Accumulate",
-							  JOBNAME          = thisJobName,
-							  RecoOptions      = RecoOptions,
-							  extraOptions     = extraOptions,
-							  AlignmentOptions = AlignmentOptions,
-							  RecoScript       = RecoScript,
-							  AlignmentLevels  = alignLevels,
-							  MonitoringScript = MonitoringScript
-							 )
-				currentjob.write()
-
-
-
-		if (Datasets.containType("900GeV") or Datasets.containType("7TeV")) :
-
-			if  GridOptions["ColCPUs"][iteration]:
-				JOBNAMES["Collision"]           = "%s_Iter%02d_Accumulate_Collision_%s.py" % (preName, iteration, thisJobDir)
-				outputTarFileNames["Collision"] = "%s.%s.Iter%02d_Accumulate_outDS_Collision_%s" % (GridOptions["userIDnum"], GridOptions["userIDname"], iteration, thisJobDir)
-				print outputTarFileNames["Collision"]
-				os.system("echo %s >> %s\n" % (outputTarFileNames["Collision"], GridAccOutDS))
-				os.system("echo %s >> %s\n" % (outputTarFileNames["Collision"], GridTotalAccOutDS))
-
-
-				if Datasets.detDescrVersion("Collision") : 
-					RecoOptions["detectorDescription"] = Datasets.detDescrVersion("Collision")
-
-				RecoScript                       	   = Datasets.recoScript("Collision")
-				if Datasets.globalTag("Collision") :
-					RecoOptions["globalTag"]  	   = Datasets.globalTag("Collision")
-
-				currentjob = writeJobGrid(OutputPath       = OutputPath,
-				    			  CosmicsBoff      = False,
-							  CosmicsBon       = False,
-							  iter             = iteration,
-							  part             = "Accumulate",
-							  JOBNAME          = JOBNAMES["Collision"],
-							  RecoOptions      = RecoOptions,
-							  extraOptions     = extraOptions,
-							  AlignmentOptions = AlignmentOptions,
-							  RecoScript       = RecoScript,
-							  AlignmentLevels  = alignLevels,
-							  MonitoringScript = MonitoringScript
-							  )
-				currentjob.write()
-
-
-			if GridOptions["CosBonCPUs"][iteration]:
-				JOBNAMES["CosmicsBon"]           = "%s_Iter%02d_Accumulate_CosBon_%s.py" % (preName, iteration, thisJobDir)
-				outputTarFileNames["CosmicsBon"] = "%s.%s.Iter%02d_Accumulate_outDS_CosBon_%s" % (GridOptions["userIDnum"], GridOptions["userIDname"], iteration, thisJobDir)
-				print outputTarFileNames["CosmicsBon"]
-				os.system("echo %s >> %s\n" % (outputTarFileNames["CosmicsBon"], GridAccOutDS))
-				os.system("echo %s >> %s\n" % (outputTarFileNames["CosmicsBon"], GridTotalAccOutDS))
-
-				if Datasets.detDescrVersion("CosmicBon") : 
-					RecoOptions["detectorDescription"] = Datasets.detDescrVersion("CosmicBon")
-				RecoScript                       	   = Datasets.recoScript("CosmicBon")
-				if Dataset.globalTag("CosmicBon"):
-					RecoOptions["globalTag"] 	   = Datasets.globalTag("CosmicBon")
-
-				currentjob = writeJobGrid(OutputPath       = OutputPath,
-							  CosmicsBoff      = False,
-							  CosmicsBon       = True,
-							  iter             = iteration,
-							  part             = "Accumulate",
-							  JOBNAME          = JOBNAMES["CosmicsBon"],
-							  RecoOptions      = RecoOptions,
-							  extraOptions     = extraOptions,
-							  AlignmentOptions = AlignmentOptions,
-							  RecoScript       = RecoScript,
-						          AlignmentLevels  = alignLevels,
-							  MonitoringScript = MonitoringScript
-							  )
-				currentjob.write()
-
-
-			if GridOptions["CosBoffCPUs"][iteration]:
-				JOBNAMES["CosmicsBoff"]           = "%s_accumulate_Iter%02d_CosBoff_%s.py" % (preName, iteration, thisJobDir)
-				outputTarFileNames["CosmicsBoff"] = "%s.%s.Iter%02d_Accumulate_outDS_CosBoff_%s" % (GridOptions["userIDnum"], GridOptions["userIDname"], iteration, thisJobDir)
-				print outputTarFileNames["CosmicsBoff"]
-				os.system("echo %s >> %s\n" % (outputTarFileNames["CosmicsBoff"], GridAccOutDS))
-				os.system("echo %s >> %s\n" % (outputTarFileNames["CosmicsBoff"], GridTotalAccOutDS))
-
-
-				if Datasets.detDescrVersion("CosmicBoff") : 				   
-					RecoOptions["detectorDescription"] = Datasets.detDescrVersion("CosmicBoff")
-				RecoScript 	                           = Datasets.recoScript("CosmicBoff")
-				if Dataset.globalTag("CosmicBoff"):
-					RecoOptions["globalTag"]  	   = Datasets.globalTag("CosmicBoff")
-
-				currentjob = writeJobGrid(OutputPath       = OutputPath,
-							  CosmicsBoff      = True,
-							  CosmicsBon       = False,
-							  iter             = iteration,
-							  part             = "Accumulate",
-							  JOBNAME          = JOBNAMES["CosmicsBoff"],
-							  RecoOptions      = RecoOptions,
-							  extraOptions     = extraOptions,
-							  AlignmentOptions = AlignmentOptions,
-				 			  RecoScript       = RecoScript,
-							  AlignmentLevels  = alignLevels,
-							  MonitoringScript = MonitoringScript
-							  )
-				currentjob.write()
-
-
-
-		############ Write the job submission script ###############################################################################################  
-		postfix = "_%s" % (thisJobDir)					       
-		SCRIPTNAME = "%s_Iter%02d_Accumulate%s.lsf"       % (preName, iteration, postfix)
-
-		if iteration == 0:
-			thisInputPoolFile = ["initial_AlignmentConstants.root"]
-		else:
-			tmpStr = "Iter%02d_AlignmentConstants.root" % ( iteration-1 )
-			thisInputPoolFile  = [tmpStr]
-
-
-		if useTFile : 
-			currentscript = writeScriptGridForTFile(OutputPath       = OutputPath,
-								preName          = preName,
-								iter             = iteration,
-								part             = "Accumulate",
-								ATHENAREL 	 = ATHENAREL,
-								SCRIPTNAME       = SCRIPTNAME,
-								Datasets         = Datasets,
-								outDS            = outputTarFileNames,
-								AccSubJobID      = GridAccSubJobID,
-								AccSubInfo       = GridAccSubInfo,
-								JOBNAMES         = JOBNAMES,
-								thisJobDir       = thisJobDir,
-								jobId            = -99,
-								retryNo		 = 0,
-								GridOptions      = GridOptions,
-								AlignmentOptions = AlignmentOptions
-								)
-
-
-			# Write the Batch Script
-			currentscript.write()
-			# Send the Batch Script
-			currentscript.send()
-			#  End j loop
-			# Wait for signal
-			os.system("pbook -c 'sync()'")
-			currentscript.wait(GridAccSubJobID)
-			GridOptions["accumulateLibDS"] = currentscript.getGridOptions("accumulateLibDS")
-			GridOptions["solveLibDS"     ] = currentscript.getGridOptions("solveLibDS")
-	
-			# enable automatically retry
-			if (True == GridOptions['autoRetry']) and (True == currentscript.whetherRetry()) :
-				currentscript.retry()
-
-
-
-
-			
-		else : 
-			# Define the script for submiting Grid accumulation jobs
-			currentscript = writeScriptGrid(OutputPath       = OutputPath,
-							preName          = preName,
-							iter             = iteration,
-							part             = "Accumulate",
-							CMTDIR           = CMTDIR,
-							ATHENAREL        = ATHENAREL,
-							TAGS             = TAGS,
-							SCRIPTNAME       = SCRIPTNAME,
-							Datasets         = Datasets,
-							outDS            = outputTarFileNames,
-							AccSubJobID      = GridAccSubJobID,
-							AccSubInfo       = GridAccSubInfo,
-							JOBNAMES         = JOBNAMES,
-							thisJobDir       = thisJobDir,
-							jobId            = -99,
-							retryNo          = 0,
-							GridOptions      = GridOptions,
-							AlignmentOptions = AlignmentOptions
-							)
-			# Write the Batch Script
-			currentscript.write()
-			# Send the Batch Script
-			currentscript.send()
-			#  End j loop
-			# Wait for signal
-			os.system("pbook -c 'sync()'")
-			currentscript.wait(GridAccSubJobID)
-			GridOptions["accumulateLibDS"] = currentscript.getGridOptions("accumulateLibDS")
-			GridOptions["solveLibDS"     ] = currentscript.getGridOptions("solveLibDS")
-
-			# enable automatically retry
-			if (True == GridOptions['autoRetry']) and (True == currentscript.whetherRetry()) :
-				currentscript.retry()
-
-
-
-
-#########################################################################################################################
-#########################################################################################################################
-	if doSolve:
-
-		print "----------------------------------------------"
-		print "  Solving Iter"+repr(iteration)
-		print "----------------------------------------------"
-		info.write('\n')
-		info.write("----------------------------------------------\n")
-		info.write("  Solving Iter %02d\n" % iteration)
-      
-		info.write("----------------------------------------------\n")
-
-		postfix    = "%s" % (thisJobDir)
-
-		PrefixName        = "Iter%02d_" % iteration
-		JOBNAMES["Solve"] = "%s_Iter%02d_Solve_%s.py"  % (preName, iteration, postfix)
-		SCRIPTNAME        = "%s_Iter%02d_Solve_%s.lsf" % (preName, iteration, postfix)
-
-		print "Logs stored in %s/Iter%02d/logs/Iter%02dSolve_%s.log" % (OutputPath, iteration, iteration, postfix)
-
-		##################################################################################################################
-		outputTarFileNames["Solve"] = "%s.%s.Iter%02d_%s_Solve" % (GridOptions["userIDnum"], GridOptions["userIDname"], iteration, thisJobDir)
-						
-		print "outputSolvingDS: ", outputTarFileNames["Solve"]
-						
-		AlignmentOptions = {}
-
-		if AlignmentMethod == "GX2":
-			AlignmentOptions["runLocal"          ] = False
-			AlignmentOptions["solveLocal"        ] = False
-		else:
-			AlignmentOptions["runLocal"          ] = True
-			AlignmentOptions["solvingOption"     ] = 0
-
-		AlignmentOptions["readConstantsFromPool"     ] = ReadAlignmentConstants
-
-		if ReadAlignmentConstants:
-			if iteration == 0:
-				if False == os.path.isfile('%s' % inputAlignmentPoolFile):
-					print "Error: the inputAlignmentPoolFile not exit ..."
-					sys.exit()
-				else : 
-					os.system("cp %s initial_AlignmentConstants.root " % inputAlignmentPoolFile)
-					AlignmentOptions["inputPoolFiles"] = ["initial_AlignmentConstants.root"]
-					if "Batch" == GridOptions["runSolveMode"] or True == GridOptions["runSolveInTmpDir"] :
-						tmpStr = "%s/initial_AlignmentConstants.root" % ( cpath )
-						AlignmentOptions["inputPoolFiles"] = [tmpStr] 
-
-			else:
-				#tmpStr = "%s/Iter%02d/Iter%02d_AlignmentConstants.root" % ( str(OutputPath), iteration-1, iteration-1 )
-				tmpStr = "Iter%02d_AlignmentConstants.root" % ( iteration-1 )
-				if "Batch" == GridOptions["runSolveMode"] or True == GridOptions["runSolveInTmpDir"] :
-					tmpStr = "%s/Iter%02d_AlignmentConstants.root" % ( cpath, iteration-1 )
-
-				AlignmentOptions["inputPoolFiles"] = [tmpStr] 
-
-
-		tmpStr = "Iter%02d_AlignmentConstants.root" % ( iteration )
-		if "Batch" == GridOptions["runSolveMode"] or True == GridOptions["runSolveInTmpDir"] :
-			tmpStr = "%s/Iter%02d_AlignmentConstants.root" % ( cpath, iteration )
-                                
-		AlignmentOptions["outputPoolFile"            ] = tmpStr
-
-		AlignmentOptions["alignTRT"                  ] = AlignTRT[iteration]
-		if AlignTRT[iteration]:
-			AlignmentOptions["trtAlignmentLevel" ] = TRTAlignmentLevel[iteration]
-
-		AlignmentOptions["alignSCT"                  ] = AlignSCT[iteration]
-                #if AlignSCTBarrel[iteration]:
-		AlignmentOptions["sctAlignmentLevel"         ] = SCTAlignmentLevel[iteration]
-	
-		AlignmentOptions["sctAlignBarrel"            ] = AlignSCTBarrel[iteration]
-                #if AlignSCTBarrel[iteration]:
-		AlignmentOptions["sctAlignmentLevelBarrel"   ] = SCTAlignmentLevelBarrel[iteration]
-	
-		AlignmentOptions["sctAlignEndcaps"           ] = AlignSCTEndcaps[iteration]
-                #if AlignSCTEndcaps[iteration]:
-		AlignmentOptions["sctAlignmentLevelEndcaps"  ] = SCTAlignmentLevelEndcaps[iteration]
-		
-		AlignmentOptions["alignPixel"                ] = AlignPixel[iteration]
-                #if AlignSCTBarrel[iteration]:
-		AlignmentOptions["pixelAlignmentLevel"       ] = PixelAlignmentLevel[iteration]
-	
-		AlignmentOptions["pixelAlignBarrel"          ] = AlignPixelBarrel[iteration]
-                #if AlignPixelBarrel[iteration]:
-		AlignmentOptions["pixelAlignmentLevelBarrel" ] = PixelAlignmentLevelBarrel[iteration]
-		
-		AlignmentOptions["pixelAlignEndcaps"         ] = AlignPixelEndcaps[iteration]
-                #if AlignPixelEndcaps[iteration]:
-		AlignmentOptions["pixelAlignmentLevelEndcaps"] = PixelAlignmentLevelEndcaps[iteration]
-
-		# all other modes except Prun, such as run solving Locally, Batch and Grid, should dq2-get back the matrices and vectors 
-		if GridOptions["runSolveMode"] != "Prun" :
-			matrices, vectors, hitmaps             = mergeMatrix(OutputPath, iteration, GridAccOutDS, GridOptions) 
-
-			print "matrices: ", matrices
-			print "vector: "  , vectors
-			print "hitmaps: " , hitmaps
-		
-			AlignmentOptions["inputMatrixFiles"]           = matrices
-			AlignmentOptions["inputVectorFiles"] 	       = vectors
-			AlignmentOptions["inputHitmapFiles"] 	       = hitmaps
-
-			newms = []
-			newvs = []
-			newhs = []
-
-			if GridOptions["runSolveMode"] == "Batch" :
-				for item in matrices : 
-					newitem                        = "%s/%s" % ( cpath , item )
-					newms.append(newitem)
-				for item in vectors :
-					newitem                        = "%s/%s" % ( cpath , item )
-					newvs.append(newitem)
-				for item in matrices :
-					newitem                        = "%s/%s" % ( cpath , item )
-					newhs.append(newitem)
-
-				AlignmentOptions["inputMatrixFiles"]   = newms
-				AlignmentOptions["inputVectorFiles"]   = newvs
-				AlignmentOptions["inputHitmapFiles"]   = newhs
-
-
-		AlignmentOptions["WriteTFile"]                 = useTFile
-		AlignmentOptions["runSolving"]                 = True
-		AlignmentOptions["runAccumulate"]              = False
-
-		RecoOptions = {}
-		RecoOptions["numberOfEvents"]                  = 10
-
-
-		if Datasets.containType("Customed") :
-			if Datasets.globalTag("Customed") :
-				RecoOptions["globalTag"]       = Datasets.globalTag("Customed")
-			#RecoScript                             = Datasets.recoScript("Customed")
-			RecoScript                             = "InDetAlignExample/BuildGeoForMatrixSolving.py"
-			if Datasets.detDescrVersion("Customed") : 
-				RecoOptions["detectorDescription"]     = Datasets.detDescrVersion("Customed")
-
-
-		if (Datasets.containType("900GeV") or Datasets.containType("7TeV")) :
-			if Datasets.globalTag("Collision") :
-				RecoOptions["globalTag"]       = Datasets.globalTag("Collision")
-			#RecoScript                             = Datasets.recoScript("Collision")
-			RecoScript 			       = "InDetAlignExample/BuildGeoForMatrixSolving.py"
-			if Datasets.detDescrVersion("Collision") :
-				RecoOptions["detectorDescription"]     = Datasets.detDescrVersion("Collision")
-
-
-		currentjob = writeJobGrid(OutputPath   = OutputPath,
-		                      CosmicsBoff      = False,
-	                              CosmicsBon       = False,
-			              iter             = iteration,
-			              part             = "Solve",
-				      JOBNAME          = JOBNAMES["Solve"],
-				      RecoOptions      = RecoOptions,
-		                      extraOptions     = extraOptions,
-				      AlignmentOptions = AlignmentOptions,
-				      RecoScript       = RecoScript,
-				      AlignmentLevels  = alignLevels,
-				      MonitoringScript = MonitoringScript
-			              )
-
-		currentjob.write()
-
-
-		if iteration == 0:
-			thisInputPoolFile = ["initial_AlignmentConstants.root"]
-			if GridOptions["runSolveMode"] != "Grid" :
-				tmpStr = "%s/initial_AlignmentConstants.root" % ( cpath )
-				thisInputPoolFile = [tmpStr]
-
-		else:
-			tmpStr = "Iter%02d_AlignmentConstants.root" % ( iteration-1 )
-			if GridOptions["runSolveMode"] != "Grid" :
-				tmpStr = "%s/Iter%02d_AlignmentConstants.root" % ( cpath, iteration-1 )
-
-			thisInputPoolFile  = [tmpStr]
-
-
-
-		if ( GridOptions["runSolveMode"] == "Grid" or GridOptions["runSolveMode"] == "Prun" ) :
-
-			if useTFile :
-				currentscript = writeScriptGridForTFile(OutputPath       = OutputPath,
-									preName          = preName,
-									iter             = iteration,
-									part             = GridOptions["runSolveMode"],
-									ATHENAREL 	 = ATHENAREL,
-									SCRIPTNAME       = SCRIPTNAME,
-									Datasets         = Datasets,
-									outDS            = outputTarFileNames,
-									AccSubJobID      = GridAccSubJobID,
-									AccSubInfo       = GridAccSubInfo,
-									JOBNAMES         = JOBNAMES,
-									thisJobDir       = thisJobDir,
-									jobId            = -99,
-									retryNo          = 0,
-									GridOptions      = GridOptions,
-									AlignmentOptions = AlignmentOptions
-									)
-		    
-				currentscript.write()
-				currentscript.send()
-				os.system("pbook -c 'sync()'")
-				currentscript.wait(GridAccSubJobID)
-				GridOptions["accumulateLibDS"] = currentscript.getGridOptions("accumulateLibDS")
-				GridOptions["solveLibDS"     ] = currentscript.getGridOptions("solveLibDS")
-	
-				# enable automatically retry
-				if (True == GridOptions['autoRetry']) and ( True == currentscript.whetherRetry()) :
-					currentscript.retry()
-
-
-
-
-
-			else : 
-
-				currentscript = writeScriptGrid(OutputPath       = OutputPath,
-								preName          = preName,
-								iter             = iteration,
-								part             = GridOptions["runSolveMode"],
-								CMTDIR           = CMTDIR,
-								ATHENAREL        = ATHENAREL,
-								TAGS             = TAGS,
-								SCRIPTNAME       = SCRIPTNAME,
-								Datasets         = Datasets, 
-								outDS            = outputTarFileNames,
-								AccSubJobID      = GridAccSubJobID,
-								AccSubInfo       = GridAccSubInfo,
-								JOBNAMES         = JOBNAMES,
-								thisJobDir       = thisJobDir,
-								jobId            = -99,
-								retryNo          = 0,
-								GridOptions      = GridOptions,
-								AlignmentOptions = AlignmentOptions
-								)
-
-				currentscript.write()
-				currentscript.send()
-				os.system("pbook -c 'sync()'")
-				currentscript.wait(GridAccSubJobID)
-				GridOptions["accumulateLibDS"] = currentscript.getGridOptions("accumulateLibDS")
-				GridOptions["solveLibDS"     ] = currentscript.getGridOptions("solveLibDS")
-
-				# enable automatically retry
-				if (True == GridOptions['autoRetry']) and ( True == currentscript.whetherRetry()) :
-					currentscript.retry()
-
-
-
-		else : 
-			currentscript = writeScriptAFS(iter           = iteration,
-						       JOBNAME        = JOBNAMES["Solve"],
-						       SCRIPTNAME     = SCRIPTNAME,
-						       preName        = preName,
-						       QUEUE          = QUEUE,
-						       CMTDIR         = CMTDIR,
-						       ATHENAREL      = ATHENAREL,
-						       TAGS           = TAGS,
-						       inputPoolFiles = thisInputPoolFile)
-			currentscript.write()
-
-			### do some preparation for running sloving locally, such as get back on file from Grid, modify the sloving jobOption
-			#if self.Datasets.containType("Customed") :
-			#	os.system("dq2-get -n 1 -H -V %s  %s/ \n "  %   ("fileForSolve" , self.Datasets.oneDatasetName("Customed")) )
-
-			#else if ( self.Datasets.containType("900GeV") or self.Datasets.containType("7TeV") ) :
-			#	os.system("dq2-get -n 1 -H -V %s  %s/ \n "  %   ("fileForSolve" , self.Datasets.oneDatasetName("Collision")) )
-
-			#else :
-			#	print " why do you come here ?? "
-
-			#ret, out = commands.getstatusoutput("cat %s") % JOBNAMES["Solve"]
-			#solveJO  = open('%s' , 'w') % JOBNAMES["Solve"]
-			#lines    = out.split("\n")
-
-
-			if "Local" == GridOptions["runSolveMode"] :
-				if ( True == GridOptions["runSolveInTmpDir"] ) : 
-					tmpstr = './%s.%s.*' % (GridOptions["userIDnum"], GridOptions["userIDname"])
-					ret    = glob.glob(tmpstr)
-					for tmpdir in ret :
-						os.system("mv %s  %s "   % ( tmpdir, GridOptions["TmpWorkDir"])  )
-					os.system(" cp *.py   %s "  % GridOptions["TmpWorkDir"] )
-					os.system(" cp *.lsf  %s "  % GridOptions["TmpWorkDir"] )
-
-					nowDir = os.getcwd()
-					os.chdir(GridOptions["TmpWorkDir"]) 
-					os.system(" rm PoolFileCatalog.*")
-					currentscript.send("Local")
-
-					os.system(" cp OldSiAlignment.txt OutputSiAlignment.txt alignlogfile.txt hitmap.bin hitmap.txt matrix.bin matrix.txt vector.bin vector.txt %s " % nowDir)
-					os.chdir(nowDir)
-					os.system(" mv OldSiAlignment.txt OutputSiAlignment.txt alignlogfile.txt hitmap.bin hitmap.txt matrix.bin matrix.txt vector.bin vector.txt %s/Iter%02d " % (OutputPath, iteration) )
-
-				else : 
-					currentscript.send("Local")
-					os.system(" mv OldSiAlignment.txt OutputSiAlignment.txt alignlogfile.txt hitmap.bin hitmap.txt matrix.bin matrix.txt vector.bin vector.txt %s/Iter%02d " % (OutputPath, iteration) )
-
-			if "Batch" == GridOptions["runSolveMode"] :   
-				currentscript.send("Batch")
-				currentscript.wait()
-
-
-                #######################################################################################################
-		'''
-		if "doMonitoring" in extraOptions and extraOptions["doMonitoring"]==True:
-			MERGEJOBNAME    = "%s_Iter%02dMergeMonitoring.py"  % (preName,iteration)
-			MERGESCRIPTNAME = "%s_Iter%02dMergeMonitoring.lsf" % (preName,iteration)
-			monitoringMerge = mergeMonitoringScript(OutputPath       = OutputPath
-								,iter            = iteration
-								,preName         = preName
-								,CosmicsBoff     = CosmicsBoff[iteration]
-								,CosmicsBon      = CosmicsBon[iteration]
-								,Collision       = Collision[iteration]
-								,CMTDIR          = CMTDIR
-								,ATHENAREL       = ATHENAREL
-								,TAGS            = TAGS
-								,SCRIPTNAME      = MERGESCRIPTNAME
-								,JOBNAME         = MERGEJOBNAME
-								,GridAccOutDS    = GridAccOutDS)
-			monitoringMerge.write()
-			monitoringMerge.send()
-		'''
-
-                #######################################################################################################
-		os.system("rm -f %s\n" % GridSolvingOutDS)
-		os.system("echo %s >> %s\n" % (outputTarFileNames["Solve"], GridSolvingOutDS))
-
-		prepareForNextIter(OutputPath, iteration, GridSolvingOutDS, GridOptions["runSolveMode"])
-
-		tmpstr = './%s.%s.*' % (GridOptions["userIDnum"], GridOptions["userIDname"])
-		ret    = glob.glob(tmpstr)
-		for tmpdir in ret :
-			os.system("mv %s  %s "   % ( tmpdir, GridOptions["TmpWorkDir"])  )
-
-		#######################################################################################################
-
-	else:
-
-		print "-----------------------------------------------------\n"
-		print " WARNING: Skipping the solving due to low statistics or set doSolve=False\n"
-		print "-----------------------------------------------------\n"
-
-		print "  Iteration %02d finished: %5.3f seconds \n" % (iteration,(time.time()-IterStartTime))
-		print "-------------------------------------------------------"
-
-
-
-
-if GridOptions["getMonitoringFiles"] == True : 
-
-	ret, out = commands.getstatusoutput("cat %s" % GridTotalAccOutDS)
-	print " GridTotalAccOutDS files : ",out
-	lines = out.split('\n')
-	for line in lines :
-		temp    = line 
-		start   = temp.find('Iter')
-		end     = start + 6
-		iter    = temp[ start : end ]
-		thisDir = GridOptions["TmpWorkDir"] + "/" + iter 
-		if os.path.isdir("%s/" % thisDir) == False :
-			os.mkdir( "%s/"  % thisDir )
-		
-		MonitoringFilesList = []
-		ValidationFilesList = []
-
-		ret, out = commands.getstatusoutput("dq2-ls -f %s/ " % line)
-		items = out.split('\n')
-		for item in items : 
-			strs = item.split()
-			for str in strs :
-				print " str: " , str
-				if str.find("CombinedMonitoring") != -1 : 
-					MonitoringFilesList.append(str)
-				if str.find("TRKVAL")             != -1 : 
-					ValidationFilesList.append(str)
-		MonitoringFilesStr = ",".join(MonitoringFilesList)
-		ValidationFilesStr = ",".join(ValidationFilesList)
-		print " in iteration : " , iter
-		print " MonitoringFilesStr for this iteration : " , MonitoringFilesStr
-		print " ValidationFilesStr for this iteration : " , ValidationFilesStr
-		os.system(" dq2-get -f %s -H %s/ -V %s/ "  % ( MonitoringFilesStr, thisDir, line ))
-		os.system(" dq2-get -f %s -H %s/ -V %s/ "  % ( ValidationFilesStr, thisDir, line ))
-
-		####### do the root files merging ###############################################
-		os.system(" find %s/ -name \"*CombinedMonitoring*.root\"  > %s/list1 \n "  % (thisDir, thisDir) )
-		os.system(" DQHistogramMerge.py  %s/list1  %s/TotalMonitoring.root  True \n "  % (thisDir, thisDir) )
-
-		os.system(" find %s/ -name \"*TRKVAL*.root\"              > %s/list2 \n "  % (thisDir, thisDir) )
-		#os.system(" DQHistogramMerge.py  %s/list2  %s/TotalTrkValidation.root True \n "  % (thisDir, thisDir) )
-		os.system(" hadd  %s/TotalTrkValidation.root  %s/*TRKVAL*.root  \n "           % (thisDir, thisDir) )
-
-#if MonitoringScript == True:
-if doCompareMonitoring == True:
-	print
-	print "Comparing the Monitoring Files"
-	print
-	info.write('\n')
-	info.write("Comparing the Monitoring Files \n" )
-	info.write("\n")
-	compareMonitoring = compareMonitoringScript(OutputPath = OutputPath
-	 	                                   ,numIter    = Iterations
-	 	                                   ,CMTDIR     = CMTDIR
-	 	                                   ,ATHENAREL  = ATHENAREL
-	 	                                   ,TAGS       = TAGS)
-   
-	compareMonitoring.write()
-	compareMonitoring.send()
-   
-	print
-	print "Processed %d iterations !!!" % Iterations
-	print "  %5.3f  seconds" % (time.time()-StartTime)
-   	
-	info=open(OutputPath+"/info.txt",'a')
-	info.write('\n')
-	info.write("Processed %d iterations !!!\n" % Iterations)
-	info.write("  %5.3f  seconds \n" % (time.time()-StartTime))
-	
-
-
-
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/L1-RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/L1-RunIterator.py
deleted file mode 100755
index fded81b7e05e5ae4ebcea6c3c57815c57a145915..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/L1-RunIterator.py
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Setup L1 alignment
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0 
-Iterations     = 4 
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE 	       = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'L1Alignment'
-
-HOME 	       = os.environ['HOME']
-# Alignment Output
-OutputPath     = "/afs/cern.ch/user/s/spedraza/work/alignment/repro2010/test/lorentzA/endcapL2"
-
-CMTDIR 	       = HOME+"/athena/cmthome/"
-# extra AtlasSetup options 
-ASetupOptions  = "single"  
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'DEBUG'
-
-
-##########################################################
-#		Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-
-Data1 = setupData('2010Test') # Name for the dataset, the output subpaths will have this name
-#Data1.setDataType("MC10_Singlemuons") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setDataType("IDTracks") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setRuns([159224]) # Run number, you can provide a list of runs
-Data1.setCPUs([300,250,250,300,150,150]) # Number of CPUs per iteration to process this data
-Data1.setEvents([-1,-1,-1,-1,3000000,3000000]) # Number of total events to process
-#Data1.setLimitFiles(20) # Limit the number of files to use (useful when runing in local a subset of data)
-Data1.CreateFileList() # Creates the file list
-## Data1.setCustomFileList("filelist") # Use your own filelist, WARNING: comment the CreateFileList line
-Data1.setGlobalTag("COMCOND-BLKPA-006-10") # Use custom Global Tag, if not given it will use the data default one
-Data1.setDetDescrVersion("ATLAS-GEO-20-19-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-DataToRun.append(Data1) # always add this line to process the defined data
-### Duplicate the previous lines to have as many datasets that you want
-
-from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-	DataToRun = [HandleRunOptions()]
-	
-for data in DataToRun:
-	data.Print()
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-inputAlignmentPoolFile = ""
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions = {}
-
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-
-extraOptions["PtCut"]               = 5000 #Pt in MeV, comment the line to use default value (10000)
-extraOptions["lorentzAngleTag"]     ="PIXELLorentzAngleScale-Data-001"
-extraOptions["siAlignmentTag"]      = "InDetAlign_Repro2012_d0z0p_constrained"
-extraOptions["trtAlignmentTag"]     = "TRTAlign_Repro2012_d0z0p_constrained"
-extraOptions["trtAlignmentTagL3"]   = "TRTCalibDX_EoverP_189598_189845v1"
-
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2-04"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-extraOptions["doBSConstraint"] = False 
-extraOptions["doPVConstraint"] = False
-extraOptions["useOldPreProcessor"] = False
-#extraOptions["eoverpmapconstraint"] = ""#"/afs/cern.ch/work/s/spedraza/alignment/D/L1/maps/Data.L1-Iter0-map.Refit1Params.root"  # Full path of the map
-#extraOptions["z0mapconstraint"] = "/afs/cern.ch/work/s/spedraza/alignment/D/L1/maps/Data.L1-Iter0-map.Refit1Params.root"
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-#extraOptions["readTRT"] = False
-#extraOptions["writeTRT"] = False
-#extraOptions["TRTCalibTextFile"] = ""
-#extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-AlignmentJune2010-00"
-#extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-AlignmentJune2010-00"
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignEndcapZ"] = False
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = False
-extraOptions["pixelAlignBarrelY"] = False
-extraOptions["pixelAlignBarrelZ"] = False
-extraOptions["pixelAlignBarrelRotX"] = False
-extraOptions["pixelAlignBarrelRotY"] = False
-extraOptions["pixelAlignBarrelRotZ"] = False
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = True
-extraOptions["sctAlignBarrelY"] = True
-extraOptions["sctAlignBarrelZ"] = True
-extraOptions["sctAlignBarrelRotX"] = True
-extraOptions["sctAlignBarrelRotY"] = True
-extraOptions["sctAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctlAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = True
-extraOptions["sctAlignEndcapRotX"] = True
-extraOptions["sctAlignEndcapRotY"] = True
-extraOptions["sctAlignEndcapRotZ"] = True
-
-
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelBarrel           = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelEndcaps          = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full Pixel
-PixelAlignmentLevel        = [ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [-1,-1 ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTBarrel            =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTEndcaps           =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full SCT
-SCTAlignmentLevel         =  [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# TRT
-# are we running TRT alignment
-AlignTRT            = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-# alignment level for the full TRT
-TRTAlignmentLevel   = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] # see InDetAlignGeometryLevel wiki for more info
-
-#AlignInDet          = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = ''
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator.py")
-execfile("NewInDetIterator.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py
deleted file mode 100755
index e8e9673b37d8d8e9426e492a6937868eec259cba..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Setup L2 alignment
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 4 
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE 	       = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'L2-alignment'
-
-HOME 	       = os.environ['HOME']
-# Alignment Output
-OutputPath     = "/afs/cern.ch/user/s/spedraza/work/alignment/repro2010/test/level2"
-
-CMTDIR 	       = HOME+"/athena/cmthome/"
-# extra AtlasSetup options 
-ASetupOptions  = "single"  
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'DEBUG'
-
-
-##########################################################
-#		Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-
-Data1 = setupData('2010Test') # Name for the dataset, the output subpaths will have this name
-#Data1.setDataType("MC10_Singlemuons") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setDataType("IDTracks") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setRuns([159224]) # Run number, you can provide a list of runs
-Data1.setCPUs([300,300,300,300,200,150]) # Number of CPUs per iteration to process this data
-Data1.setEvents([-1,-1,-1,-1,-1,3000000]) # Number of total events to process
-#Data1.setLimitFiles(20) # Limit the number of files to use (useful when runing in local a subset of data)
-Data1.CreateFileList() # Creates the file list
-## Data1.setCustomFileList("filelist") # Use your own filelist, WARNING: comment the CreateFileList line
-Data1.setGlobalTag("COMCOND-BLKPA-006-10") # Use custom Global Tag, if not given it will use the data default one
-Data1.setDetDescrVersion("ATLAS-GEO-20-19-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-DataToRun.append(Data1) # always add this line to process the defined data
-### Duplicate the previous lines to have as many datasets that you want
-
-from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-	DataToRun = [HandleRunOptions()]
-	
-for data in DataToRun:
-	data.Print()
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-inputAlignmentPoolFile = "/afs/cern.ch/user/s/spedraza/work/alignment/repro2010/test/lorentzA/last-GEO-CONDB/Iter2/Iter2_AlignmentConstants.root"
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions = {}
-
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-extraOptions["PtCut"]               = 5000 #Pt in MeV, comment the line to use default value (10000)
-extraOptions["lorentzAngleTag"]     ="PIXELLorentzAngleScale-Data-001"
-extraOptions["siAlignmentTag"] = "InDetAlign_Repro2012_d0z0p_constrained"
-extraOptions["trtAlignmentTag"] = "TRTAlign_Repro2012_d0z0p_constrained"
-extraOptions["trtAlignmentTagL3"] = "TRTCalibDX_EoverP_189598_189845v1"
-
-extraOptions["beamSpotTag"] = "IndetBeampos-Oct10-Collision_7T_2010_07-v0"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 6
-extraOptions["softModeCut"]= 0.
-#extraOptions["pixelSetSoftCutBarrelX"] = 0.02
-#extraOptions["pixelSetSoftCutBarrelY"] = 0.02
-#extraOptions["pixelSetSoftCutBarrelZ"] = 0.02
-#extraOptions["pixelSetSoftCutBarrelRotX"] = 0.05
-#extraOptions["pixelSetSoftCutBarrelRotY"] = 0.05
-#extraOptions["pixelSetSoftCutBarrelRotZ"] = 0.05
-#extraOptions["pixelSetSoftCutEndcapX"] = 0.02
-#extraOptions["pixelSetSoftCutEndcapY"] = 0.02
-#extraOptions["pixelSetSoftCutEndcapZ"] = 0.02
-#extraOptions["pixelSetSoftCutEndcapRotX"] = 0.05
-#extraOptions["pixelSetSoftCutEndcapRotY"] = 0.05
-#extraOptions["pixelSetSoftCutEndcapRotZ"] = 0.05
-#extraOptions["sctSetSoftCutBarrelX"] = 0.05
-#extraOptions["sctSetSoftCutBarrelY"] = 0.05
-#extraOptions["sctSetSoftCutBarrelZ"] = 0.05
-#extraOptions["sctSetSoftCutBarrelRotX"] = 0.05
-#extraOptions["sctSetSoftCutBarrelRotY"] = 0.05
-#extraOptions["sctSetSoftCutBarrelRotZ"] = 0.05
-#extraOptions["sctSetSoftCutEndcapX"] = 0.05
-#extraOptions["sctSetSoftCutEndcapY"] = 0.05
-#extraOptions["sctSetSoftCutEndcapZ"] = 0.005
-#extraOptions["sctSetSoftCutEndcapRotX"] = 0.005
-#extraOptions["sctSetSoftCutEndcapRotY"] = 0.05
-#extraOptions["sctSetSoftCutEndcapRotZ"] = 0.05
-
-extraOptions["doBSConstraint"] = True
-extraOptions["doPVConstraint"] = False
-extraOptions["useOldPreProcessor"] = False
-#extraOptions["eoverpmapconstraint"] = "/afs/cern.ch/user/a/atlidali/w1/users/spedraza/output/B/L2/maps/Data.L2-Iter3-map.Refit1Params.root"  # Full path of the map
-#extraOptions["z0mapconstraint"] = "/afs/cern.ch/user/a/atlidali/w1/users/spedraza/output/B/L2/maps/Data.L2-Iter3-map.Refit1Params.root"
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-#extraOptions["readTRT"] = False
-#extraOptions["writeTRT"] = False
-#extraOptions["TRTCalibTextFile"] = ""
-#extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-AlignmentJune2010-00"
-#extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-AlignmentJune2010-00"
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignEndcapZ"] = False
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = True
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = True
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = False
-
-## SCT
-extraOptions["sctAlignBarrelX"] = True
-extraOptions["sctAlignBarrelY"] = True
-extraOptions["sctAlignBarrelZ"] = True
-extraOptions["sctAlignBarrelRotX"] = True
-extraOptions["sctAlignBarrelRotY"] = True
-extraOptions["sctAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctlAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = True
-extraOptions["sctAlignEndcapRotX"] = True
-extraOptions["sctAlignEndcapRotY"] = True
-extraOptions["sctAlignEndcapRotZ"] = True
-
-
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelBarrel           = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelEndcaps          = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full Pixel
-PixelAlignmentLevel        = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [-1,-1,-1,-1,-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTBarrel            =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTEndcaps           =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full SCT
-SCTAlignmentLevel         =  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [-1,-1,-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [-1,-1,-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# TRT
-# are we running TRT alignment
-AlignTRT            = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-# alignment level for the full TRT
-TRTAlignmentLevel   = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-#AlignInDet          = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = ''
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator.py")
-execfile("NewInDetIterator.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py
deleted file mode 100755
index 07bab70a8e121e37b5abe258ecd3ab92b7213908..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Setup L3 alignment
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 4
-Iterations     = 1 
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE 	       = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'L3-alignment'
-
-HOME 	       = os.environ['HOME']
-# Alignment Output
-OutputPath     = "/afs/cern.ch/work/s/spedraza/alignment/B/L3/constants/local/"
-
-CMTDIR 	       = HOME+"/athena/cmthome/"
-# extra AtlasSetup options 
-ASetupOptions  = "single"  
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'DEBUG'
-
-
-##########################################################
-#		Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-
-Data1 = setupData('Blocal')
-#Data1.setDataType("MC10_Singlemuons") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setDataType("IDTracks") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setRuns([
- 204763,
- 204769,
- 204772,
- 204795,
- 204796,
- 204853,
- 204910,
- 204932,
- 204954,
- 204955,
- 204976,
- 205010,
- 205012,
- 205016,
- 205017,
- 205055,
- 205071,
- 205112,
- 205113]) # Run number, you can provide a list of runs
-Data1.setCPUs([250,250,250,250,250,250]) # Number of CPUs per iteration to process this data
-Data1.setEvents([10000000,7500000,7500000,7500000,6250000,7500000]) # Number of total events to process
-#Data1.setLimitFiles(20) # Limit the number of files to use (useful when runing in local a subset of data)
-Data1.CreateFileList() # Creates the file list
-## Data1.setCustomFileList("filelist") # Use your own filelist, WARNING: comment the CreateFileList line
-Data1.setGlobalTag("COMCOND-ES1PA-006-04") # Use custom Global Tag, if not given it will use the data default one
-Data1.setDetDescrVersion("ATLAS-GEO-20-00-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-DataToRun.append(Data1) # always add this line to process the defined data
-### Duplicate the previous lines to have as many datasets that you want
-
-from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-	DataToRun = [HandleRunOptions()]
-	
-for data in DataToRun:
-	data.Print()
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "LX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-inputAlignmentPoolFile = "/afs/cern.ch/user/s/spedraza/work/alignment/B/L3/constants/local/Iter3/Iter3_AlignmentConstants.root"
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions = {}
-
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-
-extraOptions["siAlignmentTag"] = "InDetAlign_InDetAlign_EoverP_2012_PeriodAv0"
-extraOptions["trtAlignmentTag"] = "TRTAlign_InDetAlign_EoverP_2012_PeriodAv0"
-extraOptions["trtAlignmentTagL3"] = "TRTCalibDX_EoverP_189598_189845v1"
-
-extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2-04"
-#extraOptions["particleNumber"] = 0
-extraOptions["solvingOption"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 1.
-extraOptions["pixelSetSoftCutBarrelX"] = 0.004
-extraOptions["pixelSetSoftCutBarrelY"] = 0.02
-extraOptions["pixelSetSoftCutBarrelZ"] = 0.004
-extraOptions["pixelSetSoftCutBarrelRotX"] = 0.01
-extraOptions["pixelSetSoftCutBarrelRotY"] = 0.01
-extraOptions["pixelSetSoftCutBarrelRotZ"] = 0.01
-extraOptions["pixelSetSoftCutEndcapX"] = 0.004
-extraOptions["pixelSetSoftCutEndcapY"] = 0.004
-extraOptions["pixelSetSoftCutEndcapZ"] = 0.01
-extraOptions["pixelSetSoftCutEndcapRotX"] = 0.01
-extraOptions["pixelSetSoftCutEndcapRotY"] = 0.01
-extraOptions["pixelSetSoftCutEndcapRotZ"] = 0.01
-extraOptions["sctSetSoftCutBarrelX"] = 0.01
-extraOptions["sctSetSoftCutBarrelY"] = 0.01
-extraOptions["sctSetSoftCutBarrelZ"] = 0.01
-extraOptions["sctSetSoftCutBarrelRotX"] = 0.01
-extraOptions["sctSetSoftCutBarrelRotY"] = 0.01
-extraOptions["sctSetSoftCutBarrelRotZ"] = 0.01
-extraOptions["sctSetSoftCutEndcapX"] = 0.01
-extraOptions["sctSetSoftCutEndcapY"] = 0.01
-extraOptions["sctSetSoftCutEndcapZ"] = 0.01
-extraOptions["sctSetSoftCutEndcapRotX"] = 0.001
-extraOptions["sctSetSoftCutEndcapRotY"] = 0.01
-extraOptions["sctSetSoftCutEndcapRotZ"] = 0.01
-
-extraOptions["doBSConstraint"] = False 
-extraOptions["doPVConstraint"] = False
-extraOptions["useOldPreProcessor"] = False
-extraOptions["eoverpmapconstraint"] = "/afs/cern.ch/user/s/spedraza/work/alignment/D/freeze-bias.root"  # Full path of the map
-extraOptions["z0mapconstraint"] =     "/afs/cern.ch/user/s/spedraza/work/alignment/D/freeze-bias.root"
-extraOptions["d0mapconstraint"] =     "/afs/cern.ch/user/s/spedraza/work/alignment/D/freeze-bias.root"
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-#extraOptions["readTRT"] = False
-#extraOptions["writeTRT"] = False
-#extraOptions["TRTCalibTextFile"] = ""
-#extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-AlignmentJune2010-00"
-#extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-AlignmentJune2010-00"
-
-extraOptions["trtAlignBarrelX"] = True
-extraOptions["trtAlignBarrelY"] = False
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignBarrelRotX"] = False
-extraOptions["trtAlignBarrelRotY"] = False
-extraOptions["trtAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["trtAlignEndcapX"] = True
-extraOptions["trtAlignEndcapY"] = True
-extraOptions["trtAlignEndcapZ"] = False
-extraOptions["trtAlignEndcapRotX"] = False
-extraOptions["trtAlignEndcapRotY"] = False
-extraOptions["trtAlignEndcapRotZ"] = True
-
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = True
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = True
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = False
-
-## SCT
-extraOptions["sctAlignBarrelX"] = True
-extraOptions["sctAlignBarrelY"] = True
-extraOptions["sctAlignBarrelZ"] = True
-extraOptions["sctAlignBarrelRotX"] = True
-extraOptions["sctAlignBarrelRotY"] = True
-extraOptions["sctAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctlAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = False
-extraOptions["sctAlignEndcapRotX"] = False
-extraOptions["sctAlignEndcapRotY"] = False
-extraOptions["sctAlignEndcapRotZ"] = True
-
-
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelBarrel           = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelEndcaps          = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full Pixel
-PixelAlignmentLevel        = [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTBarrel            =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTEndcaps           =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full SCT
-SCTAlignmentLevel         =  [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# TRT
-# are we running TRT alignment
-AlignTRT            = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-# alignment level for the full TRT
-TRTAlignmentLevel   = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1] # see InDetAlignGeometryLevel wiki for more info
-TRTAlignmentLevelBarrel   =  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-TRTAlignmentLevelEndcaps  =  [ 1, 1, 1, 1, 1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] # see InDetAlignGeometryLevel wiki for more info
-#AlignInDet          = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = ''
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator.py")
-execfile("NewInDetIterator.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/LumiBlockIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/LumiBlockIterator.py
deleted file mode 100644
index e688285d7a6bf909c32ddd549226d9a1dbe29397..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/LumiBlockIterator.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-debug = True
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    from optparse import OptionParser
-    parser = OptionParser()
-    parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-    parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-    parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: False)",action="store_true", default=False)
-    parser.add_option("--inputBowingDb", dest="inputBowingDb", help="In the case you want to use a specific IBL bowing  write here the absolute path to the cool file", default="")
-    parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-    parser.add_option("--nEvents", dest="nEvents", help="Maximum number of events to use", default="")
-    parser.add_option("--nCpus", dest="nCpus", help="Number of CPUs to be used",default="")
-    parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-    parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = "")
-    parser.add_option("--FirstLB",dest="inputFirstLB", help = " First LumiBlock to be considered ", default = 1)
-    parser.add_option("--LastLB",dest="inputLastLB", help = " Last LumiBlock to be considered (default all)", default = -1 )
-    parser.add_option("--NLB",dest = "inputNLB", help = " Number of lumiblocks per job ", default = 10)
-    parser.add_option("--suffix",dest = "inputSuffix", help = " Suffix for the jobs", default ="")
-    parser.add_option("--useLBselector", dest = "inputUseLBselector", help = "If True use the athena LB selector. If false, file list is split by LB.",action="store_true", default=False) 
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    return config
-    
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-userFile=config.inputList
-eventType=config.eventType
-userConstantsFile=config.inputConstantsFile
-usernEvents=str(config.nEvents)
-isData=config.isData
-userErrorScalingTag=config.errorScalingTag
-usernCpus= str(config.nCpus)  
-userPtMin = str(config.userPtMin)
-userFirstLB = int(config.inputFirstLB)
-userLastLB = int(config.inputLastLB)
-userNLB = int(config.inputNLB)
-userBowingDB = str(config.inputBowingDb)
-userSuffix = str(config.inputSuffix)
-userUseLBselector = config.inputUseLBselector
-
-##########################################################
-#  split the input file according to the lumiblocks      #
-##########################################################
-initialLB = userFirstLB 
-finalLB = userFirstLB - 1# intialization
-upperLB = finalLB+1 # maximum value, a value that allows to enter the loop
-if (userLastLB > 0): upperLB = userLastLB 
-ListOfDaughterFiles = []
-ListOfNFiles = []
-ListOfLBranges = []
-
-with open(userFile, 'rb') as inFile:
-    while (finalLB < upperLB and finalLB < userLastLB):
-        initialLB = finalLB + 1 # go for next LB
-        finalLB = initialLB + userNLB - 1 #to correct for the first one. This way one may do from 1 to 10 and so on 
-        if (finalLB > userLastLB): finalLB = userLastLB
-        # -- open output file
-        outputFileName = "SelectedLB_" + str(initialLB) + "_" + str(finalLB) + ".txt"
-        if ( userNLB == 1): outputFileName = "SelectedLB_" + str(initialLB) +  ".txt"
-        outFile = open(outputFileName, 'w')
-        writtenLines = 0
-        
-        # -- write list of input files into the output files 
-        for line in inFile:
-            whereLB = line.find("_lb") 
-            thisLB = int(line[whereLB+3:whereLB+7])
-            #print whereLB, thisLB
-            if ((initialLB <= thisLB and thisLB <=finalLB) or userUseLBselector):
-                outFile.write(line)
-                writtenLines += 1
-            if (thisLB > upperLB): upperLB = thisLB
-        if (writtenLines>0): print " <LumiBlockIterator> ouput file ", outputFileName, " has ", writtenLines, " lines"
-        if (writtenLines > 0): 
-            ListOfDaughterFiles.append(outputFileName)
-            ListOfNFiles.append(writtenLines)
-        else: #delete empty files
-            os.remove(outputFileName)
-        inFile.seek(0,0) # rewind
-
-        # store the list of LB ranges
-        ListOfLBranges.append(initialLB)
-        ListOfLBranges.append(finalLB)
-        
-    print " <LumiBlockIterator> Lumiblock file splitting completed. In total ", len(ListOfDaughterFiles) ," daughter files with active LumiBlocks have been created"
-
-##########################################################
-# Loop over the daughter files and submit the jobs       #
-##########################################################
-subJob=0
-if len(ListOfDaughterFiles) > 0:
-    thisfile = 0
-
-    # deal with user options
-    execCommandOptions = ""
-    execCommandOptions1 = ""
-    execCommandOptions2 = "" # input bowing file
-    execCommandOptions3 = "" # for LB selections
-
-    if (len(userConstantsFile)>0): execCommandOptions1 = execCommandOptions1 + " --inputConstantsFile " + userConstantsFile
-    if (len(userErrorScalingTag)>0): execCommandOptions1 = execCommandOptions1 + " --errorScalingTag " + userErrorScalingTag
-    if (len(usernEvents)>0):execCommandOptions1 = execCommandOptions1 + " --nEvents " + usernEvents 
-    execCommandOptions1 = execCommandOptions1 + " --isData True" 
-    if (len(userPtMin)>0): execCommandOptions1 = execCommandOptions1 + " --ptmin " + userPtMin
-    if (debug): print " <LumiBlockIterator> execCommandOptions1 = ", execCommandOptions1
-    if (len(userBowingDB)>0):  execCommandOptions2 = execCommandOptions2 + " --inputBowingDb "+userBowingDB     
-        
-    for daughterFile in ListOfDaughterFiles:
-        print "\n  <LumiBlockIterator> going to process lumiblocks in file ",  daughterFile
-        whereLB = daughterFile.find("LB_")
-        whereDotTxt = daughterFile.find(".txt")
-        theTail = daughterFile[whereLB:whereDotTxt]
-        if (len(userSuffix)>0): theTail = userSuffix + "_" + daughterFile[whereLB:whereDotTxt]
-        
-        #if (debug): print " <LumiBlockIterator> theTail = ", theTail
-
-        execCommandOptions0 = " --inputList " + daughterFile
-        execCommandOptions0 = execCommandOptions0 + " --suffix " + theTail
-
-        thisnCpus = usernCpus
-        #if (ListOfNFiles[subJob] < usernCpus): thisnCpus = ListOfNFiles[subJob] 
-        if (len(usernCpus)>0): execCommandOptions0 = execCommandOptions0 + " --nCpus " +  str(thisnCpus)
-
-        # LB selection    
-        execCommandOptions3 = "" # reset
-        firtLB = ListOfLBranges[thisfile*2]
-        lastLB = ListOfLBranges[thisfile*2+1]
-        if (userUseLBselector): execCommandOptions3 =  " --LBrangeFirst " + str(firtLB) + " --LBrangeLast " + str(lastLB)
-        
-        # build the command options for RunIterator
-        execCommandOptions = execCommandOptions0 + execCommandOptions1 + execCommandOptions2 + execCommandOptions3
-
-        if (debug): print " <LumiBlockIterator> execCommandOptions = ", execCommandOptions 
-        os.system("python RunIterator.py "+execCommandOptions+" &")
-
-        subJob += 1
-        thisfile += 1
-
-        os.system("sleep 3")
-        
-exit()    
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/MisalignmentSet1.pool.root b/InnerDetector/InDetExample/InDetAlignExample/share/MisalignmentSet1.pool.root
deleted file mode 100644
index 97a1fb999f5cd2938cc6e8b116658204d20b5d59..0000000000000000000000000000000000000000
Binary files a/InnerDetector/InDetExample/InDetAlignExample/share/MisalignmentSet1.pool.root and /dev/null differ
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py
deleted file mode 100644
index 64ef5afcffc4529e74f2d8f9ac100aadbc688575..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py
+++ /dev/null
@@ -1,799 +0,0 @@
-##############################################################################
-#
-#  Main alignment script which sets up all tools and algorithms to run global
-#  or local chi2 alignment using analytical derivatives.
-#
-#  Started:  Daniel Kollar <daniel.kollar@cern.ch> (09/2009)
-#
-##############################################################################
-#
-# The Following options can be specified seperately in a file that include this one
-#
-# General Alignemnt Options and their defaults
-newInDetAlignAlg_Options = {
-    "outputLevel"           : INFO                       #  output level for log messages for all tools and algs
-    ,"trackCollection"      : "Tracks"                   #  track collection to process
-    ,"d0significanceCut"    : -1                         #  Cut on d0 significance
-    ,"CorrectD0"            : False                      #  whether to use D0 constraint
-    ,"CorrectZ0"            : False                      #  whether to use Z0 constraint 
-    ,"readConstantsFromPool"    : False                  #  whether to read initial alignment constants from pool file
-    ,"readSilicon"          : True                       #  whether to read initial Si alignment constants from pool file
-    ,"readTRT"          : True                           #  whether to read initial TRT alignment constnats from pool file
-    ,"readTRTL3"            : False                      #  whether to read initial TRT L3 alignment constnats from pool file
-    ,"inputPoolFiles"       : ["IDalignment_nominal.pool.root"]  #  pool files to read the constants from
-    ,"writeConstantsToPool"     : True                   #  whether to write final alignment constants to pool file
-    ,"writeSilicon"         : True                       #  whether to write final Si constants to pool file
-    ,"writeTRT"             : True                           #  whether to write final TRT constants to pool file
-    ,"writeTRTL3"           : False                          #  whether to write final TRT L3 constants to pool file    
-    ,"writeIBLDistDB"       : True                          #  whether to write /Indet/IBLDist to db file    
-    ,"outputPoolFile"       : "alignment_output.pool.root"       #  pool file to write the final constants
-    ,"outputCoolFile"       : "mycool2.db"               #  cool file to write the final bowing
-    ,"tagSi"            : "IndetAlign_test"              #  DB tag to use for final Si constants
-    ,"tagTRT"           : "TRTAlign_test"                #  DB tag to use for final TRT constnats
-    ,"tagBow"           : "IndetIBLDist"                 #  DB tag to use for final Bowing constants
-    ,"runAccumulate"        : True                       #  whether to run the event/track processing
-    ,"runSolving"               : True                           #  whether to run the solving
-    ,"runLocal"             : False                          #  whether to runlocal or global Chi2 method
-    ,"residualType"         : 0                          #  type of residual to use in local method 0 - hit-only (biased), 1 - unbiased
-    ,"usePixelErrors"       : True                       #  whether to use real Pixel errors (only for local method)
-    ,"useSCTErrors"         : True                       #  whether to use real SCT errors (only for local method)
-    ,"useTRTErrors"         : True                       #  whether to use real TRT errors (only for local method)
-    ,"inputMatrixFiles"             : [ "matrix.bin" ]           #  list of matrix files when solving only
-    ,"inputVectorFiles"             : [ "vector.bin" ]               #  list of vector files when solving only
-    ,"inputTFiles"          : ["AlignmentTFile.root"]        # list of the Alignment TFiles, used only if WriteTFile is True
-    ,"solvingOption"            : 3                          #  which global solver to run 0-none, 1-Lapack, 2-Eigen, 6-ROOT, 7-CLHEP
-    ,"solveLocal"               : True                       #  whether to run locaal solving
-    ,"writeMatrixFile"          : True                       #  whether to write matrix to file before solving
-    ,"writeMatrixFileTxt"           : True                   #  whether to write matrix to text file
-    ,"WriteTFile"           : True                       #  use ROOT files for store the matrix
-    ,"TFileName"            :"AlignmentTFile.root"               #  Output TFile name, used only if WriteTFile is True
-    ,"PathBinName"          :"./"                    #  path for the output AlignmentTFile 
-    ,"runDiagonalization"           : True                   #  whether to run diagonalization (Lapack, CLHEP)
-    ,"eigenvalueCut"            : 0.                         #  minimal size of eigenvalue for diagonalization
-    ,"ModCut"               : 0                              #  nomber of modes to cut for diagonalization
-    ,"useSparse"                : False                          #  whether to use sparse or symmetric matrix representation
-    ,"softModeCut"              : 0.                         #  soft-mode-cut for all DoF
-    ,"minHits"              : 10                             #  minimal number of hits in module to do the solving
-    ,"scaleMatrix"              : True                               #  whethwe to normalize the matrix to number of hits before solving (Lapack)
-    ,"calculateFullCovariance"      : True                   #  whether to calculate the full covariance matrix of the alignment parameters
-    ,"refitTracks"              : True                           #  whether to refit tracks before processing
-    ,"runOutlier"               : True                       #  whether to refit tracks with outlier removal
-    ,"particleNumber"           : 3                          #  particle hypothesis to use in the refit
-    ,"useTrackSelector"             : True                       #  whether to use track selector
-    ,"writeAlignNtuple"         : False                       #  whether to write an alignment specific ntuple
-    ,"alignNtupleName"          : "newIDalign.root"          #  name of the ntuple file
-    ,"writeDerivatives"             : False                      #  whether to store dr/da in the ntuple
-    ,"writeHitmap"              : True                           #  whether to store the hitmap
-    ,"writeHitmapTxt"           : True                       #  whether to store the hitmap in a text file
-    ,"writeEigenMat"            : False                      #  whether to write the eigenspectrum/eigenvectors into files
-    ,"writeEigenMatTxt"             : False                      #  whether to write the eigenspectrum/eigenvectors into text files
-    ,"inputHitmapFiles"             : [ "hitmap.bin" ]               #  list of hitmap files when solving only
-    ,"readHitmaps"              : True                           #  whether to use the hitmap information when solve only
-    ,"doMonitoring"             : True                       #  whether to run the monitoring scripts
-    ,"monitoringName"           : ""                         # apply a monitoring name
-    ,"Cosmics"              : False                          #  whether to use special cosmic track selection
-    ,"useTRT"               : True                           #  whether to use TRT for track selection
-
-    ,"useOldPreProcessor"           : False                               #  temporary option, new preProcessor with beam-spot constraint is
-                                                         #  available only from tag TrkAlignGenTools-01-07-08 which didn't
-                                                         #  make it into 15.6.9, once in the release, old preProcessor will
-                                                         #  be removed
-    ,"doBSConstraint"               : False                      #  run with beam-spot constraint
-    ,"doPVConstraint"       : False                  #  run with primary vertex constraint
-    ,"doFullVertex"                 : False                              #  run with the full GX vertex constraint
-    ,"doBSTrackSelection"           : False                       #  run BS constraint only for tracks which pass tighter track selection
-    ,"doBSAssociatedToPVSelection"  : False                  #  run BS constraint only for tracks associated to primary vertex
-    ,"beamspotScalingFactor"        : 1.                     #  factor to scale the size of the beam spot
-    ,"PtCutForBSConstraint"         : 0.                     #  Max Pt Cut for the BS constraint in order to not clash with the IP constraints
-    ,"MinPtForConstrainedProvider"         : 0.                     #  Max Pt Cut for the BS constraint in order to not clash with the IP constraints
-    ,"eoverpmapconstraint"      : ""                                 #  sagitta bias map for momentum constraint(could be E/P or Z->mumu method )
-    ,"eoverpmapconstraintmap"      : ""                                 #  sagitta bias map for momentum constraint(could be E/P or Z->mumu method )
-    ,"z0mapconstraint"      : ""                                 #  z0 bias map file for IP constraint
-    ,"z0mapconstraintmap"      : "z0CorrectionVsEtaPhi"                                 #  z0 bias map name for IP constraint
-    ,"d0mapconstraint"      : ""                     #  d0 bias map for IP constraint
-    ,"d0mapconstraintmap"      : "d0CorrectionVsEtaPhi"                     #  d0 bias map for IP constraint
-    ,"PtCut"            : 2000                  #  Pt cut for the reconstruction [MeV]
-
-
-    ,"doSiHitQualSel"       : False                   #  perform Si hit (pix+sct) quality selection with InDetAlinHitQualSelTool
-    ,"AlignIBLbutNotPixel"  : False		# Set to True to align the IBL but not the Old Pixel (L11).
-    ,"AlignPixelbutNotIBL"  : False		# Set to True to align the Old Pixel but not the IBL (L11).
-    ,"FixMomentum"          : False             # Set to True to remove the QoverP from the track parameters when deriving the residuals.
-    ,"LumiblockSelection"   : False				     #	whether to select events from a list of lumiblocks.
-    ,"LumiblockList"	    : range(400,420,1) 		     #	The list of LBs you want to select
-
-}
-
-##############################################################################
-## If the variables are defined use thier values.
-## If not defined the defaults given above are used
-for var in newInDetAlignAlg_Options:
-    if var in dir():
-        newInDetAlignAlg_Options[var] = eval(var)
-# If Cosmics, switch off Beamspot / Vtx constraint 
-
-print " <NewInDetAlignAlgSetup> set up for cosmics ? ",Cosmics 
-
-if newInDetAlignAlg_Options["Cosmics"]:
-    newInDetAlignAlg_Options["doBSConstraint"] = False
-    newInDetAlignAlg_Options["doPVConstraint"] = False
-    newInDetAlignAlg_Options["doFullVertex"] = False
-    newInDetAlignAlg_Options["doBSTrackSelection"] = False
-    newInDetAlignAlg_Options["doBSAssociatedToPVSelection"] = False
-else:
-    print " <NewInDetAlignAlgSetup> setup check for BS and Pvx constraints:"
-    print " <NewInDetAlignAlgSetup> doBSConstraint ?: ",newInDetAlignAlg_Options["doBSConstraint"]
-    print " <NewInDetAlignAlgSetup> doPVConstraint ?: ",newInDetAlignAlg_Options["doPVConstraint"] 
-    print " <NewInDetAlignAlgSetup> doFullVertex   ?: ",newInDetAlignAlg_Options["doFullVertex"] 
-    print " <NewInDetAlignAlgSetup> doBSTrackSelec ?: ",newInDetAlignAlg_Options["doBSTrackSelection"] 
-    print " <NewInDetAlignAlgSetup> doBSAssoc2PV   ?: ",newInDetAlignAlg_Options["doBSAssociatedToPVSelection"] 
-
-
-## ===================================================================
-## Preprocessor Check ##
-
-if newInDetAlignAlg_Options["doBSConstraint"] or newInDetAlignAlg_Options["doPVConstraint"] or newInDetAlignAlg_Options["doBSTrackSelection"] or newInDetAlignAlg_Options["doBSAssociatedToPVSelection"]:
-    print "NewInDetAlignAlg: Switching off the OldPreprocessor"
-    newInDetAlignAlg_Options["useOldPreProcessor"] = False
-
-if newInDetAlignAlg_Options["useOldPreProcessor"]:
-    print "WARNING: The BeamSpot constraint and PV Constraint are disabled"
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==               Settings for the alignment                      ==
-## ==                                                               ==
-if not newInDetAlignAlg_Options["runAccumulate"] and not newInDetAlignAlg_Options["runSolving"]:
-    print 'ERROR: Both event processing and solving switched off. Nothing to be done.'
-    exit(10)
-
-# if we're running full local method we have to adjust some parameters
-# if we're running Global, we need to refit tracks to get matrices from the fitter
-if newInDetAlignAlg_Options["runLocal"]:
-    newInDetAlignAlg_Options["solveLocal"] = True
-    newInDetAlignAlg_Options["solvingOption"] = 0
-    newInDetAlignAlg_Options["useSparse"] = True
-else :
-    newInDetAlignAlg_Options["refitTracks"] = True
-    # residual type different that hit-only (biased)
-    # doesn't mane sense for global chi2 method
-    newInDetAlignAlg_Options["residualType"] = 0
-
-# if we're not solving ...
-if not newInDetAlignAlg_Options["runSolving"]:
-    # don't run global
-    newInDetAlignAlg_Options["solvingOption"] = 0
-    # don't run local
-    newInDetAlignAlg_Options["solveLocal"] = False
-    # don't update constants
-    updateConstants = False
-
-# if we're not writing the alignment ntuple we also don't store the derivatives
-if not newInDetAlignAlg_Options["writeAlignNtuple"]:
-    newInDetAlignAlg_Options["writeDerivatives"] = False
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==       Below is the detailed setup of the alignment job        ==
-## ==                                                               ==
-
-ToolSvc = Service('ToolSvc')
-
-#######################
-# global chi2 alignment
-#######################
-
-
-################################
-# use InDetTrackFitter as defined in the ID reconstruction
-# it is a Global Chi2 fitter and only needed when run accumulation
-if newInDetAlignAlg_Options["runAccumulate"]:
-
-    if not newInDetAlignAlg_Options["runLocal"]:
-        InDetTrackFitter.FillDerivativeMatrix = True
-
-    trackFitter = InDetTrackFitter
-    if newInDetAlignAlg_Options["refitTracks"]:
-        if newInDetAlignAlg_Options["particleNumber"] == 0:
-            trackFitter.GetMaterialFromTrack = False
-        else:
-            trackFitter.GetMaterialFromTrack = True
-
-################################
-# create AlignModuleTool
-# this will be most likely overwritten with detector specific alignModuleTool
-# during geometry setup but it is a reasonable default
-from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignModuleTool
-alignModuleTool = Trk__AlignModuleTool(
-    name = "AlignModuleTool",
-    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-    
-)
-ToolSvc += alignModuleTool
-print alignModuleTool
-
-################################
-#
-# include geometry setup
-#
-include("InDetAlignExample/NewInDetAlignGeometrySetup.py")
-
-################################
-#TOBE REMOVED # Read in constants from Pool file
-#if False:# newInDetAlignAlg_Options["readConstantsFromPool"]:
-#    from IOVDbSvc.CondDB import conddb
-#
-#    if newInDetAlignAlg_Options["readSilicon"]:
-#        conddb.blockFolder("/Indet/Align")
-#
-#    if newInDetAlignAlg_Options["readTRT"]:
-#        conddb.blockFolder("/TRT/Align")
-#
-#    if newInDetAlignAlg_Options["readTRTL3"]:
-#        conddb.blockFolder("/TRT/Calib/DX")
-#
-#    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-#    from AthenaCommon.AppMgr import ServiceMgr
-#    ServiceMgr += CondProxyProvider()
-#    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-#    # set this to the file containing AlignableTransform objects
-#    ServiceMgr.CondProxyProvider.InputCollections += newInDetAlignAlg_Options["inputPoolFiles"]
-#    ServiceMgr.CondProxyProvider.OutputLevel = DEBUG
-#    print ServiceMgr.CondProxyProvider
-
-    # this preload causes callbacks for read in objects to be activated,
-    # allowing GeoModel to pick up the transforms
-#    ServiceMgr.IOVSvc.preLoadData = True
-#    ServiceMgr.IOVSvc.OutputLevel = INFO
-
-################################
-# make GlobalChi2AlignTool
-from TrkGlobalChi2AlignTools.TrkGlobalChi2AlignToolsConf import Trk__GlobalChi2AlignTool
-globalChi2AlignTool = Trk__GlobalChi2AlignTool(
-    name = 'GlobalChi2AlignTool',
-    AlignModuleTool = alignModuleTool,
-    StoreLocalDerivOnly = (newInDetAlignAlg_Options["solveLocal"] and newInDetAlignAlg_Options["solvingOption"]==0), # If we're running local later, we want to store ony local derivs
-    SecondDerivativeCut = 0, # this is just for the moment :(
-    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-)
-ToolSvc += globalChi2AlignTool
-
-# setup MatrixTool
-matrixTool = globalChi2AlignTool.MatrixTool
-matrixTool.OutputLevel      = newInDetAlignAlg_Options["outputLevel"]
-matrixTool.AlignModuleTool  = alignModuleTool
-matrixTool.UseSparse        = newInDetAlignAlg_Options["useSparse"]
-matrixTool.SolveOption      = newInDetAlignAlg_Options["solvingOption"]
-matrixTool.MinNumHitsPerModule  = newInDetAlignAlg_Options["minHits"]
-matrixTool.Diagonalize      = newInDetAlignAlg_Options["runDiagonalization"]
-matrixTool.EigenvalueThreshold  = newInDetAlignAlg_Options["eigenvalueCut"]
-matrixTool.RunLocalMethod       = newInDetAlignAlg_Options["solveLocal"]
-matrixTool.WriteMat         = newInDetAlignAlg_Options["writeMatrixFile"]
-matrixTool.WriteMatTxt      = newInDetAlignAlg_Options["writeMatrixFileTxt"]
-matrixTool.WriteEigenMat    = newInDetAlignAlg_Options["writeEigenMat"]
-matrixTool.WriteEigenMatTxt     = newInDetAlignAlg_Options["writeEigenMatTxt"]
-matrixTool.ModCut       = newInDetAlignAlg_Options["ModCut"]
-matrixTool.InputMatrixFiles     = newInDetAlignAlg_Options["inputMatrixFiles"]
-matrixTool.InputVectorFiles     = newInDetAlignAlg_Options["inputVectorFiles"]
-matrixTool.WriteHitmap      = newInDetAlignAlg_Options["writeHitmap"]
-matrixTool.WriteHitmapTxt   = newInDetAlignAlg_Options["writeHitmapTxt"]
-matrixTool.ReadHitmaps      = newInDetAlignAlg_Options["readHitmaps"]
-matrixTool.InputHitmapFiles     = newInDetAlignAlg_Options["inputHitmapFiles"]
-matrixTool.SoftEigenmodeCut     = newInDetAlignAlg_Options["softModeCut"]
-matrixTool.ScaleMatrix      = newInDetAlignAlg_Options["scaleMatrix"]
-matrixTool.PathBinName      = newInDetAlignAlg_Options["PathBinName"]
-matrixTool.AlignIBLbutNotPixel = newInDetAlignAlg_Options["AlignIBLbutNotPixel"]
-matrixTool.AlignPixelbutNotIBL = newInDetAlignAlg_Options["AlignPixelbutNotIBL"]
-
-if newInDetAlignAlg_Options["WriteTFile"]:
-    matrixTool.WriteTFile   = True
-    matrixTool.ReadTFile    = True
-    matrixTool.WriteMat     = False
-    matrixTool.WriteHitmap  = False
-    matrixTool.TFileName        = newInDetAlignAlg_Options["TFileName"]
-    matrixTool.InputTFiles      = newInDetAlignAlg_Options["inputTFiles"]
-
-if not newInDetAlignAlg_Options["runLocal"]: 
-    # we want to set 'reasonable' defaults for global L3 solving
-    if (
-            ("sctAlignmentLevel" in dir()       and sctAlignmentLevel==3) or
-            ("sctAlignmentLevelBarrel" in dir()     and sctAlignmentLevelBarrel==3) or
-            ("sctAlignmentLevelEndcaps" in dir()    and sctAlignmentLevelEndcaps==3) or 
-            ("pixelAlignmentLevel" in dir()     and pixelAlignmentLevel==3) or 
-            ("pixelAlignmentLevelBarrel" in dir()   and pixelAlignmentLevelBarrel==3) or
-            ("pixelAlignmentLevelEndcaps" in dir()  and pixelAlignmentLevelEndcaps==3)
-        ):
-        matrixTool.WriteEigenMat = False
-        matrixTool.UseSparse = True
-        matrixTool.SolveOption = 2 # run Eigen for L3 by default
-        matrixTool.WriteMatTxt = False
-        matrixTool.WriteHitmapTxt = False
-        matrixTool.CalculateFullCovariance = False
-    # but the defaults can still be overwritten if explicitely requested
-    if 'useSparse' in dir():
-        matrixTool.UseSparse            = newInDetAlignAlg_Options["useSparse"]
-    if 'solvingOption' in dir():
-        matrixTool.SolveOption          = newInDetAlignAlg_Options["solvingOption"]
-    if 'writeMatrixFileTxt' in dir():
-        matrixTool.WriteMatTxt          = newInDetAlignAlg_Options["writeMatrixFileTxt"]
-    if 'writeHitmapTxt' in dir():
-        matrixTool.WriteHitmapTxt       = newInDetAlignAlg_Options["writeMatrixFileTxt"]
-    if 'writeEigenMat' in dir():
-        matrixTool.WriteEigenMat        = newInDetAlignAlg_Options["writeEigenMat"]
-    if 'writeEigenMatTxt' in dir():
-        matrixTool.WriteEigenMatTxt         = newInDetAlignAlg_Options["writeEigenMatTxt"]
-    if 'calculateFullCovariance' in dir():
-        matrixTool.CalculateFullCovariance  = newInDetAlignAlg_Options["calculateFullCovariance"]
-
-print matrixTool
-print globalChi2AlignTool
-
-#################################################
-##
-## Hit quality selection tool
-##
-from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignHitQualSelTool
-myHitQualSelTool = InDetAlignHitQualSelTool(
-    name = "AlignSiHitQualSelTool",
-    OutputLevel = INFO,
-    RejectOutliers = True,
-    RejectEdgeChannels = False,
-    #AcceptIBLHits = True,
-    #AcceptPixelHits = True,
-    #AcceptSCTHits = True,
-    )
-ToolSvc += myHitQualSelTool
-print myHitQualSelTool
-
-##################################################
-##
-##  Setup all tools needed for event processing
-##
-if newInDetAlignAlg_Options["runAccumulate"]:
-    ################################
-    # create AlignTrackSelector
-    #if newInDetAlignAlg_Options["useTrackSelector"]:
-    #    from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetTrtDriftCircleCutTool
-    #    trtDCtool = InDet__InDetTrtDriftCircleCutTool(
-    #        name = "TrtHitsEtaCutTool",
-    #        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-    #        UseNewParameterization = True,
-    #        UseActiveFractionSvc = False
-    #    )
-    #    ToolSvc += trtDCtool
-    #    print trtDCtool
-    #    if not newInDetAlignAlg_Options["Cosmics"] :
-    #        from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-    #        trackSelector = InDet__InDetDetailedTrackSelectorTool(
-    #            name = "TrackSelector",
-    #            #OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-    #            OutputLevel = DEBUG,
-    #            TrackSummaryTool = InDetTrackSummaryTool,
-    #            pTMin = float(newInDetAlignAlg_Options["PtCut"]),
-    #            IPd0Max = 500., 
-    #            IPz0Max = 500., 
-    #            #nHitSct = 4,
-    #            nHitPix =  1,
-    #            nHitPixPhysical = 1, 
-    #            nHitBLayerPlusPix = 0,
-    #            nHitBLayer = 0,
-    #            nHitSi = 5, 
-    #            nHitSiPhysical = 7, 
-    #            nHitTrt = 25, 
-    #            useEtaDepententMinHitTrt = True,
-    #            TrtDCCutTool = trtDCtool,
-    #            addToMinHitTrt = -3
-    #        )
-    #        if newInDetAlignAlg_Options["useTRT"]:
-    #            trackSelector.useEtaDepententMinHitTrt = True
-        
-        
-    #    else:
-    #        from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetCosmicTrackSelectorTool
-    #        print " <NewInDetAlignAlgSetup> setting InDetTrackSelectorTool for cosmic ray data"
-    #        trackSelector = InDet__InDetCosmicTrackSelectorTool(
-    #            name = "TrackSelector",
-    #            #OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-    #            OutputLevel = INFO,
-    #            TrackSummaryTool = InDetTrackSummaryTool,
-    #            minPt = float(newInDetAlignAlg_Options["PtCut"]),
-    #            numberOfPixelHits = 1,
-    #            numberOfSCTHits = 8,
-    #            #numberOfSiliconHits = 12,
-    #            numberOfSiliconHitsTop = 2,
-    #            numberOfSiliconHitsBottom = 2,
-    #            numberOfTRTHits = 25,
-    #            maxD0 = 9999.,
-    #            maxZ0 = 9999.,
-    #        )
-    #    ToolSvc += trackSelector
-    #    print trackSelector
-
-
-
-    ###############################
-    # New InDetTrackSelectionTool
-    if newInDetAlignAlg_Options["useTrackSelector"]:
-
-        minNTRTHits  = -1 
-        maxEtaForTRTHitCuts = 0 
-        maxTRTEtaAcceptance = 1e+16
-        if newInDetAlignAlg_Options["useTRT"]:
-            print "NewInDetAlignAlgSetup : setting TRT Cuts"
-            minNTRTHits = 20
-            maxEtaForTRTHitCuts = 1.9
-            maxTRTEtaAcceptance = 0.
-
-        from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-        if not newInDetAlignAlg_Options["Cosmics"] :
-            
-            
-            trackSelectorNew = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolAlignTracks",
-                                                              UseTrkTrackTools = True,
-                                                              minPt = float(newInDetAlignAlg_Options["PtCut"]),
-                                                              maxD0 = 500,
-                                                              maxZ0 = 500,
-                                                              #minNPixelHits = 1,
-                                                              #minNPixelHitsPhysical = 1,
-                                                              #minNSiHits = 5,
-                                                              #minNSiHitsPhysical = 7,
-                                                              minNTrtHits  = minNTRTHits,
-                                                              maxEtaForTrtHitCuts = maxEtaForTRTHitCuts,
-                                                              maxTrtEtaAcceptance = maxTRTEtaAcceptance,
-                                                              CutLevel = "TightPrimary",
-                                                              TrackSummaryTool    = InDetTrackSummaryTool,
-                                                              Extrapolator        = InDetExtrapolator)
-            if newInDetAlignAlg_Options["d0significanceCut"] > 0:
-                trackSelectorNew.maxD0overSigmaD0 = 3
-        else:
-            trackSelectorNew= InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolAlignTracks",
-                                                             UseTrkTrackTools = True,
-                                                             minPt = float(newInDetAlignAlg_Options["PtCut"]),
-                                                             maxD0 = 9999.,
-                                                             maxZ0 = 9999.,
-                                                             minNPixelHits = 1,
-                                                             minNSctHits = 8,
-                                                             minNSiHitsModTop = 2,
-                                                             minNSiHitsModBottom = 2,
-                                                             minNTrtHits = minNTRTHits,
-                                                             maxEtaForTrtHitCuts = maxEtaForTRTHitCuts,
-                                                             maxTrtEtaAcceptance = maxTRTEtaAcceptance,
-                                                             CutLevel = "Loose",
-                                                             TrackSummaryTool    = InDetTrackSummaryTool,
-                                                             Extrapolator        = InDetExtrapolator)
-        ToolSvc+=trackSelectorNew
-        print 
-    ###############################
-    # create AlignTrackPreProcessor
-    if newInDetAlignAlg_Options["useOldPreProcessor"] :
-        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackPreProcessor
-        # with hit quality selection tool
-        preProcessor = Trk__AlignTrackPreProcessor(
-            name = "AlignTrackPreProcessor", 
-            OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-            RefitTracks = newInDetAlignAlg_Options["refitTracks"],
-            TrackFitterTool = trackFitter,
-            SLTrackFitterTool = trackFitter,
-            UseSingleFitter = True,
-            ParticleHypothesis = newInDetAlignAlg_Options["particleNumber"],
-            RunOutlierRemoval = newInDetAlignAlg_Options["runOutlier"],
-            HitQualityTool = myHitQualSelTool
-        )
-        if newInDetAlignAlg_Options["doSiHitQualSel"]:
-            preProcessor.SelectHits = newInDetAlignAlg_Options["doSiHitQualSel"]
-
-        if newInDetAlignAlg_Options["FixMomentum"]:
-            preProcessor.FixMomentum = newInDetAlignAlg_Options["FixMomentum"]
-            print "OldProcessor -> Using FixMomentum = ", newInDetAlignAlg_Options["FixMomentum"]
-        
-        # don't store matrices when running local
-        if newInDetAlignAlg_Options["runLocal"]:
-            preProcessor.StoreFitMatricesAfterRefit = False
-
-        if newInDetAlignAlg_Options["useTrackSelector"]:
-            preProcessor.SelectTracks = True
-            preProcessor.TrackSelectorTool = trackSelectorNew
-
-    else :
-        # tighter track selection for the beam-spot constraint
-        # -- MD: same selection as of normal collisions Selector for now --> Discuss and update; 
-        #BStrackSelector = ""
-        #if newInDetAlignAlg_Options["doBSTrackSelection"] :
-            #from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-            #BStrackSelector = InDet__InDetDetailedTrackSelectorTool(
-            #    name          = "BeamSpotTrackSelector",
-            #    OutputLevel       = newInDetAlignAlg_Options["outputLevel"],
-            #    #OutputLevel      = DEBUG,
-            #    TrackSummaryTool  = InDetTrackSummaryTool,
-            #    pTMin         = float(newInDetAlignAlg_Options["PtCut"]),
-            #    IPd0Max       = 500.,
-            #    IPz0Max       = 500.,
-            #    #nHitSct      = 4,
-            #    nHitPix      = 1,
-            #    nHitPixPhysical = 1,
-            #    nHitBLayerPlusPix = 0,
-            #    nHitBLayer    = 0,
-            #    nHitSi        = 5,
-            #    nHitSiPhysical    = 7,
-            #    nHitTrt           = 25,
-            #    TrtDCCutTool      = trtDCtool,
-            #    addToMinHitTrt    = -3
-            #)
-            #if newInDetAlignAlg_Options["useTRT"]:
-            #    BStrackSelector.useEtaDepententMinHitTrt = True
-            #from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-            #BStrackSelector = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolAlignTracks",
-            #                                                UseTrkTrackTools = True,
-            #                                                minPt = float(newInDetAlignAlg_Options["PtCut"]),
-            #                                                maxD0 = 500,
-            #                                                maxZ0 = 500,
-            #                                                #minNPixelHits = 1,
-            #                                                #minNPixelHitsPhysical = 1,
-            #                                                #minNSiHits = 5,
-            #                                                #minNSiHitsPhysical = 7,
-            #                                                minNTrtHits  = 25,
-            #                                                CutLevel = "TightPrimary",
-            #                                                TrackSummaryTool    = InDetTrackSummaryTool,
-            #                                                Extrapolator        = InDetExtrapolator)
-            #ToolSvc += BStrackSelector
-            #print BStrackSelector
-
-        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__BeamspotVertexPreProcessor
-        print "TYPE PtCutForBSConstraint", type(newInDetAlignAlg_Options["PtCutForBSConstraint"])
-        preProcessor = Trk__BeamspotVertexPreProcessor(
-            name              = "BeamspotVertexPreProcessor",
-            OutputLevel           = newInDetAlignAlg_Options["outputLevel"],
-            #OutputLevel           = DEBUG,
-            RefitTracks           = newInDetAlignAlg_Options["refitTracks"],
-            TrackFitter           = trackFitter,
-            AlignModuleTool           = alignModuleTool,
-            UseSingleFitter       = True,
-            ParticleNumber        = newInDetAlignAlg_Options["particleNumber"],
-            RunOutlierRemoval     = newInDetAlignAlg_Options["runOutlier"],
-            DoBSConstraint        = newInDetAlignAlg_Options["doBSConstraint"],
-            #maxPt                 = newInDetAlignAlg_Options["PtCutForBSConstraint"],
-            DoPVConstraint        = newInDetAlignAlg_Options["doPVConstraint"],
-            #DoFullVertex              = newInDetAlignAlg_Options["doFullVertex"],
-            DoAssociatedToPVSelection = newInDetAlignAlg_Options["doBSAssociatedToPVSelection"],
-            BeamspotScalingFactor     = newInDetAlignAlg_Options["beamspotScalingFactor"],
-            DoBSTrackSelection    = newInDetAlignAlg_Options["doBSTrackSelection"],
-            BSConstraintTrackSelector = trackSelectorNew
-            #doNormalRefit = True
-        )
-
-        if newInDetAlignAlg_Options["doSiHitQualSel"]:
-            preProcessor.SelectHits = newInDetAlignAlg_Options["doSiHitQualSel"]
-
-        if newInDetAlignAlg_Options["FixMomentum"]:
-            preProcessor.FixMomentum = newInDetAlignAlg_Options["FixMomentum"]
-            print "NewProcessor -> Using FixMomentum = ", newInDetAlignAlg_Options["FixMomentum"]
-        
-        # don't store matrices when running local
-        if newInDetAlignAlg_Options["runLocal"]:
-            preProcessor.StoreFitMatrices = False
-
-        if newInDetAlignAlg_Options["useTrackSelector"]:
-            preProcessor.TrackSelector = trackSelectorNew
-
-    ToolSvc += preProcessor
-    print preProcessor
-
-    ################################
-    # create AlignResidualCalculator
-    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignResidualCalculator
-    alignResidualCalculator = Trk__AlignResidualCalculator(
-        name = "AlignResidualCalculator",
-        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-        ResidualType = newInDetAlignAlg_Options["residualType"],
-        IncludeScatterers = False
-    )
-    ToolSvc += alignResidualCalculator
-    print alignResidualCalculator
-
-    ################################
-    # create AlignTrackCreator
-    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackCreator
-    alignTrackCreator = Trk__AlignTrackCreator(
-        name = "AlignTrackCreator",
-        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-        AlignModuleTool = alignModuleTool,
-        ResidualCalculator = alignResidualCalculator,
-        IncludeScatterers = False,
-        RemoveATSOSNotInAlignModule = True,
-        WriteEventList = False,
-        RequireOverlap = False
-    )
-    ToolSvc += alignTrackCreator
-    print alignTrackCreator
-
-    ################################
-    # create AnalyticalDerivCalcTool
-    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AnalyticalDerivCalcTool
-    derivCalcTool = Trk__AnalyticalDerivCalcTool(
-        name = "AnalyticalDerivCalcTool",
-        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-        StoreDerivatives = newInDetAlignAlg_Options["writeDerivatives"],
-        AlignModuleTool = alignModuleTool
-    )
-    # some extra settings when running local
-    if newInDetAlignAlg_Options["runLocal"]:
-        derivCalcTool.UseLocalSetting = True
-        derivCalcTool.UseIntrinsicPixelError = not newInDetAlignAlg_Options["usePixelErrors"]
-        derivCalcTool.UseIntrinsicSCTError = not newInDetAlignAlg_Options["useSCTErrors"]
-        derivCalcTool.UseIntrinsicTRTError = not newInDetAlignAlg_Options["useTRTErrors"]
-    else:
-        derivCalcTool.UseLocalSetting = False
-    ToolSvc += derivCalcTool
-    print derivCalcTool
-
-    ################################
-    # create AlignTrackDresser that uses AnalyticalDerivCalcTool
-    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackDresser
-    alignTrackDresser = Trk__AlignTrackDresser(
-        name = "AlignTrackDresser",
-        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-        DerivCalcTool = derivCalcTool
-    )
-    ToolSvc += alignTrackDresser
-    print alignTrackDresser
-
-    ################################
-    # Ntuple filling tool
-    ntupleTool = ""
-    if newInDetAlignAlg_Options["writeAlignNtuple"]:
-        from InDetAlignNtupleTools.InDetAlignNtupleToolsConf import InDet__SimpleIDNtupleTool
-        ntupleTool = InDet__SimpleIDNtupleTool(
-            name = "SimpleIDNtupleTool",
-            OutputLevel = INFO,
-            TrackSummaryTool = InDetTrackSummaryTool,
-            AlignModuleTool = alignModuleTool,
-            StoreDerivatives = newInDetAlignAlg_Options["writeDerivatives"]
-        )
-        ToolSvc += ntupleTool
-        print ntupleTool
-
-    ###############################
-    ###############################
-    # Track Collection Provider
-    if newInDetAlignAlg_Options["Cosmics"]:
-        newInDetAlignAlg_Options["trackCollection"] = "CombinedInDetTracks"
-
-
-    if len(newInDetAlignAlg_Options["eoverpmapconstraint"]) == 0:
-        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__TrackCollectionProvider
-        trackCollectionProvider=Trk__TrackCollectionProvider("TrackCollectionProvider2",                                
-                                OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-                                InputTrkCol = newInDetAlignAlg_Options["trackCollection"])
-    else:
-        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__ConstrainedTrackProvider
-        trackCollectionProvider=Trk__ConstrainedTrackProvider("TrackCollectionProvider",
-                                      #OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-                                      OutputLevel = DEBUG,                        
-                                      InputTracksCollection= newInDetAlignAlg_Options["trackCollection"],
-                                      MinPt = newInDetAlignAlg_Options["MinPtForConstrainedProvider"],
-                                      MaxPt = 250,
-                                      MomentumConstraintFileName = newInDetAlignAlg_Options["eoverpmapconstraint"],
-                                      MomentumConstraintHistName = newInDetAlignAlg_Options["eoverpmapconstraintmap"],
-                                      CorrectMomentum = True,
-                                      DeltaScaling = 1,
-                                      ReduceConstraintUncertainty = 1.,
-                                      CorrectZ0 = newInDetAlignAlg_Options["CorrectZ0"],
-                                      z0ConstraintFileName =  newInDetAlignAlg_Options["z0mapconstraint"],
-                                      z0ConstraintHistName =  newInDetAlignAlg_Options["z0mapconstraintmap"],
-                                      CorrectD0 = newInDetAlignAlg_Options["CorrectD0"],
-                                      d0ConstraintFileName =  newInDetAlignAlg_Options["d0mapconstraint"],
-                                      d0ConstraintHistName =  newInDetAlignAlg_Options["d0mapconstraintmap"],
-                                      UseConstraintError =  False,
-                                      UseConstrainedTrkOnly= False,
-                                      TrackFitter = trackFitter   )
-        print trackCollectionProvider
-    ToolSvc += trackCollectionProvider
-
-    ################################
-    ################################
-    # build GlobalAlign algorithm
-    #
-    from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
-    InDetGlobalAlign =  Trk__AlignAlg(
-        "InDetGlobalAlign",
-        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-        TrackCollectionProvider = trackCollectionProvider,
-        AlignTrackCreator = alignTrackCreator,
-        AlignTrackDresser = alignTrackDresser,
-        AlignTrackPreProcessor = preProcessor,
-        GeometryManagerTool = trkAlignGeoManagerTool,
-        FillNtupleTool = ntupleTool,
-        WriteNtuple = newInDetAlignAlg_Options["writeAlignNtuple"],
-        FileName = newInDetAlignAlg_Options["alignNtupleName"],
-        AlignTool = globalChi2AlignTool,
-        AlignDBTool = trkAlignDBTool
-    )
-
-    topSequence += InDetGlobalAlign
-    print InDetGlobalAlign
-
-##################################################
-##
-##  Setup solving from accumulated files
-##
-else:
-    ################################
-    # build GlobalAlign algorithm
-    #
-    from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
-    InDetGlobalSolve =  Trk__AlignAlg(
-        "InDetGlobalSolve",
-        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
-        GeometryManagerTool = trkAlignGeoManagerTool,
-        AlignTool = globalChi2AlignTool,
-        AlignDBTool = trkAlignDBTool,
-        SolveOnly = True,
-        WriteNtuple = False
-    )
-
-    topSequence += InDetGlobalSolve
-    print InDetGlobalSolve
-
-
-################################
-# Write constants to Pool file
-# the OutputConditionsAlg has to be set up at the end
-# so that it runs last and picks up the latest version
-# of constants from memory
-if newInDetAlignAlg_Options["runSolving"] and newInDetAlignAlg_Options["writeConstantsToPool"]:
-    objectList = []
-    tagList = []
-
-    if newInDetAlignAlg_Options["writeSilicon"]:
-        objectList += [ "AlignableTransformContainer#/Indet/Align" ]
-        tagList += [ newInDetAlignAlg_Options["tagSi"] ]
-    if newInDetAlignAlg_Options["writeTRT"]:
-        objectList += [ "AlignableTransformContainer#/TRT/Align" ]
-        tagList += [ newInDetAlignAlg_Options["tagTRT"] ]
-    if newInDetAlignAlg_Options["writeTRTL3"]:
-        objectList += [ "TRTCond::StrawDxContainer#/TRT/Calib/DX"]
-    if newInDetAlignAlg_Options["writeIBLDistDB"]:
-        objectList += ["CondAttrListCollection#/Indet/IBLDist"]    
-        tagList    += [newInDetAlignAlg_Options["tagBow"]]
-    
-        
-    from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-    myOCA = OutputConditionsAlg(outputFile = newInDetAlignAlg_Options["outputPoolFile"])
-    myOCA.ObjectList = objectList
-    myOCA.IOVTagList = tagList
-
-        
-################################
-# build AlignTrack collection splitter algorithm
-print " <NewInDetAlignAlgSetup> Setting up the AlignTrackCollSplitter "
-from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignTrackCollSplitter
-AlignTrackCollSplitter = Trk__AlignTrackCollSplitter(
-    "AlignTrackCollSplitter",
-    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-)
-
-topSequence += AlignTrackCollSplitter
-print AlignTrackCollSplitter
-
-
-################################ 
-
-
-if newInDetAlignAlg_Options["doMonitoring"] and newInDetAlignAlg_Options["runAccumulate"]:
-    include("InDetAlignExample/NewInDetAlignMonitoring.py")
-    
-    
-if newInDetAlignAlg_Options["LumiblockSelection"]:
-	print " ************************** "
-	print " ** Selecting LumiBlocks ** "
-	print " ************************** "
-	print " **  List of LumiBlocks  ** "
-	
-	print str(newInDetAlignAlg_Options["LumiblockList"]).strip('[]')
-	print " **                      ** "	
-	import InDetBeamSpotExample.FilterUtils as FilterUtils
-	FilterUtils.filterSeq += FilterUtils.LBFilter(newInDetAlignAlg_Options["LumiblockList"]) 
-else:
-	print " ** Selecting LumiBlocks is deactivated ** " 
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py
deleted file mode 100644
index a9b777bb964d7edd6a0812c24648a42c16c1539a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py
+++ /dev/null
@@ -1,694 +0,0 @@
-########################################################################################
-#
-#  This script sets up the geometry manager tool and the database tool for
-#  the alignment framework based on the alignment requirements.
-#
-#  As a result three tools are setup which can be used in the definition of
-#  Trk::AlignAlg and some supporting tools :
-#
-#    alignModuleTool
-#    trkAlignGeoManagerTool
-#    trkAlignDBTool
-#
-#  Started:  Daniel Kollar <daniel.kollar@cern.ch>  (09/2009)
-#
-########################################################################################
-## common options
-
-
-
-newInDetAlignGeo_Options = {
-	"outputLevel" : INFO                 #  output level for log messages for all tools and algs
-	,"writeTextFiles" :  True            #  whether to write out text files with final constants
-	,"siliconTextFile" :  "OutputSiAlignment.txt"  #  name of the output text file with Si constants
-	,"trtTextFile" :  "OutputTRTAlignment.txt"     #  name of the output text file with TRT constants
-	,"updateConstants" : True            #  whether to update the constants in the DB
-	,"writeOldConstants" : True          #  whether to write out text files with initial constants
-	,"alignInDet" :  True                #  whether to align the full Inner Detector
-	,"alignSilicon" :  True              #  whether to align Si
-	,"alignPixel" :  True                #  whether to align Pixel
-	,"pixelAlignDBM" :  False            #  whether to align DBM instead of actual Pixel detector
-	,"alignSCT" :  True                  #  whether to align SCT
-	,"alignTRT" :  True                  #  whether to align TRT
-	,"doModuleSelection" : False         #  whether to align only selected modules
-	,"moduleSelection" : []              #  identifiers of selected modules
-}
-
-for var in newInDetAlignGeo_Options:
-	if var in dir():
-		newInDetAlignGeo_Options[var] = eval(var)
-
-########################################################################################
-## TRT Alignment Options
-trtAlignment_Options = {
-	# setup alignment geometry for TRT
-	# if level for Barrel or Endcap is set to -1 then it is set to the level
-	# set up for the whole TRT
-	"trtAlignmentLevelBarrel" : -1       #  alignment level for the TRT barrel
-	,"trtAlignmentLevelEndcaps" : -1     #  alignment level for the TRT endcaps
-	,"trtAlignmentLevel" : 1             #  alignment level for the whole TRT
-
-	# switch on or off of the whole TRT barrel or both end-caps
-	,"trtAlignBarrel" : True             #  whether to align TRT barrel
-	,"trtAlignEndcaps" : True            #  whether to align TRT endcap 
-
-	# switch on or off the alignment of the individual degrees-of-freedom
-	,"trtAlignBarrelX" : True            #  whether to align TRT barrel wrt. translations along X
-	,"trtAlignBarrelY" : True            #  whether to align TRT barrel wrt. translations along Y
-	,"trtAlignBarrelZ" : True            #  whether to align TRT barrel wrt. translations along Z
-	,"trtAlignBarrelRotX" : True         #  whether to align TRT barrel wrt. rotations around X
-	,"trtAlignBarrelRotY" : True         #  whether to align TRT barrel wrt. rotations around Y
-	,"trtAlignBarrelRotZ" : True         #  whether to align TRT barrel wrt. rotations around Z
-	,"trtAlignEndcapX" : True            #  whether to align TRT endcaps wrt. translations along X
-	,"trtAlignEndcapY" : True            #  whether to align TRT endcaps wrt. translations along Y
-	,"trtAlignEndcapZ" : True            #  whether to align TRT endcaps wrt. translations along Z
-	,"trtAlignEndcapRotX" : True         #  whether to align TRT endcaps wrt. rotations around X
-	,"trtAlignEndcapRotY" : True         #  whether to align TRT endcaps wrt. rotations around Y
-	,"trtAlignEndcapRotZ" : True         #  whether to align TRT endcaps wrt. rotations around Z
-
-   # sigma for a given DoF is used for scaling for vector and matrix entries
-   # for that DoF before solving
-	,"trtSetSigmaBarrelX" : 1            #  scaling constant for translations along X in TRT barrel
-	,"trtSetSigmaBarrelY" : 1            #  scaling constant for translations along Y in TRT barrel
-	,"trtSetSigmaBarrelZ" : 1            #  scaling constant for translations along Z in TRT barrel
-	,"trtSetSigmaBarrelRotX" : 0.001     #  scaling constant for rotations around X in TRT barrel
-	,"trtSetSigmaBarrelRotY" : 0.001     #  scaling constant for rotations around Y in TRT barrel
-	,"trtSetSigmaBarrelRotZ" : 0.001     #  scaling constant for rotations around Z in TRT barrel
-	,"trtSetSigmaEndcapX" : 1            #  scaling constant for translations along X in TRT endcaps
-	,"trtSetSigmaEndcapY" : 1            #  scaling constant for translations along Y in TRT endcaps
-	,"trtSetSigmaEndcapZ" : 1            #  scaling constant for translations along Z in TRT endcaps
-	,"trtSetSigmaEndcapRotX" : 0.001     #  scaling constant for rotations around X in TRT endcaps
-	,"trtSetSigmaEndcapRotY" : 0.001     #  scaling constant for rotations around Y in TRT endcaps
-	,"trtSetSigmaEndcapRotZ" : 0.001     #  scaling constant for rotations around Z in TRT endcaps
-
-	# soft cut for a given DoF is multiplied by the overall soft-mode-cut
-	# which is set in the NewInDetAlignAlgs.py and then added to the
-	# diagonal element of the matrix for that DoF;
-	# the addition happens after the scaling
-	,"trtSetSoftCutBarrelX" : 0.1          #  soft cut for translations along X in TRT barrel
-	,"trtSetSoftCutBarrelY" : 0.1          #  soft cut for translations along Y in TRT barrel
-	,"trtSetSoftCutBarrelZ" : 0.1        #  soft cut for translations along Z in TRT barrel
-	,"trtSetSoftCutBarrelRotX" : 0.05       #  soft cut for rotations around X in TRT barrel
-	,"trtSetSoftCutBarrelRotY" : 0.05       #  soft cut for rotations around Y in TRT barrel
-	,"trtSetSoftCutBarrelRotZ" : 0.05       #  soft cut for rotations around Z in TRT barrel
-	,"trtSetSoftCutEndcapX" : 0.1          #  soft cut for translations along X in TRT endcaps
-	,"trtSetSoftCutEndcapY" : 0.1          #  soft cut for translations along Y in TRT endcaps
-	,"trtSetSoftCutEndcapZ" : 0.001          #  soft cut for translations along Z in TRT endcaps
-	,"trtSetSoftCutEndcapRotX" : 0.05       #  soft cut for rotations around X in TRT endcaps
-	,"trtSetSoftCutEndcapRotY" : 0.05       #  soft cut for rotations around Y in TRT endcaps
-	,"trtSetSoftCutEndcapRotZ" : 0.05       #  soft cut for rotations around Z in TRT endcaps
-
-	#trt module selection
-	,"trtAlignBarrelPhiSectors" : []     #  selection of phi sectors in the TRT barrel
-	,"trtAlignBarrelLayers" : []         #  selection of layers in the TRT barrel
-	,"trtAlignEndcapPhiSectors" : []     #  selection of phi sectors in the TRT endcap
-	,"trtAlignEndcapWheels" : []         #  selection of wheels in the TRT endcap
-	,"trtAlignSingleEndcap" : 0          #  Align single endcap option (-2 is C, 2 is A, 0 is both (default))
-	#Level 3 module selection
-	#,"trtAlignL3Endcaps" : []            # Deprecated
-	#,"trtAlignL3EndcapPhiSectors" : []   # Deprecated
-	#,"trtAlignL3EndcapWheels" : []       # Deprecated
-}
-
-for var in trtAlignment_Options:
-  if var in dir():
-    trtAlignment_Options[var] = eval(var)
-
-#
-# The options for Pixel and SCT are analogical to those for TRT.
-#
-########################################################################################
-## Pixel Alignment Options
-pixelAlignment_Options = {
-	"pixelAlignmentLevelBarrel" : -1
-	,"pixelAlignmentLevelEndcaps": -1
-	,"pixelAlignmentLevel" : -1
-#	,"pixelAlignDBM" :  False            #  whether to align DBM instead of actual Pixel detector  
-        ,"pixelAlignBarrel" : True
-	,"pixelAlignEndcaps" : True
-	,"pixelAlignBarrelX" : True
-	,"pixelAlignBarrelY" : True
-	,"pixelAlignBarrelZ" : True
-	,"pixelAlignBarrelRotX" : True
-	,"pixelAlignBarrelRotY" : True
-	,"pixelAlignBarrelRotZ" : True
-	,"pixelAlignBarrelBowX" : False
-	,"pixelAlignEndcapX" : True
-	,"pixelAlignEndcapY" : True
-	,"pixelAlignEndcapZ" : True
-	,"pixelAlignEndcapRotX" : True
-	,"pixelAlignEndcapRotY" : True
-	,"pixelAlignEndcapRotZ" : True
-	,"pixelSetSigmaBarrelX" : 1
-	,"pixelSetSigmaBarrelY" : 1
-	,"pixelSetSigmaBarrelZ" : 1
-	,"pixelSetSigmaBarrelRotX" : 0.001
-	,"pixelSetSigmaBarrelRotY" : 0.001
-	,"pixelSetSigmaBarrelRotZ" : 0.001
-	,"pixelSetSigmaEndcapX" : 1
-	,"pixelSetSigmaEndcapY" : 1
-	,"pixelSetSigmaEndcapZ" : 1
-	,"pixelSetSigmaEndcapRotX" : 0.001
-	,"pixelSetSigmaEndcapRotY" : 0.001
-	,"pixelSetSigmaEndcapRotZ" : 0.001
-	,"pixelSetSoftCutBarrelX" : 0.02
-	,"pixelSetSoftCutBarrelY" : 0.02
-	,"pixelSetSoftCutBarrelZ" : 0.02
-	,"pixelSetSoftCutBarrelRotX" : 0.05
-	,"pixelSetSoftCutBarrelRotY" : 0.05
-	,"pixelSetSoftCutBarrelRotZ" : 0.05
-	,"pixelSetSoftCutEndcapX" : 0.02
-	,"pixelSetSoftCutEndcapY" : 0.02
-	,"pixelSetSoftCutEndcapZ" : 0.02
-	,"pixelSetSoftCutEndcapRotX" : 0.05
-	,"pixelSetSoftCutEndcapRotY" : 0.05
-	,"pixelSetSoftCutEndcapRotZ" : 0.05
-}
-
-for var in pixelAlignment_Options:
-  if var in dir():
-    pixelAlignment_Options[var] = eval(var)
-
-## SCT alignment Options
-sctAlignment_Options = {
-	"sctAlignmentLevelBarrel" : -1
-	,"sctAlignmentLevelEndcaps" : -1
-	,"sctAlignmentLevel" : 1
-	,"sctAlignBarrel" : True
-	,"sctAlignEndcaps" : True
-	,"sctAlignBarrelX" : True
-	,"sctAlignBarrelY" : True
-	,"sctAlignBarrelZ" : True
-	,"sctAlignBarrelRotX" : True
-	,"sctAlignBarrelRotY" : True
-	,"sctAlignBarrelRotZ" : True
-	,"sctAlignEndcapX" : True
-	,"sctAlignEndcapY" : True
-	,"sctAlignEndcapZ" : True
-	,"sctAlignEndcapRotX" : True
-	,"sctAlignEndcapRotY" : True
-	,"sctAlignEndcapRotZ" : True
-	,"sctSetSigmaBarrelX" : 1
-	,"sctSetSigmaBarrelY" : 1
-	,"sctSetSigmaBarrelZ" : 1
-	,"sctSetSigmaBarrelRotX" : 0.001
-	,"sctSetSigmaBarrelRotY" : 0.001
-	,"sctSetSigmaBarrelRotZ" : 0.001
-	,"sctSetSigmaEndcapX" : 1
-	,"sctSetSigmaEndcapY" : 1
-	,"sctSetSigmaEndcapZ" : 1
-	,"sctSetSigmaEndcapRotX" : 0.001
-	,"sctSetSigmaEndcapRotY" : 0.001
-	,"sctSetSigmaEndcapRotZ" : 0.001
-	,"sctSetSoftCutBarrelX" : 0.05
-	,"sctSetSoftCutBarrelY" : 0.05
-	,"sctSetSoftCutBarrelZ" : 0.05
-	,"sctSetSoftCutBarrelRotX" : 0.05
-	,"sctSetSoftCutBarrelRotY" : 0.05
-	,"sctSetSoftCutBarrelRotZ" : 0.05
-	,"sctSetSoftCutEndcapX" : 0.05
-	,"sctSetSoftCutEndcapY" : 0.05
-	,"sctSetSoftCutEndcapZ" : 0.005
-	,"sctSetSoftCutEndcapRotX" : 0.005
-	,"sctSetSoftCutEndcapRotY" : 0.05
-	,"sctSetSoftCutEndcapRotZ" : 0.05
-}
-
-for var in sctAlignment_Options:
-  if var in dir():
-    sctAlignment_Options[var] = eval(var)
-
-## Silicon alignment Options
-siAlignment_Options = {
-	"siAlignmentLevel" : -1
-	,"siAlignX" : True
-	,"siAlignY" : True
-	,"siAlignZ" : True
-	,"siAlignRotX" : True
-	,"siAlignRotY" : True
-	,"siAlignRotZ" : True
-}
-
-for var in siAlignment_Options:
-  if var in dir():
-    print  siAlignment_Options[var], " " ,  eval(var)
-    siAlignment_Options[var] = eval(var)
-
-## InDet alignment Options
-## -1 - use standalone Silicon and TRT setup
-##  0 - L0
-indetAlignment_Options = {
-	"indetAlignmentLevel" : -1
-	,"indetAlignX" : True
-	,"indetAlignY" : True
-	,"indetAlignZ" : True
-	,"indetAlignRotX" : True
-	,"indetAlignRotY" : True
-	,"indetAlignRotZ" : True
-}
-
-for var in indetAlignment_Options:
-  if var in dir():
-    indetAlignment_Options[var] = eval(var)
-
-################################################################################
-####
-####    Check which geometry managers need to be set up
-####
-# we need the silicon geometry manager when both Pixel and SCT are to be aligned
-# but we might also need it when the whole Inner Detector is to be aligned
-# in the later one of Pixel or SCT is in principle enough
-if newInDetAlignGeo_Options["alignPixel"] and newInDetAlignGeo_Options["alignSCT"]:
-	print "The silicon is ON"
-	newInDetAlignGeo_Options["alignSilicon"] = True
-else:
-	print "The silicon is OFF"
-	newInDetAlignGeo_Options["alignSilicon"] = False
-
-#
-# for level 0 we don't need standalone Pixel and SCT geometry managers
-if (siAlignment_Options["siAlignmentLevel"]==0):
-	newInDetAlignGeo_Options["alignPixel"] = False
-	newInDetAlignGeo_Options["alignSCT"] = False
-#
-# similar to the silicon case above, we need the inner detector geometry manager
-# when both Silicon and TRT are to be aligned
-# but we might also need it when the whole ATLAS (?) is to be aligned, in the
-# later one of Silicon or TRT is in principle enough
-if newInDetAlignGeo_Options["alignTRT"] and newInDetAlignGeo_Options["alignSilicon"]:
-	newInDetAlignGeo_Options["alignInDet"] = True
-else:
-	newInDetAlignGeo_Options["alignInDet"] = False
-#
-# Inner Detector alignment level
-# for alignment level -1 the level is set up separately
-# for Silicon and TRT according to their setup
-
-#
-# for level 0 we don't need standalone Silicon and TRT geometry managers
-if (indetAlignment_Options["indetAlignmentLevel"] ==0):
-	newInDetAlignGeo_Options["alignSilicon"] = False
-	newInDetAlignGeo_Options["alignTRT"] = False
-
-if (not newInDetAlignGeo_Options["alignTRT"] or not newInDetAlignGeo_Options["alignSCT"] or not newInDetAlignGeo_Options["alignPixel"]):
-	newInDetAlignGeo_Options["alignInDet"] = False
-if (not newInDetAlignGeo_Options["alignSCT"] or not newInDetAlignGeo_Options["alignPixel"]):
-	newInDetAlignGeo_Options["alignSilicon"] = False
-
-
-
-ToolSvc = Service('ToolSvc')
-
-#
-# AlignModuleTool
-#
-# If we're running sct endcap alignment or TRT L3, we need to load
-# ID specific AlignModuleTool, but we rather should do it always just in case
-# there are changes in the future. It won't hurt anything.
-from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__InDetAlignModuleTool
-alignModuleTool = InDet__InDetAlignModuleTool(name = "InDetAlignModuleTool")
-alignModuleTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
-ToolSvc += alignModuleTool
-print alignModuleTool
-
-########################################################################################
-####
-####    Pixel Alignment Geometry Setup
-####
-
-#
-print " <NewInDetAlignGeometrySetup> setting up Pixel Alignment_Options --> PixelGeometryManagerTool"
-if newInDetAlignGeo_Options["alignPixel"]:
-	# Pixel geometry manager tool
-	from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__PixelGeometryManagerTool
-	pixelGeometryManagerTool = InDet__PixelGeometryManagerTool(name = "PixelGeometryManagerTool")
-	pixelGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
-	pixelGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
-	pixelGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
-	pixelGeometryManagerTool.AlignModuleTool = alignModuleTool
-	# Pixel alignment level
-	pixelGeometryManagerTool.AlignmentLevel = pixelAlignment_Options["pixelAlignmentLevel"]
-	pixelGeometryManagerTool.AlignmentLevelBarrel = pixelAlignment_Options["pixelAlignmentLevelBarrel"]
-	pixelGeometryManagerTool.AlignmentLevelEndcaps = pixelAlignment_Options["pixelAlignmentLevelEndcaps"]
-	pixelGeometryManagerTool.AlignmentDBM = newInDetAlignGeo_Options["pixelAlignDBM"]
-	# Pixel alignment degrees of freedom
-	# Barrel
-	pixelGeometryManagerTool.AlignBarrel = pixelAlignment_Options["pixelAlignBarrel"]
-	if pixelAlignment_Options["pixelAlignBarrel"]:
-		pixelGeometryManagerTool.AlignBarrelX = pixelAlignment_Options["pixelAlignBarrelX"]
-		pixelGeometryManagerTool.AlignBarrelY = pixelAlignment_Options["pixelAlignBarrelY"]
-		pixelGeometryManagerTool.AlignBarrelZ = pixelAlignment_Options["pixelAlignBarrelZ"]
-		pixelGeometryManagerTool.AlignBarrelRotX = pixelAlignment_Options["pixelAlignBarrelRotX"]
-		pixelGeometryManagerTool.AlignBarrelRotY = pixelAlignment_Options["pixelAlignBarrelRotY"]
-		pixelGeometryManagerTool.AlignBarrelRotZ = pixelAlignment_Options["pixelAlignBarrelRotZ"]
-		pixelGeometryManagerTool.AlignBarrelBowX = pixelAlignment_Options["pixelAlignBarrelBowX"]
-		pixelGeometryManagerTool.SetSigmaBarrelX = pixelAlignment_Options["pixelSetSigmaBarrelX"]
-		pixelGeometryManagerTool.SetSigmaBarrelY = pixelAlignment_Options["pixelSetSigmaBarrelY"]
-		pixelGeometryManagerTool.SetSigmaBarrelZ = pixelAlignment_Options["pixelSetSigmaBarrelZ"]
-		pixelGeometryManagerTool.SetSigmaBarrelRotX = pixelAlignment_Options["pixelSetSigmaBarrelRotX"]
-		pixelGeometryManagerTool.SetSigmaBarrelRotY = pixelAlignment_Options["pixelSetSigmaBarrelRotY"]
-		pixelGeometryManagerTool.SetSigmaBarrelRotZ = pixelAlignment_Options["pixelSetSigmaBarrelRotZ"]
-		pixelGeometryManagerTool.SetSoftCutBarrelX = pixelAlignment_Options["pixelSetSoftCutBarrelX"]
-		pixelGeometryManagerTool.SetSoftCutBarrelY = pixelAlignment_Options["pixelSetSoftCutBarrelY"]
-		pixelGeometryManagerTool.SetSoftCutBarrelZ = pixelAlignment_Options["pixelSetSoftCutBarrelZ"]
-		pixelGeometryManagerTool.SetSoftCutBarrelRotX = pixelAlignment_Options["pixelSetSoftCutBarrelRotX"]
-		pixelGeometryManagerTool.SetSoftCutBarrelRotY = pixelAlignment_Options["pixelSetSoftCutBarrelRotY"]
-		pixelGeometryManagerTool.SetSoftCutBarrelRotZ = pixelAlignment_Options["pixelSetSoftCutBarrelRotZ"]
-	# Endcaps
-	pixelGeometryManagerTool.AlignEndcaps = pixelAlignment_Options["pixelAlignEndcaps"]
-	if pixelAlignment_Options["pixelAlignEndcaps"]:
-		pixelGeometryManagerTool.AlignEndcapX = pixelAlignment_Options["pixelAlignEndcapX"]
-		pixelGeometryManagerTool.AlignEndcapY = pixelAlignment_Options["pixelAlignEndcapY"]
-		pixelGeometryManagerTool.AlignEndcapZ = pixelAlignment_Options["pixelAlignEndcapZ"]
-		pixelGeometryManagerTool.AlignEndcapRotX = pixelAlignment_Options["pixelAlignEndcapRotX"]
-		pixelGeometryManagerTool.AlignEndcapRotY = pixelAlignment_Options["pixelAlignEndcapRotY"]
-		pixelGeometryManagerTool.AlignEndcapRotZ = pixelAlignment_Options["pixelAlignEndcapRotZ"]
-		pixelGeometryManagerTool.SetSigmaEndcapX = pixelAlignment_Options["pixelSetSigmaEndcapX"]
-		pixelGeometryManagerTool.SetSigmaEndcapY = pixelAlignment_Options["pixelSetSigmaEndcapY"]
-		pixelGeometryManagerTool.SetSigmaEndcapZ = pixelAlignment_Options["pixelSetSigmaEndcapZ"]
-		pixelGeometryManagerTool.SetSigmaEndcapRotX = pixelAlignment_Options["pixelSetSigmaEndcapRotX"]
-		pixelGeometryManagerTool.SetSigmaEndcapRotY = pixelAlignment_Options["pixelSetSigmaEndcapRotY"]
-		pixelGeometryManagerTool.SetSigmaEndcapRotZ = pixelAlignment_Options["pixelSetSigmaEndcapRotZ"]
-		pixelGeometryManagerTool.SetSoftCutEndcapX = pixelAlignment_Options["pixelSetSoftCutBarrelX"]
-		pixelGeometryManagerTool.SetSoftCutEndcapY = pixelAlignment_Options["pixelSetSoftCutBarrelY"]
-		pixelGeometryManagerTool.SetSoftCutEndcapZ = pixelAlignment_Options["pixelSetSoftCutBarrelZ"]
-		pixelGeometryManagerTool.SetSoftCutEndcapRotX = pixelAlignment_Options["pixelSetSoftCutBarrelRotX"]
-		pixelGeometryManagerTool.SetSoftCutEndcapRotY = pixelAlignment_Options["pixelSetSoftCutBarrelRotY"]
-		pixelGeometryManagerTool.SetSoftCutEndcapRotZ = pixelAlignment_Options["pixelSetSoftCutBarrelRotZ"]
-	#
-	ToolSvc += pixelGeometryManagerTool
-	print pixelGeometryManagerTool
-print " <NewInDetAlignGeometrySetup> PixelGeometryManagerTool completed"
-
-
-
-########################################################################################
-####
-####    SCT Alignment Geometry Setup
-####
-
-#
-print " <NewInDetAlignGeometrySetup> setting up SCT Alignment_Options --> SCTGeometryManagerTool"
-if newInDetAlignGeo_Options["alignSCT"]:
-	print " <NewInDetAlignGeometrySetup> setting up SCT Alignment_Options "
-	# SCT geometry manager tool
-	from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__SCTGeometryManagerTool
-	sctGeometryManagerTool = InDet__SCTGeometryManagerTool(name = "SCTGeometryManagerTool")
-	sctGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
-	sctGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
-	sctGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
-	sctGeometryManagerTool.AlignModuleTool = alignModuleTool
-	# SCT alignment level
-	sctGeometryManagerTool.AlignmentLevel = sctAlignment_Options["sctAlignmentLevel"]
-	sctGeometryManagerTool.AlignmentLevelBarrel = sctAlignment_Options["sctAlignmentLevelBarrel"]
-	sctGeometryManagerTool.AlignmentLevelEndcaps = sctAlignment_Options["sctAlignmentLevelEndcaps"]
-	# SCT alignment degrees of freedom
-	# Barrel
-	sctGeometryManagerTool.AlignBarrel = sctAlignment_Options["sctAlignBarrel"]
-	if sctAlignment_Options["sctAlignBarrel"]:
-		sctGeometryManagerTool.AlignBarrelX = sctAlignment_Options["sctAlignBarrelX"]
-		sctGeometryManagerTool.AlignBarrelY = sctAlignment_Options["sctAlignBarrelY"]
-		sctGeometryManagerTool.AlignBarrelZ = sctAlignment_Options["sctAlignBarrelZ"]
-		sctGeometryManagerTool.AlignBarrelRotX = sctAlignment_Options["sctAlignBarrelRotX"]
-		sctGeometryManagerTool.AlignBarrelRotY = sctAlignment_Options["sctAlignBarrelRotY"]
-		sctGeometryManagerTool.AlignBarrelRotZ = sctAlignment_Options["sctAlignBarrelRotZ"]
-		sctGeometryManagerTool.SetSigmaBarrelX = sctAlignment_Options["sctSetSigmaBarrelX"]
-		sctGeometryManagerTool.SetSigmaBarrelY = sctAlignment_Options["sctSetSigmaBarrelY"]
-		sctGeometryManagerTool.SetSigmaBarrelZ = sctAlignment_Options["sctSetSigmaBarrelZ"]
-		sctGeometryManagerTool.SetSigmaBarrelRotX = sctAlignment_Options["sctSetSigmaBarrelRotX"]
-		sctGeometryManagerTool.SetSigmaBarrelRotY = sctAlignment_Options["sctSetSigmaBarrelRotY"]
-		sctGeometryManagerTool.SetSigmaBarrelRotZ = sctAlignment_Options["sctSetSigmaBarrelRotZ"]
-		sctGeometryManagerTool.SetSoftCutBarrelX = sctAlignment_Options["sctSetSoftCutBarrelX"]
-		sctGeometryManagerTool.SetSoftCutBarrelY = sctAlignment_Options["sctSetSoftCutBarrelY"]
-		sctGeometryManagerTool.SetSoftCutBarrelZ = sctAlignment_Options["sctSetSoftCutBarrelZ"]
-		sctGeometryManagerTool.SetSoftCutBarrelRotX = sctAlignment_Options["sctSetSoftCutBarrelRotX"]
-		sctGeometryManagerTool.SetSoftCutBarrelRotY = sctAlignment_Options["sctSetSoftCutBarrelRotY"]
-		sctGeometryManagerTool.SetSoftCutBarrelRotZ = sctAlignment_Options["sctSetSoftCutBarrelRotZ"]
-	# Endcaps
-	sctGeometryManagerTool.AlignEndcaps = sctAlignment_Options["sctAlignEndcaps"]
-	if sctAlignment_Options["sctAlignEndcaps"]:
-		sctGeometryManagerTool.AlignEndcapX = sctAlignment_Options["sctAlignEndcapX"]
-		sctGeometryManagerTool.AlignEndcapY = sctAlignment_Options["sctAlignEndcapY"]
-		sctGeometryManagerTool.AlignEndcapZ = sctAlignment_Options["sctAlignEndcapZ"]
-		sctGeometryManagerTool.AlignEndcapRotX = sctAlignment_Options["sctAlignEndcapRotX"]
-		sctGeometryManagerTool.AlignEndcapRotY = sctAlignment_Options["sctAlignEndcapRotY"]
-		sctGeometryManagerTool.AlignEndcapRotZ = sctAlignment_Options["sctAlignEndcapRotZ"]
-		sctGeometryManagerTool.SetSigmaEndcapX = sctAlignment_Options["sctSetSigmaEndcapX"]
-		sctGeometryManagerTool.SetSigmaEndcapY = sctAlignment_Options["sctSetSigmaEndcapY"]
-		sctGeometryManagerTool.SetSigmaEndcapZ = sctAlignment_Options["sctSetSigmaEndcapZ"]
-		sctGeometryManagerTool.SetSigmaEndcapRotX = sctAlignment_Options["sctSetSigmaEndcapRotX"]
-		sctGeometryManagerTool.SetSigmaEndcapRotY = sctAlignment_Options["sctSetSigmaEndcapRotY"]
-		sctGeometryManagerTool.SetSigmaEndcapRotZ = sctAlignment_Options["sctSetSigmaEndcapRotZ"]
-		sctGeometryManagerTool.SetSoftCutEndcapX = sctAlignment_Options["sctSetSoftCutEndcapX"]
-		sctGeometryManagerTool.SetSoftCutEndcapY = sctAlignment_Options["sctSetSoftCutEndcapY"]
-		sctGeometryManagerTool.SetSoftCutEndcapZ = sctAlignment_Options["sctSetSoftCutEndcapZ"]
-		sctGeometryManagerTool.SetSoftCutEndcapRotX = sctAlignment_Options["sctSetSoftCutEndcapRotX"]
-		sctGeometryManagerTool.SetSoftCutEndcapRotY = sctAlignment_Options["sctSetSoftCutEndcapRotY"]
-		sctGeometryManagerTool.SetSoftCutEndcapRotZ = sctAlignment_Options["sctSetSoftCutEndcapRotZ"]
-	#
-	ToolSvc += sctGeometryManagerTool
-	print sctGeometryManagerTool
-print " <NewInDetAlignGeometrySetup> SCTGeometryManagerTool completed"
-
-
-########################################################################################
-####
-####    Silicon Alignment Geometry Setup
-####
-if newInDetAlignGeo_Options["alignSilicon"]:
-	# Silicon geometry manager tool
-	from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__SiGeometryManagerTool
-	siGeometryManagerTool = InDet__SiGeometryManagerTool(name = "SiGeometryManagerTool")
-	siGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
-	siGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
-	siGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
-	siGeometryManagerTool.AlignModuleTool = alignModuleTool
-	#
-	# Silicon alignment level
-	siGeometryManagerTool.AlignmentLevel = siAlignment_Options["siAlignmentLevel"]
-	#
-	# we don't need the Pixel and SCT geometry managers if Silicon alignment level is 0
-	if not (siAlignment_Options["siAlignmentLevel"]==0):
-		if newInDetAlignGeo_Options["alignPixel"]:
-			siGeometryManagerTool.PixelGeometryManager = pixelGeometryManagerTool
-		if newInDetAlignGeo_Options["alignSCT"]:
-			siGeometryManagerTool.SCTGeometryManager = sctGeometryManagerTool
-	siGeometryManagerTool.AlignPixel = newInDetAlignGeo_Options["alignPixel"]
-	siGeometryManagerTool.AlignSCT = newInDetAlignGeo_Options["alignSCT"]
-	#
-	# Silicon alignment degrees of freedom
-	siGeometryManagerTool.AlignX = siAlignment_Options["siAlignX"]
-	siGeometryManagerTool.AlignY = siAlignment_Options["siAlignY"]
-	siGeometryManagerTool.AlignZ = siAlignment_Options["siAlignZ"]
-	siGeometryManagerTool.AlignRotX = siAlignment_Options["siAlignRotX"]
-	siGeometryManagerTool.AlignRotY = siAlignment_Options["siAlignRotY"]
-	siGeometryManagerTool.AlignRotZ = siAlignment_Options["siAlignRotZ"]
-	#
-	ToolSvc += siGeometryManagerTool
-	print siGeometryManagerTool
-
-
-########################################################################################
-####
-####    TRT Alignment Geometry Setup
-####
-
-print " <NewInDetAlignGeometrySetup> setting up TRT Alignment_Options --> TRTGeometryManagerTool"
-if newInDetAlignGeo_Options["alignTRT"]:
-	# TRT geometry manager tool
-	from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__TRTGeometryManagerTool
-	trtGeometryManagerTool = InDet__TRTGeometryManagerTool(name = "TRTGeometryManagerTool")
-	trtGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
-	trtGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
-	trtGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
-	trtGeometryManagerTool.AlignBarrelPhiSectors = trtAlignment_Options["trtAlignBarrelPhiSectors"]
-	trtGeometryManagerTool.AlignBarrelLayers = trtAlignment_Options["trtAlignBarrelLayers"]
-	trtGeometryManagerTool.AlignEndcapPhiSectors = trtAlignment_Options["trtAlignEndcapPhiSectors"]
-	trtGeometryManagerTool.AlignEndcapWheels = trtAlignment_Options["trtAlignEndcapWheels"]
-	trtGeometryManagerTool.AlignSingleEndcap = trtAlignment_Options["trtAlignSingleEndcap"]
-	trtGeometryManagerTool.AlignModuleTool = alignModuleTool
-	# TRT alignment level
-	trtGeometryManagerTool.AlignmentLevel = trtAlignment_Options["trtAlignmentLevel"]
-	trtGeometryManagerTool.AlignmentLevelBarrel = trtAlignment_Options["trtAlignmentLevelBarrel"]
-	trtGeometryManagerTool.AlignmentLevelEndcaps = trtAlignment_Options["trtAlignmentLevelEndcaps"]
-
-	# TRT alignment degrees of freedom
-	# Barrel
-	print " <NewInDetAlignGeometrySetup> setting up TRT barrel Alignment_Options "
-	trtGeometryManagerTool.AlignBarrel = trtAlignment_Options["trtAlignBarrel"]
-	if trtAlignment_Options["trtAlignBarrel"]:
-		trtGeometryManagerTool.AlignBarrelX = trtAlignment_Options["trtAlignBarrelX"]
-		trtGeometryManagerTool.AlignBarrelY = trtAlignment_Options["trtAlignBarrelY"]
-		trtGeometryManagerTool.AlignBarrelZ = trtAlignment_Options["trtAlignBarrelZ"]
-		trtGeometryManagerTool.AlignBarrelRotX = trtAlignment_Options["trtAlignBarrelRotX"]
-		trtGeometryManagerTool.AlignBarrelRotY = trtAlignment_Options["trtAlignBarrelRotY"]
-		trtGeometryManagerTool.AlignBarrelRotZ = trtAlignment_Options["trtAlignBarrelRotZ"]
-		trtGeometryManagerTool.SetSigmaBarrelX = trtAlignment_Options["trtSetSigmaBarrelX"]
-		trtGeometryManagerTool.SetSigmaBarrelY = trtAlignment_Options["trtSetSigmaBarrelY"]
-		trtGeometryManagerTool.SetSigmaBarrelZ = trtAlignment_Options["trtSetSigmaBarrelZ"]
-		trtGeometryManagerTool.SetSigmaBarrelRotX = trtAlignment_Options["trtSetSigmaBarrelRotX"]
-		trtGeometryManagerTool.SetSigmaBarrelRotY = trtAlignment_Options["trtSetSigmaBarrelRotY"]
-		trtGeometryManagerTool.SetSigmaBarrelRotZ = trtAlignment_Options["trtSetSigmaBarrelRotZ"]
-		trtGeometryManagerTool.SetSoftCutBarrelX = trtAlignment_Options["trtSetSoftCutBarrelX"]
-		trtGeometryManagerTool.SetSoftCutBarrelY = trtAlignment_Options["trtSetSoftCutBarrelY"]
-		trtGeometryManagerTool.SetSoftCutBarrelZ = trtAlignment_Options["trtSetSoftCutBarrelZ"]
-		trtGeometryManagerTool.SetSoftCutBarrelRotX = trtAlignment_Options["trtSetSoftCutBarrelRotX"]
-		trtGeometryManagerTool.SetSoftCutBarrelRotY = trtAlignment_Options["trtSetSoftCutBarrelRotY"]
-		trtGeometryManagerTool.SetSoftCutBarrelRotZ = trtAlignment_Options["trtSetSoftCutBarrelRotZ"]
-
-	# Endcaps
-	print " <NewInDetAlignGeometrySetup> setting up TRT endcaps Alignment_Options "
-	trtGeometryManagerTool.AlignEndcaps = trtAlignment_Options["trtAlignEndcaps"]
-	if trtAlignment_Options["trtAlignEndcaps"]:
-		trtGeometryManagerTool.AlignEndcapX = trtAlignment_Options["trtAlignEndcapX"]
-		trtGeometryManagerTool.AlignEndcapY = trtAlignment_Options["trtAlignEndcapY"]
-		trtGeometryManagerTool.AlignEndcapZ = trtAlignment_Options["trtAlignEndcapZ"]
-		trtGeometryManagerTool.AlignEndcapRotX = trtAlignment_Options["trtAlignEndcapRotX"]
-		trtGeometryManagerTool.AlignEndcapRotY = trtAlignment_Options["trtAlignEndcapRotY"]
-		trtGeometryManagerTool.AlignEndcapRotZ = trtAlignment_Options["trtAlignEndcapRotZ"]
-		trtGeometryManagerTool.SetSigmaEndcapX = trtAlignment_Options["trtSetSigmaEndcapX"]
-		trtGeometryManagerTool.SetSigmaEndcapY = trtAlignment_Options["trtSetSigmaEndcapY"]
-		trtGeometryManagerTool.SetSigmaEndcapZ = trtAlignment_Options["trtSetSigmaEndcapZ"]
-		trtGeometryManagerTool.SetSigmaEndcapRotX = trtAlignment_Options["trtSetSigmaEndcapRotX"]
-		trtGeometryManagerTool.SetSigmaEndcapRotY = trtAlignment_Options["trtSetSigmaEndcapRotY"]
-		trtGeometryManagerTool.SetSigmaEndcapRotZ = trtAlignment_Options["trtSetSigmaEndcapRotZ"]
-		trtGeometryManagerTool.SetSoftCutEndcapX = trtAlignment_Options["trtSetSoftCutEndcapX"]
-		trtGeometryManagerTool.SetSoftCutEndcapY = trtAlignment_Options["trtSetSoftCutEndcapY"]
-		trtGeometryManagerTool.SetSoftCutEndcapZ = trtAlignment_Options["trtSetSoftCutEndcapZ"]
-		trtGeometryManagerTool.SetSoftCutEndcapRotX = trtAlignment_Options["trtSetSoftCutEndcapRotX"]
-		trtGeometryManagerTool.SetSoftCutEndcapRotY = trtAlignment_Options["trtSetSoftCutEndcapRotY"]
-		trtGeometryManagerTool.SetSoftCutEndcapRotZ = trtAlignment_Options["trtSetSoftCutEndcapRotZ"]
-	#
-	ToolSvc += trtGeometryManagerTool
-	print trtGeometryManagerTool
-print " <NewInDetAlignGeometrySetup> TRTGeometryManagerTool completed"
-
-
-########################################################################################
-####
-####    Inner Detector Alignment Geometry Setup
-####
-if newInDetAlignGeo_Options["alignInDet"]:
-	# Inner Detector geometry manager tool
-	from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__InDetGeometryManagerTool
-	indetGeometryManagerTool = InDet__InDetGeometryManagerTool(name = "InDetGeometryManagerTool")
-	indetGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
-	indetGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
-	indetGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
-	indetGeometryManagerTool.AlignModuleTool = alignModuleTool
-	#
-	# Inner Detector alignment level
-	indetGeometryManagerTool.AlignmentLevel = indetAlignment_Options["indetAlignmentLevel"]
-	#
-	# we don't need the Pixel and SCT geometry managers if Inner Detector alignment level is 0
-	if not (indetAlignment_Options["indetAlignmentLevel"]==0):
-		if newInDetAlignGeo_Options["alignSilicon"]:
-			indetGeometryManagerTool.SiGeometryManager = siGeometryManagerTool
-		if newInDetAlignGeo_Options["alignTRT"]:
-			indetGeometryManagerTool.TRTGeometryManager = trtGeometryManagerTool
-	indetGeometryManagerTool.AlignSilicon = newInDetAlignGeo_Options["alignSilicon"]
-	indetGeometryManagerTool.AlignTRT = newInDetAlignGeo_Options["alignTRT"]
-	#
-	# Inner Detector alignment degrees of freedom
-	indetGeometryManagerTool.AlignX = indetAlignment_Options["indetAlignX"]
-	indetGeometryManagerTool.AlignY = indetAlignment_Options["indetAlignY"]
-	indetGeometryManagerTool.AlignZ = indetAlignment_Options["indetAlignZ"]
-	indetGeometryManagerTool.AlignRotX = indetAlignment_Options["indetAlignRotX"]
-	indetGeometryManagerTool.AlignRotY = indetAlignment_Options["indetAlignRotY"]
-	indetGeometryManagerTool.AlignRotZ = indetAlignment_Options["indetAlignRotZ"]
-	#
-	ToolSvc += indetGeometryManagerTool
-	print indetGeometryManagerTool
-
-
-# select geometry manager to be used in the alignment
-if newInDetAlignGeo_Options["alignInDet"]:
-	trkAlignGeoManagerTool = indetGeometryManagerTool
-elif newInDetAlignGeo_Options["alignTRT"]:
-	trkAlignGeoManagerTool = trtGeometryManagerTool
-elif newInDetAlignGeo_Options["alignSilicon"]:
-	trkAlignGeoManagerTool = siGeometryManagerTool
-elif newInDetAlignGeo_Options["alignPixel"]:
-	trkAlignGeoManagerTool = pixelGeometryManagerTool
-elif newInDetAlignGeo_Options["alignSCT"]:
-	trkAlignGeoManagerTool = sctGeometryManagerTool
-
-
-
-
-########################################################################################
-####
-####    Inner Detector DB I/O Setup
-####
-
-########################
-#### Silicon DB Output
-if (newInDetAlignGeo_Options["alignInDet"] or newInDetAlignGeo_Options["alignSilicon"] or newInDetAlignGeo_Options["alignSCT"] or newInDetAlignGeo_Options["alignPixel"]):
-	from InDetAlignDBTools.InDetAlignDBToolsConf import InDet__SiTrkAlignDBTool
-	siTrkDBTool = InDet__SiTrkAlignDBTool(OutputLevel = newInDetAlignGeo_Options["outputLevel"]);
-	siTrkDBTool.AlignModuleTool = alignModuleTool
-	if (newInDetAlignGeo_Options["alignPixel"] or newInDetAlignGeo_Options["alignSCT"] and not newInDetAlignGeo_Options["alignSilicon"]):
-		if newInDetAlignGeo_Options["alignPixel"]:
-			siTrkDBTool.PixelGeometryManager = pixelGeometryManagerTool
-		if newInDetAlignGeo_Options["alignSCT"]:
-			siTrkDBTool.SCTGeometryManager = sctGeometryManagerTool
-	elif newInDetAlignGeo_Options["alignSilicon"]:
-		siTrkDBTool.SiGeometryManager = siGeometryManagerTool
-	else:
-		siTrkDBTool.SiGeometryManager = indetGeometryManagerTool
-	siTrkDBTool.UpdateConstants = newInDetAlignGeo_Options["updateConstants"]
-	siTrkDBTool.WriteTextFile = newInDetAlignGeo_Options["writeTextFiles"]
-	siTrkDBTool.OutputTextFile = newInDetAlignGeo_Options["siliconTextFile"]
-	siTrkDBTool.WriteOldConstants = newInDetAlignGeo_Options["writeOldConstants"]
-	siTrkDBTool.AlignmentDBM = newInDetAlignGeo_Options["pixelAlignDBM"]
-	
-	ToolSvc += siTrkDBTool
-	print      siTrkDBTool
-
-########################
-#### TRT DB Output
-if (newInDetAlignGeo_Options["alignInDet"] or newInDetAlignGeo_Options["alignTRT"]):
-	from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_AlignDbSvc
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += TRT_AlignDbSvc(
-		name = "TRT_AlignDbSvc",
-		#StreamTool = TRTCondStream,
-		alignTextFile = "",
-		#alignString = "ALold",
-		OutputLevel = newInDetAlignGeo_Options["outputLevel"])
-
-	from InDetAlignDBTools.InDetAlignDBToolsConf import InDet__TRTTrkAlignDBTool
-	trtTrkDBTool = InDet__TRTTrkAlignDBTool(OutputLevel = newInDetAlignGeo_Options["outputLevel"]);
-	trtTrkDBTool.AlignModuleTool = alignModuleTool
-	if newInDetAlignGeo_Options["alignTRT"]:
-		trtTrkDBTool.TRTGeometryManager = trtGeometryManagerTool
-	else:
-		trtTrkDBTool.SiGeometryManager = indetGeometryManagerTool
-	trtTrkDBTool.UpdateConstants = newInDetAlignGeo_Options["updateConstants"]
-	trtTrkDBTool.WriteTextFile = newInDetAlignGeo_Options["writeTextFiles"]
-	trtTrkDBTool.OutputTextFile = newInDetAlignGeo_Options["trtTextFile"]
-	trtTrkDBTool.WriteOldConstants = newInDetAlignGeo_Options["writeOldConstants"]
-
-	ToolSvc += trtTrkDBTool
-	print      trtTrkDBTool
-
-########################
-#### Inner Detector DB Output
-if newInDetAlignGeo_Options["alignInDet"]:
-	from InDetAlignDBTools.InDetAlignDBToolsConf import InDet__InDetTrkAlignDBTool
-	indetTrkDBTool = InDet__InDetTrkAlignDBTool(OutputLevel = newInDetAlignGeo_Options["outputLevel"]);
-	indetTrkDBTool.SiTrkAlignDBTool = siTrkDBTool
-	indetTrkDBTool.TRTTrkAlignDBTool = trtTrkDBTool
-
-	ToolSvc += indetTrkDBTool
-	print      indetTrkDBTool
-
-
-# select DB tool to be used in the alignment
-if newInDetAlignGeo_Options["alignInDet"]:
-	trkAlignDBTool = indetTrkDBTool
-elif newInDetAlignGeo_Options["alignTRT"]:
-	trkAlignDBTool = trtTrkDBTool
-else:
-	trkAlignDBTool = siTrkDBTool
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignLevels.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignLevels.py
deleted file mode 100644
index 6d8d7290d11364bed7b831d2845e65a79b6b603d..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignLevels.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# Add Comments
-
-## alignment geometry
-#trtAlignBarrel  = True
-#trtAlignEndcaps = True
-### alignment parameters Barrel
-#trtAlignBarrelX = True
-#trtAlignBarrelY = True
-#trtAlignBarrelZ = True
-#trtAlignBarrelRotX = True
-#trtAlignBarrelRotY = True
-#trtAlignBarrelRotZ = True
-### alignment parameters Endcap
-#trtAlignEndcapX = True
-#trtAlignEndcapY = True
-#trtAlignEndcapZ = True
-#trtAlignEndcapRotX = True
-#trtAlignEndcapRotY = True
-#trtAlignEndcapRotZ = True
-
-# when running local Chi2 method we have to switch off insensitive
-# DoF for TRT
-#if "trtAlignmentLevel" in dir() and trtAlignmentLevel == 1:
-#    trtAlignBarrelZ = False
-#if "trtAlignmentLevel" in dir() and trtAlignmentLevel == 2:
-#    trtAlignBarrelY = False
-
-## Pixel alignment DoFs   
-#pixelAlignBarrel  = True
-#pixelAlignEndcaps = True
-### alignment parameters Barrel   
-#pixelAlignBarrelX = True
-#pixelAlignBarrelY = True
-#pixelAlignBarrelZ = True
-#pixelAlignBarrelRotX = True
-#pixelAlignBarrelRotY = True
-#pixelAlignBarrelRotZ = True
-### alignment parameters Endcap   
-#pixelAlignEndcapX = True
-#pixelAlignEndcapY = True
-#pixelAlignEndcapZ = True
-#pixelAlignEndcapRotX = True
-#pixelAlignEndcapRotY = True
-#pixelAlignEndcapRotZ = True
-
-if "pixelAlignmentLevelBarrel" in dir() and pixelAlignmentLevelBarrel == 3:
-    pixelAlignBarrelY = False
-    pixelAlignBarrelZ = False
-    pixelAlignBarrelRotX = False
-    pixelAlignBarrelRotY = False
-
-if "pixelAlignmentLevelEndcaps" in dir() and pixelAlignmentLevelEndcaps == 3:
-    pixelAlignEndcapZ = False
-    pixelAlignEndcapRotX = False
-    pixelAlignEndcapRotY = False
-
-#if "pixelAlignmentLevelBarrel" in dir() and pixelAlignmentLevelBarrel == 22:
-   
-    
-if "pixelAlignmentLevelEndcaps" in dir() and pixelAlignmentLevelEndcaps == 2:
-    pixelAlignEndcapZ = False
-    pixelAlignEndcapRotX = False
-    pixelAlignEndcapRotY = False
-
-
-   
-### SCT alignment DoFs   
-#sctAlignBarrel  = True
-#sctAlignEndcaps = True
-### alignment parameters Barrel   
-#sctAlignBarrelX = True
-#sctAlignBarrelY = True
-#sctAlignBarrelZ = True
-#sctAlignBarrelRotX = True
-#sctAlignBarrelRotY = True
-#sctAlignBarrelRotZ = True
-### alignment parameters Endcap   
-#sctAlignEndcapX = True
-#sctAlignEndcapY = True
-#sctAlignEndcapZ = True
-#sctAlignEndcapRotX = True
-#sctAlignEndcapRotY = True
-#sctAlignEndcapRotZ = True
-
-if "sctAlignmentLevelBarrel" in dir() and sctAlignmentLevelBarrel == 3:
-    sctAlignBarrelY =  False
-    sctAlignBarrelZ = False
-    sctAlignBarrelRotX = False
-    sctAlignBarrelRotY = False
-
-if "sctAlignmentLevelEndcaps" in dir() and sctAlignmentLevelEndcaps == 3:
-    sctAlignEndcapZ = False
-    sctAlignEndcapRotX = False
-    sctAlignEndcapRotY = False
-
-
-
-#if "sctAlignmentLevelBarrel" in dir() and sctAlignmentLevelBarrel == 2:
-if "sctAlignmentLevelEndcaps" in dir() and sctAlignmentLevelEndcaps == 2:
-    sctAlignEndcapZ = False
-    sctAlignEndcapRotX = False
-    sctAlignEndcapRotY = False
-
-### alignment parameters
-#siAlignX = True
-#siAlignY = True
-#siAlignZ = True
-#siAlignRotX = True
-#siAlignRotY = True
-#siAlignRotZ = True
-#
-### alignment parameters
-#indetAlignX = True
-#indetAlignY = True
-#indetAlignZ = True
-#indetAlignRotX = True
-#indetAlignRotY = True
-#indetAlignRotZ = True
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py
deleted file mode 100644
index d0a82bfdcb49789dc1f9bd3000efb9c6b232560f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py
+++ /dev/null
@@ -1,744 +0,0 @@
-################################
-# setup of alignment monitoring
-
-
-
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-#InDetAlignMonManager = AthenaMonManager( name                = "InDetAlignMonManager",
-#FileKey             = DQMonFlags.monManFileKey(),
-#                                         ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-#                                         DataType            = DQMonFlags.monManDataType(),
-#                                         Environment         = "user",
-#                                         ManualRunLBSetup    = True,
-#                                         Run                 = 1,
-#                                         LumiBlock           = 1)
-#
-
-InDetAlignMonManager = AthenaMonManager( name                = "InDetAlignMonManager",
-                                         FileKey             = DQMonFlags.monManFileKey(),
-                                         ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                         DataType            = DQMonFlags.monManDataType(),
-                                         Environment         = DQMonFlags.monManEnvironment(),
-                                         ManualRunLBSetup    = DQMonFlags.monManManualRunLBSetup(),
-                                         Run                 = DQMonFlags.monManRun(),
-                                         LumiBlock           = DQMonFlags.monManLumiBlock())
-# track collection to monitor
-
-tracks = "ExtendedTracks"
-    
-if Cosmics:
-    tracks = "CombinedInDetTracks"
-    trackCollections = [tracks]
-
-# if we're running Si only (TRT is off) we need to use different track collection
-if not newInDetAlignAlg_Options["useTRT"]:
-    tracks = "ResolvedTracks"
-
-if newInDetAlignAlg_Options["doBSConstraint"] == False and newInDetAlignAlg_Options["doPVConstraint"] == False:
-    #trackCollections = [tracks,"AlignTracks","AlignTracksNormalRefitted"]
-    trackCollections  = [tracks,"AlignTracks"]
-elif newInDetAlignAlg_Options["doBSConstraint"] == True and newInDetAlignAlg_Options["doPVConstraint"] == False:
-    trackCollections = [tracks,"AlignTracks","AlignTracksNormalRefitted","AlignTracksBeamspotConstrained"]
-elif newInDetAlignAlg_Options["doBSConstraint"] == False and newInDetAlignAlg_Options["doPVConstraint"] == True:
-    trackCollections = [tracks,"AlignTracks","AlignTracksNormalRefitted","AlignTracksVertexConstrained"]
-else:
-    trackCollections = [tracks,"AlignTracks","AlignTracksNormalRefitted","AlignTracksBeamspotConstrained","AlignTracksVertexConstrained"]
-
-trackCollections.append("ForwardTracks")
-
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMon__TrackSelectionTool
-from InDetTrackSelectionTool.InDetTrackSelectionToolConf   import InDet__InDetTrackSelectionTool           #loading the InDetTrackSelectionTool
-from InDetTrackSelectorTool.InDetTrackSelectorToolConf     import InDet__InDetDetailedTrackSelectorTool
-
-
-#trackCollections.append("ForwardTracks")
-
-
-# Default Detailed TrackSelectorTool. To avoid the use of an unconfigured TrackSelectionTool
-
-InDetDetailedTrackSelector_Default = InDet__InDetDetailedTrackSelectorTool(name             = "DefaultDetailedSelector",
-                                                                           TrackSummaryTool = InDetTrackSummaryTool,
-                                                                           Extrapolator     = InDetExtrapolator)
-
-ToolSvc += InDetDetailedTrackSelector_Default
-
-
-# All tracks selection
-allSelection = InDetAlignMon__TrackSelectionTool(
-    name = "InDetAlignMonTrackSelectionTool",
-    PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-    PassAllTracks = True, ## Uncomment this line to bypass track slection
-    TrackSelectorTool    = InDetDetailedTrackSelector_Default
-)
-
-
-
-
-# Tracks For LoosePrimary Selection
-
-
-m_TrackSelectorTool_LoosePrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoosePrimary",
-                                                                  UseTrkTrackTools = True,
-                                                                  minPt = 5000,
-                                                                  maxD0 = 100000,
-                                                                  maxZ0SinTheta = 150,
-                                                                  minNTrtHits = 0,
-                                                                  CutLevel = "LoosePrimary",
-                                                                  TrackSummaryTool    = InDetTrackSummaryTool,
-                                                                  Extrapolator        = InDetExtrapolator)
-
-
-
-
-
-
-ToolSvc +=  m_TrackSelectorTool_LoosePrimary
-
-
-LPSelection = InDetAlignMon__TrackSelectionTool(
-    name = "InDetAlignMonTracksSelectionTool_LP",
-    PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-    UseIDTrackSelectionTool = True,
-    IDTrackSelectionTool = m_TrackSelectorTool_LoosePrimary,
-    #TrackSelectorTool    = InDetDetailedTrackSelector_Default
-    )
-
-
-ToolSvc += allSelection
-ToolSvc += LPSelection
-
-#Track selector: Defined in NewInDetAlignAlgSetup
-#trackSelector = The cuts are:
-#               pTMin = newInDetAlignAlg_Options["PtCut"],
-#               IPd0Max = 500.,
-#               IPz0Max = 500.,
-#               #nHitSct = 4,
-#               nHitPix = 1,
-#               nHitPixPhysical = 1,
-#               nHitBLayerPlusPix = 0,
-#               nHitBLayer = 0,
-#               nHitSi = 9,
-#               nHitSiPhysical = 7,
-#               nHitTrt = 0,
-#               TrtDCCutTool = trtDCtool,
-#               addToMinHitTrt = -3
-
-
-
-# Align tracks selection
-if newInDetAlignAlg_Options["useTrackSelector"]:
-    alignTrackSelection = InDetAlignMon__TrackSelectionTool(
-                            name = "InDetAlignMonAlignTrackSelectionTool",
-                            PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-                            #PassAllTracks = True, ## Uncomment this line to bypass track slection
-                            IDTrackSelectionTool = trackSelectorNew,
-                            UseIDTrackSelectionTool = True
-                            )
-    ToolSvc += alignTrackSelection
-
-
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonResiduals
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonEfficiencies
-
-print " <NewInDetAlignMonitoring> setting up " 
-for trackCollection in trackCollections:
-    # Selected tracks
-    print " <NewInDetAlignMonitoring> (type 1) Loading monitor for track Collection", trackCollection, " selection", allSelection.name
-    InDetAlignMonResiduals = IDAlignMonResiduals(
-        name = "InDetAlignMonResiduals_"+trackCollection,
-        trackSelection = allSelection,
-        tracksName = trackCollection,
-        useExtendedPlots = True,
-        doIBLLBPlots = True,
-        doClusterSizeHistos = True,
-        triggerChainName = "all",
-        Pixel_Manager = InDetKeys.PixelManager(),
-        SCT_Manager = InDetKeys.SCT_Manager(),
-        TRT_Manager = InDetKeys.TRT_Manager(),
-        minPIXResXFillRange = -0.08,
-        maxPIXResXFillRange =  0.08,
-        minPIXResYFillRange = -0.25,
-        maxPIXResYFillRange =  0.25,
-        minSCTResFillRange  = -0.15,
-        maxSCTResFillRange =   0.15,
-        minTRTResidualWindow =-2.5,
-        maxTRTResidualWindow = 2.5,
-        NSplitMap  = 1,
-        RangeOfPullHistos  =   5.0
-    )
-    print InDetAlignMonResiduals
-    
-    ToolSvc += InDetAlignMonResiduals
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-    InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-        name = "InDetAlignMonGenericTracks_"+trackCollection,
-        trackSelection = allSelection,
-        tracksName = trackCollection,
-        useExtendedPlots = True,
-        doIP = False,
-        #doIPmaps = True,
-        triggerChainName = "all",
-        d0Range = 5,
-        z0Range = 200,
-        #NTracksRange = 10,
-        VxPrimContainerName = InDetKeys.PrimaryVertices()
-    )
-    if Cosmics:
-        InDetAlignMonGenericTracks.d0Range = 500
-        InDetAlignMonGenericTracks.z0Range = 1000
-        
-    ToolSvc += InDetAlignMonGenericTracks
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-
-    InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-        name = "InDetAlignMonEfficiencies_"+trackCollection,
-        #doHoleSearch = False,
-        trackSelection = allSelection,
-        tracksName = trackCollection,
-        triggerChainName = "all",
-        #HoleSearch = InDetExtendedHoleSearchTool,
-        Pixel_Manager = InDetKeys.PixelManager(),
-        SCT_Manager = InDetKeys.SCT_Manager(),
-        TRT_Manager = InDetKeys.TRT_Manager()
-    )
-
-    ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-
-if True:
-    InDetAlignMonResiduals = IDAlignMonResiduals(
-        name = "InDetAlignMonResiduals_LoosePrimary",
-        trackSelection = LPSelection,
-        tracksName = "ExtendedTracks",
-        useExtendedPlots = True,
-        doClusterSizeHistos = True,
-        triggerChainName = "LoosePrimary",
-        Pixel_Manager = InDetKeys.PixelManager(),
-        SCT_Manager = InDetKeys.SCT_Manager(),
-        TRT_Manager = InDetKeys.TRT_Manager(),
-        minPIXResXFillRange = -0.4,
-        maxPIXResXFillRange =  0.4,
-        minPIXResYFillRange = -0.80,
-        maxPIXResYFillRange =  0.80,
-        minSCTResFillRange  = -0.4,
-        maxSCTResFillRange =   0.4,
-        minTRTResidualWindow =-2.5,
-        maxTRTResidualWindow = 2.5,
-        NSplitMap  = 1,
-        RangeOfPullHistos  =   5.0
-        )
-    print InDetAlignMonResiduals
-    
-    ToolSvc += InDetAlignMonResiduals
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-    InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-        name = "InDetAlignMonGenericTracks_LoosePrimary",
-        trackSelection = LPSelection,
-        tracksName = "ExtendedTracks",
-        useExtendedPlots = True,
-        triggerChainName = "LoosePrimary",
-        d0Range = 5,
-        z0Range = 200,
-        #NTracksRange = 10,
-        VxPrimContainerName = InDetKeys.PrimaryVertices()
-        )
-    ToolSvc += InDetAlignMonGenericTracks
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-
-    InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-        name = "InDetAlignMonEfficiencies_LoosePrimary",
-        #doHoleSearch = False,
-        trackSelection = LPSelection,
-        tracksName = "ExtendedTracks",
-        triggerChainName = "LoosePrimary",
-        #HoleSearch = InDetExtendedHoleSearchTool,
-        Pixel_Manager = InDetKeys.PixelManager(),
-        SCT_Manager = InDetKeys.SCT_Manager(),
-        TRT_Manager = InDetKeys.TRT_Manager()
-        )
-
-    ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-
-
-
-
-
-#TriggerChainName is only the name passed to the monitoring folder
-
-if newInDetAlignAlg_Options["useTrackSelector"]:
-    print " <NewInDetAlignMonitoring> (type 2) Loading monitor for track Collection", tracks, " selection", alignTrackSelection.name
-    InDetAlignMonResiduals = IDAlignMonResiduals(
-        name = "InDetAlignMonResiduals_"+tracks+"_sel",
-        trackSelection = alignTrackSelection,
-        tracksName = tracks,
-        useExtendedPlots = True,
-        doClusterSizeHistos = True,
-        triggerChainName = "alignSelection",  
-        Pixel_Manager = InDetKeys.PixelManager(),
-        SCT_Manager = InDetKeys.SCT_Manager(),
-        TRT_Manager = InDetKeys.TRT_Manager(),
-        minPIXResXFillRange = -0.08,
-        maxPIXResXFillRange =  0.08,
-        minPIXResYFillRange = -0.25,
-        maxPIXResYFillRange =  0.25,
-        minSCTResFillRange  = -0.15,
-        maxSCTResFillRange =   0.15,
-        minTRTResidualWindow =-2.5,
-        maxTRTResidualWindow = 2.5,
-        NSplitMap  = 1,
-        RangeOfPullHistos  =   5.0
-
-    )
-    print  InDetAlignMonResiduals
-    ToolSvc += InDetAlignMonResiduals
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-
-    InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-        name = "InDetAlignMonGenericTracks_"+tracks+"_sel",
-        trackSelection = alignTrackSelection,
-        tracksName = tracks,
-        useExtendedPlots = True,
-        triggerChainName = "alignSelection",
-        #doIPmaps = True,
-        VxPrimContainerName = InDetKeys.PrimaryVertices()
-    )
-    ToolSvc += InDetAlignMonGenericTracks
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-
-    InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-        name = "InDetAlignMonEfficiencies_"+tracks+"_sel",
-        trackSelection = alignTrackSelection,
-        tracksName = tracks,
-        #doHoleSearch = False,
-        triggerChainName = "alignSelection",
-        #HoleSearch = InDetExtendedHoleSearchTool,
-        Pixel_Manager = InDetKeys.PixelManager(),
-        SCT_Manager = InDetKeys.SCT_Manager(),
-        TRT_Manager = InDetKeys.TRT_Manager()
-    )
-    ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-if not Cosmics:
-    from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot
-    InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name                           = "InDetAlignMonBeamSpot_noTrig",
-                                                          extrapolator                   = InDetExtrapolator,
-                                                          vxContainerName                = InDetKeys.PrimaryVertices(),
-                                                          vxContainerWithBeamConstraint  = InDetFlags.useBeamConstraint())
-    ToolSvc += InDetAlignMonBeamSpot_noTrig
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonBeamSpot_noTrig ]
-
-
-
-#include("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
-#from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
-#funIDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
-#                  ReFitterTool1 = MuonRefitterTool,
-#                  ReFitterTool2 = MuonRefitterTool2,
-#                  OutputTracksName =  "SelectedMuons", 
-#                  isMC = True,
-#                  doIsoSelection = False,
-#                  OutputLevel =1)
-# I hope is correct
-#job+= funIDPerfMonZmumu
-
-
-#RefitTrackCollections= ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
-#RefitTrackSelector  = InDet__InDetDetailedTrackSelectorTool(
-#   name= "RefitTrackSelector",
-#   OutputLevel=INFO,
-#   TrackSummaryTool=InDetTrackSummaryTool,
-#   pTMin = 10000.,
-#   IPd0Max = 500.,
-#   IPz0Max = 500.,
-#   nHitPix = 1,
-#   nHitPixPhysical = 1,
-#   nHitBLayerPlusPix = 0,
-#   nHitBLayer = 0,
-#   nHitSi = 9,
-#   nHitSiPhysical = 7,
-#   nHitTrt = 0,
-#   addToMinHitTrt=-3
-#   )
-#RefitTrackSelector.useEtaDepententMinHitTrt = True
-#ToolSvc += RefitTrackSelector
-'''
-RefitAlignTrackSelection = InDetAlignMon__TrackSelectionTool(
-    name = "InDetAlignMonAlignTrackSelectionTool",
-    TrackSelectorTool = RefitTrackSelector),
-    PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
-ToolSvc+= RefitAlignTrackSelection
-
-
-for trackCollection in RefitTrackCollections:
-    InDetAlignMonResiduals = IDAlignMonResiduals(
-                name = "InDetAlignMonResiduals_"+trackCollection,
-                trackSelection = RefitAlignTrackSelection,
-                tracksName = trackCollection,
-                useExtendedPlots = True,
-                triggerChainName = "all",
-                Pixel_Manager = InDetKeys.PixelManager(),
-                SCT_Manager = InDetKeys.SCT_Manager(),
-                TRT_Manager = InDetKeys.TRT_Manager(),
-                minPIXResXFillRange = -0.1,
-                maxPIXResXFillRange =  0.1,
-                #minPIXResXFillRange = -0.5,
-                #maxPIXResXFillRange =  0.5,
-                minPIXResYFillRange = -0.5,
-                maxPIXResYFillRange =  0.5,
-                minSCTResFillRange  = -0.2,
-                maxSCTResFillRange =   0.2,
-                #minSCTResFillRange  = -0.5,
-                #maxSCTResFillRange =   0.5,
-                NSplitMap = 1,
-                RangeOfPullHistos  =   5
-        )
-    ToolSvc += InDetAlignMonResiduals
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-    InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-                name = "InDetAlignMonGenericTracks_"+trackCollection,
-                trackSelection = RefitAlignTrackSelection,#allSelection,
-                tracksName = trackCollection,
-                useExtendedPlots = True,
-                triggerChainName = "all",
-                VxPrimContainerName = InDetKeys.PrimaryVertices()
-        )
-    ToolSvc += InDetAlignMonGenericTracks
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-
-    InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-                name = "InDetAlignMonEfficiencies_"+trackCollection,
-                trackSelection = RefitAlignTrackSelection,#allSelection,
-                tracksName = trackCollection,
-                triggerChainName = "all",
-                #HoleSearch = InDetExtendedHoleSearchTool,
-                Pixel_Manager = InDetKeys.PixelManager(),
-                SCT_Manager = InDetKeys.SCT_Manager(),
-                TRT_Manager = InDetKeys.TRT_Manager()
-        )
-    ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-'''
-
-if Cosmics:     
-    print " <NewInDetAlignMonitoring> Setting track segment monitoring for various collections"
-    InDetAlignMonManager.DataType = "cosmics"
-    m_alignMonTrackSelectorTool  = []
-    m_alignMonTrackSelectionTool = []
-    # Cosmic running   
-    #
-
-    m_trackSelectorToolName       = ["AlignTracksTrackSelectorTool","AlignTracksTrackSelectorTool_Half",
-                                     "InDetAlignCosmicTrackSelectorTool", "InDetAlignCosmicTrackSelector_Half",
-                                     "PixTrackSelectorTool", "PixUpLowTrackSelectorTool",
-                                     "SCTTrackSelectorTool", "SCTUpLowTrackSelectorTool",
-                                     "SiTrackSelectorTool", "SiUpSiLowTrackSelectorTool",
-                                     "TRTonlyTrackSelectorTool","TRTUpTRTLowTrackSelectorTool"]
-    m_nHitBLayer                   = [ 0,  0,  0,  1,  2,  1,  0,  0,  2,  1,  0,  0]
-    m_nHitPix                      = [ 1,  1,  1,  3,  5,  3,  0,  0,  5,  3,  0,  0]
-    m_nHitSct                      = [ 8,  8,  8,  8,  0,  0, 14,  8, 14,  8,  0,  0]
-    m_nHitTrt                      = [25, 25, 25, 25,  0,  0,  0,  0,  0,  0, 25, 25]
-
-    m_alignMonTrackSelectionToolName = ["AlignTracksTrackSelectionTool","AlignTracksTrackSelectionTool_Half",
-                                        "InDetAlignMonCosmicsTrackSelectionTool","InDetAlignMonTrackSelectionTool_Half",
-                                        "PixTrackSelectionTool", "PixUpLowTrackSelectionTool",
-                                        "SCTTrackSelectionTool","SCTUpLowTrackSelectionTool",
-                                        "SiTrackSelectionTool", "SiUpSiLowTrackSelectionTool",
-                                        "TRTonlyTrackSelectionTool","TRTUpTRTLowTrackSelectionTool" ]
-
-    from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-    for i in range(len(m_alignMonTrackSelectionToolName)):
-        print " <NewInDetAlignMonitoring> step ",i," --> setting track selector:", m_trackSelectorToolName[i]    
-        m_alignMonTrackSelectorTool.append(InDet__InDetDetailedTrackSelectorTool(name            = m_trackSelectorToolName[i],
-                                                                                pTMin           = 2000,#1 GeV
-                                                                                IPd0Max       = 1000.0,#no cut on d0 yet
-                                                                                IPz0Max       = 1200.0,#actual cut is on sin(theta)*z0
-                                                                                nHitBLayer     = m_nHitBLayer[i],
-                                                                                nHitPix       = m_nHitPix[i],
-                                                                                nHitSct       = m_nHitSct[i],
-                                                                                nHitSi         = 0,
-                                                                                nHitTrt       = m_nHitTrt[i],
-                                                                                nSharedSct     = 0,
-                                                                                TrackSummaryTool = InDetTrackSummaryTool,
-                                                                                Extrapolator     = InDetExtrapolator))
-        ToolSvc += m_alignMonTrackSelectorTool[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_alignMonTrackSelectorTool[i]
-    
-           
-        m_alignMonTrackSelectionTool.append(InDetAlignMon__TrackSelectionTool(name              = m_alignMonTrackSelectionToolName[i],
-                                                                              ## Uncomment this line to bypass track slection
-                                                                              #PassAllTracks      = True,
-                                                                              #DoEventPhaseCut  = True,
-                                                                              TrackSelectorTool   = m_alignMonTrackSelectorTool[i]))
-
-        ToolSvc += m_alignMonTrackSelectionTool[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print " <NewInDetAlignMonitoring> m_alignMonTrackSelectionTool[",i,"] =",  m_alignMonTrackSelectionToolName[i]
-            print m_alignMonTrackSelectionTool[i]
-        
-    # Upper Vs Lower
-    #
-    from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool
-    from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonTrackSegments
-
-    m_trackSplitter       = []
-    m_trackSplitterName   = ["TrackSplitterTool_AlignTracks","TrackSplitterTool_Combined","TrackSplitterTool_Pixel","TrackSplitterTool_SCT","TrackSplitterTool_Si","TrackSplitterTool_TRT"]
-    #m_trackSplitterName   = ["TrackSplitterTool_AlignTracks","TrackSplitterTool_Combined"] # just to work with ALignTracks and CombinedInDetTracks
-    m_upperTracksName     = ["AlignTracks_Upper", "Combined_Upper", "Pixel_Upper", "SCT_Upper", "Si_Upper", "TRT_Upper"]
-    m_lowerTracksName     = ["AlignTracks_Lower", "Combined_Lower", "Pixel_Lower", "SCT_Lower", "Si_Lower", "TRT_Lower"]
-
-    m_trackSegmentsUpLow     = []
-    m_trackSegmentsUpLowName = ["InDetAlignMonTrackSegment_AlignTracks", "InDetAlignMonTrackSegments_Combined","InDetAlignMonTrackSegments_PixUpLow",
-                                "InDetAlignMonTrackSegments_SCTUpLow", "InDetAlignMonTrackSegments_SiUpLow","InDetAlignMonTrackSegments_TRTUpLow"]
-    
-    m_inputTracksUpLow     = ["AlignTracks", "CombinedInDetTracks",InDetKeys.Tracks(),InDetKeys.PixelTracks(),InDetKeys.SCTTracks(),"ResolvedTracks",InDetKeys.TRTTracks()]
-
-    m_d0Range               = [   100,   1000,    100,    100,    100,    100, 800.]
-    m_deltaD0               = [   0.5,    0.5,    0.5,    0.8,   0.8,   0.5,     8.]
-    m_deltaD02D             = [   1.0,    1.0,    1.0,    1.0,   1.0,   1.0,    10.]
-    m_deltaPhi              = [ 0.002,   0.01,   0.002,  0.005, 0.005, 0.002, 0.01]
-    m_deltaPhi2D            = [  0.02,   0.05,   0.02,   0.02,  0.02,  0.02,  0.05]
-    m_deltaQoverPt          = [  0.02,    0.1,    0.02,   0.2,   0.05,  0.02,  0.1]
-    m_deltaQoverPt2D        = [  0.05,    0.1,    0.05,   0.2,   0.05,  0.04,  0.1]
-
-    for i in range(len(m_trackSplitterName)):
-        print " <NewInDetAlignMonitoring> Setting track splitter:", m_trackSplitterName[i]
-        m_trackSplitter.append(InDet__InDetTrackSplitterTool(name                 = m_trackSplitterName[i],
-                                                             TrackFitter           = InDetTrackFitter,
-                                                             OutputUpperTracksName = m_upperTracksName[i],
-                                                             OutputLowerTracksName = m_lowerTracksName[i],
-                                                             OutputLevel = WARNING))
-       
-        ToolSvc += m_trackSplitter[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_trackSplitter[i]
-            print " <NewInDetAlignMonitoring> step ",i," -> defined track segment monitoring for",m_trackSegmentsUpLowName[i],"using", m_upperTracksName[i],"and",  m_lowerTracksName[i], "   2*i+1=",2*i+1," m_alignMonTrackSelectionTool ? length=",len(m_alignMonTrackSelectionTool)
-        m_trackSegmentsUpLow.append(IDAlignMonTrackSegments(name                = m_trackSegmentsUpLowName[i],
-                                                            InputTracksName     = m_inputTracksUpLow[i],
-                                                            UpperTracksName     = m_upperTracksName[i],
-                                                            LowerTracksName     = m_lowerTracksName[i],
-                                                            UseCTBSplitTracks   = False,
-                                                            TrackSplitter       = m_trackSplitter[i],#Need the even ones
-                                                            trackSelectionUp    = m_alignMonTrackSelectionTool[2*i+1],
-                                                            trackSelectionLow   = m_alignMonTrackSelectionTool[2*i+1],
-                                                            trackSumTool        = InDetTrackSummaryTool,
-                                                            DeltaD0Range        = m_deltaD0[i],
-                                                            DeltaD0Range2D      = m_deltaD02D[i],
-                                                            DeltaPhiRange       = m_deltaPhi[i],
-                                                            DeltaPhiRange2D     = m_deltaPhi2D[i],
-                                                            DeltaQoverPtRange   = m_deltaQoverPt[i],
-                                                            DeltaQoverPtRange2D = m_deltaQoverPt2D[i],
-                                                            D0Range             = m_d0Range[i],
-                                                            OutputLevel = WARNING))
-
-        ToolSvc += m_trackSegmentsUpLow[i]
-        InDetAlignMonManager.AthenaMonTools += [ m_trackSegmentsUpLow[i] ]
-        print " <NewInDetAlignMonitoring> step ",i, m_trackSegmentsUpLowName[i]," added to the ToolSvc"
-
-        # vvv trying to add monitoring of the splitted tracks
-        # Upper track segments
-        trackCollection = m_upperTracksName[i]
-        
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonResiduals for track collection: ",trackCollection
-        InDetAlignMonResiduals = IDAlignMonResiduals(
-            name = "InDetAlignMonResiduals_"+trackCollection,
-            trackSelection = allSelection,
-            tracksName = trackCollection,
-            useExtendedPlots = True,
-            doClusterSizeHistos = True,
-            triggerChainName = "all",
-            Pixel_Manager = InDetKeys.PixelManager(),
-            SCT_Manager = InDetKeys.SCT_Manager(),
-            TRT_Manager = InDetKeys.TRT_Manager(),
-            minPIXResXFillRange = -0.40,
-            maxPIXResXFillRange =  0.40,
-            minPIXResYFillRange = -0.80,
-            maxPIXResYFillRange =  0.80,
-            minSCTResFillRange  = -0.4,
-            maxSCTResFillRange =   0.4,
-            minTRTResidualWindow =-2.5,
-            maxTRTResidualWindow = 2.5,
-            NSplitMap  = 1,
-            RangeOfPullHistos  =   5.00,
-            OutputLevel = WARNING
-            )
-    
-        ToolSvc += InDetAlignMonResiduals
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-        print InDetAlignMonResiduals
-
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonGenericTracks for track collection: ",trackCollection
-        InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-            name = "InDetAlignMonGenericTracks_"+trackCollection,
-            trackSelection = allSelection,
-            tracksName = trackCollection,
-            useExtendedPlots = True,
-            triggerChainName = "all",
-            #doIPmaps = True,
-            d0Range = 5,
-            z0Range = 200,
-            #NTracksRange = 10,
-            VxPrimContainerName = InDetKeys.PrimaryVertices()
-        )
-        print InDetAlignMonGenericTracks
-        
-        if Cosmics:
-            InDetAlignMonGenericTracks.d0Range = 500
-            InDetAlignMonGenericTracks.z0Range = 1000
-        
-        ToolSvc += InDetAlignMonGenericTracks
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonSelectedTracksEfficiencies for track collection: ",trackCollection
-        InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-            name = "InDetAlignMonEfficiencies_"+trackCollection,
-            trackSelection = allSelection,
-            #doHoleSearch= False,
-            tracksName = trackCollection,
-            triggerChainName = "all",
-            #HoleSearch = InDetExtendedHoleSearchTool,
-            Pixel_Manager = InDetKeys.PixelManager(),
-            SCT_Manager = InDetKeys.SCT_Manager(),
-            TRT_Manager = InDetKeys.TRT_Manager()
-            )
-
-        ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-        
-        # Lower track segments
-        trackCollection = m_lowerTracksName[i]
-        
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonResiduals for track collection: ",trackCollection
-        InDetAlignMonResiduals = IDAlignMonResiduals(
-            name = "InDetAlignMonResiduals_"+trackCollection,
-            trackSelection = allSelection,
-            tracksName = trackCollection,
-            useExtendedPlots = True,
-            doClusterSizeHistos = True,
-            triggerChainName = "all",
-            Pixel_Manager = InDetKeys.PixelManager(),
-            SCT_Manager = InDetKeys.SCT_Manager(),
-            TRT_Manager = InDetKeys.TRT_Manager(),
-            minPIXResXFillRange = -0.40,
-            maxPIXResXFillRange =  0.40,
-            minPIXResYFillRange = -0.80,
-            maxPIXResYFillRange =  0.80,
-            minSCTResFillRange  = -0.4,
-            maxSCTResFillRange =   0.4,
-            minTRTResidualWindow =-2.5,
-            maxTRTResidualWindow = 2.5,
-            NSplitMap  = 1,
-            RangeOfPullHistos  =   5.00,
-            OutputLevel = WARNING
-            )
-    
-        ToolSvc += InDetAlignMonResiduals
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-        print InDetAlignMonResiduals
-
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonGenericTracks for track collection: ",trackCollection
-        InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
-            name = "InDetAlignMonGenericTracks_"+trackCollection,
-            trackSelection = allSelection,
-            tracksName = trackCollection,
-            useExtendedPlots = True,
-            triggerChainName = "all",
-            d0Range = 5,
-            z0Range = 200,
-            #doIPmaps = True,
-            #NTracksRange = 10,
-            VxPrimContainerName = InDetKeys.PrimaryVertices()
-        )
-        print InDetAlignMonGenericTracks
-        
-        if Cosmics:
-            InDetAlignMonGenericTracks.d0Range = 500
-            InDetAlignMonGenericTracks.z0Range = 1000
-        
-        ToolSvc += InDetAlignMonGenericTracks
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-        print " <NewInDetAlignMonitoring> going to define InDetAlignMonSelectedTracksEfficiencies for track collection: ",trackCollection
-        InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
-            name = "InDetAlignMonEfficiencies_"+trackCollection,
-            trackSelection = allSelection,
-            #doHoleSearch= False,
-            tracksName = trackCollection,
-            triggerChainName = "all",
-            #HoleSearch = InDetExtendedHoleSearchTool,
-            Pixel_Manager = InDetKeys.PixelManager(),
-            SCT_Manager = InDetKeys.SCT_Manager(),
-            TRT_Manager = InDetKeys.TRT_Manager()
-            )
-
-        ToolSvc += InDetAlignMonSelectedTracksEfficiencies
-        InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSelectedTracksEfficiencies ]
-
-        # ^^^
-        if (InDetFlags.doPrintConfigurables()):
-            print m_trackSegmentsUpLow[i]
-
-     
-    #
-    # Subdetector Vs Subdetector
-    #
-    m_trackSegments_Sub  = []
-    m_trackSegmentsName_Sub = ["InDetAlignMonTrackSegments_PixSCT","InDetAlignMonTrackSegments_SiTRT"]
-    m_inputTracks_Sub      = [InDetKeys.Tracks(),InDetKeys.Tracks()]
-    m_upperTracksName_Sub   = [InDetKeys.PixelTracks(),"ResolvedTracks"]
-    m_trackSelectionUpper   = [2,6]
-    m_lowerTracksName_Sub   = [InDetKeys.SCTTracks(),InDetKeys.TRTTracks()]
-    m_trackSelectionLower   = [4,8]
-    m_d0Range_Sub          = [   50, 800]
-    m_deltaD0_Sub          = [  0.8,   8]
-    m_deltaD02D_Sub      = [    5,  10]
-    m_deltaPhi_Sub        = [0.005,0.01]
-    m_deltaPhi2D_Sub        = [ 0.02,0.05]
-    m_deltaQoverPt_Sub    = [ 0.05, 0.1]
-    m_deltaQoverPt2D_Sub    = [ 0.05, 0.1]
-
-    for i in range(2):
-        m_trackSegments_Sub.append(IDAlignMonTrackSegments(name = m_trackSegmentsName_Sub[i],
-                                                           InputTracksName       = m_inputTracks_Sub[i],
-                                                           UpperTracksName       = m_upperTracksName_Sub[i],
-                                                           LowerTracksName       = m_lowerTracksName_Sub[i],
-                                                           trackSelectionUp     = m_alignMonTrackSelectionTool[m_trackSelectionUpper[i]],
-                                                           trackSelectionLow       = m_alignMonTrackSelectionTool[m_trackSelectionLower[i]],
-                                                           trackSumTool         = InDetTrackSummaryTool,
-                                                           DeltaD0Range         = m_deltaD0_Sub[i],
-                                                           DeltaD0Range2D         = m_deltaD02D_Sub[i],
-                                                           DeltaPhiRange           = m_deltaPhi_Sub[i],
-                                                           DeltaPhiRange2D       = m_deltaPhi2D_Sub[i],
-                                                           DeltaQoverPtRange       = m_deltaQoverPt_Sub[i],
-                                                           DeltaQoverPtRange2D   = m_deltaQoverPt2D_Sub[i],
-                                                           D0Range               = m_d0Range_Sub[i]))
-
-        ToolSvc += m_trackSegments_Sub[i]
-        if (InDetFlags.doPrintConfigurables()):
-            print m_trackSegments_Sub[i]
-    
-    #for i in range(5):
-        # InDetAlignMonManager.AthenaMonTools += [ m_trackSegmentsUpLow[i] ]
-    for i in range(2):
-        InDetAlignMonManager.AthenaMonTools += [ m_trackSegments_Sub[i] ]
-
-if not hasattr(ServiceMgr, 'THistSvc'):
-    from GaudiSvc.GaudiSvcConf import THistSvc
-    ServiceMgr += THistSvc()
-
-
-#include("AthenaMonitoring/DQMonFlagsConfig_jobOptions.py")
-THistSvc         = Service( "THistSvc" )
-#histOutput       = DQMonFlags.monManFileKey()+" DATAFILE='monitoring.root' OPT='RECREATE'"
-histOutput       = "IDAlignMon DATAFILE='./monitoring.root' OPT='RECREATE'"
-THistSvc.Output += [histOutput]
-InDetAlignMonManager.FileKey = "IDAlignMon"
-topSequence += InDetAlignMonManager
-print InDetAlignMonManager
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_DBMRel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_DBMRel17.py
deleted file mode 100644
index c5e33ca483e6aefcc121a4b0c597c2498ea57351..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_DBMRel17.py
+++ /dev/null
@@ -1,249 +0,0 @@
-#
-# This jobOption file allows to run a single standalone alignment job.
-# It contains mostly used  of the steering jobOptions for setting up
-# the alignment geometry, solving etc. Further jobOptions can be found
-# by reading through
-#   NewInDetAlignAlgSetup.py and
-#   NewInDetAlignGeometrySetup.py.
-#
-# This is a good example for beginners to start with. It loads file
-# loadInDetRec*.py for setting up the reconstruction options and file
-# NewInDetAlignAlgSetup.py for the actual alignment processing.
-#
-# author: Daniel Kollar <daniel.kollar@cern.ch>
-#
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==                  Settings for the alignment                   ==
-## ==                                                               ==
-## message level for the alignment
-## INFO, DEBUG, ...
-outputLevel=DEBUG
-#
-## track collection to process
-trackCollection = "Tracks"
-#
-#
-##
-## if readConstantsFromPool is set to true the initial alignment constants
-## are read in from the pool file, otherwise they are taken from the DB
-## according to the global tag
-##
-readConstantsFromPool = False
-readSilicon = True
-readTRT = False
-#inputPoolFiles = [ "NewRun2Si_pool.root" ]
-ErrorScaling = False
-#
-##
-## write final alignment constants to pool file
-writeConstantsToPool = True
-writeSilicon = True
-writeTRT = False
-outputPoolFile = "alignment_output.pool.root"
-tagSi = "IndetAlign_test"
-tagTRT = "TRTAlign_test"
-writeTextFiles = True
-siliconTextFile = "OutputSiAlignment.txt"
-trtTextFile = "OutputTRTAlignment.txt"
-#
-## write initial alignment constants into text file
-writeOldConstants = True
-#
-##
-## What to align?
-alignInDet = True
-alignSilicon = True
-alignPixel = True
-alignSCT = False
-alignTRT = False
-
-trtAlignmentLevel = 1
-trtAlignmentLevelBarrel = -1
-trtAlignmentLevelEndcaps = -1
-#
-## Pixel alignment
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevel = 2
-pixelAlignDBM = True
-# if pixelAlignDBM is configured to "True" the pixelAlignmentLevel is used for DBM alignment
-# Note, only levels 1, 2, and 3 ar epossible. If set to "False" DBM is ignored (default)
-pixelAlignmentLevelBarrel = -1
-pixelAlignmentLevelEndcaps = -1
-
-## Pixel alignment DoFs
-pixelAlignEndcaps = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = True
-pixelAlignEndcapRotY = True
-pixelAlignEndcapRotZ = True
-
-
-sctAlignmentLevel = 1
-sctAlignmentLevelBarrel = -1
-sctAlignmentLevelEndcaps = -1
-
-#
-## Silicon alignment
-## -1 - use standalone Pixel and SCT setup
-##  0 - L0
-siAlignmentLevel = -1
-#
-## alignment parameters
-siAlignX = True
-siAlignY = True
-siAlignZ = True
-siAlignRotX = True
-siAlignRotY = True
-siAlignRotZ = True
-#
-## InDet alignment
-## -1 - use standalone Silicon and TRT setup
-##  0 - L0
-indetAlignmentLevel = -1
-#
-## alignment parameters
-indetAlignX = True
-indetAlignY = True
-indetAlignZ = True
-indetAlignRotX = True
-indetAlignRotY = True
-indetAlignRotZ = True
-#
-## do module selection using identifiers
-doModuleSelection = False
-## list of identifiers for selected modules
-moduleSelection = []
-#
-####################################################################
-##
-## Accumulate and Solving
-##
-runAccumulate = False
-runSolving = True
-
-#
-## if we only run solving we need the list of files from
-## which to accumulate
-inputMatrixFiles = [ "matrix.bin" ]
-inputVectorFiles = [ "vector.bin" ]
-#
-#####################################
-####### Full Local Chi2 method ######
-# by default the global method is run
-# if you want to include the full local method
-# set runLocal to True
-runLocal = True
-#
-# for full local method one can also setup different kinds of residuals
-# (will be ignored if runLocal==False)
-# 0 - hit-only (biased) residuals
-# 1 - unbiased
-#residualType = 0
-#
-# for full local method one can also switch off refitting of tracks
-# (will be ignored if runLocal==False)
-#refitTracks = False
-#
-######################################
-####### Full Global Chi2 method ######
-## solving option
-##   0 - No global solving
-##   1 - Lapack
-##   2 - Eigen
-##   6 - ROOT
-##   7 - CLHEP
-solvingOption = 1
-#
-####
-## run local solving
-## this option is automatically set to True if runLocal is selected
-solveLocal = False
-#
-## if diagonalization is set to false the matrix inversion is run
-## only applies to CLHEP
-runDiagonalization = True
-## number of smallest eigenvalues (global movements) to cut
-ModCut = 0
-#softModeCut = 1
-## cut on eigenvalue for diagonalization
-eigenvalueCut = 0.
-#
-############################
-###### common options ######
-## minimum number of hits per module for solving
-## is ignored if runAccumulate=False
-minHits = 0
-#
-## options of the track refit needed to obtain the derivatives
-## and the full covariance matrix of the track
-##
-## run outlier removal when refitting the track
-runOutlier     = True
-## particle hypothesis when refitting the track
-##   0 - non-interacting
-particleNumber = 0
-#
-## write special alignment ntuple
-writeAlignNtuple = False
-##
-## store derivatives of residuals wrt. alignment parameters
-## in the ntuple
-writeDerivatives = False
-##
-## ==                                                               ==
-## ==            End of settings for the alignment                  ==
-## ==                                                               ==
-## ===================================================================
-## ===================================================================
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==             Settings for the Reconstruction                   ==
-## ==                                                               ==
-
-# The following options are the defaults for configuring InnerDetector reconstruction.
-# They may be changed by uncommenting the lines and specifying the appropriate input.
-# ========================================
-
-# ID Reconstruction  Options
-# ==========================
-
-detectorDescription = "ATLAS-IBL3D25-04-00-01"
-realData = False
-#globalTag = "OFLCOND-MC12-IBL-20-30-25"
-globalTag = "OFLCOND-SDR-BS14T-IBL-CORR-06-02"
-
-from IOVDbSvc.CondDB import conddb 
-conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterial','AtlasLayerMat_v15_ATLAS-IBL3D25-04-00-01') 
-
-#doTrkNtuple = False
-#doMonitoring = True
-#siPoolFile = ""
-siAlignmentTag = "InDetAlign_R2_Nominal"
-#errorScalingTag = ""
-#TRTCalibTextFile = ""
-numberOfEvents = 10
-import glob
-inputFiles = glob.glob('/afs/cern.ch/work/m/mrudolph/public/singleMuon_minus_DBM_digits.pool.root')
-print inputFiles
-
-# Run collision reconstruction
-# ==========================
-# (Collision Specific Options)
-#doReadBS = False
-include("RecJobTransforms/UseFrontier.py")
-
-include("InDetAlignExample/loadInDetRec_DBMRel17.py")
-
-# Run Alignment
-# ========================
-include("InDetAlignExample/InDetAlignAlgSetup_DBM.py")
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel17.py
deleted file mode 100644
index c9574e5b9dd6c8a7568d8819791aab2e5fb7ea6b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel17.py
+++ /dev/null
@@ -1,431 +0,0 @@
-#
-# This jobOption file allows to run a single standalone alignment job.
-# It contains mostly used  of the steering jobOptions for setting up
-# the alignment geometry, solving etc. Further jobOptions can be found
-# by reading through
-#   NewInDetAlignAlgSetup.py and
-#   NewInDetAlignGeometrySetup.py.
-#
-# This is a good example for beginners to start with. It loads file
-# loadInDetRec*.py for setting up the reconstruction options and file
-# NewInDetAlignAlgSetup.py for the actual alignment processing.
-#
-# author: Daniel Kollar <daniel.kollar@cern.ch>
-#
-## ===================================================================                                                                               
-## ===================================================================
-## ==                                                               ==                                                                               
-## ==          Parse some inputs to make running simpler            ==
-## ==                                                               ==
-if 'eventType' in dir():
-    if eventType=="cosmics":
-        print "Config: Alignment is performed on Cosmics: "
-
-
-        Cosmics = True
-    elif eventType=="collisions":
-        print "Config: Alignment is performed on Collisions: "
-        Cosmics = False
-else:
-    Cosmics = False
-    eventType = "collisions"
-    print "Config: Alignment is performed on Collisions and as EventType is not specified, and Cosmics-flag is set to: ",Cosmics
-
-if 'inputConstantsFile' in dir():
-    print "Config: Read alignment constants from Pool-file instead of DB: "
-    readConstantsFromPool = True
-    readTRT = False   # this is for now important as the pool file does not contain TRT     
-    print "Config: inputConstantsFile is specified as: ", inputConstantsFile
-else:
-    inputConstantsFile = ""
-    readConstantsFromPool = False
-    readTRT = True
-    print "Config: Reading alignment constants from DB. "
-
-if 'nEvents' in dir():
-    print "Config: nEvents = ",nEvents
-else:
-    nEvents = -1
-    print "Config: setting nEvents to: ",nEvents
-
-if 'preIBLgeometry' in dir():
-    print "Config: You configured to run on pre-IBL geometry. Make sure all conditions are set correctly! "
-    print "Config: This is especially important when running on MC"
-else:
-    print "Config: Running geometry including IBL"
-    preIBLgeometry=False
-
-
-if 'inputFileDir' in dir():
-    print  "Config: Data directory for files is configured to: ",inputFileDir
-    print  "Config: !!Note!! All root files within this directory will be used as input"
-    oldFileDefault=False
-else:
-    if preIBLgeometry == False:
-        oldFileDefault=False
-        inputFileDir='/afs/cern.ch/user/m/mdanning/hias/public/OUT'
-    else:
-        #inputFileDir='/afs/cern.ch/user/m/mdanning/eos/atlas/user/s/shuli/Alignment_DATA/data12_8TeV.00200863.physics_Muons.recon.DESD_ZMUMU.r4644_p1559_r4644_tid01296318_00/DESD_ZMUMU.01296318._000001.pool.root.1'
-        oldFileDefault=True
-        inputFileDir='root://eosatlas//eos/atlas/atlascerngroupdisk/perf-idtracking/rtt/mc10_7TeV.107233.singlepart_mu100.digit.RDO.e605_s933_s946_d369//RDO.197117._000005.pool.root.1'
-    print  "Config: !!Note!! You have not specified an inputFileDir -- Default sample is chosen!"
-
-if 'doMonitoring' in dir():
-    print "Config: Monitoring is enabled"
-else:
-    doMonitoring = False;
-
-if 'isData' in dir():
-    print "Config: Running on real data"
-    realData = True    
-else:
-    print "Config: Running on MC"
-    realData = False;
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==                  Settings for the alignment                   ==
-## ==                                                               ==
-## message level for the alignment
-## INFO, DEBUG, ...
-outputLevel=INFO
-#
-## track collection to process
-trackCollection = "Tracks"
-#
-#
-##
-## if readConstantsFromPool is set to true the initial alignment constants
-## are read in from the pool file, otherwise they are taken from the DB
-## according to the global tag
-##
-#readConstantsFromPool = False  ## is set as input to the script
-readSilicon = True
-#readTRT = False  ## is also set as input to the script for now 
-inputPoolFiles = [ inputConstantsFile ]
-ErrorScaling = False
-##
-## write final alignment constants to pool file
-writeConstantsToPool = True
-writeSilicon = True
-writeTRT = False
-outputPoolFile = "alignment_output.pool.root"
-tagSi = "IndetAlign_test"
-tagTRT = "TRTAlign_test"
-writeTextFiles = True
-siliconTextFile = "OutputSiAlignment.txt"
-trtTextFile = "OutputTRTAlignment.txt"
-#
-## write initial alignment constants into text file
-writeOldConstants = True
-#
-##
-## What to align?
-alignInDet = True
-alignSilicon = True
-alignPixel = True
-alignSCT = True
-alignTRT = True
-
-#
-##
-## TRT alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   0 - L0
-##   1 - L1
-##   2 - L2
-trtAlignmentLevel = 1
-#
-## TRT barrel alignment
-## overwrite trtAlignmentLevel if present
-##  -1 - take setup from trtAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-trtAlignmentLevelBarrel = -1
-#
-## TRT barrel alignment
-## overwrite trtAlignmentLevel if present
-##  -1 - take setup from trtAlignmentLevel
-##   1 - L1
-##   2 - L2
-## 200 - L2 old setup
-trtAlignmentLevelEndcaps = -1
-#
-## alignment geometry
-trtAlignBarrel  = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = False
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = False
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-#
-## Pixel alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##  11 - L11 IBL subdetector as one structure + all "old" pixel subdetector as one structure  
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevel = 2
-pixelAlignDBM = False
-# if pixelAlignDBM is configured to "True" the pixelAlignmentLevel is used for DBM alignment
-# Note, only levels 1, 2, and 3 ar epossible. If set to "False" DBM is ignored (default)
-#
-## Pixel barrel alignment
-## overwrite pixelAlignmentLevel if present
-##  -1 - take setup from pixelAlignmentLevel
-##  15 - L15: 2 halfs
-##   2 - L2
-##  22 - L22: 6 half-layers
-##   3 - L3
-pixelAlignmentLevelBarrel = -1
-#
-## Pixel barrel alignment
-## overwrite pixelAlignmentLevel if present
-##  -1 - take setup from pixelAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevelEndcaps = -1
-
-#
-## Pixel alignment DoFs
-pixelAlignBarrel  = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = True
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = False
-pixelAlignEndcapRotY = False
-pixelAlignEndcapRotZ = True
-#
-## SCT alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   0 - L0
-##   1 - L1
-##   2 - L2
-##   3 - L3
-sctAlignmentLevel = 1
-#
-## SCT barrel alignment
-## overwrite sctAlignmentLevel if present
-##  -1 - take setup from sctAlignmentLevel
-##   2 - L2
-##   3 - L3
-sctAlignmentLevelBarrel = -1
-#
-## SCT barrel alignment
-## overwrite sctAlignmentLevel if present
-##  -1 - take setup from sctAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-sctAlignmentLevelEndcaps = -1
-#
-## SCT alignment DoFs
-sctAlignBarrel  = False
-sctAlignEndcaps = True
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = True
-sctAlignBarrelZ = True
-sctAlignBarrelRotX = True
-sctAlignBarrelRotY = True
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = True
-sctAlignEndcapRotX = True
-sctAlignEndcapRotY = True
-sctAlignEndcapRotZ = True
-#
-## Silicon alignment
-## -1 - use standalone Pixel and SCT setup
-##  0 - L0
-siAlignmentLevel = -1
-#
-## alignment parameters
-siAlignX = True
-siAlignY = True
-siAlignZ = True
-siAlignRotX = True
-siAlignRotY = True
-siAlignRotZ = True
-#
-## InDet alignment
-## -1 - use standalone Silicon and TRT setup
-##  0 - L0
-indetAlignmentLevel = -1
-#
-## alignment parameters
-indetAlignX = True
-indetAlignY = True
-indetAlignZ = True
-indetAlignRotX = True
-indetAlignRotY = True
-indetAlignRotZ = True
-#
-## do module selection using identifiers
-doModuleSelection = False
-## list of identifiers for selected modules
-moduleSelection = []
-#
-####################################################################
-##
-## Accumulate and Solving
-##
-runAccumulate = True
-runSolving = True
-
-#
-## if we only run solving we need the list of files from
-## which to accumulate
-inputMatrixFiles = [ "matrix.bin" ]
-inputVectorFiles = [ "vector.bin" ]
-#
-#####################################
-####### Full Local Chi2 method ######
-# by default the global method is run
-# if you want to include the full local method
-# set runLocal to True
-runLocal = False
-#
-# for full local method one can also setup different kinds of residuals
-# (will be ignored if runLocal==False)
-# 0 - hit-only (biased) residuals
-# 1 - unbiased
-#residualType = 0
-#
-# for full local method one can also switch off refitting of tracks
-# (will be ignored if runLocal==False)
-#refitTracks = False
-#
-######################################
-####### Full Global Chi2 method ######
-## solving option
-##   0 - No global solving
-##   1 - Lapack
-##   2 - Eigen
-##   6 - ROOT
-##   7 - CLHEP
-solvingOption = 1
-#
-####
-## run local solving
-## this option is automatically set to True if runLocal is selected
-solveLocal = False
-#
-## if diagonalization is set to false the matrix inversion is run
-## only applies to CLHEP
-runDiagonalization = True
-## number of smallest eigenvalues (global movements) to cut
-ModCut = 0
-#softModeCut = 1
-## cut on eigenvalue for diagonalization
-eigenvalueCut = 0.
-#
-############################
-###### common options ######
-## minimum number of hits per module for solving
-## is ignored if runAccumulate=False
-minHits = 0
-#
-## options of the track refit needed to obtain the derivatives
-## and the full covariance matrix of the track
-##
-## run outlier removal when refitting the track
-runOutlier     = True
-## particle hypothesis when refitting the track
-##   0 - non-interacting
-particleNumber = 0
-#
-## write special alignment ntuple
-#writeAlignNtuple = True
-##
-## store derivatives of residuals wrt. alignment parameters
-## in the ntuple
-#writeDerivatives = True
-##
-## ==                                                               ==
-## ==            End of settings for the alignment                  ==
-## ==                                                               ==
-## ===================================================================
-## ===================================================================
-#
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==             Settings for the Reconstruction                   ==
-## ==                                                               ==
-# ID Reconstruction  Options
-# ==========================
-#realData = False
-
-if preIBLgeometry == True:
-    detectorDescription = "ATLAS-GEO-21-02-01"
-    ## This tag is an example tag for MC
-    ## Please check AMI DB for each MC sample when using old preIBLgeometry
-    globalTag = "OFLCOND-SDR-BS7T-04-02"
-    ## This is the data tag which should be used for Run1
-    #globalTag = "COMCOND-BLKPA-RUN1-06"
-else:
-    detectorDescription = "ATLAS-IBL3D25-04-00-01"
-    if eventType == "collisions":
-        globalTag = "OFLCOND-MC12-IBL-20-30-25" 
-    else: 
-        globalTag = "OFLCOND-MC12-IBL-20-30-50" #Cosmics
-
-#doTrkNtuple = False
-#doMonitoring = True
-#siPoolFile = ""
-if not preIBLgeometry == True:
-    siAlignmentTag = "InDetAlign_R2_Nominal"
-
-#errorScalingTag = ""
-#TRTCalibTextFile = ""
-numberOfEvents = nEvents
-
-# Input Files
-import glob
-
-if oldFileDefault == True:
-    inputFiles = [str(inputFileDir)]
-else:
-    inputFiles = glob.glob(str(inputFileDir)+'*')
-
-print inputFiles
-#x-check the files I read in  
-
-# Run cosmic reconstruction or Collision: This is the same script now. 
-# Important flag is Cosmics true/false, which will be picked up by the loadInDetRec script,
-# and will set all options accordingly 
-
-#doReadBS = False
-include("RecJobTransforms/UseFrontier.py")
-include("InDetAlignExample/loadInDetRec_Run2Rel17.py")
-
-# Run Alignment
-# ========================
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel19.py
deleted file mode 100644
index b1b7c21021336b32251290dfcf8de0a78be23bac..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel19.py
+++ /dev/null
@@ -1,451 +0,0 @@
-#
-# This jobOption file allows to run a single standalone alignment job.
-# It contains mostly used  of the steering jobOptions for setting up
-# the alignment geometry, solving etc. Further jobOptions can be found
-# by reading through
-#   NewInDetAlignAlgSetup.py and
-#   NewInDetAlignGeometrySetup.py.
-#
-# This is a good example for beginners to start with. It loads file
-# loadInDetRec*.py for setting up the reconstruction options and file
-# NewInDetAlignAlgSetup.py for the actual alignment processing.
-#
-# author: Daniel Kollar <daniel.kollar@cern.ch>
-#
-## ===================================================================                                                                               
-## ===================================================================
-## ==                                                               ==                                                                               
-## ==        Parse some inputs to make running simpler            ==
-## ==                                                               ==
-
-
-if 'eventType' in dir():
-    if eventType=="cosmics":
-        print "Config: Alignment is performed on Cosmics: "
-
-
-        Cosmics = True
-    elif eventType=="collisions":
-        print "Config: Alignment is performed on Collisions: "
-        Cosmics = False
-else:
-    Cosmics = False
-    eventType = "collisions"
-    print "Config: Alignment is performed on Collisions and as EventType is not specified, and Cosmics-flag is set to: ",Cosmics
-
-if 'inputConstantsFile' in dir():
-    print "Config: Read alignment constants from Pool-file instead of DB: "
-    readConstantsFromPool = True
-    readTRT = False   # this is for now important as the pool file does not contain TRT     
-    print "Config: inputConstantsFile is specified as: ", inputConstantsFile
-else:
-    inputConstantsFile = ""
-    readConstantsFromPool = False
-    readTRT = True
-    print "Config: Reading alignment constants from DB. "
-
-if 'nEvents' in dir():
-    print "Config: nEvents = ",nEvents
-else:
-    nEvents = -1
-    print "Config: setting nEvents to: ",nEvents
-
-if 'preIBLgeometry' in dir():
-    print "Config: You configured to run on pre-IBL geometry. Make sure all conditions are set correctly! "
-    print "Config: This is especially important when running on MC"
-else:
-    print "Config: Running geometry including IBL"
-    preIBLgeometry=False
-
-
-if 'inputFileDir' in dir():
-    print  "Config: Data directory for files is configured to: ",inputFileDir
-    print  "Config: !!Note!! All root files within this directory will be used as input"
-    oldFileDefault=False
-else:
-    if preIBLgeometry == False:
-        oldFileDefault=False
-        inputFileDir='/afs/cern.ch/user/m/mdanning/hias/public/OUT'
-    else:
-        #inputFileDir='/afs/cern.ch/user/m/mdanning/eos/atlas/user/s/shuli/Alignment_DATA/data12_8TeV.00200863.physics_Muons.recon.DESD_ZMUMU.r4644_p1559_r4644_tid01296318_00/DESD_ZMUMU.01296318._000001.pool.root.1'
-        oldFileDefault=True
-        inputFileDir='root://eosatlas//eos/atlas/atlascerngroupdisk/perf-idtracking/rtt/mc10_7TeV.107233.singlepart_mu100.digit.RDO.e605_s933_s946_d369//RDO.197117._000005.pool.root.1'
-    print  "Config: !!Note!! You have not specified an inputFileDir -- Default sample is chosen!"
-
-if 'doMonitoring' in dir():
-    print "Config: Monitoring is enabled"
-else:
-    doMonitoring = False;
-
-if 'isData' in dir():
-    print "Config: Running on real data"
-    realData = True    
-else:
-    print "Config: Running on MC"
-    realData = False;
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==                  Settings for the alignment                   ==
-## ==                                                               ==
-## message level for the alignment
-## INFO, DEBUG, ...
-outputLevel=INFO
-#
-## track collection to process
-trackCollection = "Tracks"
-#
-#
-##
-## if readConstantsFromPool is set to true the initial alignment constants
-## are read in from the pool file, otherwise they are taken from the DB
-## according to the global tag
-##
-#readConstantsFromPool = False  ## is set as input to the script
-readSilicon = True
-#readTRT = False  ## is also set as input to the script for now 
-inputPoolFiles = [ inputConstantsFile ]
-ErrorScaling = False
-##
-## write final alignment constants to pool file
-writeConstantsToPool = True
-writeSilicon = True
-writeTRT = False
-outputPoolFile = "alignment_output.pool.root"
-tagSi = "IndetAlign_test"
-tagTRT = "TRTAlign_test"
-writeTextFiles = True
-siliconTextFile = "OutputSiAlignment.txt"
-trtTextFile = "OutputTRTAlignment.txt"
-#
-## write initial alignment constants into text file
-writeOldConstants = True
-#
-##
-## What to align?
-alignInDet = True
-alignSilicon = True
-alignPixel = True
-alignSCT = True
-alignTRT = False
-
-#
-##
-## TRT alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   0 - L0
-##   1 - L1
-##   2 - L2
-trtAlignmentLevel = 1
-#
-## TRT barrel alignment
-## overwrite trtAlignmentLevel if present
-##  -1 - take setup from trtAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-trtAlignmentLevelBarrel = -1
-#
-## TRT barrel alignment
-## overwrite trtAlignmentLevel if present
-##  -1 - take setup from trtAlignmentLevel
-##   1 - L1
-##   2 - L2
-## 200 - L2 old setup
-trtAlignmentLevelEndcaps = -1
-#
-## alignment geometry
-trtAlignBarrel  = True
-trtAlignEndcaps = True
-## alignment parameters Barrel
-trtAlignBarrelX = True
-trtAlignBarrelY = True
-trtAlignBarrelZ = False
-trtAlignBarrelRotX = True
-trtAlignBarrelRotY = True
-trtAlignBarrelRotZ = True
-## alignment parameters Endcap
-trtAlignEndcapX = True
-trtAlignEndcapY = True
-trtAlignEndcapZ = False
-trtAlignEndcapRotX = True
-trtAlignEndcapRotY = True
-trtAlignEndcapRotZ = True
-
-#
-## Pixel alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##  11 - L11 IBL subdetector as one structure + all "old" pixel subdetector as one structure  
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevel = 11
-pixelAlignDBM = False
-# if pixelAlignDBM is configured to "True" the pixelAlignmentLevel is used for DBM alignment
-# Note, only levels 1, 2, and 3 ar epossible. If set to "False" DBM is ignored (default)
-#
-## Pixel barrel alignment
-## overwrite pixelAlignmentLevel if present
-##  -1 - take setup from pixelAlignmentLevel
-##  15 - L15: 2 halfs
-##   2 - L2
-##  22 - L22: 6 half-layers
-##   3 - L3
-pixelAlignmentLevelBarrel = -1
-#
-## Pixel barrel alignment
-## overwrite pixelAlignmentLevel if present
-##  -1 - take setup from pixelAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-pixelAlignmentLevelEndcaps = -1
-
-#
-## Pixel alignment DoFs
-pixelAlignBarrel  = True
-pixelAlignEndcaps = True
-## alignment parameters Barrel
-pixelAlignBarrelX = True
-pixelAlignBarrelY = True
-pixelAlignBarrelZ = True
-pixelAlignBarrelRotX = True
-pixelAlignBarrelRotY = True
-pixelAlignBarrelRotZ = True
-## alignment parameters Endcap
-pixelAlignEndcapX = True
-pixelAlignEndcapY = True
-pixelAlignEndcapZ = False
-pixelAlignEndcapRotX = False
-pixelAlignEndcapRotY = False
-pixelAlignEndcapRotZ = True
-#
-## SCT alignment
-##  -1 - unknown, take setup from barrel and endcaps
-##   0 - L0
-##   1 - L1
-##   2 - L2
-##   3 - L3
-sctAlignmentLevel = 1
-#
-## SCT barrel alignment
-## overwrite sctAlignmentLevel if present
-##  -1 - take setup from sctAlignmentLevel
-##   2 - L2
-##   3 - L3
-sctAlignmentLevelBarrel = -1
-#
-## SCT barrel alignment
-## overwrite sctAlignmentLevel if present
-##  -1 - take setup from sctAlignmentLevel
-##   1 - L1
-##   2 - L2
-##   3 - L3
-sctAlignmentLevelEndcaps = -1
-#
-## SCT alignment DoFs
-sctAlignBarrel  = True
-sctAlignEndcaps = False
-## alignment parameters Barrel
-sctAlignBarrelX = True
-sctAlignBarrelY = True
-sctAlignBarrelZ = True
-sctAlignBarrelRotX = True
-sctAlignBarrelRotY = True
-sctAlignBarrelRotZ = True
-## alignment parameters Endcap
-sctAlignEndcapX = True
-sctAlignEndcapY = True
-sctAlignEndcapZ = True
-sctAlignEndcapRotX = True
-sctAlignEndcapRotY = True
-sctAlignEndcapRotZ = True
-#
-## Silicon alignment
-## -1 - use standalone Pixel and SCT setup
-##  0 - L0
-siAlignmentLevel = -1
-#
-## alignment parameters
-siAlignX = True
-siAlignY = True
-siAlignZ = True
-siAlignRotX = True
-siAlignRotY = True
-siAlignRotZ = True
-#
-## InDet alignment
-## -1 - use standalone Silicon and TRT setup
-##  0 - L0
-indetAlignmentLevel = -1
-#
-## alignment parameters
-indetAlignX = True
-indetAlignY = True
-indetAlignZ = True
-indetAlignRotX = True
-indetAlignRotY = True
-indetAlignRotZ = True
-#
-## do module selection using identifiers
-doModuleSelection = False
-## list of identifiers for selected modules
-moduleSelection = []
-#
-####################################################################
-##
-## Accumulate and Solving
-##
-runAccumulate = True
-runSolving = True
-
-#
-## if we only run solving we need the list of files from
-## which to accumulate
-inputMatrixFiles = [ "matrix.bin" ]
-inputVectorFiles = [ "vector.bin" ]
-#
-#####################################
-####### Full Local Chi2 method ######
-# by default the global method is run
-# if you want to include the full local method
-# set runLocal to True
-runLocal = True
-#
-# for full local method one can also setup different kinds of residuals
-# (will be ignored if runLocal==False)
-# 0 - hit-only (biased) residuals
-# 1 - unbiased
-#residualType = 0
-#
-# for full local method one can also switch off refitting of tracks
-# (will be ignored if runLocal==False)
-#refitTracks = False
-#
-######################################
-####### Full Global Chi2 method ######
-## solving option
-##   0 - No global solving
-##   1 - Lapack
-##   2 - Eigen
-##   6 - ROOT
-##   7 - CLHEP
-solvingOption = 1
-#
-####
-## run local solving
-## this option is automatically set to True if runLocal is selected
-solveLocal = False
-#
-## if diagonalization is set to false the matrix inversion is run
-## only applies to CLHEP
-runDiagonalization = True
-## number of smallest eigenvalues (global movements) to cut
-ModCut = 0
-#softModeCut = 1
-## cut on eigenvalue for diagonalization
-eigenvalueCut = 0.
-#
-############################
-###### common options ######
-## minimum number of hits per module for solving
-## is ignored if runAccumulate=False
-minHits = 0
-#
-## options of the track refit needed to obtain the derivatives
-## and the full covariance matrix of the track
-##
-## run outlier removal when refitting the track
-runOutlier     = True
-## particle hypothesis when refitting the track
-##   0 - non-interacting
-particleNumber = 0
-#
-## write special alignment ntuple
-writeAlignNtuple = True
-##
-## store derivatives of residuals wrt. alignment parameters
-## in the ntuple
-writeDerivatives = True
-##
-## ==                                                               ==
-## ==            End of settings for the alignment                  ==
-## ==                                                               ==
-## ===================================================================
-## ===================================================================
-#
-
-Cosmics=True
-doMonitoring=True
-realData=True
-doReadBS=True
-BField=False
-projectName='data14_cos'
-dataSource='data'
-
-
-## ===================================================================
-## ===================================================================
-## ==                                                               ==
-## ==             Settings for the Reconstruction                   ==
-## ==                                                               ==
-# ID Reconstruction  Options
-# ==========================
-
-
-if preIBLgeometry == True:
-    detectorDescription = "ATLAS-GEO-21-02-01"
-    ## This tag is an example tag for MC
-    ## Please check AMI DB for each MC sample when using old preIBLgeometry
-    globalTag = "OFLCOND-SDR-BS7T-04-02"
-    ## This is the data tag which should be used for Run1
-    #globalTag = "COMCOND-BLKPA-RUN1-06"
-else:
-    #detectorDescription = "ATLAS-IBL3D25-04-00-01"
-    #if eventType == "collisions":
-    #    globalTag = "OFLCOND-MC12-IBL-20-30-25" 
-    #else: 
-    #    globalTag = "OFLCOND-MC12-IBL-20-30-50" #Cosmics
-    # detectorDescription = "ATLAS-R2-2015-01-01-00"  --> IBL not rotated 
-    detectorDescription = "ATLAS-R2-2015-02-00-00" # --> IBL Rotated geometry 
-    globalTag ="CONDBR2-ES1PA-2014-01"
-
-        
-
-#doTrkNtuple = False
-#doMonitoring = True
-#siPoolFile = ""
-if not preIBLgeometry == True:
-    #siAlignmentTag = "InDetAlign_R2_Nominal"
-    siAlignmentTag=""
-errorScalingTag = ""
-#TRTCalibTextFile = ""
-numberOfEvents = nEvents
-
-# Input Files
-import glob
-
-if oldFileDefault == True:
-    inputFiles = [str(inputFileDir)]
-else:
-    inputFiles = glob.glob(str(inputFileDir)+'*')
-
-print inputFiles
-#x-check the files I read in  
-
-# Run cosmic reconstruction or Collision: This is the same script now. 
-# Important flag is Cosmics true/false, which will be picked up by the loadInDetRec script,
-# and will set all options accordingly 
-
-#doReadBS = False
-
-include ("PyJobTransforms/UseFrontier.py")
-#include("loadInDetRec_Run2Rel19.py")
-include("InDetAlignExample/jobOption_RecExCommon.py")
-include("InDetAlignExample/jobOption_ConditionsOverrider.py")
-
-# Run Alignment
-# ========================
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator.py
deleted file mode 100755
index ae088afd7a70db92b811a360a13712a811e881a3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator.py
+++ /dev/null
@@ -1,491 +0,0 @@
-#################################################################
-#    Script to run InDetAlignExample with parallelization       #
-#      (local or lxbatch mode) & (physic data or cosmics)       #
-#             Vicente Lacuesta [started 12-03-2008]             #
-#################################################################
-
-import os, string, time, datetime
-import sys
-
-# ==============================================================
-#  End of User Options
-# ==============================================================
-
-# =====================================================================
-# =====================================================================
-# =====================================================================
-# =====================================================================
-#
-# Don not edit the lines below unless you know what you're doing!
-#
-
-print "Output saved in:",OutputPath
-
-# AW: moved that one to python dir such that it can be imported from anywhere
-from InDetAlignExample.NewInDet_IteratorClasses import *
-
-# =====================================================================
-#
-#  Main Script
-#
-# =====================================================================
-
-
-# extract release configuration
-
-ATHENACFG = getAthenaConfig(ASetupOptions)
-
-
-print
-if not os.path.isdir(OutputPath):
-	os.mkdir(OutputPath)
-
-info=open(OutputPath+"/info.txt",'w')
-info.write("----------------------------------------------\n")
-info.write("\t\t%s      \n" % datetime.date.today() )
-info.write("----------------------------------------------\n")
-#info.write("Release %s\n" % ATHENAREL)
-info.write("Output stored in %s\n\n" % OutputPath)
-
-print "Info stored in: " +OutputPath+"/info.txt"
-
-if runMode == 'batch':
-	print "Alignment Algorithm will run in Lxbatch"
-	info.write("Alignment Algorithm run in Lxbatch\n")
-elif runMode == ' local':
-	print "Alignment Algorithm will run on local machine"
-	info.write("Alignment Algorithm run on local machine\n")
-	info.write("----------------------------------------------\n")
-	print "System Info"
-	info.write("----------------------------------------------\n")
-	info.write("System Info\n")
-	os.system('grep processor /var/log/dmesg | grep MHz')
-	info.write("----------------------------------------------\n")
-	info.write(os.popen('grep processor /var/log/dmesg | grep MHz','r').read())
-	info.write("\n")
-	os.system('dmesg | grep Brought')
-	info.write(os.popen('dmesg | grep Brought','r').read())
-	info.write("\n")
-	os.system('cat /proc/meminfo | grep MemTotal')
-	info.write(os.popen('cat /proc/meminfo | grep MemTotal','r').read())
-	info.write("\n")
-	info.write("----------------------------------------------\n")
-	info.write("\n")
-
-print
-info.write("\n")
-StartTime=time.time()   # Start the total time counter
-info.close()
-
-#  Loop over iterations
-for iteration in range(FirstIteration,Iterations+FirstIteration):
-	IterStartTime=time.time()
-	if (iteration == 0) and not inputAlignmentPoolFile:
-		ReadAlignmentConstants = False
-	else:
-		ReadAlignmentConstants = True
-
-	print '\n'
-	print " ---> Iteration "+repr(iteration)
-	print '\n'
-	info=open(OutputPath+"/info.txt",'a')
-	info.write('\n')
-	info.write("---> Iteration "+repr(iteration))
-	info.write('\n')
-	# Protect existing directories
-	if os.path.isdir("%s/Iter%d" % (OutputPath, iteration)):
-		countdir=0
-		while os.path.isdir("%s/Iter%d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)):
-			countdir += 1
-		os.rename("%s/Iter%d" % (OutputPath, iteration),("%s/Iter%d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)))
-
-		print "WARNING: %s/Iter%d directory exists" % (OutputPath, iteration)
-		print "Renamed to %s/Iter%d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)
-
-	# Make OutputPaths
-	#os.mkdir(OutputPath+'/Iter'+repr(iteration))
-	#os.mkdir(OutputPath+'/Iter'+repr(iteration)+'/logs/')
-	# Settup up a local copy of the alignment levels
-	#os.system("get_files -jo InDetAlignExample/NewInDetAlignLevels.py >/dev/null")
-	#os.system("cp NewInDetAlignLevels.py %s" % OutputPath+'/Iter'+repr(iteration))
-	#alignLevels = OutputPath+'/Iter'+repr(iteration)+"/NewInDetAlignLevels.py"
-	
-	for data in DataToRun:
-		# Protect existing directories
-		OutputPaths = ""
-		if len(DataToRun) > 1:
-			OutputPaths = OutputPath+'/'+data.getName()
-			if os.path.isdir("%s/Iter%d" % (OutputPaths, iteration)):
-				countdir=0
-				while os.path.isdir("%s/Iter%d-%s-%d" % (OutputPaths, iteration, datetime.date.today(), countdir)):
-					countdir += 1
-				os.rename("%s/Iter%d" % (OutputPaths, iteration),("%s/Iter%d-%s-%d" % (OutputPaths, iteration, datetime.date.today(), countdir)))
-				print "WARNING: %s/Iter%d directory exists" % (OutputPaths, iteration)
-				print "Renamed to %s/Iter%d-%s-%d" % (OutputPaths, iteration, datetime.date.today(), countdir)
-		else:
-			OutputPaths = OutputPath
-		if not os.path.isdir(OutputPaths):
-			os.mkdir(OutputPaths)
-
-		# Make OutputPaths '/'+data.getName()
-		os.mkdir(OutputPaths+'/Iter'+repr(iteration))
-		os.mkdir(OutputPaths+'/Iter'+repr(iteration)+'/logs/')
-		# Settup up a local copy of the alignment levels
-		os.system("get_files -jo InDetAlignExample/NewInDetAlignLevels.py >/dev/null")
-		os.system("cp NewInDetAlignLevels.py %s" %(OutputPaths+'/Iter'+repr(iteration)))
-		alignLevels = OutputPaths+'/Iter'+repr(iteration)+"/NewInDetAlignLevels.py"
-		print "----------------------------------------------"
-		print "Number of CPUs used to process the sample " + data.getName() + ": " + str(data.getCPUs(iteration))
-		print "----------------------------------------------"
-
-		info.write("Number of CPUs used to process the sample %s : %s\n\n" % (data.getName(), data.getCPUs(iteration)))
-
-		if data.getEvents(iteration)!=-1:
-			print "Number of events per CPU: " +  str(data.getEventsPerCPU(iteration))
-			info.write("Number of events per CPU: %d\n\n" % data.getEventsPerCPU(iteration))
-			
-		else:
-			print "Number of events per CPU: All" 
-			info.write("Number of events per CPU: All" )
-		os.mkdir(OutputPaths+'/Iter'+repr(iteration)+'/'+data.getName()+'/')
-
-		print "Processing..."
-
-		# Get the Input file
-		dataFiles = SortCpus(data.getCPUs(iteration)
-					  ,""
-					  ,data.getFileList()
-					  ,OutputLevel
-					  ,doDetailedSplitting=doDetailedSplitting
-					  ,nEventsPerFile=data.getEventsPerCPU(iteration))
-		# Loop over subjobs
-		for subJob in range(0, data.getCPUs(iteration)):
-			RecoOptions = {}
-			# Get the Reconstruction Options
-			if ErrorScaling[iteration]:
-				RecoOptions["errorScalingTag"] = errorScalingTag
-
-			JOBNAME="%s_Iter%d_%s_Part%02d.py" % (preName,iteration,data.getName(),subJob)
-			RecoScript = "InDetAlignExample/loadInDetRec_Run2Rel17.py"
-			if not doDetailedSplitting:
-				RecoOptions["inputFiles"] = dataFiles.getCPU(subJob)
-				RecoOptions["numberOfEvents"] = data.getEventsPerCPU(iteration)
-			else:
-				RecoOptions["inputFiles"] = dataFiles.getInputFiles(subJob)
-				RecoOptions["numberOfEvents"] = dataFiles.getNumEvents(subJob)
-				RecoOptions["SkipEvents"] = dataFiles.getSkipEvents(subJob)
-		
-			extraOptions["doReadBS"] = data.getByteStream()
-	
-			if subJob == 0:
-				filesForSolve = RecoOptions["inputFiles"]
-				solveDoReadBS = extraOptions["doReadBS"]
-			if len(data.getGlobalTag()) != 0:
-				RecoOptions["globalTag"] = data.getGlobalTag()
-			if len(data.getDetDescrVersion()) != 0:
-				RecoOptions["detectorDescription"] = data.getDetDescrVersion()
-	
-		
-	
-			# Get the Alignment Options
-			AlignmentOptions = {}
-			if AlignmentMethod == "GX2":
-				AlignmentOptions["runLocal"] = False
-				AlignmentOptions["solveLocal"] = False
-				AlignmentOptions["solvingOption"] = 1
-				AlignmentOptions["ModCut"] = 6
-			else:
-				AlignmentOptions["runLocal"] = True
-				AlignmentOptions["solvingOption"] = 0
-	
-	
-			AlignmentOptions["readConstantsFromPool"] = ReadAlignmentConstants
-			constantsFile = ""
-			if ReadAlignmentConstants:
-				if iteration == 0:
-					constantsFile = inputAlignmentPoolFile 
-					AlignmentOptions["inputPoolFiles"] = [constantsFile]
-				else:
-					constantsFile = str(OutputPaths)+"/Iter"+str(iteration-1)+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
-					AlignmentOptions["inputPoolFiles"] = [constantsFile]
-	
-			AlignmentOptions["alignTRT"] = AlignTRT[iteration]
-			if AlignTRT[iteration]:
-				AlignmentOptions["trtAlignmentLevel"] = TRTAlignmentLevel[iteration]
-	
-			AlignmentOptions["alignSCT"] = AlignSCT[iteration]
-			#if AlignSCTBarrel[iteration]:
-			AlignmentOptions["sctAlignmentLevel"] = SCTAlignmentLevel[iteration]
-	
-			AlignmentOptions["sctAlignBarrel"] = AlignSCTBarrel[iteration]
-			#if AlignSCTBarrel[iteration]:
-			AlignmentOptions["sctAlignmentLevelBarrel"] = SCTAlignmentLevelBarrel[iteration]
-	
-			AlignmentOptions["sctAlignEndcaps"] = AlignSCTEndcaps[iteration]
-			#if AlignSCTEndcaps[iteration]:
-			AlignmentOptions["sctAlignmentLevelEndcaps"] = SCTAlignmentLevelEndcaps[iteration]
-	
-			AlignmentOptions["alignPixel"] = AlignPixel[iteration]
-			#if AlignSCTBarrel[iteration]:
-			AlignmentOptions["pixelAlignmentLevel"] = PixelAlignmentLevel[iteration]
-	
-			AlignmentOptions["pixelAlignBarrel"] = AlignPixelBarrel[iteration]
-			#if AlignPixelBarrel[iteration]:
-			AlignmentOptions["pixelAlignmentLevelBarrel"] = PixelAlignmentLevelBarrel[iteration]
-	
-			AlignmentOptions["pixelAlignEndcaps"] = AlignPixelEndcaps[iteration]
-			#if AlignPixelEndcaps[iteration]:
-			AlignmentOptions["pixelAlignmentLevelEndcaps"] = PixelAlignmentLevelEndcaps[iteration]
-	
-	
-			AlignmentOptions["runSolving"] = False
-			AlignmentOptions["runAccumulate"] = True
-			AlignmentOptions["WriteTFile"] = useTFiles
-							
-	
-			poolfiles = RecoOptions["inputFiles"]
-			poolfiles.append(constantsFile)
-		
-	
-			currentjob = manageJob(OutputPath = OutputPaths,
-					      dataName = data.getName(),
-					      iter = iteration,
-					      part = subJob,
-					      JOBNAME = JOBNAME,
-					      preName = preName,
-					      RecoOptions = RecoOptions,
-					      extraOptions = extraOptions,
-					      AlignmentOptions = AlignmentOptions,
-					      RecoScript = RecoScript,
-					      AlignmentLevels = alignLevels,
-					      #MonitoringScript = MonitoringScript,
-					      QUEUE = QUEUE,
-					      CMTDIR = CMTDIR,
-					      ATHENACFG = ATHENACFG,
-					      inputPoolFiles = poolfiles
-					      )
-	
-			# Write the job
-			currentjob.createDirectories()
-			currentjob.writeJO()
-			currentjob.writeScript()
-			
-			currentjob.send(runMode)
-	#  End j loop
-	#if runMode == "batch":
-		# Wait for signal
-	#	currentjob.wait()
-
-
-	#  Solving the system
-	if doSolve:
-		DataToSolve = list(DataToRun)
-		while len(DataToSolve):
-			for data in DataToSolve:
-				batchjobs = "%s_Iter%d_%s_Part" % (preName,iteration,data.getName())
-				if os.popen('bjobs -w').read().find(batchjobs)!=-1:
-					continue
-				time.sleep(20) # to be secure reco step has finished
-				OutputPaths = ""
-				if len(DataToRun) > 1:
-					OutputPaths = OutputPath+'/'+data.getName()
-				else:
-					OutputPaths = OutputPath
-				print "----------------------------------------------"
-				print "  Solving dataset %s, Iter %s"%(data.getName(),iteration)
-				print "----------------------------------------------"
-
-				info.write('\n')
-				info.write("----------------------------------------------\n")
-				info.write("  Solving dataset %s, Iter %d\n" %(data.getName(),iteration))
-				info.write("----------------------------------------------\n")
-			
-				alignLevels = OutputPaths+'/Iter'+repr(iteration)+"/NewInDetAlignLevels.py"
-				PrefixName="Iter%d_" % iteration
-				JOBNAME="%s_R%s_Iter%d_Solve.py" % (preName,data.getName(),iteration)
-				SCRIPTNAME="%s_R%s_Iter%dSolve.lsf" % (preName,data.getName(),iteration)
-
-				print "Logs stored in %s/Iter%d/logs/Iter%d_Solve.log" % (OutputPaths, iteration, iteration)
-	
-				# Get the aligment options
-				AlignmentOptions = {}
-		
-				if AlignmentMethod == "GX2":
-					AlignmentOptions["runLocal"] = False
-					AlignmentOptions["solveLocal"] = False
-				else:
-					AlignmentOptions["runLocal"] = True
-					AlignmentOptions["solvingOption"] = 0
-
-				AlignmentOptions["readConstantsFromPool"] = ReadAlignmentConstants
-	
-				AlignmentOptions["inputPoolFiles"] = [constantsFile]
-		
-				AlignmentOptions["alignTRT"] = AlignTRT[iteration]
-				if AlignTRT[iteration]:
-					AlignmentOptions["trtAlignmentLevel"] = TRTAlignmentLevel[iteration]
-
-				AlignmentOptions["alignSCT"] = AlignSCT[iteration]
-				#if AlignSCTBarrel[iteration]:
-				AlignmentOptions["sctAlignmentLevel"] = SCTAlignmentLevel[iteration]
-	
-				AlignmentOptions["sctAlignBarrel"] = AlignSCTBarrel[iteration]
-				#if AlignSCTBarrel[iteration]:
-				AlignmentOptions["sctAlignmentLevelBarrel"] = SCTAlignmentLevelBarrel[iteration]
-	
-				AlignmentOptions["sctAlignEndcaps"] = AlignSCTEndcaps[iteration]
-				#if AlignSCTEndcaps[iteration]:
-				AlignmentOptions["sctAlignmentLevelEndcaps"] = SCTAlignmentLevelEndcaps[iteration]
-	
-				AlignmentOptions["alignPixel"] = AlignPixel[iteration]
-				#if AlignSCTBarrel[iteration]:
-				AlignmentOptions["pixelAlignmentLevel"] = PixelAlignmentLevel[iteration]
-	
-				AlignmentOptions["pixelAlignBarrel"] = AlignPixelBarrel[iteration]
-				#if AlignPixelBarrel[iteration]:
-				AlignmentOptions["pixelAlignmentLevelBarrel"] = PixelAlignmentLevelBarrel[iteration]
-	
-				AlignmentOptions["pixelAlignEndcaps"] = AlignPixelEndcaps[iteration]
-				#if AlignPixelEndcaps[iteration]:
-				AlignmentOptions["pixelAlignmentLevelEndcaps"] = PixelAlignmentLevelEndcaps[iteration]
-
-
-				# Get Vectors, Matricies and Hitmaps
-				if not useTFiles:
-					tdata = [data]
-					matrices, vectors, hitmaps = mergeMatrix(OutputPaths, iteration, tdata)
-					AlignmentOptions["inputMatrixFiles"] =  matrices
-					AlignmentOptions["inputVectorFiles"] = vectors
-					AlignmentOptions["inputHitmapFiles"] = hitmaps
-					AlignmentOptions["WriteTFile"] = False
-					if len(hitmaps) == 0:
-						AlignmentOptions["readHitmaps"] = False
-				else:
-					tdata = [data]
-					tfiles = mergeTFiles(OutputPaths, iteration, tdata)
-					AlignmentOptions["inputTFiles"] = tfiles
-					AlignmentOptions["WriteTFile"] = True			
-			
-		
-				AlignmentOptions["runSolving"] = True
-				AlignmentOptions["runAccumulate"] = False
-
-				# Get the reconstruction options
-				RecoOptions = {}
-				RecoOptions["numberOfEvents"] = 1
-				RecoOptions["inputFiles"] = filesForSolve
-				extraOptions["doReadBS"] = solveDoReadBS
-
-				if len(data.getGlobalTag()) != 0:
-	 				RecoOptions["globalTag"] = data.getGlobalTag()
-	
-				if len(data.getDetDescrVersion()) != 0:
-					RecoOptions["detectorDescription"] = data.getDetDescrVersion()
-
-				RecoScript = "InDetAlignExample/loadInDetRec_Run2Rel17.py"
-				constantsFile = ""
-				if ReadAlignmentConstants:	
-					if iteration == 0:
-						constantsFile = inputAlignmentPoolFile 
-						AlignmentOptions["inputPoolFiles"] = [inputAlignmentPoolFile]
-					else:
-						constantsFile = str(OutputPaths)+"/Iter"+str(iteration-1)+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
-						AlignmentOptions["inputPoolFiles"] = [constantsFile]
-
-				poolfiles = [RecoOptions["inputFiles"][0],constantsFile]
-		
-				currentjob = manageJob(OutputPath = OutputPaths,
-				  dataName = data.getName(),
-				  iter = iteration,
-				  part = -1,
-				  JOBNAME = JOBNAME,
-				  preName = preName,
-				  RecoOptions = RecoOptions,
-				  extraOptions = extraOptions,
-				  AlignmentOptions = AlignmentOptions,
-				  RecoScript = RecoScript,
-				  AlignmentLevels = alignLevels,
-				  #MonitoringScript = MonitoringScript,
-				  QUEUE = QUEUE,
-				  CMTDIR = CMTDIR,
-				  ATHENACFG = ATHENACFG,
-				  inputPoolFiles = poolfiles
-				  )
-
-				# Write the job
-				currentjob.createDirectories()
-				currentjob.writeJO()
-				currentjob.writeScript()
-				currentjob.send(runMode)
-				DataToSolve.remove(data)
-			#end loop over DatatoSolve
-		#end while
-		
-		if runMode == "batch":
-			# Wait for signal
-			currentjob.wait()
-		
-	else:
-		print "-----------------------------------------------------\n"
-		print " WARNING: Skipping the solving due to low statistics\n"
-		print "-----------------------------------------------------\n"
-	for data in DataToRun:
-		if "doMonitoring" in extraOptions and extraOptions["doMonitoring"]==True:
-			OutputPaths = OutputPath+'/'
-			MERGEJOBNAME="%s_Iter%d_%s_Merge.py" % (preName,iteration,data.getName())
-			MERGESCRIPTNAME="%s_Iter%d_%s_Merge.lsf" % (preName,iteration, data.getName())
-			monitoringMerge = mergeScript(OutputPath = OutputPaths
-					      ,iter = iteration
-					      ,preName = preName
-					      ,dataName = data.getName()
-					      ,nCPUs = data.getCPUs(iteration)
-					      ,QUEUE = QUEUE
-					      ,CMTDIR = CMTDIR
-					      ,ATHENACFG = ATHENACFG
-					      ,SCRIPTNAME = MERGESCRIPTNAME
-					      ,JOBNAME = MERGEJOBNAME)
-
-		monitoringMerge.write()
-		monitoringMerge.send(runMode)
-
-#	print "  Iteration %d finished: %5.3f seconds \n" % (iteration,(time.time()-IterStartTime))
-#	print "----------------------------------------------"
-#
-#	info.write("\n")
-#	info.write("----------------------------------------------\n")
-#	info.write("  Iteration %d finished: %5.3f  seconds\n" % (iteration, (time.time()-IterStartTime)))
-#	info.write("----------------------------------------------\n")
-#
-#	lastIteration = iteration
-#	os.system("gzip %s/Iter%d/logs/Iter*.log" % (OutputPath, iteration))
-#
-#
-## =======================
-## Post Processing
-## =======================
-##if MonitoringScript == True:
-#if False:
-#	print
-#	print "Comparing the Monitoring Files"
-#	print
-#	info.write('\n')
-#	info.write("Comparing the Monitoring Files \n" )
-#	info.write("\n")
-#	compareMonitoring = compareMonitoringScript(OutputPath = OutputPath
-#						    ,numIter = Iterations
-#						    ,QUEUE = QUEUE
-#						    ,CMTDIR = CMTDIR
-#						    ,ATHENACFG = ATHENACFG)
-#						    
-#	compareMonitoring.write()
-#	compareMonitoring.send(runMode)
-#
-#	print
-#	print "Processed %d iterations !!!" % Iterations
-#	print "  %5.3f  seconds" % (time.time()-StartTime)
-#
-#info=open(OutputPath+"/info.txt",'a')
-#info.write('\n')
-#info.write("Processed %d iterations !!!\n" % Iterations)
-#info.write("  %5.3f  seconds \n" % (time.time()-StartTime))
-#
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_EoPMaps.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_EoPMaps.py
deleted file mode 100755
index 406ecc8d982e8311f92435e4cb4dbd209701016b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_EoPMaps.py
+++ /dev/null
@@ -1,201 +0,0 @@
-#################################################################
-#    Script to run InDetAlignExample with parallelization       #
-#      (local or lxbatch mode) & (physic data or cosmics)       #
-#             Vicente Lacuesta [started 12-03-2008]             #
-#################################################################
-
-import os, string, time, datetime
-import sys
-
-# ==============================================================
-#  End of User Options
-# ==============================================================
-
-# =====================================================================
-# =====================================================================
-# =====================================================================
-# =====================================================================
-#
-# Don not edit the lines below unless you know what you're doing!
-#
-
-print "Output saved in:",OutputPath
-
-# AW: moved that one to python dir such that it can be imported from anywhere
-from InDetAlignExample.NewInDet_IteratorClasses import *
-from InDetAlignExample.NewInDet_IteratorClasses_EoverPMaps import *
-
-# =====================================================================
-#
-#  Main Script
-#
-# =====================================================================
-
-
-# extract release configuration
-
-ATHENACFG = getAthenaConfig(ASetupOptions)
-
-if runMode == 'batch':
-	print "E over P map jobs will run in Lxbatch"
-elif runMode == ' local':
-	print "E over P map jobs will run on local machine"
-
-print
-
-
-
-
-IterStartTime=time.time()
-ReadAlignmentConstants = True
-if os.path.isdir("%s" % OutputPath):
-	countdir=0
-	while os.path.isdir("%s-%s-%d/" % (OutputPath[:-1], datetime.date.today(), countdir)):
-		countdir += 1
-	os.rename("%s" % OutputPath,"%s-%s-%d/" % (OutputPath[:-1], datetime.date.today(), countdir))
-	
-	print "WARNING: %s directory exists" % OutputPath
-	
-	print "Renamed to %s-%s-%d" % (OutputPath[:-1], datetime.date.today(), countdir)
-os.mkdir(OutputPath)
-
-for data in DataToRun:
-	print "----------------------------------------------"
-	print "Number of CPUs used to process the sample " + data.getName() + ": " + str(data.getCPUs(0))
-	print "----------------------------------------------"
-
-	if data.getEvents(0)!=-1:
-		print "Number of events per CPU: " +  str(data.getEventsPerCPU(0))
-	else:
-		print "Number of events per CPU: All" 
-
-	os.mkdir(OutputPath+data.getName()+'/')
-	if not os.path.isdir(OutputPath+'/logs'):
-		os.mkdir(OutputPath+'/logs')
-	print "Processing..."
-	# Get the Input file
-	dataFiles = SortCpus(data.getCPUs(0)
-				  ,""
-				  ,data.getFileList()
-				  ,OutputLevel
-				  ,doDetailedSplitting=doDetailedSplitting
-				  ,nEventsPerFile=data.getEventsPerCPU(0))
-	# Loop over subjobs
-	for subJob in range(0, data.getCPUs(0)):
-		RecoOptions = {}
-		#extraOptions = {}
-		AlignmentOptions = {}
-		# Get the Reconstruction Options
-		JOBNAME="%s_%s_Part%02d.py" % (preName,data.getName(),subJob)
-		SCRIPTNAME = "%s_%s_Part%02d.lsf" % (preName,data.getName(),subJob)
-		RunPath="%s/%s/%02d/" % (OutputPath, data.getName(), subJob)
-		RecoScript = "InDetAlignExample/loadInDetRec_EoverPMaps.py"
-		if not doDetailedSplitting:
-			RecoOptions["inputFiles"] = dataFiles.getCPU(subJob)
-			RecoOptions["numberOfEvents"] = data.getEventsPerCPU(0)
-		else:
-			RecoOptions["inputFiles"] = dataFiles.getInputFiles(subJob)
-			RecoOptions["numberOfEvents"] = dataFiles.getNumEvents(subJob)
-			RecoOptions["SkipEvents"] = dataFiles.getSkipEvents(subJob)
-		
-
-		if len(data.getGlobalTag()) != 0:
-			RecoOptions["globalTag"] = data.getGlobalTag()
-		if len(data.getDetDescrVersion()) != 0:
-			RecoOptions["detectorDescription"] = data.getDetDescrVersion()
-
-			RecoOptions["readConstantsFromPool"] = ReadAlignmentConstants
-			constantsFile = ""
-		if ReadAlignmentConstants:
-			constantsFile = inputAlignmentPoolFile 
-			RecoOptions["inputPoolFiles"] = [constantsFile]
-		RecoOptions["GoodRunList"] = GoodRunList
-	
-		currentjob = manageJobEoverPMaps(OutputPath = OutputPath,
-				      dataName = data.getName(),
-				      iter = -1,
-				      part = subJob,
-				      JOBNAME = JOBNAME,
-				      SCRIPTNAME = SCRIPTNAME,
-				      RunPath = RunPath,
-				      preName = preName,
-				      RecoOptions = RecoOptions,
-				      extraOptions = extraOptions,
-				      AlignmentOptions = AlignmentOptions,
-				      RecoScript = RecoScript,
-				      AlignmentLevels = 0,
-				      #MonitoringScript = MonitoringScript,
-				      QUEUE = QUEUE,
-				      CMTDIR = CMTDIR,
-				      ATHENACFG = ATHENACFG,
-				      inputPoolFiles = ""
-				      )
-
-		# Write the job
-		currentjob.createDirectories()
-		currentjob.writeJO()
-		currentjob.writeScript()
-		
-		currentjob.send(runMode)
-			
-				
-	
-	#  End j loop
-if runMode == "batch":
-	# Wait for signal
-	currentjob.wait()
-
-MERGEJOBNAME="%s_Merge.py" % preName
-MERGESCRIPTNAME="%s_Merge.lsf" % preName
-monitoringMerge = mergeScriptEoverPMaps(OutputPath = OutputPath
-			      ,preName = preName
-			      ,QUEUE = QUEUE
-			      ,CMTDIR = CMTDIR
-			      ,ATHENACFG = ATHENACFG
-			      ,SCRIPTNAME = MERGESCRIPTNAME
-			      ,JOBNAME = MERGEJOBNAME)
-
-monitoringMerge.write()
-monitoringMerge.send(runMode)
-
-#	print "  Iteration %d finished: %5.3f seconds \n" % (iteration,(time.time()-IterStartTime))
-#	print "----------------------------------------------"
-#
-#	info.write("\n")
-#	info.write("----------------------------------------------\n")
-#	info.write("  Iteration %d finished: %5.3f  seconds\n" % (iteration, (time.time()-IterStartTime)))
-#	info.write("----------------------------------------------\n")
-#
-#	lastIteration = iteration
-#	os.system("gzip %s/Iter%d/logs/Iter*.log" % (OutputPath, iteration))
-#
-#
-## =======================
-## Post Processing
-## =======================
-##if MonitoringScript == True:
-#if False:
-#	print
-#	print "Comparing the Monitoring Files"
-#	print
-#	info.write('\n')
-#	info.write("Comparing the Monitoring Files \n" )
-#	info.write("\n")
-#	compareMonitoring = compareMonitoringScript(OutputPath = OutputPath
-#						    ,numIter = Iterations
-#						    ,QUEUE = QUEUE
-#						    ,CMTDIR = CMTDIR
-#						    ,ATHENACFG = ATHENACFG)
-#						    
-#	compareMonitoring.write()
-#	compareMonitoring.send(runMode)
-#
-#	print
-#	print "Processed %d iterations !!!" % Iterations
-#	print "  %5.3f  seconds" % (time.time()-StartTime)
-#
-#info=open(OutputPath+"/info.txt",'a')
-#info.write('\n')
-#info.write("Processed %d iterations !!!\n" % Iterations)
-#info.write("  %5.3f  seconds \n" % (time.time()-StartTime))
-#
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_Rel19.py
deleted file mode 100755
index 6db4ee7ab04619e5a837083ee99666bedd25cbef..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_Rel19.py
+++ /dev/null
@@ -1,605 +0,0 @@
-#################################################################
-#    Script to run InDetAlignExample with parallelization       #
-#      (local or lxbatch mode) & (physic data or cosmics)       #
-#             Vicente Lacuesta [started 12-03-2008]             #
-#################################################################
-
-import os, string, time, datetime
-import sys
-
-# ==============================================================
-#  End of User Options
-# ==============================================================
-
-# =====================================================================
-# =====================================================================
-# =====================================================================
-# =====================================================================
-#
-# Don not edit the lines below unless you know what you're doing!
-#
-
-print "Output saved in:",OutputPath
-
-# AW: moved that one to python dir such that it can be imported from anywhere
-from InDetAlignExample.NewInDet_IteratorClasses import *
-
-# =====================================================================
-#
-#  Main Script
-#
-# =====================================================================
-
-
-# extract release configuration
-
-ATHENACFG = getAthenaConfig(ASetupOptions)
-
-
-print
-if not os.path.isdir(OutputPath):
-    os.mkdir(OutputPath)
-
-info=open(OutputPath+"/info.txt",'w')
-info.write("----------------------------------------------\n")
-info.write("\t\t%s      \n" % datetime.date.today() )
-info.write("----------------------------------------------\n")
-#info.write("Release %s\n" % ATHENAREL)
-info.write("Output stored in %s\n\n" % OutputPath)
-print "Info stored in: " +OutputPath+"/info.txt"
-
-if runMode == 'batch':
-    print "Alignment Algorithm will run in Lxbatch"
-    info.write("Alignment Algorithm run in Lxbatch\n")
-elif runMode == ' local':
-    print "Alignment Algorithm will run on local machine"
-    info.write("Alignment Algorithm run on local machine\n")
-    info.write("----------------------------------------------\n")
-    print "System Info"
-    info.write("----------------------------------------------\n")
-    info.write("System Info\n")
-    os.system('grep processor /var/log/dmesg | grep MHz')
-    info.write("----------------------------------------------\n")
-    info.write(os.popen('grep processor /var/log/dmesg | grep MHz','r').read())
-    info.write("\n")
-    os.system('dmesg | grep Brought')
-    info.write(os.popen('dmesg | grep Brought','r').read())
-    info.write("\n")
-    os.system('cat /proc/meminfo | grep MemTotal')
-    info.write(os.popen('cat /proc/meminfo | grep MemTotal','r').read())
-    info.write("\n")
-    info.write("----------------------------------------------\n")
-    info.write("\n")
-
-print
-info.write("\n")
-StartTime=time.time()   # Start the total time counter
-info.close()
-
-# check that user requires to run some iterations:
-if (Iterations == 0):
-    print " ------------------------------------------------- \n -- WARNING -- user requests Iterations = 0 !!! -- \n ------------------------------------------------- \n" 
-
-#  Loop over iterations
-for iteration in range(FirstIteration,Iterations+FirstIteration):
-    IterStartTime=time.time()
-    if (iteration == 0) and not inputAlignmentPoolFile:
-        ReadAlignmentConstants = False
-    else:
-        ReadAlignmentConstants = True
-
-    if (iteration == 0 ) and not inputBowingCoolFile:
-	    ReadBowingParameter = False
-    else:
-        ReadBowingParameter = True
-
-    print '\n'
-    print " ---> Iteration "+repr(iteration)
-    print '\n'
-    info=open(OutputPath+"/info.txt",'a')
-    info.write('\n')
-    info.write("---> Iteration "+repr(iteration))
-    info.write('\n')
-    # Protect existing directories
-    if os.path.isdir("%s/Iter%d%s" % (OutputPath, iteration, folderSuffix)):
-        countdir=0
-        while os.path.isdir("%s/Iter%d%s-%s-%d" % (OutputPath, iteration, folderSuffix,datetime.date.today(), countdir)):
-            countdir += 1
-        os.rename("%s/Iter%d%s" % (OutputPath, iteration, folderSuffix),("%s/Iter%d%s-%s-%d" % (OutputPath, iteration, folderSuffix, datetime.date.today(), countdir)))
-
-        print "WARNING: %s/Iter%d%s directory exists" % (OutputPath, iteration, folderSuffix)
-        print "Renamed to %s/Iter%d%s-%s-%d" % (OutputPath, iteration, folderSuffix, datetime.date.today(), countdir)
-
-    # Make OutputPaths
-    folderName = OutputPath+'/Iter'+repr(iteration)+folderSuffix
-    os.mkdir(folderName)
-    os.mkdir(folderName+'/logs/')
-    print " <NewInDetIterator> Storing all files of this iteration in folder ", folderName 
-
-    # Settup up a local copy of the alignment levels
-    os.system("get_files -jo InDetAlignExample/NewInDetAlignLevels.py >/dev/null")
-    os.system("cp NewInDetAlignLevels.py %s" % folderName)
-    alignLevels = folderName+"/NewInDetAlignLevels.py"
-    
-    for data in DataToRun:
-        print "----------------------------------------------"
-        print " Number of CPUs used to process the sample " + data.getName() + ": " + str(data.getCPUs(iteration))
-        print "----------------------------------------------"
-
-        info.write(" Number of CPUs used to process the sample %s : %s\n\n" % (data.getName(), data.getCPUs(iteration)))
-
-        if data.getEvents(iteration)!=-1:
-            print "Number of events per CPU: " +  str(data.getEventsPerCPU(iteration))
-            info.write("Number of events per CPU: %d\n\n" % data.getEventsPerCPU(iteration))
-            
-        else:
-            print "Number of events per CPU: All" 
-            info.write("Number of events per CPU: All" )
-
-        OutputPaths = OutputPath
-        os.mkdir(folderName+'/'+data.getName()+'/')
-
-        print " Processing..."
-        
-        # check how many jobs must be sent
-        # if users requests many, but the input file has less files, then the number of
-        # jobs must be capped
-        numberOfSubJobs = data.getCPUs(iteration)
-        if (data.getNFilesInList() < numberOfSubJobs): 
-            numberOfSubJobs = data.getNFilesInList()
-            print " >>> User requested ",data.getCPUs(iteration), " jobs but files has fewer entries. numberOfSubJobs= ", numberOfSubJobs     
-
-        # Get the Input file
-        dataFiles = SortCpus(numberOfSubJobs
-                      ,""
-                      ,data.getFileList()
-                      ,OutputLevel
-                      ,doDetailedSplitting=doDetailedSplitting
-                      ,nEventsPerFile=data.getEventsPerCPU(iteration))
-
-        preJOBNAME="%s_Iter%d%s_%s" % (preName,iteration,folderSuffix,data.getName())
-        
-        # Loop over subjobs     
-        for subJob in range(0, numberOfSubJobs):
-            RecoOptions = {}
-            # Get the Reconstruction Options
-            RecoOptions["ClusteringAlgo"] = ClusteringAlgo
-            if ErrorScaling[iteration]:
-                RecoOptions["errorScalingTag"] = errorScalingTag
-
-            JOBNAME="%s_Part%02d.py" % (preJOBNAME,subJob)
-            RecoScript = "InDetAlignExample/jobOption_RecExCommon.py"
-            ConditionsScript = "InDetAlignExample/jobOption_ConditionsOverrider.py"
-
-            if not doDetailedSplitting:
-                RecoOptions["inputFiles"] = dataFiles.getCPU(subJob)
-                RecoOptions["numberOfEvents"] = data.getEventsPerCPU(iteration)
-            else:
-                RecoOptions["inputFiles"] = dataFiles.getInputFiles(subJob)
-                RecoOptions["numberOfEvents"] = dataFiles.getNumEvents(subJob)
-                RecoOptions["SkipEvents"] = dataFiles.getSkipEvents(subJob)
-
-            extraOptions["doReadBS"] = data.getByteStream()
-            if (len(data.getProjectName())>0): 
-                extraOptions["projectName"] = data.getProjectName()
-            extraOptions["Cosmics"] = data.getCosmics()
-            extraOptions["DigitalClustering"] = data.getDigitalClustering()
-            extraOptions["PtCut"] = data.getPtMin()
-                
-            if subJob == 0:
-                filesForSolve = RecoOptions["inputFiles"]
-                solveDoReadBS = extraOptions["doReadBS"]
-            if len(data.getGlobalTag()) != 0:
-                RecoOptions["globalTag"] = data.getGlobalTag()
-            if len(data.getDetDescrVersion()) != 0:
-                RecoOptions["detectorDescription"] = data.getDetDescrVersion()
-    
-        
-    
-            # Get the Alignment Options
-            AlignmentOptions = {}
-            if AlignmentMethod == "GX2":
-                AlignmentOptions["runLocal"] = False
-                AlignmentOptions["solveLocal"] = False
-                AlignmentOptions["solvingOption"] = 1
-                # AlignmentOptions["ModCut"] = 6 # This is not needed anymore (Salva, 19/May/2015)
-            else:
-                AlignmentOptions["runLocal"] = True
-                AlignmentOptions["solvingOption"] = 0
-    
-    
-            AlignmentOptions["readConstantsFromPool"] = ReadAlignmentConstants
-            constantsFile = ""
-            bowingdb= ""
-            if ReadAlignmentConstants:
-                if iteration == 0:
-                    constantsFile = inputAlignmentPoolFile 
-                    AlignmentOptions["inputPoolFiles"] = [constantsFile]
-                else:
-                    constantsFile = str(OutputPaths)+"/Iter"+str(iteration-1)+folderSuffix+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
-                    AlignmentOptions["inputPoolFiles"] = [constantsFile]
-
-            if ReadBowingParameter:
-                    if iteration == 0:
-                        bowingdb = inputBowingCoolFile
-                        AlignmentOptions["inputBowingDatabase"] = inputBowingCoolFile
-                    else:
-                        bowingdb = str(OutputPaths)+"/Iter"+str(iteration-1)+folderSuffix+"/mycool.db"
-                        AlignmentOptions["inputBowingDatabase"] = bowingdb
-
-            AlignmentOptions["alignTRT"] = AlignTRT[iteration]
-            if AlignTRT[iteration]:
-                AlignmentOptions["trtAlignmentLevel"] = TRTAlignmentLevel[iteration]
-                AlignmentOptions["trtAlignBarrel"]    = AlignTRTBarrel[iteration]
-                AlignmentOptions["trtAlignEndcaps"]   = AlignTRTEndcaps[iteration]
-                AlignmentOptions["trtAlignmentLevel"] = TRTAlignmentLevel[iteration]
-                AlignmentOptions["trtAlignmentLevelBarrel"] = TRTAlignmentLevelBarrel[iteration]
-                AlignmentOptions["trtAlignmentLevelEndcaps"] = TRTAlignmentLevelEndcaps[iteration]
-
-                
-            AlignmentOptions["alignSCT"] = AlignSCT[iteration]
-            #if AlignSCTBarrel[iteration]:
-            AlignmentOptions["sctAlignmentLevel"] = SCTAlignmentLevel[iteration]
-    
-            AlignmentOptions["sctAlignBarrel"] = AlignSCTBarrel[iteration]
-            #if AlignSCTBarrel[iteration]:
-            AlignmentOptions["sctAlignmentLevelBarrel"] = SCTAlignmentLevelBarrel[iteration]
-    
-            AlignmentOptions["sctAlignEndcaps"] = AlignSCTEndcaps[iteration]
-            #if AlignSCTEndcaps[iteration]:
-            AlignmentOptions["sctAlignmentLevelEndcaps"] = SCTAlignmentLevelEndcaps[iteration]
-    
-            AlignmentOptions["alignPixel"] = AlignPixel[iteration]
-            #if AlignSCTBarrel[iteration]:
-            AlignmentOptions["pixelAlignmentLevel"] = PixelAlignmentLevel[iteration]
-    
-            AlignmentOptions["pixelAlignBarrel"] = AlignPixelBarrel[iteration]
-            #if AlignPixelBarrel[iteration]:
-            AlignmentOptions["pixelAlignmentLevelBarrel"] = PixelAlignmentLevelBarrel[iteration]
-    
-            AlignmentOptions["pixelAlignEndcaps"] = AlignPixelEndcaps[iteration]
-            #if AlignPixelEndcaps[iteration]:
-            AlignmentOptions["pixelAlignmentLevelEndcaps"] = PixelAlignmentLevelEndcaps[iteration]
-    
-    
-            AlignmentOptions["runSolving"] = False
-            AlignmentOptions["runAccumulate"] = True
-            AlignmentOptions["WriteTFile"] = useTFiles
-                            
-    
-            poolfiles = RecoOptions["inputFiles"]
-            poolfiles.append(constantsFile)
-
-            #coolfiles = RecoOptions["inputDbs"]
-            #coolfiles.append("")
-
-
-            #print " <NewInDetIterator> create a job: Outputpath = ", OutputPaths
-            #print "                                     JOBNAME = ", JOBNAME
-            currentjob = manageJob(OutputPath = OutputPaths,
-                                   dataName = data.getName(),
-                                   iter = iteration,
-                                   folderSuffix = folderSuffix,
-                                   part = subJob,
-                                   JOBNAME = JOBNAME,
-                                   preName = preName,
-                                   RecoOptions = RecoOptions,
-                                   extraOptions = extraOptions,
-                                   AlignmentOptions = AlignmentOptions,
-                                   RecoScript = RecoScript,
-                                   ConditionsScript = ConditionsScript,
-                                   AlignmentLevels = alignLevels,
-                                   #MonitoringScript = MonitoringScript,
-                                   QUEUE = QUEUE,
-                                   CMTDIR = CMTDIR,
-                                   ATHENACFG = ATHENACFG,
-                                   inputPoolFiles = poolfiles,
-                                   inputCoolFiles = []
-                          )
-    
-            # Write the job
-            currentjob.createDirectories()
-            currentjob.writeJO()
-            currentjob.writeScript()
-            
-            currentjob.send(runMode)
-    #  End j loop
-    #if runMode == "batch":
-        # Wait for signal
-    #   currentjob.wait()
-    #print " -- SALVA -- Accumulate jobs already submitted. Waiting for completion -- "
-    #rep = ''
-    #while not rep in [ 'c', 'Q' ]:
-    #    rep = raw_input( '[RunIterator]% enter "c" to continue: ' )
-    #    if 1 < len(rep):
-    #        rep = rep[0]
-
-            
-    #  Solving the system
-    if doSolve:
-        DataToSolve = list(DataToRun) # in case there is more than one set to run
-        print "\n Waiting for Accumulate job completion. Please be patient. "
-        while len(DataToSolve):
-            for data in DataToSolve:
-                batchjobs = "%s_Iter%d%s_%s_Part" % (preName,iteration,folderSuffix,data.getName())
-                #print "            preJOBNAME ", preJOBNAME
-                if os.popen('bjobs -w').read().find(preJOBNAME)!=-1: # check if accumulate jobs still running 
-                    time.sleep(30) # wait for a while before asking again
-                    continue
-                DataToSolve.remove(data) # this data set is already completed 
-                time.sleep(30) # wait a bit longer just to be sure reco step has already finished
-                print " --> DataToSolve --> jobs running for ",len(DataToRun)," data types "
-               
-        print " >> Accumulate jobs were completed at ", time.strftime("%H:%M:%S")        
-        info.write("\n Accumulate jobs were completed at \n")
-
-        if (len(DataToRun)>1): 
-            # As only one solving is sent for when combining several data sets, name it Total
-            JOBNAME="%s_R%s_Iter%d%s_Solve.py" % (preName,"Total",iteration,folderSuffix)
-            SCRIPTNAME="%s_R%s_Iter%d%sSolve.lsf" % (preName,"Total",iteration, folderSuffix)
-        else:
-            JOBNAME="%s_R%s_Iter%d%s_Solve.py" % (preName,data.getName(),iteration, folderSuffix)
-            SCRIPTNAME="%s_R%s_Iter%d%sSolve.lsf" % (preName,data.getName(),iteration,folderSuffix)
-            
-            
-        DataToSolve = list(DataToRun) # Restore data set the list
-        
-        # Obtain the aligment options
-        AlignmentOptions = {}
-            
-        if AlignmentMethod == "GX2":
-            AlignmentOptions["runLocal"] = False
-            AlignmentOptions["solveLocal"] = False
-        else:
-            AlignmentOptions["runLocal"] = True
-            AlignmentOptions["solvingOption"] = 0
-
-        AlignmentOptions["readConstantsFromPool"] = ReadAlignmentConstants
-    
-        AlignmentOptions["inputPoolFiles"] = [constantsFile]
-
-        AlignmentOptions["inputBowingDatabase"] = bowingdb
-        
-        AlignmentOptions["alignTRT"] = AlignTRT[iteration]
-        if AlignTRT[iteration]:
-            AlignmentOptions["trtAlignmentLevel"] = TRTAlignmentLevel[iteration]
-            AlignmentOptions["trtAlignBarrel"]    = AlignTRTBarrel[iteration]
-            AlignmentOptions["trtAlignEndcaps"]   = AlignTRTEndcaps[iteration]
-            AlignmentOptions["trtAlignmentLevel"] = TRTAlignmentLevel[iteration]
-            AlignmentOptions["trtAlignmentLevelBarrel"] = TRTAlignmentLevelBarrel[iteration]
-            AlignmentOptions["trtAlignmentLevelEndcaps"] = TRTAlignmentLevelEndcaps[iteration]
-
-        AlignmentOptions["alignSCT"] = AlignSCT[iteration]
-        #if AlignSCTBarrel[iteration]:
-        AlignmentOptions["sctAlignmentLevel"] = SCTAlignmentLevel[iteration]
-    
-        AlignmentOptions["sctAlignBarrel"] = AlignSCTBarrel[iteration]
-        #if AlignSCTBarrel[iteration]:
-        AlignmentOptions["sctAlignmentLevelBarrel"] = SCTAlignmentLevelBarrel[iteration]
-        
-        AlignmentOptions["sctAlignEndcaps"] = AlignSCTEndcaps[iteration]
-        #if AlignSCTEndcaps[iteration]:
-        AlignmentOptions["sctAlignmentLevelEndcaps"] = SCTAlignmentLevelEndcaps[iteration]
-        
-        AlignmentOptions["alignPixel"] = AlignPixel[iteration]
-        #if AlignSCTBarrel[iteration]:
-        AlignmentOptions["pixelAlignmentLevel"] = PixelAlignmentLevel[iteration]
-
-        AlignmentOptions["pixelAlignBarrel"] = AlignPixelBarrel[iteration]
-        #if AlignPixelBarrel[iteration]:
-        AlignmentOptions["pixelAlignmentLevelBarrel"] = PixelAlignmentLevelBarrel[iteration]
-    
-        AlignmentOptions["pixelAlignEndcaps"] = AlignPixelEndcaps[iteration]
-        #if AlignPixelEndcaps[iteration]:
-        AlignmentOptions["pixelAlignmentLevelEndcaps"] = PixelAlignmentLevelEndcaps[iteration]
-
-            
-        # need to figure out the list of matrices from the individual Accumulate jobs
-        tfiles = [] # set an empty list
-        while len(DataToSolve):
-            for data in DataToSolve:
-                print "----------------------------------------------"
-                print "  Solving dataset %s, Iter %s"%(data.getName(),iteration)
-                print "----------------------------------------------"
-            
-                info.write('\n')
-                info.write("----------------------------------------------\n")
-                info.write("  Solving dataset %s, Iter %d\n" %(data.getName(),iteration))
-                info.write("----------------------------------------------\n")
-            
-                #alignLevels = OutputPaths+'/Iter'+repr(iteration)+"/NewInDetAlignLevels.py"
-                alignLevels = folderName+"/NewInDetAlignLevels.py"
-                PrefixName="Iter%d%s_%s" % (iteration, folderSuffix, data.getName()) 
-
-                print " Solving logs stored in %s/Iter%d%s/logs/%s_Solve.log" % (OutputPaths, iteration, folderSuffix, PrefixName)
-        
-                # Get Vectors, Matricies and Hitmaps
-                if not useTFiles:
-                    tdata = [data]
-                    matrices, vectors, hitmaps = mergeMatrix(OutputPaths, iteration, tdata)
-                    AlignmentOptions["inputMatrixFiles"] =  matrices
-                    AlignmentOptions["inputVectorFiles"] = vectors
-                    AlignmentOptions["inputHitmapFiles"] = hitmaps
-                    AlignmentOptions["WriteTFile"] = False
-                    if len(hitmaps) == 0:
-                        AlignmentOptions["readHitmaps"] = False
-                else:
-                    tdata = [data]
-                    tfiles = mergeTFiles(OutputPaths, iteration, folderSuffix, tdata) + tfiles
-                    AlignmentOptions["inputTFiles"] = tfiles
-                    AlignmentOptions["WriteTFile"] = True           
-            
-        
-                AlignmentOptions["runSolving"] = True
-                AlignmentOptions["runAccumulate"] = False
-
-                # Get the reconstruction options
-                RecoOptions = {}
-                RecoOptions["numberOfEvents"] = 1
-                RecoOptions["inputFiles"] = filesForSolve
-                extraOptions["doReadBS"] = solveDoReadBS
-
-                if len(data.getGlobalTag()) != 0:
-                    RecoOptions["globalTag"] = data.getGlobalTag()
-    
-                if len(data.getDetDescrVersion()) != 0:
-                    RecoOptions["detectorDescription"] = data.getDetDescrVersion()
-
-                RecoScript = "InDetAlignExample/jobOption_RecExCommon.py"
-                ConditionsScript = "InDetAlignExample/jobOption_ConditionsOverrider.py"
-                constantsFile = ""
-                bowingdb = ""
-                if ReadAlignmentConstants:  
-                    if iteration == 0:
-                        constantsFile = inputAlignmentPoolFile 
-                        AlignmentOptions["inputPoolFiles"] = [inputAlignmentPoolFile]
-                    else:
-                        constantsFile = str(OutputPaths)+"/Iter"+str(iteration-1)+folderSuffix+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
-                        AlignmentOptions["inputPoolFiles"] = [constantsFile]
-                
-                if ReadBowingParameter:
-                    if iteration == 0:
-                        bowingdb = inputBowingCoolFile
-                        AlignmentOptions["inputBowingDatabase"] = inputBowingCoolFile
-                    else:
-                        bowingdb = str(OutputPaths)+"/Iter"+str(iteration-1)+folderSuffix+"/mycool.db"
-                        AlignmentOptions["inputBowingDatabase"] = bowingdb
-
-                poolfiles = [RecoOptions["inputFiles"][0],constantsFile]
-                #coolfiles = [RecoOptions["inputDbs"][0],bowingdb]
-
-                # only one solution job submitted
-                print " -- tfiles list = ", tfiles 
-                
-                #form
-                #OriginalLBIBLTweak = extraOptions["applyLBibldistTweak"]
-                #if OriginalLBIBLTweak:
-                #    print "-- Turning Off the LB IBLDistortion Tweak During Solving --"
-                #    extraOptions["applyLBibldistTweak"] = False
-                #else:
-                #    print "-- The LB IBLDistortion tweak was ", extraOptions["applyLBibldistTweak"], " since accumulation"
-
-                currentjob = manageJob(OutputPath = OutputPaths,
-                                       dataName = data.getName(),
-                                       iter = iteration,
-                                       folderSuffix = folderSuffix,
-                                       part = -1,
-                                       JOBNAME = JOBNAME,
-                                       preName = preName,
-                                       RecoOptions = RecoOptions,
-                                       extraOptions = extraOptions,
-                                       AlignmentOptions = AlignmentOptions,
-                                       RecoScript = RecoScript,
-                                       ConditionsScript = ConditionsScript,
-                                       AlignmentLevels = alignLevels,
-                                       #MonitoringScript = MonitoringScript,
-                                       QUEUE = QUEUE,
-                                       CMTDIR = CMTDIR,
-                                       ATHENACFG = ATHENACFG,
-                                       inputPoolFiles = poolfiles,
-                                       inputCoolFiles = []
-                                       )
-
-                # Write the job
-                currentjob.createDirectories()
-                currentjob.writeJO()
-                currentjob.writeScript()
-                if (len(DataToSolve) == 1):
-                    if (len(tfiles)>0): # there are tfiles ready to be used 
-                        print " -- Submitting Solve job: ",currentjob.JOBNAME," to queue ", currentjob.QUEUE
-                        currentjob.send(runMode) # submit only the last one 
-                    else:
-                        print " -- WARNING -- No tfiles are found !!! Solve job is not submitted "
-                            
-                DataToSolve.remove(data)
-            #end loop over DatatoSolve
-        #end while
-        
-        if runMode == "batch":
-            #Don't wait for the solve. 
-            currentjob.wait()
-        #Restoring the LBibldistTweak for the next Iteration.
-        #formd
-        #extraOptions["applyLBibldistTweak"] = OriginalLBIBLTweak
-        
-    else:
-        print "---------------------------------------------------------------\n"
-        print " WARNING: Skipping the solving because the flag doSolve is OFF\n"
-        print "---------------------------------------------------------------\n"
-        
-        DataToMerge = list(DataToRun)
-        print "\n Waiting for Accumulate job completion. Please be patient."
-        while len(DataToMerge):
-            for data in DataToMerge:
-                batchjobs = "%s_Iter%d%s_%s_Part" % (preName,iteration,folderSuffix, data.getName())
-                if os.popen('bjobs -w').read().find(batchjobs)!=-1: #check if accumulate jobs are running
-                    #print "Waiting for ",batchjobs
-                    time.sleep(60)
-                    continue
-                DataToMerge.remove(data) #completed
-                #print len(DataToMerge)
-                time.sleep(30)
-
-
-    # histogram merging step    
-    for data in DataToRun:
-        if "doMonitoring" in extraOptions and extraOptions["doMonitoring"]==True:
-            OutputPaths = OutputPath+'/'
-            MERGEJOBNAME="%s_Iter%d%s_%s_Merge.py" % (preName,iteration,folderSuffix,data.getName())
-            MERGESCRIPTNAME="%s_Iter%d%s_%s_Merge.lsf" % (preName,iteration, folderSuffix, data.getName())
-            monitoringMerge = mergeScript(OutputPath = OutputPaths
-                          ,iter = iteration
-                          ,preName = preName
-                          ,folderSuffix = folderSuffix
-                          ,dataName = data.getName()
-                          ,nCPUs = data.getCPUs(iteration)
-                          ,QUEUE = QUEUE
-                          ,CMTDIR = CMTDIR
-                          ,ATHENACFG = ATHENACFG
-                          ,SCRIPTNAME = MERGESCRIPTNAME
-                          ,JOBNAME = MERGEJOBNAME)
-
-            monitoringMerge.write()
-            monitoringMerge.send(runMode)
-
-#   print "  Iteration %d finished: %5.3f seconds \n" % (iteration,(time.time()-IterStartTime))
-#   print "----------------------------------------------"
-#
-#   info.write("\n")
-#   info.write("----------------------------------------------\n")
-#   info.write("  Iteration %d finished: %5.3f  seconds\n" % (iteration, (time.time()-IterStartTime)))
-#   info.write("----------------------------------------------\n")
-#
-#   lastIteration = iteration
-#   os.system("gzip %s/Iter%d/logs/Iter*.log" % (OutputPath, iteration))
-#
-#
-## =======================
-## Post Processing
-## =======================
-##if MonitoringScript == True:
-#if False:
-#   print
-#   print "Comparing the Monitoring Files"
-#   print
-#   info.write('\n')
-#   info.write("Comparing the Monitoring Files \n" )
-#   info.write("\n")
-#   compareMonitoring = compareMonitoringScript(OutputPath = OutputPath
-#                           ,numIter = Iterations
-#                           ,QUEUE = QUEUE
-#                           ,CMTDIR = CMTDIR
-#                           ,ATHENACFG = ATHENACFG)
-#                           
-#   compareMonitoring.write()
-#   compareMonitoring.send(runMode)
-#
-#   print
-#   print "Processed %d iterations !!!" % Iterations
-#   print "  %5.3f  seconds" % (time.time()-StartTime)
-#
-#info=open(OutputPath+"/info.txt",'a')
-#info.write('\n')
-#info.write("Processed %d iterations !!!\n" % Iterations)
-#info.write("  %5.3f  seconds \n" % (time.time()-StartTime))
-#
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/ReadPool.py b/InnerDetector/InDetExample/InDetAlignExample/share/ReadPool.py
deleted file mode 100755
index 7300292dfb4c2d28afc9e1176959307eb0bac67a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/ReadPool.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# ReadPool.py
-# Based on InDetAlignGenAlgs/ReadPool.py
-# Read AlignableTransforms directly from file without using IOV database
-# Use CondProxyProvider instead of IOVSvc to provide objects
-# joboption FRAGMENT to be run e.g. in framework of InDetRecExample
-#
-
-     
-# load converters for AlignableTransforms
-#include ( "DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-
-conddb.blockFolder("/Indet/Align")
-conddb.blockFolder("/TRT/Align")
-
-from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-from AthenaCommon.AppMgr import ServiceMgr
-ServiceMgr += CondProxyProvider()
-ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-ServiceMgr.CondProxyProvider.InputCollections += [ "alignobjs.root" ]
-ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-print ServiceMgr.CondProxyProvider
-
-ServiceMgr.IOVSvc.preLoadData=True
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator.py
deleted file mode 100755
index b99ca835c111d6a66e427982e7296f9e42572855..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator.py
+++ /dev/null
@@ -1,480 +0,0 @@
-
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 2
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-QUEUE = '1nh'
-#QUEUE = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'IDAling_'
-
-#suffix to the folder name
-folderSuffix = ""
-
-HOME           = os.environ['HOME']
-# Alignment Output
-OutputPath     = os.environ['PWD']+"/."
-
-CMTDIR         = HOME+"/athena/cmthome/"
-# extra AtlasSetup options
-ASetupOptions  = "single"
-#ASetupOptions  = "nightlies"
-
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'INFO'
-
-# list of extra options for NewInDetAlignAlgSetup
-extraOptions = {}
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    from optparse import OptionParser
-    parser = OptionParser()
-    parser.add_option("--ClusteringAlgo",dest="ClusteringAlgo", help="Which Clustering algorithm to use: NN (Default), Analog, Digital. NOT FULLY WORKING",default="NN")
-    parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-    parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-    parser.add_option("--HeavyIons", dest="HeavyIons", help="Set it to true if you want to reconstruct HeavyIons",action="store_true",default=False)
-    parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-    parser.add_option("--inputDir", dest="inputDir", help="Directory containing the input files - NOT YET IMPLEMENTED", default="")
-    parser.add_option("--inputBowingDb", dest="inputBowingDb", help="In the case you want to use a specific IBL bowing  write here the absolute path to the cool file", default="")
-    parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-    parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: True)",action="store_true", default=True)
-    parser.add_option("--LBrangeFirst", dest="LBrangeFirst", help=" Setting this the LumiBlock selection is set to true and one sets the lower LB to be accepted", default=0)
-    parser.add_option("--LBrangeLast", dest="LBrangeLast", help=" Setting this the LumiBlock selection is set to true and one sets the upper LB to be accepted", default=4096)
-    parser.add_option("--nCpus",dest="nCpus", help="Number of CPUs to be used", default = "1")
-    parser.add_option("--nEvents",dest="nEvents", help="Maximum number of events to use", default = "-1")
-    parser.add_option("--nIter",dest="nIter", help="Number of iterations to be executed", default = "")
-    parser.add_option("--prefix", dest="prefix", help="prefix to the jobs name", default="")
-    parser.add_option("--preIBLgeometry",dest="preIBLgeometry", help="Set it when you want to run on Run1 geometry (Default: False)",action="store_true",default=False)
-    parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = "2000")
-    parser.add_option("--queue",dest="userQueue", help="name of the LSF queue were jobs will be submitted", default="")
-    parser.add_option("--suffix", dest="suffix", help="suffix to the IterN folder name --> IterN_suffix", default="")
-    
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    return config
-    
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputList=config.inputList
-inputDir =config.inputDir
-eventType=config.eventType
-HeavyIons=config.HeavyIons
-ConstantsFile=config.inputConstantsFile
-BowingDb=config.inputBowingDb
-nEventsMax=config.nEvents
-preIBLgeometry=config.preIBLgeometry
-isData=config.isData
-ClusteringAlgo=config.ClusteringAlgo
-inputErrorScalingTag=config.errorScalingTag
-nCpus=config.nCpus
-userPtMin = config.userPtMin
-userPrefix = config.prefix
-userSuffix = config.suffix
-userLBselection = (config.LBrangeFirst > 0) or (config.LBrangeLast < 4096)
-userLBrangeFirst = int(config.LBrangeFirst)
-userLBrangeLast = int(config.LBrangeLast)
-userQueue = config.userQueue
-userNIter = config.nIter
-
-
-# split the possible collections
-inputList = inputList.split()
-eventType = eventType.split()
-nCpus = nCpus.split()
-nEventsMax = nEventsMax.split()
-userPtMin = userPtMin.split()
-
-# check that inputList and eventype have the same number of elements
-if (len(inputList) != len(eventType)):
-    print " <RunIterator> ERROR no input list. Please provide a set of files with data to be processed"
-    exit()
-
-#prefix for the job's name
-if (len(userPrefix) > 0):
-    preName = userPrefix
-
-if (len(userSuffix) > 0):
-    folderSuffix = "_"+userSuffix
-
-# LSF queue
-if (len(userQueue)>0):
-    QUEUE = userQueue
-
-# Number of iterations
-if (len(userNIter)>0):
-    Iterations     = int(userNIter)
-
-##########################################################
-#               Print input parameters                   #
-##########################################################
-
-print " \n <RunIterator> ----- User input in command line --- "
-if (len(folderSuffix)>0): print " <RunIterator> folder suffix = ", folderSuffix
-print " <RunIterator> inputList = ",inputList
-print " <RunIterator> nCpus = ",nCpus
-print " <RunIterator> nEventsMax = ",nEventsMax
-if (len(ConstantsFile)>0): print " <RunIterator> ConstantsFile = ",ConstantsFile
-if (len(BowingDb)>0): print " <RunIterator> BowingDb = ", BowingDb
-if (len(inputErrorScalingTag)>0): print " <RunIterator> inputErrorScalingTag = ",inputErrorScalingTag
-if (len(userPtMin)>0): print " <RunIterator> userPtMin = ",userPtMin, " MeV"
-print " <RunIterator> eventType = ",eventType
-print " <RunIterator> iterating on ",len(eventType),"samples "
-if (len(userNIter)>0): print " <RunIterator> #Iterations = ",Iterations
-if userLBselection:
-    print " <RunIterator> LB range = ",userLBrangeFirst, " --> ", userLBrangeLast
-
-##########################################################
-#       Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-for i_sample in range(len(inputList)):
-    print " "
-    print " ==== configuring sample #",i_sample
-    Data1 = setupData(eventType[i_sample])
-    #Need To be changed this one
-    myDataType = "Data_15" + eventType[i_sample]
-    #Data1.setDataType("MinBias_Data_15") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    Data1.setDataType(myDataType) # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    
-    # number of CPUS to be used in each iteration to process this data type
-    thisNCpus = int(nCpus[0]) 
-    if (len(nCpus) >= i_sample+1):
-        thisNCpus = int(nCpus[i_sample])
-    Data1.setCPUs([thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus])
-    
-    # number of events to be processed 
-    thisNEvents = int(nEventsMax[0])
-    if (len(nEventsMax) >= i_sample+1):
-         thisNEvents = int(nEventsMax[i_sample])
-    Data1.setEvents([thisNEvents,thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents])
-    Data1.setLimitFiles(5000) # Limit the number of files to use (useful when runing in local a subset of data)
-    #Data1.setRuns([201280]) # Run number, you can provide a list of runs
-    #Data1.CreateFileList() # Creates the file list
-    
-    # figure out the mimimum pt
-    thisPtMin = userPtMin[0]
-    if (len(userPtMin) >= i_sample+1):
-         thisPtMin = userPtMin[i_sample]
-
-    #     
-    if isData:
-        Data1.setByteStream(True)
-    else:
-        Data1.setByteStream(False)
-        
-    Data1.setCustomFileList(inputList[i_sample])
-
-    # Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-    if (eventType[i_sample] == "collisions"):
-        # default
-        myTag = "ATLAS-R2-2015-03-01-00"
-        print " ==> default tag   myTag=",myTag            
-        Data1.setGlobalTag("OFLCOND-RUN12-SDR-28")
-        Data1.setDetDescrVersion(myTag)
-        if isData:
-            print " ==> In collisions and isData True :)   myTag=",myTag
-            myTag = "ATLAS-R2-2015-03-01-00"
-            Data1.setGlobalTag("CONDBR2-BLKPA-2015-14")
-            Data1.setDetDescrVersion(myTag)
-            if HeavyIons:
-                myTag = "ATLAS-R2-2015-03-01-00"
-                print " ==> In collisions and HeavyIons :)   myTag=",myTag
-                Data1.setGlobalTag("COMCOND-BLKPA-RUN1-06")
-                Data1.setDetDescrVersion(myTag)
-            if preIBLgeometry and HeavyIons:
-                print " ==> In preIBLgeometry and HeavyIons :) "
-                Data1.setDetDescrVersion("ATLAS-R1-2011-02-00-00")
-
-    
-    if (eventType[i_sample] == "cosmics"):
-        if isData:
-            print " ==> In cosmics and isData True :) "
-            Data1.setGlobalTag("CONDBR2-BLKPA-2015-14")
-            Data1.setDetDescrVersion("ATLAS-R2-2015-03-01-00")
-        else:
-            print " ==> In cosmics and else :) "
-            Data1.setGlobalTag("OFLCOND-RUN12-SDR-14")
-            Data1.setDetDescrVersion("ATLAS-R2-2015-03-01-00")
-
-    extraOptions["Cosmics"] = False # default is False
-    
-    Data1.setCosmic(False)
-    Data1.setDigitalClustering(False)
-    Data1.setPtMin(thisPtMin)
-    if "cosmics" in eventType[i_sample] or "Cosmics" in eventType[i_sample]:
-        Data1.setProjectName("data15_cos")
-        Data1.setCosmic(True)
-        Data1.setDigitalClustering(True)
-    if HeavyIons:
-        Data1.setProjectName("data11_hi")
-        
-
-    DataToRun.append(Data1) # always add this line to process the defined data
-    print " == configuration sample ",i_sample," completed"
-# end of loop on data types
-
-### Duplicate the previous lines to have as many datasets that you want
-
-    
-for data in DataToRun:
-    data.Print()
-
-# Lumiblock selection
-if userLBselection:
-    extraOptions["LumiblockSelection"] = True
-    extraOptions["LumiblockList"]      = range(userLBrangeFirst,userLBrangeLast+1,1)
-    
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/m/mdanning/AlignmentTestArea/IBL_4br_30Jan/run_misalign/MisalignmentSet1.pool.root"
-inputAlignmentPoolFile = ""
-inputBowingCoolFile    = ""
-readConstantsFromPool = False
-readBowingFromCool    = False
-
-if ConstantsFile != "":
-    inputAlignmentPoolFile=ConstantsFile
-    readConstantsFromPool = True
-
-if BowingDb != "":
-    inputBowingCoolFile = BowingDb
-    readBowingFromCool  = True
-
-
-
-
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions["realData"] = isData
-if isData: 
-   extraOptions["dataSource"]  = 'data' 
-   #extraOptions["projectName"] = 'data15_cos' 
-   #extraOptions["projectName"] = 'data15_comm' 
-   extraOptions["doReadBS"]=True
-else: 
-   extraOptions["dataSource"]  = 'geant4'  
-   #extraOptions["projectName"] = 'MC_Cosmic_BOFF' 
-   extraOptions["doReadBS"]=False
-
-extraOptions["doMonitoring"] = True
-#extraOptions["doTrkNtuple"] = False
-extraOptions["BField"]  = True
-extraOptions["BField_AlgSetup"] = extraOptions["BField"]  
-
-
-#Heavy Ions reconstruction
-extraOptions["HeavyIons"] = HeavyIons
-
-
-
-#
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Nominal"
-#extraOptions["siAlignmentTag"] = "InDetAlign_RUN1-L3IBLm15-CORRECT"
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Initial_fixed"
-#extraOptions["trtAlignmentTag"] = "TRTAlign_nominal"
-
-#25 NS
-extraOptions["siAlignmentTag"] = "InDetAlign-RUN2-25NS"
-extraOptions["trtAlignmentTag"] = "TRTAlign-RUN2-25NS"
-
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-#--- Pixel and IBL alignment
-#extraOptions["AlignIBLbutNotPixel"]= True
-#extraOptions["AlignPixelbutNotIBL"]= True
-
-#extraOptions["LumiblockSelection"] = True
-#extraOptions["LumiblockList"]      = range(100,400,1)
-
-#
-#---- IBL stave bowing alignment
-extraOptions["applyLBibldistTweak"] = False
-extraOptions["writeIBLDistDB"] = True
-
-
-#extraOptions["doBSConstraint"] = False
-#extraOptions["doPVConstraint"] = False
-
-#extraOptions["eoverpmapconstraint"] = ""  # Full path of the map
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-extraOptions["readTRT"] = True
-extraOptions["writeTRT"] = True
-#extraOptions["TRTCalibTextFile"] = ""
-if isData:
-    extraOptions["TRTCalibT0TagCos"] = "" # "TrtCalibT0-AlignmentJune2010-00"
-    extraOptions["TRTCalibRtTagCos"] = "" # "TrtCalibRt-AlignmentJune2010-00"
-else:
-    extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-MCCosmics_00-00" 
-    extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-MCCosmics_00-00" 
-
-## TRT dofs
-extraOptions["trtAlignBarrelX"] = True
-extraOptions["trtAlignBarrelY"] = True
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignBarrelRotX"] = True
-extraOptions["trtAlignBarrelRotY"] = True
-extraOptions["trtAlignBarrelRotZ"] = True
-# end-caps
-extraOptions["trtAlignEndcapX"] = True
-extraOptions["trtAlignEndcapY"] = True
-extraOptions["trtAlignEndcapZ"] = False
-extraOptions["trtAlignEndcapRotX"] = False
-extraOptions["trtAlignEndcapRotY"] = False
-extraOptions["trtAlignEndcapRotZ"] = True
-
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = True
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-extraOptions["pixelAlignBarrelBowX"] = True
-
-## end-caps
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = False
-extraOptions["sctAlignBarrelY"] = False
-extraOptions["sctAlignBarrelZ"] = False
-extraOptions["sctAlignBarrelRotX"] = False
-extraOptions["sctAlignBarrelRotY"] = False
-extraOptions["sctAlignBarrelRotZ"] = False
-## end-caps
-extraOptions["sctAlignEndcapX"] = False
-extraOptions["sctAlignEndcapY"] = False
-extraOptions["sctAlignEndcapZ"] = False
-extraOptions["sctAlignEndcapRotX"] = False
-extraOptions["sctAlignEndcapRotY"] = False
-extraOptions["sctAlignEndcapRotZ"] = True
-             
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [ True, True, True, True, True, True, True, True, True, True]
-AlignPixelBarrel           = [ True, True, True, True, True, True, True, True, True, True]
-AlignPixelEndcaps          = [ True, True, True, True, True, True, True, True, True, True]
-# alignment level for the full Pixel # see InDetAlignGeometryLevel wiki for more info
-PixelAlignmentLevel        = [   11,   11,   11,   11,   11,   11,   11,   11,   11,   11]
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [ True, True, True, True, True, True, True, True, True, True]
-AlignSCTBarrel            =  [ True, True, True, True, True, True, True, True, True, True]
-AlignSCTEndcaps           =  [ True, True, True, True, True, True, True, True, True, True]
-
-# alignment level for the full SCT # see InDetAlignGeometryLevel wiki for more info
-SCTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1] 
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1] 
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1] 
-
-##########
-# TRT
-# are we running TRT alignment # see InDetAlignGeometryLevel wiki for more info
-AlignTRT                  =  [ True, True, True, True, True, True, True, True, True, True]
-AlignTRTBarrel            =  [ True, True, True, True, True, True, True, True, True, True]
-AlignTRTEndcaps           =  [ True, True, True, True, True, True, True, True, True, True]
-# alignment level for the TRT parts
-TRTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1]
-TRTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-TRTAlignmentLevelEndcaps  =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1]
-##########
-# XXXX                  = [False,False,False,False,False,False,False,False,False,False]
-
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [ True, True, True, True, True, True, True, True, True, True]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = inputErrorScalingTag
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py")
-execfile("NewInDetIterator_Rel19.py")
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIteratorOnGrid.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIteratorOnGrid.py
deleted file mode 100644
index 539fafb87643c0e2c70afcbe7d6c9d217605ddc1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIteratorOnGrid.py
+++ /dev/null
@@ -1,244 +0,0 @@
-#
-#################################################################
-#    Script for running ATLAS ID alignment jobs on Grid resources
-#    Authors: Jike Wang      (jike.wang@cern.ch)
-#             Song-Ming Wang (smwang@phys.sinica.edu.tw)
-#################################################################
-
-import os, string, time, datetime
-import sys
-
-# =====================================================================
-#  Run Options
-# =====================================================================
-
-# Number of Iterations and events
-# ===============================
-FirstIteration = 0
-#Iterations = 11
-Iterations = 5
-
-global GridOptions
-GridOptions = {}
-GridOptions["userIDnum"           ] = "user"
-# use NICK NAME be here! See twiki: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/RunIDAlignmentOnGrid to know more
-GridOptions["userIDname"          ] = "jwang"
-# Unless you really know how to select a Site by yourself, you would better leave here to be empty
-GridOptions["siteName"            ] = "ANALY_BNL"
-GridOptions["siteName"            ] = ""
-GridOptions["accumulateLibDS"     ] = ""
-GridOptions["solveLibDS"          ] = ""
-GridOptions["fileList"            ] = ""
-# You should make sure the directory GridOptions["TmpWorkDir"] really exist
-GridOptions["TmpWorkDir"          ] = "/tmp/jwang"
-GridOptions["dbRelease"           ] = "LATEST"
-GridOptions["excludedSite"        ] = "ANALY_BNL"
-#GridOptions["removeFileList"      ] = "list.txt"
-GridOptions["reUseSolveLibDS"     ] = False
-GridOptions["reUseAccumulateLibDS"] = False
-GridOptions["doNFilesPerJobSplit" ] = True
-GridOptions["getMonitoringFiles"  ] = False
-# you could chose from "Grid","Local","Batch","Prun"
-GridOptions["runSolveMode"        ] = "Prun"
-GridOptions["runSolveInTmpDir"    ] = False
-GridOptions["debugLevel"          ] = 0
-GridOptions["nEventsPerJob"       ] = 100
-GridOptions["submitOnlyOneJobset" ] = True
-GridOptions['autoRetry'		  ] = True
-GridOptions["successRatioCut"     ] = 0.95
-
-
-# GridSiteName = 'ANALY_TAIWAN'
-# GridSiteName = 'ANALY_TW-FTT'
-# GridSiteName = 'ANALY_BNL'
-# GridSiteName = 'ANALY_BNL_ATLAS_1'
-# GridSiteName = 'ANALY_TRIUMF'
-# GridSiteName = 'ANALY_QMUL'
-# GridSiteName = 'ANALY_AGLT2'
-# GridSiteName = 'ANALY_GLASGOW'
-# GridSiteName = 'ANALY_DESY-HH'
-# GridSiteName = 'ANALY_LAPP'
-# GridSiteName = 'ANALY_LPC'
-# GridSiteName = 'ANALY_LANCS'
-# GridSiteName = 'ANALY_FZU'
-# GridSiteName = 'ANALY_MANC'
-# GridSiteName = 'ANALY_AUSTRALIA'
-# GridSiteName = 'ANALY_NIKHEF-ELPROD'
-
-# athena paths
-HOME        = os.environ['HOME']
-ATHENAREL   = '16.0.3.6'
-TAGS        = 'opt,slc5,AtlasProduction'
-QUEUE       = '8nh'
-#CMTDIR = HOME+"/cmthome/"
-CMTDIR      = "/afs/cern.ch/user/j/jwang/scratch0/IDAlignmentOnGrid/16.0.3.6_Grid/cmthome/"
-OutputPath  = "./alignment"
-preName     = "JW2"
-OutputLevel = 'DEBUG'
-
-# ======================================
-
-global DatasetsOptions 
-DatasetsOptions = {}
-
-DatasetsOptions["CompareTagsWithAMI"          ] = True;
-DatasetsOptions["doDetailedTagsConfig"        ] = True;
-# explicitly fill the name of your interested dataset be here, seperated by comma(s). For example:
-#DatasetsOptions["CustomedDatasetsNameList"   ] = ["mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731/", "mc09_7TeV.105001.pythia_minbias.recon.ESD.e517_s787_s767_r1250/"]
-DatasetsOptions["CustomedDatasetsNameList"    ] = ["mc09_valid.107271.Multimuons_pt9.recon.ESD.e436_s561_r731/"]
-# You'd better explicitly fill the geometry tag by yourself, otherwise I will retrieve the corresponding geometry tag from AMI for you. But sometimes the retrieve could fail
-DatasetsOptions["CustomedDatasetsDetDescr"    ] = ["", "", ""]
-DatasetsOptions["CustomedDatasetsDetDescrBoff"] = ["", "", ""]
-# You'd better explicitly fill the condition tag by yourself, otherwise I will retrieve the corresponding condition tag from AMI for you. But sometimes the retrieve could fail
-DatasetsOptions["CustomedDatasetsGlobalTag"   ] = ["", "", ""]   
-
-DatasetsOptions["CollisionRunList"            ] = ["141749"]
-DatasetsOptions["CollisionRecoTag"            ] = ["f196"  ] 
-DatasetsOptions["CollisionDetDescr"           ] = ""
-DatasetsOptions["CollisionDetDescrBoff"       ] = ""
-DatasetsOptions["CollisionGlobalTag"          ] = "" 
-DatasetsOptions["CollisionStream"             ] = "MinBias" 
-
-DatasetsOptions["CosBonRunList"               ] = ["141749", "141811"]
-DatasetsOptions["CosBonRecoTag"               ] = ["f196"  , "f196"  ]
-DatasetsOptions["CosBonDetDescr"              ] = ""
-DatasetsOptions["CosBonGlobalTag"             ] = ""
-DatasetsOptions["CosBonStream"                ] = "MinBias"
-
-DatasetsOptions["CosBoffRunList"              ] = ["141749", "141811"]
-DatasetsOptions["CosBoffRecoTag"              ] = ["f196"  , "f196"  ]
-DatasetsOptions["CosBoffDetDescr"             ] = ""
-DatasetsOptions["CosBoffGlobalTag"            ] = ""
-DatasetsOptions["CosBoffStream"               ] = "MinBias"
-
-
-
-from InDetAlignExample.IDAlignGridDatasets import ConfiguredIDAlignDatasets
-# here now you can set Customed, 900GeV, 7TeV 
-Datasets = ConfiguredIDAlignDatasets("Customed", "Nominal", DatasetsOptions)
-
-
-# ======================================
-# Iteration Options
-# ======================================
-
-
-# BE ATTENTION, here the array CustomedCPUs is not for every iteration, it is for every dataset!!!
-# For example, the array in below means the first customed dataset spit to 300CPUs, the second customed dataset spit to 200CPUs, the second customed dataset spit to 300CPUs
-GridOptions["CustomedCPUs"  ] = [ 3,   2,  3, 300, 300, 300, 300, 300, 300, 300]
-
-# CPUs to run collision data
-GridOptions["ColCPUs"       ] = [ 3,  3, 3, 300, 300, 300, 300, 300, 300, 300]
-
-# CPUs to run cosmics
-GridOptions["CosBonCPUs"    ] = [ 0,   0,   0,   0,   0,   0,   0,   0,   0,   0  ]
-
-# CPUs to run cosmics without B Field
-GridOptions["CosBoffCPUs"   ] = [ 0,   0,   0,   0,   0,   0,   0,   0,   0,   0  ] 
-
-# number of files per sub-job, for every customed dataset!!! 
-GridOptions["CustomedNFPJ"  ] = [ 2,   2,   2 , 2,  2,  5]
-
-# number of files per sub-job when running collision data, for every iteration
-GridOptions["ColNFPJ"       ] = [ 5,   5,   5,   5,   5,  10,  10,  10,  10,  10 ]
-
-# number of files to be used, for every customed dataset!!!
-GridOptions["CustomedNFiles"] = [ -1,  -1,   -1 , -1,  -1]
-
-# number of files to be used, for every iteration !!!
-GridOptions["SkipFiles"]      = [ 3,  7, -1, -1, -1, -1, -1, -1, -1,  -1 , -1,  -1]
-
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/a/atlidali/w1/users/johnda/TRTAlignmentForDB/TRTAlignmentL2_3DofTRT_L1_BarrelAndEndcap_L2Endcap_InDetCosmics_06/indetalignment.root"
-#inputAlignmentPoolFile = "/afs/cern.ch/user/a/atlidali/athena/15.5.2.5/InnerDetector/InDetExample/InDetAlignExample/share/CSCLevel1.root"
-inputAlignmentPoolFile = ""
-
-
-#These options will be written to the jobOptions
-doDetailedSplitting = False
-extraOptions = {}
-extraOptions["doMonitoring"      ] = True
-extraOptions["doTrkNtuple"       ] = True
-extraOptions["doVtxNtuple"       ] = True
-extraOptions["writeEigenMat"]  = True
-extraOptions["writeEigenMatTxt"]  = True
-
-GridOptions["writeEigenMat"]  = True     
-GridOptions["writeEigenMatTxt"]  = True
-
-
-GridOptions["doMonitoring"       ] = extraOptions["doMonitoring"]
-GridOptions["doTrkNtuple"        ] = extraOptions["doTrkNtuple"]
-GridOptions["doVtxNtuple"        ] = extraOptions["doVtxNtuple"]
-
-
-
-
-extraOptions["softModeCut"]       = 0.02 
-extraOptions["siAlignmentTag"]    = "InDetAlign_Nominal_RDeltaR_01"
-extraOptions["trtAlignmentTag"]   = "TRTAlign_Nominal_RDeltaR_01"
-#extraOptions["siAlignmentTag"   ] = "InDet_Cosmic_2009_01"
-#extraOptions["siAlignmentTag"   ] = "InDetAlign_Collision_2009_08"
-#extraOptions["trtAlignmentTag"  ] = "TRTAlign_Collision_2009_04"
-#extraOptions["beamSpotTag"      ] = "IndetBeampos-ES1-UPD2"
-extraOptions["ModCut"            ] = 4
-extraOptions["doBSConstraint"    ] = False
-extraOptions["useOldPreProcessor"] = False
-#extraOptions["CosmicGRL"        ] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"     ] = "ColisionGRL.xml"
-extraOptions["useTRT"            ] = False
-extraOptions["readTRT"           ] = False
-extraOptions["writeTRT"          ] = False
-#extraOptions["TRTCalibTextFile" ]  = ""
-#extraOptions["TRTCalibTextFile" ]  = "/afs/cern.ch/user/a/atlidali/w0/users/johnda/fall2008ReprocessingFieldOnNewT0s.txt"
-
-
-useTFile 	    = False
-# do the solving? (Set to false only to do quick reconstruction tests)
-doAccumulate 	    = True
-doSolve 	    = True
-doCompareMonitoring = True
-
-
-# Sub-detector Alignment
-AlignPixel                 =  [True,True,True,True,True,True,True,True,True,True]
-PixelAlignmentLevel        =  [2,   3,   3,   3,   3,   3,   1,   1,   2,   2   ]
-AlignPixelBarrel           =  [True,True,True,True,True,True,True,True,True,True]
-PixelAlignmentLevelBarrel  =  [2,   3,   3,   3,   3,   3,   1,   1,   2,   2   ] 
-AlignPixelEndcaps          =  [True,True,True,True,True,True,True,True,True,True]
-PixelAlignmentLevelEndcaps =  [2,   3,   3,   3,   3,   3,   1,   1,   2,   2   ]   
-
-AlignSCT                   =  [True,True,True,True,True,True,True,True,True,True]
-SCTAlignmentLevel          =  [2,   3,   3,   3,   3,   3,   1,   1,   2,   2   ] 
-AlignSCTBarrel             =  [True,True,True,True,True,True,True,True,True,True]
-SCTAlignmentLevelBarrel    =  [2,   3,   3,   3,   3,   3,   2,   2,   2,   2   ] 
-AlignSCTEndcaps            =  [True,True,True,True,True,True,True,True,True,True]
-SCTAlignmentLevelEndcaps   =  [2,   3,   3,   3,   3,   3,   2,   2,   2,   2   ] 
-
-
-AlignTRT           	   =  [False,False,False,False,False,False,False,False,False,False]
-TRTAlignmentLevel   	   =  [2,    2,    2,    2,    2,    2,    1,    1,    1,    1    ] 
-
-#AlignInDet                = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-# Error Scaling
-# =============================
-ErrorScaling        	  =  [False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-#errorScalingTag = "/afs/cern.ch/atlas/calib/id/calib_2/users/lacuesta/NewAlignment_From_InDet_Cosmic_2009_01/mycoolEC200.db"
-
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-#MonitoringScript = "/afs/cern.ch/user/a/atlidali/athena/15.5.2.5/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/InDetMonitoringBon.py"
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/IteratorGrid.py >/dev/null")
-execfile("IteratorGrid.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_EoPMaps.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_EoPMaps.py
deleted file mode 100755
index b691fe67910b1de2bdcc00ccb99e5c538fd970a0..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_EoPMaps.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode        = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE 	       = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'EoverPMaps'
-
-HOME 	       = os.environ['HOME']
-# Job Output
-#OutputPath     = os.environ['PWD']+"/."
-OutputPath = '/afs/cern.ch/user/l/lacuesta/w0/users/lacuesta/EoPMaps_LargePeriod/'
-CMTDIR 	       = HOME+"/athena/cmthome/"
-# extra AtlasSetup options 
-ASetupOptions  = "single"  
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'DEBUG'
-
-
-##########################################################
-#		Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-Data1 = setupData('Egamma') # Name for the dataset, the output subpaths will have this name
-#Data1.setDataType("MC10_Singlemuons") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setDataType("Egamma") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-Data1.setRecoTags(["f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f405_m986","f406_m992","f406_m992","f406_m992","f406_m992"])
-Data1.setRuns([189598,189600,189602,189610,189639,189655,189660,189692,189693,189719,189751,189774,189781,189813,189822,189836,189845,189875]) # Run number, you can provide a list of runs
-Data1.setCPUs([200]) # Number of CPUs per iteration to process this data
-Data1.setEvents([-1]) # Number of total events to process
-#Data1.setLimitFiles() # Limit the number of files to use (useful when runing in local a subset of data)
-Data1.CreateFileList() # Creates the file list
-## Data1.setCustomFileList("filelist") # Use your own filelist, WARNING: comment the CreateFileList line
-Data1.setGlobalTag("COMCOND-BLKPST-005-05") # Use custom Global Tag, if not given it will use the data default one
-Data1.setDetDescrVersion("ATLAS-GEO-18-01-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-DataToRun.append(Data1) # always add this line to process the defined data
-### Duplicate the previous lines to have as many datasets that you want
-
-# Data2 = setupData('Egamma_187552') # Name for the dataset, the output subpaths will have this name
-# #Data1.setDataType("MC10_Singlemuons") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-# Data2.setDataType("Egamma") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-# Data2.setRecoTags(["f396_m946"])
-# Data2.setRuns([187552]) # Run number, you can provide a list of runs
-# Data2.setCPUs([50]) # Number of CPUs per iteration to process this data
-# Data2.setEvents([-1]) # Number of total events to process
-# #Data1.setLimitFiles() # Limit the number of files to use (useful when runing in local a subset of data)
-# Data2.CreateFileList() # Creates the file list
-# ## Data1.setCustomFileList("filelist") # Use your own filelist, WARNING: comment the CreateFileList line
-# Data2.setGlobalTag("COMCOND-BLKPST-005-05") # Use custom Global Tag, if not given it will use the data default one
-# Data2.setDetDescrVersion("ATLAS-GEO-18-01-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-# DataToRun.append(Data2) # always add this line to process the defined data
-# ### Duplicate the previous lines to have as many datasets that you want
-
-for data in DataToRun:
-	data.Print()
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-inputAlignmentPoolFile = ""
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-GoodRunList = "/afs/cern.ch/user/a/atlasdqm/www/grlgen/CombinedPerf/Egamma/Eg_standard_v5/data11_7TeV.periodAllYear_DetStatus-v32-pro09_CoolRunQuery-00-04-00_Eg_standard.xml"
-os.system("get_files -jo InDetAlignExample/NewInDetIterator_EoPMaps.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator_EoPMaps.py")
-execfile("NewInDetIterator_EoPMaps.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_L11.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_L11.py
deleted file mode 100755
index 051a2e05104d7ef76922ec9f81bf4fe747bf2abc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_L11.py
+++ /dev/null
@@ -1,480 +0,0 @@
-
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 2
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-QUEUE = '1nh'
-#QUEUE = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'IDAling_'
-
-#suffix to the folder name
-folderSuffix = ""
-
-HOME           = os.environ['HOME']
-# Alignment Output
-OutputPath     = os.environ['PWD']+"/."
-
-CMTDIR         = HOME+"/athena/cmthome/"
-# extra AtlasSetup options
-ASetupOptions  = "single"
-#ASetupOptions  = "nightlies"
-
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'INFO'
-
-# list of extra options for NewInDetAlignAlgSetup
-extraOptions = {}
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    from optparse import OptionParser
-    parser = OptionParser()
-    parser.add_option("--ClusteringAlgo",dest="ClusteringAlgo", help="Which Clustering algorithm to use: NN (Default), Analog, Digital. NOT FULLY WORKING",default="NN")
-    parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-    parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-    parser.add_option("--HeavyIons", dest="HeavyIons", help="Set it to true if you want to reconstruct HeavyIons",action="store_true",default=False)
-    parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-    parser.add_option("--inputDir", dest="inputDir", help="Directory containing the input files - NOT YET IMPLEMENTED", default="")
-    parser.add_option("--inputBowingDb", dest="inputBowingDb", help="In the case you want to use a specific IBL bowing  write here the absolute path to the cool file", default="")
-    parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-    parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: True)",action="store_true", default=True)
-    parser.add_option("--LBrangeFirst", dest="LBrangeFirst", help=" Setting this the LumiBlock selection is set to true and one sets the lower LB to be accepted", default=0)
-    parser.add_option("--LBrangeLast", dest="LBrangeLast", help=" Setting this the LumiBlock selection is set to true and one sets the upper LB to be accepted", default=4096)
-    parser.add_option("--nCpus",dest="nCpus", help="Number of CPUs to be used", default = "1")
-    parser.add_option("--nEvents",dest="nEvents", help="Maximum number of events to use", default = "-1")
-    parser.add_option("--nIter",dest="nIter", help="Number of iterations to be executed", default = "")
-    parser.add_option("--prefix", dest="prefix", help="prefix to the jobs name", default="")
-    parser.add_option("--preIBLgeometry",dest="preIBLgeometry", help="Set it when you want to run on Run1 geometry (Default: False)",action="store_true",default=False)
-    parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = "2000")
-    parser.add_option("--queue",dest="userQueue", help="name of the LSF queue were jobs will be submitted", default="")
-    parser.add_option("--suffix", dest="suffix", help="suffix to the IterN folder name --> IterN_suffix", default="")
-    
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    return config
-    
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputList=config.inputList
-inputDir =config.inputDir
-eventType=config.eventType
-HeavyIons=config.HeavyIons
-ConstantsFile=config.inputConstantsFile
-BowingDb=config.inputBowingDb
-nEventsMax=config.nEvents
-preIBLgeometry=config.preIBLgeometry
-isData=config.isData
-ClusteringAlgo=config.ClusteringAlgo
-inputErrorScalingTag=config.errorScalingTag
-nCpus=config.nCpus
-userPtMin = config.userPtMin
-userPrefix = config.prefix
-userSuffix = config.suffix
-userLBselection = (config.LBrangeFirst > 0) or (config.LBrangeLast < 4096)
-userLBrangeFirst = int(config.LBrangeFirst)
-userLBrangeLast = int(config.LBrangeLast)
-userQueue = config.userQueue
-userNIter = config.nIter
-
-
-# split the possible collections
-inputList = inputList.split()
-eventType = eventType.split()
-nCpus = nCpus.split()
-nEventsMax = nEventsMax.split()
-userPtMin = userPtMin.split()
-
-# check that inputList and eventype have the same number of elements
-if (len(inputList) != len(eventType)):
-    print " <RunIterator> ERROR no input list. Please provide a set of files with data to be processed"
-    exit()
-
-#prefix for the job's name
-if (len(userPrefix) > 0):
-    preName = userPrefix
-
-if (len(userSuffix) > 0):
-    folderSuffix = "_"+userSuffix
-
-# LSF queue
-if (len(userQueue)>0):
-    QUEUE = userQueue
-
-# Number of iterations
-if (len(userNIter)>0):
-    Iterations     = int(userNIter)
-
-##########################################################
-#               Print input parameters                   #
-##########################################################
-
-print " \n <RunIterator> ----- User input in command line --- "
-if (len(folderSuffix)>0): print " <RunIterator> folder suffix = ", folderSuffix
-print " <RunIterator> inputList = ",inputList
-print " <RunIterator> nCpus = ",nCpus
-print " <RunIterator> nEventsMax = ",nEventsMax
-if (len(ConstantsFile)>0): print " <RunIterator> ConstantsFile = ",ConstantsFile
-if (len(BowingDb)>0): print " <RunIterator> BowingDb = ", BowingDb
-if (len(inputErrorScalingTag)>0): print " <RunIterator> inputErrorScalingTag = ",inputErrorScalingTag
-if (len(userPtMin)>0): print " <RunIterator> userPtMin = ",userPtMin, " MeV"
-print " <RunIterator> eventType = ",eventType
-print " <RunIterator> iterating on ",len(eventType),"samples "
-if (len(userNIter)>0): print " <RunIterator> #Iterations = ",Iterations
-if userLBselection:
-    print " <RunIterator> LB range = ",userLBrangeFirst, " --> ", userLBrangeLast
-
-##########################################################
-#       Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-for i_sample in range(len(inputList)):
-    print " "
-    print " ==== configuring sample #",i_sample
-    Data1 = setupData(eventType[i_sample])
-    #Need To be changed this one
-    myDataType = "Data_15" + eventType[i_sample]
-    #Data1.setDataType("MinBias_Data_15") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    Data1.setDataType(myDataType) # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    
-    # number of CPUS to be used in each iteration to process this data type
-    thisNCpus = int(nCpus[0]) 
-    if (len(nCpus) >= i_sample+1):
-        thisNCpus = int(nCpus[i_sample])
-    Data1.setCPUs([thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus])
-    
-    # number of events to be processed 
-    thisNEvents = int(nEventsMax[0])
-    if (len(nEventsMax) >= i_sample+1):
-         thisNEvents = int(nEventsMax[i_sample])
-    Data1.setEvents([thisNEvents,thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents])
-    Data1.setLimitFiles(5000) # Limit the number of files to use (useful when runing in local a subset of data)
-    #Data1.setRuns([201280]) # Run number, you can provide a list of runs
-    #Data1.CreateFileList() # Creates the file list
-    
-    # figure out the mimimum pt
-    thisPtMin = userPtMin[0]
-    if (len(userPtMin) >= i_sample+1):
-         thisPtMin = userPtMin[i_sample]
-
-    #     
-    if isData:
-        Data1.setByteStream(True)
-    else:
-        Data1.setByteStream(False)
-        
-    Data1.setCustomFileList(inputList[i_sample])
-
-    # Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-    if (eventType[i_sample] == "collisions"):
-        # default
-        myTag = "ATLAS-R2-2015-03-01-00"
-        print " ==> default tag   myTag=",myTag            
-        Data1.setGlobalTag("OFLCOND-RUN12-SDR-28")
-        Data1.setDetDescrVersion(myTag)
-        if isData:
-            print " ==> In collisions and isData True :)   myTag=",myTag
-            myTag = "ATLAS-R2-2015-03-01-00"
-            Data1.setGlobalTag("CONDBR2-BLKPA-2015-14")
-            Data1.setDetDescrVersion(myTag)
-            if HeavyIons:
-                myTag = "ATLAS-R2-2015-03-01-00"
-                print " ==> In collisions and HeavyIons :)   myTag=",myTag
-                Data1.setGlobalTag("COMCOND-BLKPA-RUN1-06")
-                Data1.setDetDescrVersion(myTag)
-            if preIBLgeometry and HeavyIons:
-                print " ==> In preIBLgeometry and HeavyIons :) "
-                Data1.setDetDescrVersion("ATLAS-R1-2011-02-00-00")
-
-    
-    if (eventType[i_sample] == "cosmics"):
-        if isData:
-            print " ==> In cosmics and isData True :) "
-            Data1.setGlobalTag("CONDBR2-BLKPA-2015-14")
-            Data1.setDetDescrVersion("ATLAS-R2-2015-03-01-00")
-        else:
-            print " ==> In cosmics and else :) "
-            Data1.setGlobalTag("OFLCOND-RUN12-SDR-14")
-            Data1.setDetDescrVersion("ATLAS-R2-2015-03-01-00")
-
-    extraOptions["Cosmics"] = False # default is False
-    
-    Data1.setCosmic(False)
-    Data1.setDigitalClustering(False)
-    Data1.setPtMin(thisPtMin)
-    if "cosmics" in eventType[i_sample] or "Cosmics" in eventType[i_sample]:
-        Data1.setProjectName("data15_cos")
-        Data1.setCosmic(True)
-        Data1.setDigitalClustering(True)
-    if HeavyIons:
-        Data1.setProjectName("data11_hi")
-        
-
-    DataToRun.append(Data1) # always add this line to process the defined data
-    print " == configuration sample ",i_sample," completed"
-# end of loop on data types
-
-### Duplicate the previous lines to have as many datasets that you want
-
-    
-for data in DataToRun:
-    data.Print()
-
-# Lumiblock selection
-if userLBselection:
-    extraOptions["LumiblockSelection"] = True
-    extraOptions["LumiblockList"]      = range(userLBrangeFirst,userLBrangeLast+1,1)
-    
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/m/mdanning/AlignmentTestArea/IBL_4br_30Jan/run_misalign/MisalignmentSet1.pool.root"
-inputAlignmentPoolFile = ""
-inputBowingCoolFile    = ""
-readConstantsFromPool = False
-readBowingFromCool    = False
-
-if ConstantsFile != "":
-    inputAlignmentPoolFile=ConstantsFile
-    readConstantsFromPool = True
-
-if BowingDb != "":
-    inputBowingCoolFile = BowingDb
-    readBowingFromCool  = True
-
-
-
-
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions["realData"] = isData
-if isData: 
-   extraOptions["dataSource"]  = 'data' 
-   #extraOptions["projectName"] = 'data15_cos' 
-   #extraOptions["projectName"] = 'data15_comm' 
-   extraOptions["doReadBS"]=True
-else: 
-   extraOptions["dataSource"]  = 'geant4'  
-   #extraOptions["projectName"] = 'MC_Cosmic_BOFF' 
-   extraOptions["doReadBS"]=False
-
-extraOptions["doMonitoring"] = True
-#extraOptions["doTrkNtuple"] = False
-extraOptions["BField"]  = True
-extraOptions["BField_AlgSetup"] = extraOptions["BField"]  
-
-
-#Heavy Ions reconstruction
-extraOptions["HeavyIons"] = HeavyIons
-
-
-
-#
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Nominal"
-#extraOptions["siAlignmentTag"] = "InDetAlign_RUN1-L3IBLm15-CORRECT"
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Initial_fixed"
-#extraOptions["trtAlignmentTag"] = "TRTAlign_nominal"
-
-#25 NS
-extraOptions["siAlignmentTag"] = "InDetAlign-RUN2-25NS"
-extraOptions["trtAlignmentTag"] = "TRTAlign-RUN2-25NS"
-
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-#--- Pixel and IBL alignment
-#extraOptions["AlignIBLbutNotPixel"]= True
-#extraOptions["AlignPixelbutNotIBL"]= True
-
-#extraOptions["LumiblockSelection"] = True
-#extraOptions["LumiblockList"]      = range(100,400,1)
-
-#
-#---- IBL stave bowing alignment
-extraOptions["applyLBibldistTweak"] = False
-extraOptions["writeIBLDistDB"] = True
-
-
-#extraOptions["doBSConstraint"] = False
-#extraOptions["doPVConstraint"] = False
-
-#extraOptions["eoverpmapconstraint"] = ""  # Full path of the map
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-extraOptions["readTRT"] = True
-extraOptions["writeTRT"] = True
-#extraOptions["TRTCalibTextFile"] = ""
-if isData:
-    extraOptions["TRTCalibT0TagCos"] = "" # "TrtCalibT0-AlignmentJune2010-00"
-    extraOptions["TRTCalibRtTagCos"] = "" # "TrtCalibRt-AlignmentJune2010-00"
-else:
-    extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-MCCosmics_00-00" 
-    extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-MCCosmics_00-00" 
-
-## TRT dofs
-extraOptions["trtAlignBarrelX"] = True
-extraOptions["trtAlignBarrelY"] = True
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignBarrelRotX"] = True
-extraOptions["trtAlignBarrelRotY"] = True
-extraOptions["trtAlignBarrelRotZ"] = True
-# end-caps
-extraOptions["trtAlignEndcapX"] = True
-extraOptions["trtAlignEndcapY"] = True
-extraOptions["trtAlignEndcapZ"] = False
-extraOptions["trtAlignEndcapRotX"] = False
-extraOptions["trtAlignEndcapRotY"] = False
-extraOptions["trtAlignEndcapRotZ"] = True
-
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = True
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-extraOptions["pixelAlignBarrelBowX"] = True
-
-## end-caps
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = False
-extraOptions["sctAlignBarrelY"] = False
-extraOptions["sctAlignBarrelZ"] = False
-extraOptions["sctAlignBarrelRotX"] = False
-extraOptions["sctAlignBarrelRotY"] = False
-extraOptions["sctAlignBarrelRotZ"] = False
-## end-caps
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = False
-extraOptions["sctAlignEndcapRotX"] = False
-extraOptions["sctAlignEndcapRotY"] = False
-extraOptions["sctAlignEndcapRotZ"] = True
-             
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [ True, True, True, True, True, True, True, True, True, True]
-AlignPixelBarrel           = [ True, True, True, True, True, True, True, True, True, True]
-AlignPixelEndcaps          = [ True, True, True, True, True, True, True, True, True, True]
-# alignment level for the full Pixel # see InDetAlignGeometryLevel wiki for more info
-PixelAlignmentLevel        = [   11,   11,   11,   11,   11,   11,   11,   11,   11,   11]
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [ True, True, True, True, True, True, True, True, True, True]
-AlignSCTBarrel            =  [ True, True, True, True, True, True, True, True, True, True]
-AlignSCTEndcaps           =  [ True, True, True, True, True, True, True, True, True, True]
-
-# alignment level for the full SCT # see InDetAlignGeometryLevel wiki for more info
-SCTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1] 
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1] 
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1] 
-
-##########
-# TRT
-# are we running TRT alignment # see InDetAlignGeometryLevel wiki for more info
-AlignTRT                  =  [ True, True, True, True, True, True, True, True, True, True]
-AlignTRTBarrel            =  [ True, True, True, True, True, True, True, True, True, True]
-AlignTRTEndcaps           =  [ True, True, True, True, True, True, True, True, True, True]
-# alignment level for the TRT parts
-TRTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1]
-TRTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-TRTAlignmentLevelEndcaps  =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1]
-##########
-# XXXX                  = [False,False,False,False,False,False,False,False,False,False]
-
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [ True, True, True, True, True, True, True, True, True, True]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = inputErrorScalingTag
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py")
-execfile("NewInDetIterator_Rel19.py")
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_L16.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_L16.py
deleted file mode 100755
index e90a1d7e27cde5d7247436b7a5eacaaec3f28841..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_L16.py
+++ /dev/null
@@ -1,480 +0,0 @@
-
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 2
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-QUEUE = '1nh'
-#QUEUE = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'IDAling_'
-
-#suffix to the folder name
-folderSuffix = ""
-
-HOME           = os.environ['HOME']
-# Alignment Output
-OutputPath     = os.environ['PWD']+"/."
-
-CMTDIR         = HOME+"/athena/cmthome/"
-# extra AtlasSetup options
-ASetupOptions  = "single"
-#ASetupOptions  = "nightlies"
-
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'INFO'
-
-# list of extra options for NewInDetAlignAlgSetup
-extraOptions = {}
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    from optparse import OptionParser
-    parser = OptionParser()
-    parser.add_option("--ClusteringAlgo",dest="ClusteringAlgo", help="Which Clustering algorithm to use: NN (Default), Analog, Digital. NOT FULLY WORKING",default="NN")
-    parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-    parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-    parser.add_option("--HeavyIons", dest="HeavyIons", help="Set it to true if you want to reconstruct HeavyIons",action="store_true",default=False)
-    parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-    parser.add_option("--inputDir", dest="inputDir", help="Directory containing the input files - NOT YET IMPLEMENTED", default="")
-    parser.add_option("--inputBowingDb", dest="inputBowingDb", help="In the case you want to use a specific IBL bowing  write here the absolute path to the cool file", default="")
-    parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-    parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: True)",action="store_true", default=True)
-    parser.add_option("--LBrangeFirst", dest="LBrangeFirst", help=" Setting this the LumiBlock selection is set to true and one sets the lower LB to be accepted", default=0)
-    parser.add_option("--LBrangeLast", dest="LBrangeLast", help=" Setting this the LumiBlock selection is set to true and one sets the upper LB to be accepted", default=4096)
-    parser.add_option("--nCpus",dest="nCpus", help="Number of CPUs to be used", default = "1")
-    parser.add_option("--nEvents",dest="nEvents", help="Maximum number of events to use", default = "-1")
-    parser.add_option("--nIter",dest="nIter", help="Number of iterations to be executed", default = "")
-    parser.add_option("--prefix", dest="prefix", help="prefix to the jobs name", default="")
-    parser.add_option("--preIBLgeometry",dest="preIBLgeometry", help="Set it when you want to run on Run1 geometry (Default: False)",action="store_true",default=False)
-    parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = "2000")
-    parser.add_option("--queue",dest="userQueue", help="name of the LSF queue were jobs will be submitted", default="")
-    parser.add_option("--suffix", dest="suffix", help="suffix to the IterN folder name --> IterN_suffix", default="")
-    
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    return config
-    
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputList=config.inputList
-inputDir =config.inputDir
-eventType=config.eventType
-HeavyIons=config.HeavyIons
-ConstantsFile=config.inputConstantsFile
-BowingDb=config.inputBowingDb
-nEventsMax=config.nEvents
-preIBLgeometry=config.preIBLgeometry
-isData=config.isData
-ClusteringAlgo=config.ClusteringAlgo
-inputErrorScalingTag=config.errorScalingTag
-nCpus=config.nCpus
-userPtMin = config.userPtMin
-userPrefix = config.prefix
-userSuffix = config.suffix
-userLBselection = (config.LBrangeFirst > 0) or (config.LBrangeLast < 4096)
-userLBrangeFirst = int(config.LBrangeFirst)
-userLBrangeLast = int(config.LBrangeLast)
-userQueue = config.userQueue
-userNIter = config.nIter
-
-
-# split the possible collections
-inputList = inputList.split()
-eventType = eventType.split()
-nCpus = nCpus.split()
-nEventsMax = nEventsMax.split()
-userPtMin = userPtMin.split()
-
-# check that inputList and eventype have the same number of elements
-if (len(inputList) != len(eventType)):
-    print " <RunIterator> ERROR no input list. Please provide a set of files with data to be processed"
-    exit()
-
-#prefix for the job's name
-if (len(userPrefix) > 0):
-    preName = userPrefix
-
-if (len(userSuffix) > 0):
-    folderSuffix = "_"+userSuffix
-
-# LSF queue
-if (len(userQueue)>0):
-    QUEUE = userQueue
-
-# Number of iterations
-if (len(userNIter)>0):
-    Iterations     = int(userNIter)
-
-##########################################################
-#               Print input parameters                   #
-##########################################################
-
-print " \n <RunIterator> ----- User input in command line --- "
-if (len(folderSuffix)>0): print " <RunIterator> folder suffix = ", folderSuffix
-print " <RunIterator> inputList = ",inputList
-print " <RunIterator> nCpus = ",nCpus
-print " <RunIterator> nEventsMax = ",nEventsMax
-if (len(ConstantsFile)>0): print " <RunIterator> ConstantsFile = ",ConstantsFile
-if (len(BowingDb)>0): print " <RunIterator> BowingDb = ", BowingDb
-if (len(inputErrorScalingTag)>0): print " <RunIterator> inputErrorScalingTag = ",inputErrorScalingTag
-if (len(userPtMin)>0): print " <RunIterator> userPtMin = ",userPtMin, " MeV"
-print " <RunIterator> eventType = ",eventType
-print " <RunIterator> iterating on ",len(eventType),"samples "
-if (len(userNIter)>0): print " <RunIterator> #Iterations = ",Iterations
-if userLBselection:
-    print " <RunIterator> LB range = ",userLBrangeFirst, " --> ", userLBrangeLast
-
-##########################################################
-#       Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-for i_sample in range(len(inputList)):
-    print " "
-    print " ==== configuring sample #",i_sample
-    Data1 = setupData(eventType[i_sample])
-    #Need To be changed this one
-    myDataType = "Data_15" + eventType[i_sample]
-    #Data1.setDataType("MinBias_Data_15") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    Data1.setDataType(myDataType) # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    
-    # number of CPUS to be used in each iteration to process this data type
-    thisNCpus = int(nCpus[0]) 
-    if (len(nCpus) >= i_sample+1):
-        thisNCpus = int(nCpus[i_sample])
-    Data1.setCPUs([thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus,thisNCpus])
-    
-    # number of events to be processed 
-    thisNEvents = int(nEventsMax[0])
-    if (len(nEventsMax) >= i_sample+1):
-         thisNEvents = int(nEventsMax[i_sample])
-    Data1.setEvents([thisNEvents,thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents, thisNEvents])
-    Data1.setLimitFiles(5000) # Limit the number of files to use (useful when runing in local a subset of data)
-    #Data1.setRuns([201280]) # Run number, you can provide a list of runs
-    #Data1.CreateFileList() # Creates the file list
-    
-    # figure out the mimimum pt
-    thisPtMin = userPtMin[0]
-    if (len(userPtMin) >= i_sample+1):
-         thisPtMin = userPtMin[i_sample]
-
-    #     
-    if isData:
-        Data1.setByteStream(True)
-    else:
-        Data1.setByteStream(False)
-        
-    Data1.setCustomFileList(inputList[i_sample])
-
-    # Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-    if (eventType[i_sample] == "collisions"):
-        # default
-        myTag = "ATLAS-R2-2015-03-01-00"
-        print " ==> default tag   myTag=",myTag            
-        Data1.setGlobalTag("OFLCOND-RUN12-SDR-28")
-        Data1.setDetDescrVersion(myTag)
-        if isData:
-            print " ==> In collisions and isData True :)   myTag=",myTag
-            myTag = "ATLAS-R2-2015-03-01-00"
-            Data1.setGlobalTag("CONDBR2-BLKPA-2015-14")
-            Data1.setDetDescrVersion(myTag)
-            if HeavyIons:
-                myTag = "ATLAS-R2-2015-03-01-00"
-                print " ==> In collisions and HeavyIons :)   myTag=",myTag
-                Data1.setGlobalTag("COMCOND-BLKPA-RUN1-06")
-                Data1.setDetDescrVersion(myTag)
-            if preIBLgeometry and HeavyIons:
-                print " ==> In preIBLgeometry and HeavyIons :) "
-                Data1.setDetDescrVersion("ATLAS-R1-2011-02-00-00")
-
-    
-    if (eventType[i_sample] == "cosmics"):
-        if isData:
-            print " ==> In cosmics and isData True :) "
-            Data1.setGlobalTag("CONDBR2-BLKPA-2015-14")
-            Data1.setDetDescrVersion("ATLAS-R2-2015-03-01-00")
-        else:
-            print " ==> In cosmics and else :) "
-            Data1.setGlobalTag("OFLCOND-RUN12-SDR-14")
-            Data1.setDetDescrVersion("ATLAS-R2-2015-03-01-00")
-
-    extraOptions["Cosmics"] = False # default is False
-    
-    Data1.setCosmic(False)
-    Data1.setDigitalClustering(False)
-    Data1.setPtMin(thisPtMin)
-    if "cosmics" in eventType[i_sample] or "Cosmics" in eventType[i_sample]:
-        Data1.setProjectName("data15_cos")
-        Data1.setCosmic(True)
-        Data1.setDigitalClustering(True)
-    if HeavyIons:
-        Data1.setProjectName("data11_hi")
-        
-
-    DataToRun.append(Data1) # always add this line to process the defined data
-    print " == configuration sample ",i_sample," completed"
-# end of loop on data types
-
-### Duplicate the previous lines to have as many datasets that you want
-
-    
-for data in DataToRun:
-    data.Print()
-
-# Lumiblock selection
-if userLBselection:
-    extraOptions["LumiblockSelection"] = True
-    extraOptions["LumiblockList"]      = range(userLBrangeFirst,userLBrangeLast+1,1)
-    
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/m/mdanning/AlignmentTestArea/IBL_4br_30Jan/run_misalign/MisalignmentSet1.pool.root"
-inputAlignmentPoolFile = ""
-inputBowingCoolFile    = ""
-readConstantsFromPool = False
-readBowingFromCool    = False
-
-if ConstantsFile != "":
-    inputAlignmentPoolFile=ConstantsFile
-    readConstantsFromPool = True
-
-if BowingDb != "":
-    inputBowingCoolFile = BowingDb
-    readBowingFromCool  = True
-
-
-
-
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions["realData"] = isData
-if isData: 
-   extraOptions["dataSource"]  = 'data' 
-   #extraOptions["projectName"] = 'data15_cos' 
-   #extraOptions["projectName"] = 'data15_comm' 
-   extraOptions["doReadBS"]=True
-else: 
-   extraOptions["dataSource"]  = 'geant4'  
-   #extraOptions["projectName"] = 'MC_Cosmic_BOFF' 
-   extraOptions["doReadBS"]=False
-
-extraOptions["doMonitoring"] = True
-#extraOptions["doTrkNtuple"] = False
-extraOptions["BField"]  = True
-extraOptions["BField_AlgSetup"] = extraOptions["BField"]  
-
-
-#Heavy Ions reconstruction
-extraOptions["HeavyIons"] = HeavyIons
-
-
-
-#
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Nominal"
-#extraOptions["siAlignmentTag"] = "InDetAlign_RUN1-L3IBLm15-CORRECT"
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Initial_fixed"
-#extraOptions["trtAlignmentTag"] = "TRTAlign_nominal"
-
-#25 NS
-extraOptions["siAlignmentTag"] = "InDetAlign-RUN2-25NS"
-extraOptions["trtAlignmentTag"] = "TRTAlign-RUN2-25NS"
-
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-#--- Pixel and IBL alignment
-extraOptions["AlignIBLbutNotPixel"]= True
-#extraOptions["AlignPixelbutNotIBL"]= True
-
-#extraOptions["LumiblockSelection"] = True
-#extraOptions["LumiblockList"]      = range(100,400,1)
-
-#
-#---- IBL stave bowing alignment
-extraOptions["applyLBibldistTweak"] = False
-extraOptions["writeIBLDistDB"] = True
-
-
-#extraOptions["doBSConstraint"] = False
-#extraOptions["doPVConstraint"] = False
-
-#extraOptions["eoverpmapconstraint"] = ""  # Full path of the map
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-extraOptions["readTRT"] = True
-extraOptions["writeTRT"] = True
-#extraOptions["TRTCalibTextFile"] = ""
-if isData:
-    extraOptions["TRTCalibT0TagCos"] = "" # "TrtCalibT0-AlignmentJune2010-00"
-    extraOptions["TRTCalibRtTagCos"] = "" # "TrtCalibRt-AlignmentJune2010-00"
-else:
-    extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-MCCosmics_00-00" 
-    extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-MCCosmics_00-00" 
-
-## TRT dofs
-extraOptions["trtAlignBarrelX"] = True
-extraOptions["trtAlignBarrelY"] = True
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignBarrelRotX"] = True
-extraOptions["trtAlignBarrelRotY"] = True
-extraOptions["trtAlignBarrelRotZ"] = True
-# end-caps
-extraOptions["trtAlignEndcapX"] = True
-extraOptions["trtAlignEndcapY"] = True
-extraOptions["trtAlignEndcapZ"] = False
-extraOptions["trtAlignEndcapRotX"] = False
-extraOptions["trtAlignEndcapRotY"] = False
-extraOptions["trtAlignEndcapRotZ"] = True
-
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = False
-extraOptions["pixelAlignBarrelY"] = False
-extraOptions["pixelAlignBarrelZ"] = False
-extraOptions["pixelAlignBarrelRotX"] = False
-extraOptions["pixelAlignBarrelRotY"] = False
-extraOptions["pixelAlignBarrelRotZ"] = False
-extraOptions["pixelAlignBarrelBowX"] = True
-
-## end-caps
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = False
-extraOptions["sctAlignBarrelY"] = False
-extraOptions["sctAlignBarrelZ"] = False
-extraOptions["sctAlignBarrelRotX"] = False
-extraOptions["sctAlignBarrelRotY"] = False
-extraOptions["sctAlignBarrelRotZ"] = False
-## end-caps
-extraOptions["sctAlignEndcapX"] = False
-extraOptions["sctAlignEndcapY"] = False
-extraOptions["sctAlignEndcapZ"] = False
-extraOptions["sctAlignEndcapRotX"] = False
-extraOptions["sctAlignEndcapRotY"] = False
-extraOptions["sctAlignEndcapRotZ"] = False
-             
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [ True, True, True, True, True, True, True, True, True, True]
-AlignPixelBarrel           = [ True, True, True, True, True, True, True, True, True, True]
-AlignPixelEndcaps          = [False,False,False,False,False,False,False,False,False,False]
-# alignment level for the full Pixel # see InDetAlignGeometryLevel wiki for more info
-PixelAlignmentLevel        = [   16,   16,   11,   11,   11,   11,   11,   11,   11,   11]
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [ True, True, True, True, True, True, True, True, True, True]
-AlignSCTBarrel            =  [ True, True, True, True, True, True, True, True, True, True]
-AlignSCTEndcaps           =  [ True, True, True, True, True, True, True, True, True, True]
-
-# alignment level for the full SCT # see InDetAlignGeometryLevel wiki for more info
-SCTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1] 
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1] 
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1] 
-
-##########
-# TRT
-# are we running TRT alignment # see InDetAlignGeometryLevel wiki for more info
-AlignTRT                  =  [False,False,False,False,False,False,False,False,False,False]
-AlignTRTBarrel            =  [False,False,False,False,False,False,False,False,False,False]
-AlignTRTEndcaps           =  [False,False,False,False,False,False,False,False,False,False]
-# alignment level for the TRT parts
-TRTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1]
-TRTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1]
-TRTAlignmentLevelEndcaps  =  [    1,    1,    1,    1,    1,    1,    1,    1,    1,    1]
-##########
-# XXXX                  = [False,False,False,False,False,False,False,False,False,False]
-
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [ True, True, True, True, True, True, True, True, True, True]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = inputErrorScalingTag
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py")
-execfile("NewInDetIterator_Rel19.py")
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel17.py
deleted file mode 100755
index 275c929f42641b685a0ca33a5312d5434fdf86cc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel17.py
+++ /dev/null
@@ -1,279 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 1
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-#runMode = 'batch'
-runMode        = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE 	       = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'test'
-
-HOME 	       = os.environ['HOME']
-# Alignment Output
-OutputPath     = os.environ['PWD']+"/."
-
-CMTDIR 	       = HOME+"/athena/cmthome/"
-# extra AtlasSetup options 
-ASetupOptions  = "single"  
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'INFO'
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-	from optparse import OptionParser
-	parser = OptionParser()
-	parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-	parser.add_option("--inputDir", dest="inputDir", help="Directory containing the input files - NOT YET IMPLEMENTED", default="")
-	parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-	parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-	parser.add_option("--nEvents",dest="nEvents", type=int, help="Maximum number of events to use", default=1000)
-	parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data",action="store_true", default=False)
-	parser.add_option("--preIBLgeometry",dest="preIBLgeometry", help="Set it  if you want to run on Run1 geometry",action="store_true",default=False)
-	(config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-	return config
-	
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputList=config.inputList
-inputDir =config.inputDir
-eventType=config.eventType
-ConstantsFile=config.inputConstantsFile
-nEventsMax=config.nEvents
-preIBLgeometry=config.preIBLgeometry
-isData=config.isData
-
-##########################################################
-#		Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-Data1 = setupData(eventType)
-#Need To be changed this one
-Data1.setDataType("Zmumu") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-#Data1.setRuns([201280]) # Run number, you can provide a list of runs
-Data1.setCPUs([1,1,1]) # Number of CPUs per iteration to process this data
-#Data1.setEvents([5000,5000,5000]) # Number of total events to process
-Data1.setEvents([nEventsMax,nEventsMax,nEventsMax])
-Data1.setLimitFiles(1) # Limit the number of files to use (useful when runing in local a subset of data)
-#Data1.CreateFileList() # Creates the file list
-Data1.setByteStream(False)
-
-Data1.setCustomFileList(inputList)
-
-# Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-if eventType == "collisions":
-	Data1.setGlobalTag("OFLCOND-MC12-IBL-20-30-25") 
-else: 
-	Data1.setGlobalTag("OFLCOND-MC12-IBL-20-30-50") #Cosmics
-
-Data1.setDetDescrVersion("ATLAS-IBL3D25-04-00-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-
-DataToRun.append(Data1) # always add this line to process the defined data
-
-
-### Duplicate the previous lines to have as many datasets that you want
-
-### I'm disabling the original SYNOPSIS.
-### Fast and Dirty solution. Better to modify this part
-
-
-### from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-### if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-###	DataToRun = [HandleRunOptions()]
-	
-for data in DataToRun:
-	data.Print()
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/m/mdanning/AlignmentTestArea/IBL_4br_30Jan/run_misalign/MisalignmentSet1.pool.root"
-inputAlignmentPoolFile = ""
-readConstantsFromPool = False
-
-if ConstantsFile != "":
-	inputAlignmentPoolFile=ConstantsFile
-	readConstantsFromPool = True
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions = {}
-
-extraOptions["Cosmics"] = False
-if "cosmics" in eventType or "Cosmics" in eventType:
-	extraOptions["Cosmics"] = True
-
-extraOptions["realData"] = isData
-#if isData==1:
-#    extraOption["realData"] = True
-    
-extraOptions["preIBLgeometry"] = preIBLgeometry
-#if preIBLgeometry==1:
-#    extraOption["preIBLgeometry"]=True
-
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-extraOptions["doReadBS"]=False
-
-extraOptions["PtCut"]               = 5000 #Pt in MeV, comment the line to use default value (10000)
-extraOptions["siAlignmentTag"] = "InDetAlign_R2_Nominal"
-#extraOptions["trtAlignmentTag"] = "TRTAlign_nominal"
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-#extraOptions["doBSConstraint"] = False
-#extraOptions["doPVConstraint"] = False
-#extraOptions["useOldPreProcessor"] = False
-#extraOptions["eoverpmapconstraint"] = ""  # Full path of the map
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-extraOptions["readTRT"] = False
-extraOptions["writeTRT"] = True
-#extraOptions["TRTCalibTextFile"] = ""
-#extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-AlignmentJune2010-00"
-#extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-AlignmentJune2010-00"
-
-## I'm fixing SCT to test IBL alignment
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignEndcapZ"] = False
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = True
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = False
-extraOptions["sctAlignBarrelY"] = False
-extraOptions["sctAlignBarrelZ"] = False
-extraOptions["sctAlignBarrelRotX"] = False
-extraOptions["sctAlignBarrelRotY"] = False
-extraOptions["sctAlignBarrelRotZ"] = False
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctlAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = True
-extraOptions["sctAlignEndcapRotX"] = True
-extraOptions["sctAlignEndcapRotY"] = True
-extraOptions["sctAlignEndcapRotZ"] = True
-             
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelBarrel           = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelEndcaps          = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full Pixel
-PixelAlignmentLevel        = [ 11, 11, 11, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [-1,-1,-1,-1,22,22,22,22,22,22,22, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTBarrel            =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTEndcaps           =  [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full SCT
-SCTAlignmentLevel         =  [ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# TRT
-# are we running TRT alignment
-AlignTRT            = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-# alignment level for the full TRT
-TRTAlignmentLevel   = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-#AlignInDet          = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = ''
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator.py")
-execfile("NewInDetIterator.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel19.py
deleted file mode 100755
index c5071b2cb1972fb940548b193f12fc09032aa4ad..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel19.py
+++ /dev/null
@@ -1,356 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 1
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-runMode = 'batch'
-#runMode = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE          = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'm9_test'
-
-HOME           = os.environ['HOME']
-# Alignment Output
-OutputPath     = os.environ['PWD']+"/."
-
-CMTDIR         = HOME+"/athena/cmthome/"
-# extra AtlasSetup options
-ASetupOptions  = "single"
-#ASetupOptions  = "nightlies"
-
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'INFO'
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    from optparse import OptionParser
-    parser = OptionParser()
-    parser.add_option("--inputList", dest="inputList", help="Input txt file with the list of the files for the first data set you want to process", default="")
-    parser.add_option("--inputList2", dest="inputList2", help="Input txt file with the list of the files for the second data set you want to process", default="")
-    parser.add_option("--inputDir", dest="inputDir", help="Directory containing the input files - NOT YET IMPLEMENTED", default="")
-    parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-    parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: False)",action="store_true", default=False)
-    parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-    parser.add_option("--nEvents",dest="nEvents", type=int, help="Maximum number of events to use", default=-1)
-    parser.add_option("--nCpus",dest="nCpus", help="Number of CPUs to be used",default=1)
-    parser.add_option("--preIBLgeometry",dest="preIBLgeometry", help="Set it  if you want to run on Run1 geometry (Default: False)",action="store_true",default=False)
-    parser.add_option("--ClusteringAlgo",dest="ClusteringAlgo", help="Which Clustering algorithm to use: NN (Default), Analog, Digital",default="NN")
-    parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-    parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = 0)
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    return config
-    
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputList=config.inputList
-inputList2 = config.inputList2
-inputDir =config.inputDir
-eventType=config.eventType
-ConstantsFile=config.inputConstantsFile
-nEventsMax=config.nEvents
-preIBLgeometry=config.preIBLgeometry
-isData=config.isData
-ClusteringAlgo=config.ClusteringAlgo
-inputErrorScalingTag=config.errorScalingTag
-nCpus=int(config.nCpus)  
-userPtMin = float(config.userPtMin)
-
-
-print " \n <RunIterator> ----- User input in command line --- "
-print " <RunIterator> inputList = ",inputList
-print " <RunIterator> nCpus = ",nCpus
-print " <RunIterator> nEventsMax = ",nEventsMax
-print " <RunIterator> inputList2 = ",inputList2
-print " <RunIterator> ConstantsFile = ",ConstantsFile
-print " <RunIterator> inputErrorScalingTag = ",inputErrorScalingTag
-print " <RunIterator> userPtMin = ",userPtMin, " MeV"
-
-##########################################################
-#       Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-#################### test to run BON and BOFF data
-Data1 = setupData(eventType)
-#Need To be changed this one
-Data1.setDataType("IDCosmics") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-#Data1.setRuns([201280]) # Run number, you can provide a list of runs
-Data1.setCPUs([nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus]) # Number of CPUs per iteration to process this data
-#Data1.setEvents([5000,5000,5000]) # Number of total events to process
-Data1.setEvents([nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax])
-Data1.setLimitFiles(500) # Limit the number of files to use (useful when runing in local a subset of data)
-#Data1.CreateFileList() # Creates the file list
-if isData:
-    Data1.setByteStream(True)
-else:
-    Data1.setByteStream(False)
-
-Data1.setCustomFileList(inputList)
-
-# Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-if eventType == "collisions":
-    #Data1.setGlobalTag("OFLCOND-MC12-IBL-20-30-25") 
-    Data1.setGlobalTag("OFLCOND-RUN12-SDR-14")
-else: 
-    #Data1.setGlobalTag("OFLCOND-MC12-IBL-20-30-50") #Cosmics
-    #Data1.setGlobalTag("CONDBR2-ES1PA-2014-01")
-    if isData:
-        #Data1.setGlobalTag("CONDBR2-ES1PA-2014-01")
-        Data1.setGlobalTag("CONDBR2-ES1PA-2014-03") # move to 03 -> recomended by PF 
-        # Data1.setDetDescrVersion("ATLAS-R2-2015-02-00-00")
-        Data1.setDetDescrVersion("ATLAS-R2-2015-03-04-00")
-    else:
-        Data1.setGlobalTag("OFLCOND-RUN12-SDR-14")
-        Data1.setDetDescrVersion("ATLAS-R2-2015-01-01-00")
-#Data1.setDetDescrVersion("ATLAS-IBL3D25-04-00-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-#Data1.setDetDescrVersion("ATLAS-R2-2015-01-01-00")  --Bugged: IBL is rotated with respect to the real position
-#Data1.setDetDescrVersion("ATLAS-R2-2015-01-01-00")
-
-##############
-############## deal with second data set
-##############
-if (len(inputList2)>1):
-    Data2 = setupData("cosmics_boff")
-    Data2.setCustomFileList(inputList2)
-    # Need To be changed this one
-    Data2.setDataType("IDCosmics") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-    Data2.setCPUs([nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus]) # Number of CPUs per iteration to process this data
-    Data2.setEvents([nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax])
-    Data2.setLimitFiles(500) # Limit the number of files to use (useful when runing in local a subset of data)
-    if isData:
-       Data2.setByteStream(True)
-    else:
-       Data2.setByteStream(False)
-
-    # Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-    if eventType == "collisions":
-        Data2.setGlobalTag("OFLCOND-RUN12-SDR-14")
-    else: 
-        if isData:
-            Data2.setGlobalTag("CONDBR2-ES1PA-2014-03") # move to 03 -> recomended by PF 
-            Data2.setDetDescrVersion("ATLAS-R2-2015-02-00-00")
-        else:
-            Data2.setGlobalTag("OFLCOND-RUN12-SDR-14")
-            Data2.setDetDescrVersion("ATLAS-R2-2015-01-01-00")
-            
-            
-######################## continue
-            
-DataToRun.append(Data1) # always add this line to process the defined data
-if (len(inputList2)>1): DataToRun.append(Data2) # always add this line to process the defined data
-
-
-### Duplicate the previous lines to have as many datasets that you want
-
-### I'm disabling the original SYNOPSIS.
-### Fast and Dirty solution. Better to modify this part
-
-
-### from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-### if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-### DataToRun = [HandleRunOptions()]
-    
-for data in DataToRun:
-    data.Print()
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/m/mdanning/AlignmentTestArea/IBL_4br_30Jan/run_misalign/MisalignmentSet1.pool.root"
-inputAlignmentPoolFile = ""
-readConstantsFromPool = False
-
-if ConstantsFile != "":
-    inputAlignmentPoolFile=ConstantsFile
-    readConstantsFromPool = True
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions = {}
-
-extraOptions["Cosmics"] = False
-if "cosmics" in eventType or "Cosmics" in eventType:
-    extraOptions["Cosmics"] = True
-
-extraOptions["realData"] = isData
-if isData: 
-   extraOptions["dataSource"]  = 'data' 
-   extraOptions["projectName"] = 'data15_cos' 
-   extraOptions["doReadBS"]=True
-else: 
-   extraOptions["dataSource"]  = 'geant4'  
-   extraOptions["projectName"] = 'MC_Cosmic_BOFF' 
-   extraOptions["doReadBS"]=False
-
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-extraOptions["BField"]  = False
-extraOptions["BField_AlgSetup"] = extraOptions["BField"]  
-extraOptions["PtCut"]               = userPtMin #Pt in MeV, comment the line to use default value (10000)
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Nominal"
-extraOptions["siAlignmentTag"] = ""
-#extraOptions["trtAlignmentTag"] = "TRTAlign_nominal"
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-#extraOptions["doBSConstraint"] = False
-#extraOptions["doPVConstraint"] = False
-#extraOptions["useOldPreProcessor"] = False
-#extraOptions["eoverpmapconstraint"] = ""  # Full path of the map
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-extraOptions["readTRT"] = True
-extraOptions["writeTRT"] = True
-#extraOptions["TRTCalibTextFile"] = ""
-if isData:
-    extraOptions["TRTCalibT0TagCos"] = "" # "TrtCalibT0-AlignmentJune2010-00"
-    extraOptions["TRTCalibRtTagCos"] = "" # "TrtCalibRt-AlignmentJune2010-00"
-else:
-    extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-MCCosmics_00-00" 
-    extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-MCCosmics_00-00" 
-
-## I'm fixing SCT to test IBL alignment
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignEndcapZ"] = False
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = True
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = True
-extraOptions["sctAlignBarrelY"] = True
-extraOptions["sctAlignBarrelZ"] = False
-extraOptions["sctAlignBarrelRotX"] = True
-extraOptions["sctAlignBarrelRotY"] = True
-extraOptions["sctAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctlAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = False
-extraOptions["sctAlignEndcapRotX"] = False
-extraOptions["sctAlignEndcapRotY"] = False
-extraOptions["sctAlignEndcapRotZ"] = True
-             
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = True
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelBarrel           = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelEndcaps          = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full Pixel
-PixelAlignmentLevel        = [  11, 11, 11, 11, 11, 11, 11,  2,  2,  2,  2,  2,  2, 11, 11, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [ True, True, True, True, True, True, True, True, True, True, True, True, True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTBarrel            =  [ True, True, True, True, True, True, True, True, True, True, True, True, True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTEndcaps           =  [False,False,False,False,False,False, True, True, True, True, True, True, True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full SCT
-SCTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,  2,  2,  2,  2,  2,  2,  2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,  1,  1,  1,  1,  1,  1,  1, 1, 1, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# TRT
-# are we running TRT alignment
-AlignTRT            = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True]
-# alignment level for the full TRT
-TRTAlignmentLevel   = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-#AlignInDet          = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = inputErrorScalingTag
-
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py")
-execfile("NewInDetIterator_Rel19.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_collisions.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_collisions.py
deleted file mode 100755
index 24f6767c072d00bb130e0effe2c12cd63ad93963..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_collisions.py
+++ /dev/null
@@ -1,323 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Main script to run the NewInDetIterator
-# run with ./RunIterator.py
-# =====================================================================
-import os
-import sys
-
-
-# ===============================
-# Number of Iterations
-# ===============================
-FirstIteration = 0
-Iterations     = 1
-
-# ===============================
-# Basic running options
-# ===============================
-
-# Run mode: local or batch
-#runMode = 'batch'
-runMode = 'local'
-# Batch queue
-#QUEUE = '1nh'
-QUEUE 	       = 'atlasb1'
-
-# Prefix to identify your jobs
-preName        = 'ttbar'
-
-HOME 	       = os.environ['HOME']
-# Alignment Output
-OutputPath     = os.environ['PWD']+"/."
-
-CMTDIR 	       = HOME+"/athena/cmthome/"
-# extra AtlasSetup options
-ASetupOptions  = "single"
-#ASetupOptions  = "nightlies"
-
-
-# OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'INFO'
-
-
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-	from optparse import OptionParser
-	parser = OptionParser()
-	parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-	parser.add_option("--inputDir", dest="inputDir", help="Directory containing the input files - NOT YET IMPLEMENTED", default="")
-	parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-	parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: False)",action="store_true", default=False)
-	parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-	parser.add_option("--nEvents",dest="nEvents", type=int, help="Maximum number of events to use", default=-1)
-	parser.add_option("--nCpus",dest="nCpus", help="Number of CPUs to be used",default=1)
-	parser.add_option("--preIBLgeometry",dest="preIBLgeometry", help="Set it  if you want to run on Run1 geometry (Default: False)",action="store_true",default=False)
-	parser.add_option("--ClusteringAlgo",dest="ClusteringAlgo", help="Which Clustering algorithm to use: NN (Default), Analog, Digital",default="NN")
-	parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-	parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = 0)
-	
-	(config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-	return config
-	
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-inputList=config.inputList
-inputDir =config.inputDir
-eventType=config.eventType
-ConstantsFile=config.inputConstantsFile
-nEventsMax=config.nEvents
-preIBLgeometry=config.preIBLgeometry
-isData=config.isData
-ClusteringAlgo=config.ClusteringAlgo
-inputErrorScalingTag=config.errorScalingTag
-nCpus=int(config.nCpus)  
-userPtMin = float(config.userPtMin)
-
-
-print " \n <RunIterator> ----- User input in command line --- "
-print " <RunIterator> inputList = ",inputList
-print " <RunIterator> nCpus = ",nCpus
-print " <RunIterator> nEventsMax = ",nEventsMax
-print " <RunIterator> ConstantsFile = ",ConstantsFile
-print " <RunIterator> inputErrorScalingTag = ",inputErrorScalingTag
-print " <RunIterator> userPtMin = ",userPtMin, " MeV"
-
-##########################################################
-#		Datasets to use
-##########################################################
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-
-Data1 = setupData(eventType)
-#Need To be changed this one
-Data1.setDataType("TTbar") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
-#Data1.setRuns([201280]) # Run number, you can provide a list of runs
-Data1.setCPUs([nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus,nCpus]) # Number of CPUs per iteration to process this data
-#Data1.setEvents([5000,5000,5000]) # Number of total events to process
-Data1.setEvents([nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax,nEventsMax])
-Data1.setLimitFiles(5000) # Limit the number of files to use (useful when runing in local a subset of data)
-#Data1.CreateFileList() # Creates the file list
-if isData:
-	Data1.setByteStream(True)
-else:
-	Data1.setByteStream(False)
-
-Data1.setCustomFileList(inputList)
-
-# Use custom Global Tag, if not given it will use the data default one (that is empty ;) )
-if eventType == "collisions":
-	if isData:
-		Data1.setGlobalTag("CONDBR2-ES1PA-2014-03")
-		Data1.setDetDescrVersion("ATLAS-R2-2015-03-04-00")
-	else:
-		Data1.setGlobalTag("OFLCOND-RUN12-SDR-28")
-		Data1.setDetDescrVersion("ATLAS-R2-2015-02-01-00")
-else: 
-	#Data1.setGlobalTag("OFLCOND-MC12-IBL-20-30-50") #Cosmics
-	#Data1.setGlobalTag("CONDBR2-ES1PA-2014-01")
-	if isData:
-		Data1.setGlobalTag("CONDBR2-ES1PA-2014-03")
-		Data1.setDetDescrVersion("ATLAS-R2-2015-03-04-00")
-	else:
-		Data1.setGlobalTag("OFLCOND-RUN12-SDR-14")
-		Data1.setDetDescrVersion("ATLAS-R2-2015-01-01-00")
-#Data1.setDetDescrVersion("ATLAS-IBL3D25-04-00-01") # Use custom DetDescrVersion Tag, if not given it will use the data default one
-#Data1.setDetDescrVersion("ATLAS-R2-2015-01-01-00")  --Bugged: IBL is rotated with respect to the real position
-#Data1.setDetDescrVersion("ATLAS-R2-2015-01-01-00")
-
-DataToRun.append(Data1) # always add this line to process the defined data
-
-
-### Duplicate the previous lines to have as many datasets that you want
-
-### I'm disabling the original SYNOPSIS.
-### Fast and Dirty solution. Better to modify this part
-
-
-### from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-### if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-###	DataToRun = [HandleRunOptions()]
-	
-for data in DataToRun:
-	data.Print()
-
-# Alignment Options
-# =============================
-# Global chi^2 alignment
-# Alignment method: GX2, LX2
-AlignmentMethod = "GX2"
-
-# Alignment poolFile to be read on the first iteration, if empty, constants from database will be read
-#inputAlignmentPoolFile = "/afs/cern.ch/user/m/mdanning/AlignmentTestArea/IBL_4br_30Jan/run_misalign/MisalignmentSet1.pool.root"
-inputAlignmentPoolFile = ""
-readConstantsFromPool = False
-
-if ConstantsFile != "":
-	inputAlignmentPoolFile=ConstantsFile
-	readConstantsFromPool = True
-
-# split files to subjobs to have exactly equal number of events (True)
-# or just approximately based on the size of the input files (False)
-doDetailedSplitting = False
-
-# Option to use TFiles instead bin files
-# if False it will use the standard bin files
-useTFiles = True
-
-
-# These options will be written to the jobOptions
-# have a look into NewInDetAlignAlgSetup.py and NewInDetAlignGeometrySetup.py
-# for all supported options
-
-extraOptions = {}
-
-extraOptions["Cosmics"] = False
-if "cosmics" in eventType or "Cosmics" in eventType:
-	extraOptions["Cosmics"] = True
-
-extraOptions["realData"] = isData
-if isData: 
-   extraOptions["dataSource"]  = 'data' 
-   extraOptions["projectName"] = 'data15_cos' 
-   extraOptions["doReadBS"]=True
-else: 
-   extraOptions["dataSource"]  = 'geant4'  
-   #extraOptions["projectName"] = 'MC_Cosmic_BOFF' 
-   extraOptions["doReadBS"]=False
-
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-extraOptions["BField"]  = False
-extraOptions["BField_AlgSetup"] = extraOptions["BField"]  
-extraOptions["PtCut"]               = userPtMin #Pt in MeV, comment the line to use default value (10000)
-#extraOptions["siAlignmentTag"] = "InDetAlign_R2_Nominal"
-extraOptions["siAlignmentTag"] = ""
-#extraOptions["trtAlignmentTag"] = "TRTAlign_nominal"
-#extraOptions["beamSpotTag"] = "IndetBeampos-ES1-UPD2"
-#extraOptions["particleNumber"] = 0
-extraOptions["ModCut"] = 0
-extraOptions["softModeCut"]= 0.
-
-#extraOptions["doBSConstraint"] = False
-#extraOptions["doPVConstraint"] = False
-#extraOptions["useOldPreProcessor"] = False
-#extraOptions["eoverpmapconstraint"] = ""  # Full path of the map
-#extraOptions["CosmicGRL"] = "CosmicsGRL.xml"
-#extraOptions["CollisionGRL"] = "ColisionGRL.xml"
-extraOptions["useTRT"] = True
-extraOptions["readTRT"] = True
-extraOptions["writeTRT"] = True
-#extraOptions["TRTCalibTextFile"] = ""
-if isData:
-	extraOptions["TRTCalibT0TagCos"] = "" # "TrtCalibT0-AlignmentJune2010-00"
-	extraOptions["TRTCalibRtTagCos"] = "" # "TrtCalibRt-AlignmentJune2010-00"
-else:
-	extraOptions["TRTCalibT0TagCos"] = "TrtCalibT0-MCCosmics_00-00" 
-	extraOptions["TRTCalibRtTagCos"] = "TrtCalibRt-MCCosmics_00-00" 
-
-## I'm fixing SCT to test IBL alignment
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignEndcapZ"] = False
-## PIXEL
-extraOptions["pixelAlignBarrelX"] = True
-extraOptions["pixelAlignBarrelY"] = True
-extraOptions["pixelAlignBarrelZ"] = True
-extraOptions["pixelAlignBarrelRotX"] = False
-extraOptions["pixelAlignBarrelRotY"] = True
-extraOptions["pixelAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = True
-extraOptions["pixelAlignEndcapY"] = True
-extraOptions["pixelAlignEndcapZ"] = False
-extraOptions["pixelAlignEndcapRotX"] = False
-extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = True
-
-## SCT
-extraOptions["sctAlignBarrelX"] = True
-extraOptions["sctAlignBarrelY"] = True
-extraOptions["sctAlignBarrelZ"] = False
-extraOptions["sctAlignBarrelRotX"] = False
-extraOptions["sctAlignBarrelRotY"] = True
-extraOptions["sctAlignBarrelRotZ"] = True
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctlAlignEndcapY"] = True
-extraOptions["sctAlignEndcapZ"] = False
-extraOptions["sctAlignEndcapRotX"] = False
-extraOptions["sctAlignEndcapRotY"] = False
-extraOptions["sctAlignEndcapRotZ"] = True
-             
-# do the solving? (Set to False only to do quick reconstruction tests)
-doSolve = False
-
-# Setup of alignment geometry
-# =============================
-##########
-# Pixel
-# are we running Pixel alignment (for barrel and endcaps)
-AlignPixel                 = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelBarrel           = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-AlignPixelEndcaps          = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full Pixel
-PixelAlignmentLevel        = [  11, 11, 11, 11, 11, 11, 11,  2,  2,  2,  2,  2,  2, 11, 11, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel barrel. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelBarrel  = [  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the Pixel endcaps. If set to -1 uses PixelAlignmentLevel, otherwise it overwrites it
-PixelAlignmentLevelEndcaps = [  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# SCT
-# are we running SCT alignment (for barrel and endcaps)
-AlignSCT                  =  [ True, True, True, True, True, True, True, True, True, True, True, True, True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTBarrel            =  [ True, True, True, True, True, True, True, True, True, True, True, True, True,True,True,True,True,True,True,True,True,True,True]
-AlignSCTEndcaps           =  [False,False,False,False,False,False, True, True, True, True, True, True, True,True,True,True,True,True,True,True,True,True,True]
-
-# alignment level for the full SCT
-SCTAlignmentLevel         =  [    1,    1,    1,    1,    1,    1,    1,  2,  2,  2,  2,  2,  2,  2, 2, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT barrel. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelBarrel   =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-# alignment level for the SCT endcaps. If set to -1 uses SCTAlignmentLevel, otherwise it overwrites it
-SCTAlignmentLevelEndcaps  =  [   -1,   -1,   -1,   -1,   -1,   -1,   -1,  1,  1,  1,  1,  1,  1,  1, 1, 1, 2, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-##########
-# TRT
-# are we running TRT alignment
-AlignTRT            = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True,True,True,True,True,True,True,True]
-# alignment level for the full TRT
-TRTAlignmentLevel   = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2] # see InDetAlignGeometryLevel wiki for more info
-
-#AlignInDet          = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-
-########
-#### To setup additional detailed settings for different alignment levels
-#### use NewInDetAlignLevels.py
-########
-
-# Error Scaling
-# =============================
-ErrorScaling        = [True,True,True,True,True,True,True,True,True,True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
-#errorScalingTag = "IndetTrkErrorScaling_nominal"
-#errorScalingTag = "IndetTrkErrorScaling_cscalign00_00"
-#errorScalingTag = "IndetTrkErrorScaling_Day1-00"
-errorScalingTag = inputErrorScalingTag
-
-
-# Alignment Montioring Script to be run, if empty, no monitoring script will be run
-# A dedicated monitoring script from InDetAlignmentMonitoring package can be used (with full path)
-# Only if extraOptions["doMonitoring"]=True
-MonitoringScript = ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator_Rel19.py")
-execfile("NewInDetIterator_Rel19.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunReco_tf_onBatch.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunReco_tf_onBatch.py
deleted file mode 100644
index 3786ea6b67d99e286d9dab56304f6eecdd911762..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunReco_tf_onBatch.py
+++ /dev/null
@@ -1,168 +0,0 @@
-##Script to run Reco_tf.py on the lxplus batch system
-##author:PF
-##pierfrancesco.butti@cern.ch
-######################################################
- 
-import sys,os
-from datetime import datetime
-import glob
-
-
-def OptParsing():
-    from optparse import OptionParser
-    parser=OptionParser()
-    Now=datetime.now()
-    parser.add_option("--preInclude",dest="preInclude",help="preInclude options",default="")
-    parser.add_option("--preExec",dest="preExec",help="preExec options",default="")
-    parser.add_option("--inFilesDir",dest="inFilesDir",help="Directory Containing the inputFiles",default="")
-    parser.add_option("--inFilesList",dest="inFilesList",help="List of files",default="")
-    parser.add_option("--postInclude",dest="postInclude",help="postInclude options",default="")
-    parser.add_option("--postExec",dest="postExec",help="postExec options",default="")
-    parser.add_option("--inType",dest="inType",help="Input File Type:RDO,BS,ESD,AOD",default="BS")
-    parser.add_option("--outType",dest="outType",help="Output File Type: ESD,AOD", default="ESD")
-    parser.add_option("--amiTag",dest="amiTag",help="Parse the options from a particular amiTAG",default="")
-    parser.add_option("--OptFile",dest="OptFile",help="Parse options from a File",default="")
-    parser.add_option("--queue",dest="queue",help="Queue where to send the jobs (1nd,1nh,8nh,1nw,2nw,8nm,atlasb1)",default="8nh")
-    parser.add_option("--sampleType",dest="sampleType",help="sampleType:data, mc.",default="data")
-    parser.add_option("--conditionsTag",dest="conditionsTag",help="Conditions Tag. Overrides the default one",default="") #MC: OFLCOND-RUN12-SDR-14
-    parser.add_option("--Rel",dest="Rel",help="Which athena Release",default="19.3.0.1")
-    parser.add_option("--debug",dest="debug",help="debug",type='int',default=0)
-    parser.add_option("--nFilesPerJob",dest="nFilesPerJob",help="nFilesPerJob",default=1,type="int")
-    parser.add_option("--OutName",dest="OutName",help="Name to give to the jobs",default="JobTime_"+Now.strftime('%Y_%m_%d_%H_%M_%S'))
-    (config,sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-    return config
-
-def main():
-    config = OptParsing()
-    sampleType=config.sampleType
-    jobname = config.OutName
-    inputFileList = config.inFilesDir
-    inputFilesFromList = config.inFilesList
-    nFilesPerJob = config.nFilesPerJob
-    postExec=config.postExec
-    inType=config.inType
-    outType=config.outType
-    conditionsTag="CONDBR2-ES1PA-2014-01"
-    inputType=""
-    outputType=""
-    debug=config.debug
-    triggerFlags="from TrigHLTMonitoring.HLTMonFlags import HLTMonFlags;HLTMonFlags.doBphys=False;"
-
-    
-    if sampleType=="mc":
-        triggerFlags=""
-        conditionsTag="OFLCOND-RUN12-SDR-14"
-        
-
-    if config.conditionsTag!="":
-        conditionsTag=config.conditionsTag
-    
-
-    if conditionsTag=="OFLCOND-RUN12-SDR-14":
-        postExec+="'conddb.addOverride(\"/PIXEL/PixdEdx\",\"PixdEdx_January2011_mc-000-00\")'"
-
-
-    if inType=="RDO":
-        inputType="--inputRDOFile="
-    elif inType=="BS":
-        inputType="--inputBSFile="
-    elif inType=="ESD":
-        inputType="--inputESDFile="
-    else:
-        print "WARNING: input type not known: ",inType
-
-
-    if outType=="ESD":
-        outputType="--outputESDFile="
-    elif outType=="AOD":
-        outputType="--outputAODFile="
-    else:
-        print "WARNING:output type not known: ", outType
-
-
-    if debug:
-        print "inType="+inType+" triggerFlags="+triggerFlags+" postExec="+postExec
-    
-    if inputFileList != "":
-        print "From Dir"
-        if not inputFileList.endswith("/"):
-            inputFileList=inputFileList+"/"
-        
-        inputFileList = glob.glob(inputFileList+"data*")
-    
-    if inputFilesFromList !="":
-        inputFileList=[]
-        List=open(inputFilesFromList,'r')
-        for line in List:
-            inputFileList.append(line.strip())
-
-            
-    
-            
-    
-    nJobs = int(len(inputFileList))/nFilesPerJob
-    if int(len(inputFileList)) % nFilesPerJob != 0:
-        nJobs+=1
-        
-    print "Total Input Files number", len(inputFileList)
-    print "Sending a total of ",nJobs, "jobs"
-    
-    PWD=os.environ["PWD"]+"/"
-
-    if not os.path.exists("batchScripts"):
-        os.mkdir("batchScripts")
-    
-    if not os.path.exists("batchLogs"):
-        os.mkdir("batchLogs")
-
-    for job in xrange(nJobs):
-        script = open("batchScripts/batch_script_"+str(job)+"_"+jobname+".lsf","w")
-        script.write("#BSUB -J RecoTf_job"+str(job)+"_M6_"+jobname+"\n")
-        script.write("#BSUB -o "+PWD+"batchLogs/RecoTf_job"+str(job)+"_M6_"+jobname+".log\n")
-        script.write("#BSUB -e "+PWD+"batchLogs/RecoTf_job"+str(job)+"_M6_"+jobname+".err\n")
-        script.write("#BSUB -q "+config.queue+"\n\n\n")
-        script.write("#     setup the environment\n")
-        script.write("source /afs/cern.ch/atlas/software/dist/AtlasSetup/scripts/asetup.sh "+config.Rel+" --testarea="+PWD+" --single\n")
-        script.write("mkdir "+PWD+"M6_jobN_"+str(job)+"_"+jobname+"\n")
-        script.write("cd "+PWD+"M6_jobN_"+str(job)+"_"+jobname+"\n")
-        
-        InputFiles=""
-        
-    
-        if len(inputFileList)-job*nFilesPerJob >= nFilesPerJob:
-            #print len(inputFileList)-job*nFilesPerJob
-            for iFile in xrange(nFilesPerJob):
-                InputFiles+=inputFileList[job*nFilesPerJob+iFile]+","
-        
-        else:
-                for iFile in xrange(len(inputFileList)-job*nFilesPerJob):
-                    InputFiles+=inputFileList[job*nFilesPerJob+iFile]+","
-                    
-        
-        InputFiles=InputFiles.strip(",")
-        if debug:
-            print InputFiles
-        
-        #Setting Up and running the command
-        #cmd = "Reco_tf.py --conditionsTag='CONDBR2-ES1PA-2014-01' --beamType='cosmics' --ignoreErrors=True --autoConfiguration='everything' --maxEvents=-1  --postExec='ServiceMgr.InDetSCT_ConditionsSummarySvc.ConditionsServices=[\"InDetSCT_ConfigurationConditionsSvc\",\"InDetSCT_FlaggedConditionSvc\",\"InDetSCT_ByteStreamErrorsSvc\",\"InDetSCT_ReadCalibDataSvc\"]' --preExec='rec.doJetMissingETTag=False;rec.doTau=False;from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArHVCorr=False;jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr.set_Value_and_Lock(False);from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False);from TrigHLTMonitoring.HLTMonFlags import HLTMonFlags;HLTMonFlags.doBphys=False;DQMonFlags.doJetMon=False;DQMonFlags.doMissingEtMon=False;DQMonFlags.enableLumiAccess=False;InDetFlags.doInnerDetectorCommissioning.set_Value_and_Lock(True);InDetFlags.useBroadClusterErrors.set_Value_and_Lock(False);DQMonFlags.doStreamAwareMon=False;from JetRec.JetRecFlags import jetFlags;jetFlags.useTracks=False;larCondFlags.OFCShapeFolder.set_Value_and_Lock(\"\")' --geometryVersion='ATLAS-R2-2015-01-01-00' --inputBSFile="+InputFiles+" --outputESDFile=myESD.pool.root --postInclude='"+PWD+"InDetMonitoringAlignment.py'"
-        #
-
-        
-            
-        #cmd = "Reco_tf.py --conditionsTag='"+conditionsTag+"' --beamType='cosmics' --ignoreErrors=True --autoConfiguration='everything' --maxEvents=-1  --postExec="+postExec+" --preExec='rec.doJetMissingETTag=False;rec.doTau=False;from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArHVCorr=False;jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr.set_Value_and_Lock(False);from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False);InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True);"+triggerFlags+"DQMonFlags.doJetMon=False;DQMonFlags.doMissingEtMon=False;DQMonFlags.enableLumiAccess=False;InDetFlags.doInnerDetectorCommissioning.set_Value_and_Lock(True);InDetFlags.useBroadClusterErrors.set_Value_and_Lock(True);InDetFlags.doTrackSegmentsPixel.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsSCT.set_Value_and_Lock(False);InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock(False); DQMonFlags.doStreamAwareMon=False;from JetRec.JetRecFlags import jetFlags;jetFlags.useTracks=False;larCondFlags.OFCShapeFolder.set_Value_and_Lock(\"\");' --geometryVersion='ATLAS-R2-2015-02-01-00' "+inputType+InputFiles+" "+outputType+"my"+outType+".pool.root --postInclude='"+PWD+"LayerMaterialOverrider.py','"+PWD+"InDetMonitoringAlignment.py'"
-
-        #19.3 Command
-        
-        cmd = "Reco_tf.py --beamType='cosmics' --ignoreErrors=True --autoConfiguration='everything' --maxEvents=-1 --conditionsTag='"+conditionsTag+"' --geometryVersion=ATLAS-R2-2015-02-00-00 --preExec='rec.doJetMissingETTag=False;from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArHVCorr=False;jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr.set_Value_and_Lock(False);from InDetRecExample.InDetJobProperties import InDetFlags;from TrigHLTMonitoring.HLTMonFlags import HLTMonFlags;HLTMonFlags.doBphys=False;DQMonFlags.enableLumiAccess=False;InDetFlags.doInnerDetectorCommissioning.set_Value_and_Lock(True);InDetFlags.useBroadClusterErrors.set_Value_and_Lock(False);DQMonFlags.doStreamAwareMon=False;from JetRec.JetRecFlags import jetFlags;jetFlags.useTracks=False;larCondFlags.OFCShapeFolder.set_Value_and_Lock(\"\");InDetFlags.ForceCoraCool=True;' --postExec='from IOVDbSvc.CondDB import conddb;conddb.addOverride(\"/GLOBAL/TrackingGeo/LayerMaterialV2\",\"AtlasLayerMat_v18_ATLAS-R2-2015\");' "+inputType+InputFiles+" "+outputType+"my"+outType+".pool.root --postInclude='"+PWD+"ErrorScaling.py','"+PWD+"InDetMonitoringAlignment.py'"
-
-        script.write(cmd+"\n")
-        #script.write("rm *ESD*root\n")
-        script.write("cd -\n")
-        script.close()
-        
-        os.system("chmod +x batchScripts/batch_script_"+str(job)+"_"+jobname+".lsf")
-        os.system("bsub <batchScripts/batch_script_"+str(job)+"_"+jobname+".lsf")
-    
-
-if __name__=="__main__":
-    main()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/AlignmentHistoSetup.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/AlignmentHistoSetup.py
deleted file mode 100755
index aecf7bcd1de1905dbff0f82cec1aee0400a75ef1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/AlignmentHistoSetup.py
+++ /dev/null
@@ -1,344 +0,0 @@
-#==========================================================#
-#===========Setup for Alignment Histograms=================#
-#==========================================================#
-include("InDetAlignExample/analyzeAlignmentTools.py")
-doNew = True
-
-# Getting the LevelOfAlignment 
-if doNew:
-    LevelOfAlignment = getLevelOfAlignmentNew()
-else:
-    LevelOfAlignment = getLevelOfAlignment()
-
-
-if LevelOfAlignment == 0:
-
-    print "|=================================================================================================================================|"
-    print "|========================================== Reading the Global (L1) TRT alignment ================================================|"
-    print "|=================================================================================================================================|"
-        
-
-elif LevelOfAlignment == 1:
-
-    print "|=================================================================================================================================|"
-    print "|========================================== Reading the Internal (L2) TRT alignment ==============================================|"
-    print "|=================================================================================================================================|"
-
-else:
-    print "LevelOfAlignment is not set properly"
-    sys.exit(0)
-
-#==========================================================#
-#===========Initializing the modules and containers========#
-#==========================================================#
-
-#Create modules that aren't masked and store those that are read out==========#
-if doNew:
-    modDict = getModulesNew()
-    DofNotAligned = getDofNotAlignedNew()
-else:
-    modDict = getModules()
-    DofNotAligned = getDofNotAligned()
-    
-print modDict
-# Getting the DoF not aligned
-
-
-#==========write out dofs which aren't being aligned=========
-for i in range(DofNotAligned.__len__()):
-    print "!========================== Warning, ",DofNotAligned[i], " is being ignored! ==================!"
-
-if doCSCTruth:
-    print "!========================== Warning, we are comparing to the CSC truth   ==================!"
-
-#=============== Things needed for both the L1 and L2 alignment =================
-#====total chi2====#
-totChi2    = {}
-
-#====proccessed Tracks====#
-procTracks = {}
-
-#====proccessed Hits====#
-procHits   = {}
-
-#====Change in Chi2====#
-chngChi2   = {}
-
-#====Eigen values for global ===#
-eigenValues = []
-
-#==========================================================#
-#=============Initial CSC misalignments====================#
-#==========================================================#
-if doCSCTruth:
-    path = str(os.environ['TestArea'])+"/InnerDetector/InDetAlignAlgs/TRT_AlignAlgs/share/"
-    file = open(path+"CSCLocalL2InitialPhiMisAlignments.txt")
-    for line in file:
-        words = string.split(line)
-        modId = 3*int(words[1])+int(words[0])
-        if modId in readOut:
-            modDict[modId].initialPositionDx = float(words[2])
-
-    file.close()
-
-    file = open(path+"CSCLocalL2InitialRadialMisAlignments.txt")
-    for line in file:
-        words = string.split(line)
-        modId = 3*int(words[1])+int(words[0])
-        if modId in readOut:
-            modDict[modId].initialPositionDz = float(words[2])
-    file.close()
-
-#==============================================================#
-# Setting up graphs/histograms all iterations (or just last one) 
-#==============================================================#
-
-#===Setting up the Chi2 graph===#
-TotalChi2Graph = makeGraph("Total Chi2 vs Iteration",0,1e7)
-
-#===Setting up the change in Chi2 graph===#
-ChangeInChi2Graph = makeGraph("Change in Chi2 vs Iteration",1,4e6)
-
-#===Setting up the #tracks graph===#
-ProcTracksGraph = makeGraph("Tracks vs Iteration",0,35e3)
-
-#===Setting up the #hits graph===#
-ProcHitsGraph = makeGraph("Hits vs Iteration",0,1.5e6)
-
-#=============Draw General Statistics from the alignment iterations=======
-def drawStats():
-    for i in range(numIter):
-        try:
-            totChi2[i]
-            TotalChi2Graph.SetPoint(i,i,totChi2[i] )
-        except:
-            print "totChi2 not filled"
-
-        try:
-            chngChi2[i]
-            ChangeInChi2Graph.SetPoint(i,i,chngChi2[i] )
-        except:
-            print "changeinchi2 not filled"
-
-        try:
-            procTracks[i]
-            ProcTracksGraph.SetPoint(i,i,procTracks[i] )
-        except:
-            print "procTracks not filled"
-
-        try:
-            procHits[i]
-            ProcHitsGraph.SetPoint(i,i,procHits[i] )
-        except:
-            print "procHits not filled"
-        
-    c0 = TCanvas("Statistics vs iteration","title",1050,750)
-    c0.Divide(2,2)
-    c0.cd(1)
-    TotalChi2Graph.Draw("APL")
-    c0.cd(2)
-    gPad.SetLogy(1)
-    ChangeInChi2Graph.Draw("APL")
-    c0.cd(3)
-    ProcTracksGraph.Draw("APL")
-    c0.cd(4)
-    ProcHitsGraph.Draw("APL")
-    c0.Write()
-    return c0
-
-#=============Draw the information on a module by module basis=======
-def drawModule(module):
-    bec = module.bec
-    lay = module.lay
-    phi = module.phi
-
-    printout = "|        "+str(bec)+"/"+str(lay)+"/"+str(phi)+"     "
-    while printout.__len__() < 20:
-        printout = printout + " "
-    print printout+"|",
-
-    
-    m_c2 = TCanvas("Change in Chi2","Chi2 for module: Layer:"+str(lay)+" Phi "+str(phi),700,500)
-    m_c1 = TCanvas("Change in Rotations","Change in Rotations for(Black=rotx, Red=roty, Blue=rotz) module: Layer:"+str(lay)+" Phi "+str(phi),700,500)
-    m_c3 = TCanvas("Total Rotations","Total Rotations for(Black=rotx, Red=roty, Blue=rotz) module: Layer:"+str(lay)+" Phi "+str(phi),700,500)
-
-    m_c0 = TCanvas("Change in Translations","Change in Translations (Black=dx, Red=dy, Blue=dz) for module: Layer:"+str(lay)+" Phi "+str(phi),700,500)
-    m_c4 = TCanvas("Total Translations","Total Translations (Black=dx, Red=dy, Blue=dz) for module: Layer:"+str(lay)+" Phi "+str(phi),700,500)
-    m_c5 = TCanvas("Number of Hits","Number of hits seen for module: Layer:"+str(lay)+" Phi "+str(phi),700,500)
-    
-    zeroLine.Draw("same")
-    #Change in Translations
-    m_c0.cd()
-
-    #Dx
-    if "Dx" not in DofNotAligned:
-        module.drawDx("APL")
-        printout =  "    "+printerror(module.tot["dx"], module.err["dx"])
-        
-        while printout.__len__() < 20:
-            printout = printout + " "
-        print printout+"|",
-
-        
-    #Dy
-    if "Dy" not in DofNotAligned:
-
-        if "Dx" in DofNotAligned:
-            module.drawDy("APL")
-        else:
-            module.drawDy("PL")
-
-        printout =  "    "+printerror(module.tot["dy"], module.err["dy"])
-        
-        while printout.__len__() < 20:
-            printout = printout + " "
-        print printout+"|",
-
-    #Dz
-    if "Dz" not in DofNotAligned:
-
-        if "Dx" in DofNotAligned and "Dy" in DofNotAligned:
-            module.drawDz("APL")
-        else:
-            module.drawDz("PL")
-
-        printout =  "    "+printerror(module.tot["dz"], module.err["dz"])
-        while printout.__len__() < 20:
-            printout = printout + " "
-        print printout+"|",
-            
-    zeroLine.Draw("same")
-    #=======Total Translations
-    m_c4.cd()
-
-    #Dx
-    if "Dx" not in DofNotAligned:
-        module.drawTotDx("APL")
-
-    #Dy
-    if "Dy" not in DofNotAligned:
-        if "Dx" in DofNotAligned:
-            module.drawTotDy("APL")
-        else:
-            module.drawTotDy("PL")
-
-    #Dz
-    if "Dz" not in DofNotAligned:
-        if "Dx" in DofNotAligned and "Dy" in DofNotAligned:
-            module.drawTotDz("APL")
-        else:
-            module.drawTotDz("PL")
-
-    zeroLine.Draw("same")
-    #=======Change in Rotations
-    m_c1.cd()
-
-    #Rotx
-    if "Rotx" not in DofNotAligned:
-
-        module.drawRotx("APL")
-        printout =  "  "+printerror(module.tot["rotx"], module.err["rotx"])
-        while printout.__len__() < 20:
-            printout = printout + " "
-        print printout+"|",
-
-    
-    #Roty
-    if "Roty" not in DofNotAligned:
-
-        if "Rotx" in DofNotAligned:
-            module.drawRoty("APL")
-        else:
-            module.drawRoty("PL")
-            
-        printout =  "  "+printerror(module.tot["roty"], module.err["roty"])
-        while printout.__len__() < 20:
-            printout = printout + " "
-        print printout+"|",
-
-
-    #Rotz
-    if "Rotz" not in DofNotAligned:
-
-        if "Rotx" in DofNotAligned and "Roty" in DofNotAligned:
-            module.drawRotz("APL")
-        else:
-            module.drawRotz("PL")
-        printout =  "  "+printerror(module.tot["rotz"], module.err["rotz"])
-        while printout.__len__() < 20:
-            printout = printout + " "
-        print printout+"|",
-        
-    zeroLine.Draw("same")
-    #=========Total Rotations
-    m_c3.cd()
-
-    #Rotx
-    if "Rotx" not in DofNotAligned:
-        module.drawTotRotx("APL")
-
-    #Roty
-    if "Roty" not in DofNotAligned:
-        if "Rotx" in DofNotAligned:
-            module.drawTotRoty("APL")
-        else:
-            module.drawTotRoty("PL")
-
-    #Rotz
-    if "Rotz" not in DofNotAligned:
-        if "Rotx" in DofNotAligned and "Roty" in DofNotAligned:
-            module.drawTotRotz("APL")
-        else:
-            module.drawTotRotz("PL")
-
-    print ""
-
-    zeroLine.Draw("same")
-    #========The Chi2
-    
-    m_c2.cd()
-    gPad.SetLogy(1)
-    module.drawChi2("APL")
-
-    #=========Total Rotations
-    m_c5.cd()
-    
-    module.NHitGraph = TGraphErrors(module.NHitsIter.__len__())
-    #module.tot["chi2"] = 0.0
-    module.NHitGraph.SetTitle("N Hits vs Iterations for Layer"+str(module.lay)+"and Phi Module"+str(module.phi))
-    module.NHitGraph.GetXaxis().SetTitle("Iteration")
-    module.NHitGraph.GetXaxis().SetLimits(-0.2,(module.NHitsIter.__len__()+1)-0.8)
-    module.NHitGraph.SetMaximum(1e6)
-    module.NHitGraph.SetMinimum(0)
-    module.NHitGraph.SetMarkerStyle(3)
-    module.NHitGraph.SetMarkerSize(2)
-    module.NHitGraph.SetMarkerColor(1)
-    module.NHitGraph.SetLineColor(1)
-    for i in range(module.NHitsIter.__len__()):
-        module.NHitGraph.SetPoint(i,i,module.NHitsIter[i])
-        #module.tot["chi2"] += module.Chi2Iter[i]
-    module.NHitGraph.Draw("APL")
-
-    if "Dx" not in DofNotAligned or "Dz" not in DofNotAligned: 
-        m_c0.Write()
-        m_c4.Write()
-    if "Rotx" not in DofNotAligned or "Roty" not in DofNotAligned or "Rotz" not in DofNotAligned:
-        m_c1.Write()
-        m_c3.Write()
-    if not Chi2Method:
-        m_c2.Write()
-    m_c5.Write()
-    
-    return m_c2, m_c1, m_c0, m_c4
-
-#======Drawing the line at zero in all these plots
-zeroLine = TLine(0,0,numIter-1+0.3,0)
-
-#===============================
-if LevelOfAlignment == 1:
-    include("InDetAlignExample/ModulePlots.py")
-    #===============================
-    if doCSCTruth:
-        include("InDetAlignExample/CSCTruthPlots.py")
-
-print "We've loaded all the functions ======== Exiting AlignmentHistoSetup.py"
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/AnalyzeAlignment.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/AnalyzeAlignment.py
deleted file mode 100755
index a17c97d29d643c7876d1a7e472f73d2bfeae3268..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/AnalyzeAlignment.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#===========================================================================
-#===========================================================================
-# Author: John Alison (johnda) 
-# June 17, 2008
-#===========================================================================
-#===========================================================================
-# This is a script which creates a rootfile for displaying the results 
-# of the L1 and L2 alignment from the TRTAlignAlg.  It assumes the different
-# iterations of the algorithm are in seperate directories, located under
-# a common directory head, and named with a common prefix which ends in 
-# a number(starting with 0+skipIters) specifing the iteration.   
-#
-# Eg:
-#  > ls TRTL2Alignment/
-#    Iter0 Iter1 Iter2 Iter3 Iter4 ...
-#
-# To run the script change the options below and run,
-#
-# > athena AnalyzeTRTAlignment.py
-#
-# This should generate a table of the total alignment changes, and a rootfile
-# containing changes vs iteration for the entire TRT and on a module by module
-# basis and a visualization of the alignment changes between the two files
-# specified below.
-
-#============ Output file name ===========================
-Outputfile = "AnalyzeAlignment.root"
-
-#============= Path to the directory where the iterations are stored
-dirHead = "/afs/cern.ch/user/a/atlidali/w1/users/johnda/testNewIterator"
-
-#============= Prefix of the directory ===================
-#(eg dirPrefix = Iter if iterations as given in the above example)
-dirPrefix = "Iter"
-
-#============= Number of iterations ======================
-numIter = 10
-skipIter = 10
-
-#============= Are there sub jobs ? ======================
-# This Needs fixed
-numSubJobs = 0
-
-#======================================
-include("InDetAlignExample/makeAnalysis.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/BarrelModule.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/BarrelModule.py
deleted file mode 100755
index 50167fa6b83ccb0691e7d7a6504dcc6debb85c13..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/BarrelModule.py
+++ /dev/null
@@ -1,396 +0,0 @@
-from ROOT import *
-
-class Module:
-    "handles modules that are read in from alignlog"
-
-    def __init__(self,m_bec,m_lay,m_phi):
-        self.bec = int(m_bec)
-        self.lay = int(m_lay)
-        self.phi = int(m_phi)
-        self.ID = 3*self.phi + self.lay
-        self.CogX = 0.0
-        self.CogY = 0.0
-        self.CogZ = 0.0
-        self.RefX = 0.0
-        self.RefY = 0.0
-        self.RefZ = 0.0
-        self.RefRotx = 0.0
-        self.RefRoty = 0.0
-        self.RefRotz = 0.0
-        self.Rotx = 0.0
-        self.Roty = 0.0
-        self.Rotz = 0.0
-        self.Dx = 0.0
-        self.Dy = 0.0
-        self.Dz = 0.0
-        self.Drotx = 0.0
-        self.Droty = 0.0
-        self.Drotz = 0.0
-        self.ErrDx = 0.0
-        self.ErrDy = 0.0
-        self.ErrDz = 0.0
-        self.NHitsIter = []
-        self.DxIter = []
-        self.DxErrIter = []
-        self.DyIter = []
-        self.DyErrIter = []
-        self.DzIter = []
-        self.DzErrIter = []
-        self.RotxIter = []
-        self.RotxErrIter = []
-        self.RotyIter = []
-        self.RotyErrIter = []
-        self.RotzIter = []
-        self.RotzErrIter = []
-        self.Chi2Iter = []
-        self.tot = {}
-        self.err = {}
-        self.initialPositionDx = 0
-        self.initialPositionDy = 0
-        self.initialPositionDz = 0
-        
-    def drawDx(self, opt="PL"):
-        self.DxGraph = TGraphErrors(self.DxIter.__len__())
-        self.tot["dx"] = 0.0
-        self.err["dx"] = 0.0
-        self.DxGraph.SetTitle("Dx Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.DxGraph.GetXaxis().SetTitle("Iteration")
-        self.DxGraph.GetYaxis().SetTitle("mm")
-        self.DxGraph.GetXaxis().SetLimits(-0.2,(self.DxIter.__len__()+1)-0.8)
-        self.DxGraph.SetMaximum(0.4)
-        self.DxGraph.SetMinimum(-0.4)
-        self.DxGraph.SetMarkerColor(self.ID+7)
-        self.DxGraph.SetLineColor(self.ID+7)
-        for i in range(self.DxIter.__len__()):
-            self.DxGraph.SetPoint(i,i,self.DxIter[i])
-            self.DxGraph.SetPointError(i,0,self.DxErrIter[i])
-            self.tot["dx"] += self.DxIter[i]
-            self.err["dx"] =  self.DxErrIter[i]
-        #print "The total change in Dx for ",str(self.bec),"_"+str(self.lay)+"_"+str(self.phi)," was",self.tot["dx"],"+/-",self.err["dx"],
-        return self.DxGraph.Draw(opt)
-
-    def drawTotDx(self, opt="PL"):
-        self.DxTotGraph = TGraphErrors(self.DxIter.__len__())
-        self.tot["dx"] = 0.0
-        self.err["dx"] = 0.0
-        self.DxTotGraph.SetTitle("X Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.DxTotGraph.GetXaxis().SetTitle("Iteration")
-        self.DxTotGraph.GetYaxis().SetTitle("mm")
-        self.DxTotGraph.GetXaxis().SetLimits(-0.2,(self.DxIter.__len__()+1)-0.8)
-        self.DxTotGraph.SetMaximum(0.2)
-        self.DxTotGraph.SetMinimum(-0.4)
-        self.DxTotGraph.SetMarkerColor(self.ID+7)
-        self.DxTotGraph.SetLineColor(self.ID+7)
-        for i in range(self.DxIter.__len__()):
-            self.err["dx"] =  self.DxErrIter[i]
-            self.tot["dx"] +=  self.DxIter[i]
-            self.DxTotGraph.SetPoint(i,i,self.tot["dx"])
-            self.DxTotGraph.SetPointError(i,0,self.DxErrIter[i])
-        return self.DxTotGraph.Draw(opt)
-
-    def drawDy(self, opt="PL"):
-        self.DyGraph = TGraphErrors(self.DyIter.__len__())
-        self.tot["dy"] = 0.0
-        self.err["dy"] = 0.0
-        self.DyGraph.SetTitle("Dy Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.DyGraph.GetXaxis().SetTitle("Iteration")
-        self.DyGraph.GetYaxis().SetTitle("mm")
-        self.DyGraph.GetXaxis().SetLimits(-0.2,(self.DyIter.__len__()+1)-0.8)
-        self.DyGraph.SetMaximum(0.4)
-        self.DyGraph.SetMinimum(-0.4)
-        self.DyGraph.SetMarkerColor(self.ID+8)
-        self.DyGraph.SetLineColor(self.ID+8)
-        for i in range(self.DyIter.__len__()):
-            self.DyGraph.SetPoint(i,i,self.DyIter[i])
-            self.DyGraph.SetPointError(i,0,self.DyErrIter[i])
-            self.tot["dy"] += self.DyIter[i]
-            self.err["dy"] =  self.DyErrIter[i]
-        #print "The total change in Dy for ",str(self.bec),"_"+str(self.lay)+"_"+str(self.phi)," was",self.tot["dy"],"+/-",self.err["dy"],
-        return self.DyGraph.Draw(opt)
-
-    def drawTotDy(self, opt="PL"):
-        self.DyTotGraph = TGraphErrors(self.DyIter.__len__())
-        self.tot["dy"] = 0.0
-        self.err["dy"] = 0.0
-        self.DyTotGraph.SetTitle("X Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.DyTotGraph.GetXaxis().SetTitle("Iteration")
-        self.DyTotGraph.GetYaxis().SetTitle("mm")
-        self.DyTotGraph.GetXaxis().SetLimits(-0.2,(self.DyIter.__len__()+1)-0.8)
-        self.DyTotGraph.SetMaximum(0.2)
-        self.DyTotGraph.SetMinimum(-0.4)
-        self.DyTotGraph.SetMarkerColor(self.ID+8)
-        self.DyTotGraph.SetLineColor(self.ID+8)
-        for i in range(self.DyIter.__len__()):
-            self.err["dy"] =  self.DyErrIter[i]
-            self.tot["dy"] +=  self.DyIter[i]
-            self.DyTotGraph.SetPoint(i,i,self.tot["dy"])
-            self.DyTotGraph.SetPointError(i,0,self.DyErrIter[i])
-        return self.DyTotGraph.Draw(opt)
-    
-    def drawDz(self, opt="PL"):
-        self.DzGraph = TGraphErrors(self.DzIter.__len__())
-        self.tot["dz"] = 0.0
-        self.err["dz"] = 0.0
-        self.DzGraph.SetTitle("Dz Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.DzGraph.GetXaxis().SetTitle("Iteration")
-        self.DzGraph.GetYaxis().SetTitle("mm")
-        self.DzGraph.GetXaxis().SetLimits(-0.2,(self.DzIter.__len__()+1)-0.8)
-        self.DzGraph.SetMaximum(0.6)
-        self.DzGraph.SetMinimum(-0.6)
-        self.DzGraph.SetMarkerColor(self.ID+9)
-        self.DzGraph.SetLineColor(self.ID+9)
-        for i in range(self.DzIter.__len__()):
-            self.DzGraph.SetPoint(i,i,self.DzIter[i])
-            self.DzGraph.SetPointError(i,0,self.DzErrIter[i])
-            self.tot["dz"] += self.DzIter[i]
-            self.err["dz"] =  self.DzErrIter[i]
-        #print "The total change in Dz for ",str(self.bec)+"_"+str(self.lay)+"_",str(self.phi)," was",self.tot["dz"],"+/-",self.err["dz"]
-        return self.DzGraph.Draw(opt)
-
-    def drawTotDz(self, opt="PL"):
-        self.DzTotGraph = TGraphErrors(self.DzIter.__len__())
-        self.tot["dz"] = 0.0
-        self.err["dz"] = 0.0
-        self.DzTotGraph.SetTitle("Z Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.DzTotGraph.GetXaxis().SetTitle("Iteration")
-        self.DzTotGraph.GetYaxis().SetTitle("mm")
-        self.DzTotGraph.GetXaxis().SetLimits(-0.2,(self.DzIter.__len__()+1)-0.8)
-        self.DzTotGraph.SetMaximum(1.5)
-        self.DzTotGraph.SetMinimum(-1.5)
-        self.DzTotGraph.SetMarkerColor(self.ID+9)
-        self.DzTotGraph.SetLineColor(self.ID+9)
-        for i in range(self.DzIter.__len__()):
-            self.err["dz"] =  self.DzErrIter[i]
-            self.tot["dz"] +=  self.DzIter[i]
-            self.DzTotGraph.SetPoint(i,i,self.tot["dz"])
-            self.DzTotGraph.SetPointError(i,0,self.DzErrIter[i])
-        return self.DzTotGraph.Draw(opt)
-    
-    def drawRotx(self, opt="PL"):
-        self.RotxGraph = TGraphErrors(self.RotxIter.__len__())
-        self.tot["rotx"] = 0.0
-        self.err["rotx"] = 0.0
-        self.RotxGraph.SetTitle("Rotx Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.RotxGraph.GetXaxis().SetTitle("Iteration")
-        self.RotxGraph.GetYaxis().SetTitle("mm")
-        self.RotxGraph.GetXaxis().SetLimits(-0.2,(self.RotxIter.__len__()+1)-0.8)
-        self.RotxGraph.SetMaximum(0.002)
-        self.RotxGraph.SetMinimum(-0.002)
-        self.RotxGraph.SetMarkerColor(self.ID+7)
-        self.RotxGraph.SetLineColor(self.ID+7)
-        for i in range(self.RotxIter.__len__()):
-            self.RotxGraph.SetPoint(i,i,self.RotxIter[i])
-            self.RotxGraph.SetPointError(i,0,self.RotxErrIter[i])
-            self.tot["rotx"] += self.RotxIter[i]
-            self.err["rotx"] =  self.RotxErrIter[i]
-        #print "The total change in Rotx for ",str(self.bec)+"_"+str(self.lay)+"_"+str(self.phi)," was",self.tot["rotx"],"+/-",self.err["rotx"]
-        return self.RotxGraph.Draw(opt)
-
-    def drawTotRotx(self, opt="PL"):
-        self.RotxTotGraph = TGraphErrors(self.RotxIter.__len__())
-        self.tot["rotx"] = 0.0
-        self.err["rotx"] = 0.0
-        self.RotxTotGraph.SetTitle("Rotx Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.RotxTotGraph.GetXaxis().SetTitle("Iteration")
-        self.RotxTotGraph.GetYaxis().SetTitle("mm")
-        self.RotxTotGraph.GetXaxis().SetLimits(-0.2,(self.RotxIter.__len__()+1)-0.8)
-        self.RotxTotGraph.SetMaximum(0.002)
-        self.RotxTotGraph.SetMinimum(-0.002)
-        self.RotxTotGraph.SetMarkerColor(self.ID+7)
-        self.RotxTotGraph.SetLineColor(self.ID+7)
-        for i in range(self.RotxIter.__len__()):
-            self.tot["rotx"] += self.RotxIter[i]
-            self.err["rotx"] =  self.RotxErrIter[i]
-            self.RotxTotGraph.SetPoint(i,i,self.tot["rotx"])
-            self.RotxTotGraph.SetPointError(i,0,self.RotxErrIter[i])
-            
-        #print "The total change in Rotx for ",str(self.bec)+"_"+str(self.lay)+"_"+str(self.phi)," was",self.tot["rotx"],"+/-",self.err["rotx"]
-        return self.RotxTotGraph.Draw(opt)
-
-    def drawRoty(self, opt="PL"):
-        self.RotyGraph = TGraphErrors(self.RotyIter.__len__())
-        self.tot["roty"] = 0.0
-        self.err["roty"] = 0.0
-        self.RotyGraph.SetTitle("Roty Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.RotyGraph.GetXaxis().SetTitle("Iteration")
-        self.RotyGraph.GetYaxis().SetTitle("mm")
-        self.RotyGraph.GetXaxis().SetLimits(-0.2,(self.RotyIter.__len__()+1)-0.8)
-        self.RotyGraph.SetMaximum(0.002)
-        self.RotyGraph.SetMinimum(-0.002)
-        self.RotyGraph.SetMarkerColor(self.ID+8)
-        self.RotyGraph.SetLineColor(self.ID+8)
-        for i in range(self.RotyIter.__len__()):
-            self.RotyGraph.SetPoint(i,i,self.RotyIter[i])
-            self.RotyGraph.SetPointError(i,0,self.RotyErrIter[i])
-            self.tot["roty"] += self.RotyIter[i]
-            self.err["roty"] =  self.RotyErrIter[i]
-        #print "The total change in roty for ",str(self.bec)+"_"+str(self.lay)+"_",str(self.phi)," was",self.tot["roty"],"+/-",self.err["roty"]
-        return self.RotyGraph.Draw(opt)
-
-    def drawTotRoty(self, opt="PL"):
-        self.RotyTotGraph = TGraphErrors(self.RotyIter.__len__())
-        self.tot["roty"] = 0.0
-        self.err["roty"] = 0.0
-        self.RotyTotGraph.SetTitle("Roty Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.RotyTotGraph.GetXaxis().SetTitle("Iteration")
-        self.RotyTotGraph.GetYaxis().SetTitle("mm")
-        self.RotyTotGraph.GetXaxis().SetLimits(-0.2,(self.RotyIter.__len__()+1)-0.8)
-        self.RotyTotGraph.SetMaximum(0.0002)
-        self.RotyTotGraph.SetMinimum(-0.0002)
-        self.RotyTotGraph.SetMarkerColor(self.ID+8)
-        self.RotyTotGraph.SetLineColor(self.ID+8)
-        for i in range(self.RotyIter.__len__()):
-            self.tot["roty"] += self.RotyIter[i]
-            self.err["roty"] =  self.RotyErrIter[i]
-            self.RotyTotGraph.SetPoint(i,i,self.tot["roty"])
-            self.RotyTotGraph.SetPointError(i,0,self.RotyErrIter[i])
-            
-        return self.RotyTotGraph.Draw(opt)
-
-    def drawRotz(self, opt="PL"):
-        self.RotzGraph = TGraphErrors(self.RotzIter.__len__())
-        self.tot["rotz"] = 0.0
-        self.err["rotz"] = 0.0
-        self.RotzGraph.SetTitle("Rotz Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.RotzGraph.GetXaxis().SetTitle("Iteration")
-        self.RotzGraph.GetYaxis().SetTitle("mm")
-        self.RotzGraph.GetXaxis().SetLimits(-0.2,(self.RotzIter.__len__()+1)-0.8)
-        self.RotzGraph.SetMaximum(0.002)
-        self.RotzGraph.SetMinimum(-0.002)
-        self.RotzGraph.SetMarkerColor(self.ID+9)
-        self.RotzGraph.SetLineColor(self.ID+9)
-        for i in range(self.RotzIter.__len__()):
-            self.RotzGraph.SetPoint(i,i,self.RotzIter[i])
-            self.RotzGraph.SetPointError(i,0,self.RotzErrIter[i])
-            self.tot["rotz"] += self.RotzIter[i]
-            self.err["rotz"] =  self.RotzErrIter[i]
-        ##print "The total change in rotz for ",str(self.bec)+"_"+str(self.lay)+"_"+str(self.phi)," was",self.tot["rotz"],"+/-",self.err["rotz"]
-        #print "The total change in rotz for %i %i %i was %.2g +/- %.1g" % (self.bec,self.lay,self.phi,self.tot["rotz"], self.err["rotz"])
-        return self.RotzGraph.Draw(opt)
-
-    def drawTotRotz(self, opt="PL"):
-        self.RotzTotGraph = TGraphErrors(self.RotzIter.__len__())
-        self.tot["rotz"] = 0.0
-        self.err["rotz"] = 0.0
-        self.RotzTotGraph.SetTitle("Rotz Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.RotzTotGraph.GetXaxis().SetTitle("Iteration")
-        self.RotzTotGraph.GetYaxis().SetTitle("mm")
-        self.RotzTotGraph.GetXaxis().SetLimits(-0.2,(self.RotzIter.__len__()+1)-0.8)
-        self.RotzTotGraph.SetMaximum(0.002)
-        self.RotzTotGraph.SetMinimum(-0.002)
-        self.RotzTotGraph.SetMarkerColor(self.ID+9)
-        self.RotzTotGraph.SetLineColor(self.ID+9)
-        for i in range(self.RotzIter.__len__()):
-            self.tot["rotz"] += self.RotzIter[i]
-            self.err["rotz"] =  self.RotzErrIter[i]
-            self.RotzTotGraph.SetPoint(i,i,self.tot["rotz"])
-            self.RotzTotGraph.SetPointError(i,0,self.RotzErrIter[i])
-                        
-        return self.RotzTotGraph.Draw(opt)
-
-    def drawChi2(self, opt="PL"):
-        self.Chi2Graph = TGraphErrors(self.Chi2Iter.__len__())
-        self.tot["chi2"] = 0.0
-        self.Chi2Graph.SetTitle("Chi2 Alignment vs Iterations for Layer"+str(self.lay)+"and Phi Module"+str(self.phi))
-        self.Chi2Graph.GetXaxis().SetTitle("Iteration")
-        self.Chi2Graph.GetXaxis().SetLimits(-0.2,(self.Chi2Iter.__len__()+1)-0.8)
-        self.Chi2Graph.SetMaximum(5000)
-        self.Chi2Graph.SetMinimum(1e-8)
-        self.Chi2Graph.SetMarkerStyle(3)
-        self.Chi2Graph.SetMarkerSize(2)
-        self.Chi2Graph.SetMarkerColor(self.ID+1)
-        self.Chi2Graph.SetLineColor(self.ID+1)
-        for i in range(self.Chi2Iter.__len__()):
-            self.Chi2Graph.SetPoint(i,i,self.Chi2Iter[i])
-            self.tot["chi2"] += self.Chi2Iter[i]
-        return self.Chi2Graph.Draw(opt)
-    
-    def AddDxIter(self, m_x, m_err):
-        self.DxIter.append(float(m_x))
-        self.DxErrIter.append(float(m_err))
-
-    def AddDyIter(self, m_x, m_err):
-        self.DyIter.append(float(m_x))
-        self.DyErrIter.append(float(m_err))
-
-    def AddDzIter(self, m_z, m_err):
-        self.DzIter.append(float(m_z))
-        self.DzErrIter.append(float(m_err))
-
-    def AddRotxIter(self, m_x, m_err):
-        self.RotxIter.append(float(m_x))
-        self.RotxErrIter.append(float(m_err))
-
-    def AddRotyIter(self, m_y, m_err):
-        self.RotyIter.append(float(m_y))
-        self.RotyErrIter.append(float(m_err))
-
-    def AddRotzIter(self, m_z, m_err):
-        self.RotzIter.append(float(m_z))
-        self.RotzErrIter.append(float(m_err))
-
-    def AddChi2Iter(self, m_chi2):
-        self.Chi2Iter.append(float(m_chi2))
-        
-    def SetCogX(self, m_x):
-        self.CogX = float(m_x)
-
-    def SetCogY(self, m_y):
-        self.CogY = float(m_y)
-
-    def SetCogZ(self, m_z):
-        self.CogZ = float(m_z)
-
-    def SetRefX(self, m_x):
-        self.RefX = float(m_x)
-
-    def SetRefY(self, m_y):
-        self.RefY = float(m_y)
-
-    def SetRefZ(self, m_z):
-        self.RefZ = float(m_z)
-
-    def SetRefRotx(self, m_x):
-        self.RefRotx = float(m_x)
-
-    def SetRefRoty(self, m_y):
-        self.RefRoty = float(m_y)
-
-    def SetRefRotz(self, m_z):
-        self.RefRotz = float(m_z)
-
-    def SetRotx(self, m_rotx):
-        self.Rotx = float(m_rotx)
-
-    def SetRoty(self, m_roty):
-        self.Roty = float(m_roty)
-
-    def SetRotz(self, m_rotz):
-        self.Rotz = float(m_rotz)
-
-    def SetDx(self, m_dx):
-       self.Dx = float(m_dx)
-
-    def SetDy(self, m_dy):
-        self.Dy = float(m_dy)
-
-    def SetDz(self, m_dz):
-        self.Dz = float(m_dz)
-
-    def SetDrotx(self, m_rotx):
-        self.Drotx = float(m_rotx)
-
-    def SetDroty(self, m_roty):
-        self.Droty = float(m_roty)
-
-    def SetDrotz(self, m_rotz):
-        self.Drotz = float(m_rotz)
-
-    def SetErrDx(self, m_dx):
-        self.ErrDx = float(m_dx)
-
-    def SetErrDz(self, m_dz):
-        self.ErrDz = float(m_dz)
-
-    def AddNHits(self, m_nhits):
-        self.NHitsIter.append(int(m_nhits))
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/CSCTruthPlots.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/CSCTruthPlots.py
deleted file mode 100755
index 38d4c742f7648eccf6412fc1e993d0f279f8a5ce..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/CSCTruthPlots.py
+++ /dev/null
@@ -1,347 +0,0 @@
-from ROOT import *
-include("InDetAlignExample/RootSetup.py")
-import sys, string, os
-
-
-def drawCSCTruth( posfile ):
-    m_pull_p_tot = TH1F("m_pull_p_tot"," \hat{#phi} pulls for all layers ", 50, -20,20)
-    m_pull_p_tot.SetLineWidth(2)
-    m_pull_p_0 = TH1F("m_pull_p_0"," \hat{#phi} pulls for modules in layer 0", 50, -20,20)
-    m_pull_p_0.SetLineWidth(2)
-    m_pull_p_1 = TH1F("m_pull_p_1"," \hat{#phi} pulls for modules in layer 1", 50, -20,20)
-    m_pull_p_1.SetLineWidth(2)
-    m_pull_p_2 = TH1F("m_pull_p_2"," \hat{#phi} pulls for modules in layer 2", 50, -20,20)
-    m_pull_p_2.SetLineWidth(2)
-    
-    m_res_p_tot = TH1F("m_res_p_tot"," \hat{#phi} res for all layers ", 50, -0.1,0.1)
-    m_res_p_tot.SetLineWidth(2)
-    m_res_p_0 = TH1F("m_res_p_0"," \hat{#phi} res for modules in layer 0", 50, -0.1,0.1)
-    m_res_p_0.SetLineWidth(2)
-    m_res_p_1 = TH1F("m_res_p_1"," \hat{#phi} res for modules in layer 1", 50, -0.1,0.1)
-    m_res_p_1.SetLineWidth(2)
-    m_res_p_2 = TH1F("m_res_p_2"," \hat{#phi} res for modules in layer 2", 50, -0.1,0.1)
-    m_res_p_2.SetLineWidth(2)
-    
-    m_resN_p_tot = TH2F("m_resN_p_tot"," \hat{#phi} res times sqrt(N) for all layers ", 50, 100,10000, 50,-10,10)
-    m_resN_p_tot.SetLineWidth(2)
-    m_resN_p_0 = TH2F("m_resN_p_0"," \hat{#phi} res times sqrt(N) for modules in layer 0", 50,100, 10000, 50, -10,10)
-    m_resN_p_0.SetLineWidth(2)
-    m_resN_p_1 = TH2F("m_resN_p_1"," \hat{#phi} res  times sqrt(N) for modules in layer 1", 50,100,10000, 50, -10,10)
-    m_resN_p_1.SetLineWidth(2)
-    m_resN_p_2 = TH2F("m_resN_p_2"," \hat{#phi} res  times sqrt(N) for modules in layer 2", 50, 100, 10000, 50, -10,10)
-    m_resN_p_2.SetLineWidth(2)
-    
-    m_pull_r_tot = TH1F("m_pull_r_tot"," \hat{r} pulls for all layers   ", 50, -20,20)
-    m_pull_r_tot.SetLineWidth(2)
-    m_pull_r_0 = TH1F("m_pull_r_0"," \hat{r} pulls for modules in layer 0", 50, -20,20)
-    m_pull_r_0.SetLineWidth(2)
-    m_pull_r_1 = TH1F("m_pull_r_1"," \hat{r} pulls for modules in layer 1", 50, -20,20)
-    m_pull_r_1.SetLineWidth(2)
-    m_pull_r_2 = TH1F("m_pull_r_2"," \hat{r} pulls for modules in layer 2", 50, -20,20)
-    m_pull_r_2.SetLineWidth(2)
-    
-    m_res_r_tot = TH1F("m_res_r_tot"," \hat{r} res for all layers   ", 50, -1,1)
-    m_res_r_tot.SetLineWidth(2)
-    m_res_r_0 = TH1F("m_res_r_0"," \hat{r} res for modules in layer 0", 50, -1,1)
-    m_res_r_0.SetLineWidth(2)
-    m_res_r_1 = TH1F("m_res_r_1"," \hat{r} res for modules in layer 1", 50, -1,1)
-    m_res_r_1.SetLineWidth(2)
-    m_res_r_2 = TH1F("m_res_r_2"," \hat{r} res for modules in layer 2", 50, -1,1)
-    m_res_r_2.SetLineWidth(2)
-    
-    m_resN_r_tot = TH2F("m_resN_r_tot"," \hat{r} res  times sqrt(N) vs N for all layers   ", 50, 100, 10000,50,-100,100)
-    m_resN_r_tot.SetLineWidth(2)
-    m_resN_r_0 = TH2F("m_resN_r_0"," \hat{r} res  times sqrt(N) vs N for modules in layer 0", 50, 100,10000,50,-100,100)
-    m_resN_r_0.SetLineWidth(2)
-    m_resN_r_1 = TH2F("m_resN_r_1"," \hat{r} res  times sqrt(N) vs N for modules in layer 1", 50, 100,10000,50,-100,100)
-    m_resN_r_1.SetLineWidth(2)
-    m_resN_r_2 = TH2F("m_resN_r_2"," \hat{r} res  times sqrt(N) vs N for modules in layer 2", 50, 100,10000,50,-100,100)
-    m_resN_r_2.SetLineWidth(2)
-    
-    m_cor_tot = TH2F("m_cor_tot"," res correlation (phi vs R) for all layers   ", 50, -0.1,0.1, 50, -2, 2)
-    m_cor_tot.SetMarkerStyle(7)
-    m_cor_0 = TH2F("m_cor_0"," res correlation (phi vs R) for modules in layer 0", 50, -0.1,0.1, 50, -2, 2)
-    m_cor_0.SetMarkerStyle(7)
-    m_cor_1 = TH2F("m_cor_1"," res correlation (phi vs R) for modules in layer 1", 50, -0.1,0.1, 50, -2, 2)
-    m_cor_1.SetMarkerStyle(7)
-    m_cor_2 = TH2F("m_cor_2"," res correlation (phi vs R) for modules in layer 2", 50, -0.1,0.1, 50, -2, 2)
-    m_cor_2.SetMarkerStyle(7)
-
-    m_modDict={}
-
-    #==== Initialize all the modules which are readout
-    for i in range(3):
-        for j in range(32):
-            if 3*j+i in readOut:
-                mod = Module(-1,i,j)
-                m_modDict[3*mod.phi+mod.lay] = mod
-    #================================================
-                
-    # Read the referncefile next,  Here we get the local-to-global position.
-    file = open(referencefile)
-
-    for line in file:
-        words = string.split(line)
-        if words.__len__() > 1:
-            if words[1] == "trans=":
-                m_id = words[0].split('_')
-                modId = 3*int(m_id[2])+int(m_id[3])
-                if m_id[1] == "-1" and modId in readOut:
-                    m_cog = words[2].split(',')
-                    m_modDict[modId].SetRefX(m_cog[0].lstrip('('))
-                    m_modDict[modId].SetRefY(m_cog[1])
-                    m_modDict[modId].SetRefZ(m_cog[2].rstrip(')'))
-                    m_modDict[modId].SetRefRotx(words[4].lstrip('(').rstrip(','))
-                    m_modDict[modId].SetRefRoty(words[5].rstrip(','))
-                    m_modDict[modId].SetRefRotz(words[6].rstrip(')'))
-                    
-
-    file.close()
-    
-    # Read the positionfile next,  Here we get the local-to-global position plus 
-    # the displacements recommended by the alignment.
-    file = open(posfile)
-
-    nlinesAfterModInitialize = 99 #start value > 0
-    modId = 99 # start value of modId different from all others
-    
-    for line in file:
-        nlinesAfterModInitialize += 1
-        words = string.split(line)
-        if words[0] == "new" and words[4].split('_')[0].split('/')[1] == "Barrel" :
-            modId = 3* int(words[4].split('_')[2])+ int(words[4].split('_')[3])
-            if modId in readOut:
-                nlinesAfterModInitialize = 0
-            
-        if nlinesAfterModInitialize == 1 and modId in readOut:
-            m_modDict[modId].SetNHits( words[4] )
-            
-
-        if nlinesAfterModInitialize == 3 and modId in readOut:
-            m_modDict[modId].SetErrDx( words[3] )
-              
-        if nlinesAfterModInitialize == 4 and modId in readOut:
-            m_modDict[modId].SetErrDz( words[3] ) 
-            
-        #Reading in the Cog-displacement and rotation from the alignlog
-        if words[0] == "Total" and words[1]== "alignment":
-            m_id = words[3].split('_')
-            if m_id[1] == "-1":
-                modId = 3*int(m_id[2]) + int(m_id[3])
-                if modId in readOut:
-                    m_dis = words[7].split(',')
-                    m_modDict[modId].SetDx( m_dis[0].lstrip('(') )
-                    m_modDict[modId].SetDy( m_dis[1] )
-                    m_modDict[modId].SetDz( m_dis[2].rstrip(')') )
-                    m_rot = words[10].split(',')
-                    m_modDict[modId].SetDrotx( m_rot[0].lstrip('(') )
-                    m_modDict[modId].SetDroty( m_rot[1] )
-                    m_modDict[modId].SetDrotz( m_rot[2].rstrip(')') )
-
-        #Reading in the Local to Global transformations
-        if words.__len__() > 1:
-            if words[1] == "trans=":
-                m_id = words[0].split('_')
-                if m_id[1] == "-1":
-                    m_cog = words[2].split(',')
-                    modId = 3*int(m_id[2])+int(m_id[3])
-                    if modId in readOut:
-                        m_modDict[modId].SetCogX(m_cog[0].lstrip('('))
-                        m_modDict[modId].SetCogY(m_cog[1])
-                        m_modDict[modId].SetCogZ(m_cog[2].rstrip(')'))
-                        m_modDict[modId].SetRotx(words[4].lstrip('(').rstrip(','))
-                        m_modDict[modId].SetRoty(words[5].rstrip(','))
-                        m_modDict[modId].SetRotz(words[6].rstrip(')'))
-                
-    file.close()
-
-    
-       
-    # ======================
-    # Fill the plots
-    # ======================
-
-    for j in range(readOut.__len__()):
-        i = readOut[j]
-        if m_modDict[i].bec == -1:
-            x1 = m_modDict[i].RefX 
-            y1 = m_modDict[i].RefY 
-            
-            x2 = m_modDict[i].CogX 
-            y2 = m_modDict[i].CogY 
-            
-            dx = x2-x1
-            dy = y2-y1
-            
-            # the reference point
-            v1 = TVector2(x1,y1)
-            # the change
-            v2 = TVector2(dx,dy)
-            
-            # - Projection
-            perp2r = v2.Norm(v1)
-            
-            dxpj = perp2r.Px() 
-            dypj = perp2r.Py() 
-            dxr  = dx - perp2r.Px()
-            dyr  = dy - perp2r.Py()
-
-            #residuals of the r and phi direction
-            res_p = pow( pow( dxpj, 2) + pow( dypj, 2) , 0.5)
-            res_r = pow( pow( dxr, 2) + pow( dyr, 2) , 0.5)
-
-            #errors on the r and phi direction need to get the error
-            errorp = m_modDict[i].ErrDx
-            errorr = m_modDict[i].ErrDz
-            
-            #Setting the signs of the residuals
-            sign = v2.DeltaPhi(v1)
-
-            if sign >0:
-                res_p *= -1
-            else:
-                res_p *= 1
-
-            if y1 > 0 and dyr > 0:
-                res_r *=1
-            elif y1<0 and dyr <0:
-                res_r *=1
-            else:
-                res_r *= -1
-            sqN = pow( m_modDict[i].Nhits , 0.5)
-            
-            # Filling the total residuals
-            if errorr != 0 and errorp != 0:
-                m_res_p_tot.Fill( res_p)
-                m_res_r_tot.Fill( res_r)
-                m_resN_p_tot.Fill( m_modDict[i].Nhits,res_p*sqN)
-                m_resN_r_tot.Fill( m_modDict[i].Nhits,res_r*sqN)
-                m_cor_tot.Fill(res_p, res_r )
-                m_pull_p_tot.Fill( res_p/errorp)
-                m_pull_r_tot.Fill( res_r/errorr)
-
-                  
-
-                # Filling the residuals at the layer level
-                if m_modDict[i].lay == 0:
-                    m_res_p_0.Fill( res_p)
-                    m_res_r_0.Fill( res_r)
-                    m_resN_p_0.Fill( m_modDict[i].Nhits,res_p*sqN)
-                    m_resN_r_0.Fill( m_modDict[i].Nhits,res_r*sqN)
-                    m_cor_0.Fill(res_p, res_r )
-                    m_pull_p_0.Fill( res_p/errorp)
-                    m_pull_r_0.Fill( res_r/errorr)
-                    
-                if m_modDict[i].lay == 1:
-                    m_res_p_1.Fill( res_p)
-                    m_res_r_1.Fill( res_r)
-                    m_resN_p_1.Fill( m_modDict[i].Nhits,res_p*sqN)
-                    m_resN_r_1.Fill( m_modDict[i].Nhits,res_r*sqN)
-                    m_cor_1.Fill(res_p, res_r )
-                    m_pull_p_1.Fill( res_p/errorp)
-                    m_pull_r_1.Fill( res_r/errorr)
-
-                if m_modDict[i].lay == 2:
-                    m_res_p_2.Fill( res_p)
-                    m_res_r_2.Fill( res_r)
-                    m_resN_p_2.Fill( m_modDict[i].Nhits,res_p*sqN)
-                    m_resN_r_2.Fill( m_modDict[i].Nhits,res_r*sqN)
-                    m_cor_2.Fill(res_p, res_r )
-                    m_pull_p_2.Fill( res_p/errorp)
-                    m_pull_r_2.Fill( res_r/errorr)
-    
-
-  
-  
-    if "Dx" not in DofNotAligned:
-        c1 = TCanvas("Residual Misalignments in Phi")
-        c1.Divide(2,2)
-        c1.cd(1)
-        m_res_p_tot.Draw()
-        gStyle.SetOptFit()
-        c1.cd(2)
-        m_res_p_0.Draw()
-        c1.cd(3)
-        m_res_p_1.Draw("")
-        c1.cd(4)
-        m_res_p_2.Draw("")
-        c1.Write()
-
-        c5 = TCanvas("Residual Misalignments in Phi times sqrt(N)")
-        c5.Divide(2,2)
-        c5.cd(1)
-        m_resN_p_tot.Draw()
-        gStyle.SetOptFit()
-        c5.cd(2)
-        m_resN_p_0.Draw()
-        c5.cd(3)
-        m_resN_p_1.Draw("")
-        c5.cd(4)
-        m_resN_p_2.Draw("")
-        c5.Write()
-
-        c3 = TCanvas("Phi Pulls")
-        c3.Divide(2,2)
-        c3.cd(1)
-        m_pull_p_tot.Draw()
-        gStyle.SetOptFit()
-        m_pull_p_tot.Fit("gaus","q")
-        c3.cd(2)
-        m_pull_p_0.Draw()
-        c3.cd(3)
-        m_pull_p_1.Draw("")
-        c3.cd(4)
-        m_pull_p_2.Draw("")
-        c3.Write()
-        
-    if "Dz" not in DofNotAligned:
-        c2  = TCanvas("Residual Misalignments in R")
-        c2.Divide(2,2)
-        c2.cd(1)
-        m_res_r_tot.Draw()
-        c2.cd(2)
-        m_res_r_0.Draw()
-        c2.cd(3)
-        m_res_r_1.Draw("")
-        c2.cd(4)
-        m_res_r_2.Draw("")
-        c2.Write()
-        
-
-        c6 = TCanvas("Residual Misalignments in Phi times sqrt(N)")
-        c6.Divide(2,2)
-        c6.cd(1)
-        m_resN_r_tot.Draw()
-        c6.cd(2)
-        m_resN_r_0.Draw()
-        c6.cd(3)
-        m_resN_r_1.Draw("")
-        c6.cd(4)
-        m_resN_r_2.Draw("")
-        c6.Write()
-
-        c4 = TCanvas("R Pulls")
-        c4.Divide(2,2)
-        c4.cd(1)
-        m_pull_r_tot.Draw()
-        m_pull_r_tot.Fit("gaus","q")
-        c4.cd(2)
-        m_pull_r_0.Draw()
-        c4.cd(3)
-        m_pull_r_1.Draw("")
-        c4.cd(4)
-        m_pull_r_2.Draw("")
-        c4.Write()
-
-    if "Dz" not in DofNotAligned and "Dx" not in DofNotAligned:    
-        c10 = TCanvas("Correlation between the phi and the r residual")
-        c10.Divide(2,2)
-        c10.cd(1)
-        m_cor_tot.Draw()
-        c10.cd(2)
-        m_cor_0.Draw()
-        c10.cd(3)
-        m_cor_1.Draw("")
-        c10.cd(4)
-        m_cor_2.Draw("")
-        c10.Write()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ModulePlots.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ModulePlots.py
deleted file mode 100755
index 3189370e10dd170ea3e42b4511beb07c921d97d1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ModulePlots.py
+++ /dev/null
@@ -1,242 +0,0 @@
-from ROOT import *
-include("InDetAlignExample/RootSetup.py")
-import sys, string, os
-
-
-def drawModulePlots( posfile ):
-    m_error_p_tot = TH1F("m_error_p_tot"," \hat{#phi} error for all layers ", 50, 0,0.05)
-    m_error_p_tot.SetLineWidth(2)
-    m_error_p_tot.SetFillColor(kGray+1)
-    m_error_p_0 = TH1F("m_error_p_0"," \hat{#phi} error for modules in layer 0", 50, 0,0.05)
-    m_error_p_0.SetLineWidth(2)
-    m_error_p_0.SetFillColor(kGray+1)
-    m_error_p_1 = TH1F("m_error_p_1"," \hat{#phi} error for modules in layer 1", 50, 0,0.05)
-    m_error_p_1.SetLineWidth(2)
-    m_error_p_1.SetFillColor(kGray+1)
-    m_error_p_2 = TH1F("m_error_p_2"," \hat{#phi} error for modules in layer 2", 50, 0,0.05)
-    m_error_p_2.SetLineWidth(2)
-    m_error_p_2.SetFillColor(kGray+1)
-    
-    m_errorN_p_tot = TH2F("m_errorN_p_tot"," \hat{#phi} error  times sqrt(N) vs N for all layers ", 50, 100, 1e5, 50,0,10)
-    m_errorN_p_tot.SetMarkerStyle(7)
-    m_errorN_p_0 = TH2F("m_errorN_p_0"," \hat{#phi} error  times sqrt(N) vs N for modules in layer 0", 50, 100,1e5,50,0,10)
-    m_errorN_p_0.SetMarkerStyle(7)
-    m_errorN_p_1 = TH2F("m_errorN_p_1"," \hat{#phi} error  times sqrt(N) vs N for modules in layer 1", 50, 100,1e5,50,0,10)
-    m_errorN_p_1.SetMarkerStyle(7)
-    m_errorN_p_2 = TH2F("m_errorN_p_2"," \hat{#phi} error  times sqrt(N) vs N for modules in layer 2", 50, 100,1e5,50,0,10)
-    m_errorN_p_2.SetMarkerStyle(7)
-    
-    m_error_r_tot = TH1F("m_error_r_tot"," \hat{r} error for all layers   ", 50, 0,0.1)
-    m_error_r_tot.SetLineWidth(2)
-    m_error_r_tot.SetFillColor(kGray+1)
-    m_error_r_0 = TH1F("m_error_r_0"," \hat{r} error for modules in layer 0", 50, 0,0.1)
-    m_error_r_0.SetLineWidth(2)
-    m_error_r_0.SetFillColor(kGray+1)
-    m_error_r_1 = TH1F("m_error_r_1"," \hat{r} error for modules in layer 1", 50, 0,0.1)
-    m_error_r_1.SetLineWidth(2)
-    m_error_r_1.SetFillColor(kGray+1)
-    m_error_r_2 = TH1F("m_error_r_2"," \hat{r} error for modules in layer 2", 50, 0,0.1)
-    m_error_r_2.SetLineWidth(2)
-    m_error_r_2.SetFillColor(kGray+1)
-    
-    m_errorN_r_tot = TH2F("m_errorN_r_tot"," \hat{r} error  times sqrt(N) for all layers   ", 50, 100, 1e5,50, 0,5)
-    m_errorN_r_tot.SetMarkerStyle(7)
-    m_errorN_r_0 = TH2F("m_errorN_r_0"," \hat{r} error  times sqrt(N) for modules in layer 0", 50, 100, 1e5,50, 0,5 )
-    m_errorN_r_0.SetMarkerStyle(7)
-    m_errorN_r_1 = TH2F("m_errorN_r_1"," \hat{r} error  times sqrt(N) for modules in layer 1", 50, 100, 1e5, 50, 0,5)
-    m_errorN_r_1.SetMarkerStyle(7)
-    m_errorN_r_2 = TH2F("m_errorN_r_2"," \hat{r} error  times sqrt(N) for modules in layer 2", 50, 100, 1e5, 50, 0,5)
-    m_errorN_r_2.SetMarkerStyle(7)
-    
-    m_N_tot = TH1F("m_N_tot"," sqrt(N) for all layers   ", 50, 0,1e3)
-    m_N_tot.SetLineWidth(2)
-    m_N_tot.SetFillColor(kGray+1)
-    m_N_0 = TH1F("m_N_0"," sqrt(N) for modules in layer 0", 50, 0,1e3)
-    m_N_0.SetLineWidth(2)
-    m_N_0.SetFillColor(kGray+1)
-    m_N_1 = TH1F("m_N_1"," sqrt(N) for modules in layer 1", 50, 0,1e3)
-    m_N_1.SetLineWidth(2)
-    m_N_1.SetFillColor(kGray+1)
-    m_N_2 = TH1F("m_N_2"," sqrt(N) for modules in layer 2", 50, 0,1e3)
-    m_N_2.SetLineWidth(2)
-    m_N_2.SetFillColor(kGray+1)
-
-    
-    m_modDict={}
-
-    #==== Initialize all the modules which are readout
-    for i in range(3):
-        for j in range(32):
-            if 3*j+i in readOut:
-                mod = Module(-1,i,j)
-                m_modDict[3*mod.phi+mod.lay] = mod
-    #================================================
-    
-    file = open(posfile)
-
-    nlinesAfterModInitialize = 99 #start value > 0
-    modId = 99 # start value of modId different from all others
-   
-    for line in file:
-        nlinesAfterModInitialize += 1
-        words = string.split(line)
-        if words[0] == "new" and words[4].split('_')[0].split('/')[1] == "Barrel" :
-            modId = 3* int(words[4].split('_')[2])+ int(words[4].split('_')[3])
-            if modId in readOut:
-                nlinesAfterModInitialize = 0
-   
-        if nlinesAfterModInitialize == 1 and modId in readOut:
-            m_modDict[modId].AddNHits( words[4] )
-     
-
-        if nlinesAfterModInitialize == 3 and modId in readOut:
-            m_modDict[modId].SetErrDx( words[3] )
-     
-        
-        #Commment out the following for 1 dof  
-        if nlinesAfterModInitialize == 4 and modId in readOut:
-            m_modDict[modId].SetErrDz( words[3] ) 
-            
-        #Reading in the Cog-displacement and rotation from the alignlog
-        if words[0] == "Total" and words[1]== "alignment":
-            m_id = words[3].split('_')
-            if m_id[1] == "-1":
-                modId = 3*int(m_id[2]) + int(m_id[3])
-                if modId in readOut:
-                    m_dis = words[7].split(',')
-                    m_modDict[modId].SetDx( m_dis[0].lstrip('(') )
-                    m_modDict[modId].SetDy( m_dis[1] )
-                    m_modDict[modId].SetDz( m_dis[2].rstrip(')') )
-                    m_rot = words[10].split(',')
-                    m_modDict[modId].SetDrotx( m_rot[0].lstrip('(') )
-                    m_modDict[modId].SetDroty( m_rot[1] )
-                    m_modDict[modId].SetDrotz( m_rot[2].rstrip(')') )
-                
-        #Reading in the Local to Global transformations
-        if words.__len__() > 1:
-            if words[1] == "trans=":
-                m_id = words[0].split('_')
-                if m_id[1] == "-1":
-                    m_cog = words[2].split(',')
-                    modId = 3*int(m_id[2])+int(m_id[3])
-                    if modId in readOut:
-                        m_modDict[modId].SetCogX(m_cog[0].lstrip('('))
-                        m_modDict[modId].SetCogY(m_cog[1])
-                        m_modDict[modId].SetCogZ(m_cog[2].rstrip(')'))
-                        m_modDict[modId].SetRotx(words[4].lstrip('(').rstrip(','))
-                        m_modDict[modId].SetRoty(words[5].rstrip(','))
-                        m_modDict[modId].SetRotz(words[6].rstrip(')'))
-                    
-    file.close()
-    
-    
-       
-    # ======================
-    # Fill the plots
-    # ======================
-
-    for j in range(readOut.__len__()):
-        i = readOut[j]
-        if m_modDict[i].bec == -1:
-            
-            errorp = m_modDict[i].ErrDx
-            errorr = m_modDict[i].ErrDz
-
-            max = modDict[i].NHitsIter.__len__()
-            sqN = pow( modDict[i].NHitsIter[max-1] , 0.5)
-            m_N_tot.Fill( sqN )
-            
-            # Filling the total residuals
-            if errorr != 0 and errorp != 0:
-                m_error_p_tot.Fill( errorp)
-                m_error_r_tot.Fill( errorr)
-                m_errorN_p_tot.Fill( modDict[i].NHitsIter[max-1],errorp*sqN)
-                m_errorN_r_tot.Fill( modDict[i].NHitsIter[max-1], errorr*sqN)
-                
-                  
-                # Filling the residuals at the layer level
-                if m_modDict[i].lay == 0:
-                    m_error_p_0.Fill( errorp)
-                    m_error_r_0.Fill( errorr)
-                    m_errorN_p_0.Fill( modDict[i].NHitsIter[max-1], errorp*sqN)
-                    m_errorN_r_0.Fill( modDict[i].NHitsIter[max-1], errorr*sqN)
-                    m_N_0.Fill( sqN )
-
-                if m_modDict[i].lay == 1:
-                    m_error_p_1.Fill( errorp)
-                    m_error_r_1.Fill( errorr)
-                    m_errorN_r_1.Fill( modDict[i].NHitsIter[max-1] , errorr*sqN)
-                    m_errorN_p_1.Fill( modDict[i].NHitsIter[max-1],errorp*sqN)
-                    m_N_1.Fill( sqN )
-                    
-                if m_modDict[i].lay == 2:
-                    m_error_p_2.Fill( errorp)
-                    m_error_r_2.Fill( errorr)
-                    m_errorN_r_2.Fill( modDict[i].NHitsIter[max-1], errorr*sqN)
-                    m_errorN_p_2.Fill( modDict[i].NHitsIter[max-1], errorp*sqN)
-                    m_N_2.Fill( sqN )
-                    
-    c9 = TCanvas("Number of hits")
-    c9.Divide(2,2)
-    c9.cd(1)
-    m_N_tot.Draw()
-    c9.cd(2)
-    m_N_0.Draw()
-    c9.cd(3)
-    m_N_1.Draw("")
-    c9.cd(4)
-    m_N_2.Draw("")
-    c9.Write()
-
-    if "Dx" not in DofNotAligned:
-        c3 = TCanvas("Error on module phi positions" )
-        c3.Divide(2,2)
-        c3.cd(1)
-        m_error_p_tot.Draw()
-        c3.cd(2)
-        m_error_p_0.Draw()
-        c3.cd(3)
-        m_error_p_1.Draw("")
-        c3.cd(4)
-        m_error_p_2.Draw("")
-        c3.Write()
-        
-        c7 = TCanvas("Error on module phi positions times sqrt(N)" )
-        c7.Divide(2,2)
-        c7.cd(1)
-        m_errorN_p_tot.Draw()
-        c7.cd(2)
-        m_errorN_p_0.Draw()
-        c7.cd(3)
-        m_errorN_p_1.Draw("")
-        c7.cd(4)
-        m_errorN_p_2.Draw("")
-        c7.Write()
-        
-    if "Dz" not in DofNotAligned:
-        c4 = TCanvas("Error on module r positions" )
-        c4.Divide(2,2)
-        c4.cd(1)
-        m_error_r_tot.Draw()
-        c4.cd(2)
-        m_error_r_0.Draw()
-        c4.cd(3)
-        m_error_r_1.Draw("")
-        c4.cd(4)
-        m_error_r_2.Draw("")
-        c4.Write()
-    
-        c8 = TCanvas("Error on module r positions times sqrt(N)" )
-        c8.Divide(2,2)
-        c8.cd(1)
-        m_errorN_r_tot.Draw()
-        c8.cd(2)
-        m_errorN_r_0.Draw()
-        c8.cd(3)
-        m_errorN_r_1.Draw("")
-        c8.cd(4)
-        m_errorN_r_2.Draw("")
-        c8.Write()
-    
-        
-    
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadAlignTextFile.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadAlignTextFile.py
deleted file mode 100644
index d1d46d9d4133989a6b2f0001ed30ba186440a383..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadAlignTextFile.py
+++ /dev/null
@@ -1,158 +0,0 @@
-""" This file takes an alignment output (or input) file and writes out the alignment constants with respect to the nominal (0,0,0,0,0,0) positions in the Cartesian frame, from the euler angles"""
-
-import sys
-
-from ROOT import *
-
-if sys.argv.__len__() == 1:
-    print "You have to give an alignmentinput.txt file"
-    sys.exit(-1)
-
-onlyL1 = False
-onlyL2B = False
-onlyL2EC = False
-onlyL2ECA = False
-onlyL2ECC = False
-
-if sys.argv.__len__() == 3:
-    if sys.argv[2] == "-L1":
-        onlyL1 = True
-    elif sys.argv[2] == "-L2B":
-        onlyL2B = True
-    elif sys.argv[2] == "-L2EC":
-        onlyL2EC = True
-    elif sys.argv[2] == "-L2ECC":
-        onlyL2ECC = True
-    elif sys.argv[2] == "-L2ECA":
-        onlyL2ECA = True
-    
-    
-inputFileName = str( sys.argv[1])
-inputFile = open(inputFileName, "r")
-
-AlignmentContainer = ""
-
-for line in inputFile:
-    words = line.split()
-    
-    # Get the alignment container
-    if words.__len__() == 1:
-        AlignmentContainer = words[0].split("/")[3]
-        
-    
-    # Get the lines with the alignable transforms
-    if words.__len__() == 9:
-
-        #Get the L1 alignable transforms
-        # Barrel
-        if AlignmentContainer == 'TRT':
-            if words[0] == '-1':
-                print "====================================="
-                print "The L1 alignment for the Barrel is: "
-            elif words[0] == '-2':
-                print "====================================="
-                print "The L1 alignment for the Endcap C is: "
-            elif words[0] == '2':
-                print "====================================="
-                print "The L1 alignment for the Endcap A is: "
-        elif AlignmentContainer == "B0":
-            if onlyL1:
-                sys.exit()
-            elif onlyL2EC or onlyL2ECA or onlyL2ECC:
-                continue
-            print "==========================="
-            print " The L2 alignment for Layer 0, Phi Sector", words[2],"is"
-        elif AlignmentContainer == "B1":
-            if onlyL1:
-                sys.exit()
-            elif onlyL2EC or onlyL2ECA or onlyL2ECC:
-                continue
-            print "==========================="
-            print " The L2 alignment for Layer 1, Phi Sector", words[2],"is"
-        elif AlignmentContainer == "B2":
-            if onlyL1:
-                sys.exit()
-            elif onlyL2EC or onlyL2ECA or onlyL2ECC:
-                continue
-            print "==========================="
-            print " The L2 alignment for Layer 2, Phi Sector", words[2],"is" 
-        elif AlignmentContainer == "L2A":
-            if onlyL1:
-                sys.exit()
-            elif onlyL2B or onlyL2ECC:
-                continue
-            print "==========================="
-            print " The L2 alignment for Endcap A, Wheel",words[1],"StrayLayer",words[2],"is"
-        elif AlignmentContainer == "L2C":
-            if onlyL1:
-                sys.exit()
-            elif onlyL2B or onlyL2ECA:
-                continue
-            print "==========================="
-            print " The L2 alignment for Endcap C, Wheel",words[1],"StrayLayer",words[2],"is"
-                
-        dx =    float(words[3])
-        dy =    float(words[4])
-        dz =    float(words[5])
-        Phi =   float(words[6])
-        Theta = float(words[7])
-        Psi =   float(words[8])
-        
-        rotation = TRotation()
-        rotation.SetXEulerAngles(Phi, Theta, Psi)
-
-        print "Dx = ",dx
-        print "Dy = ",dy
-        print "Dz = ",dz
-                
-        # To get rotation around X
-        #============================
-        vectorAlongZ = TVector3(0,0,1)
-        rotatedVectorAlongZ = rotation * vectorAlongZ
-        rotatedVectorProjectedYZPlane = TVector3(0,
-                                                 rotatedVectorAlongZ.Y(),
-                                                 rotatedVectorAlongZ.Z())
-        sign = 1.0
-        # clockwise is negative
-        if rotatedVectorProjectedYZPlane.Y() < 0:
-            sign = -1.0
-
-        rotationAboutX = sign * vectorAlongZ.Angle(rotatedVectorProjectedYZPlane)
-        print "Rotx = ",rotationAboutX
-        
-        # To get rotation around Y
-        #============================
-        rotatedVectorProjectedXZPlane = TVector3(rotatedVectorAlongZ.X(),
-                                                 0,
-                                                 rotatedVectorAlongZ.Z())
-
-        sign = 1.0
-        # clockwise is negative
-        if rotatedVectorProjectedXZPlane.X() < 0:
-            sign = -1.0
-        
-        rotationAboutY = sign*vectorAlongZ.Angle(rotatedVectorProjectedXZPlane)
-        print "Roty = ",rotationAboutY
-        
-        # To get rotation around Z
-        #============================
-        vectorAlongX = TVector3(1,0,0)
-        rotatedVectorAlongX = rotation * vectorAlongX
-        rotatedVectorProjectedXYPlane = TVector3(rotatedVectorAlongX.X(),
-                                                 rotatedVectorAlongX.Y(),
-                                                 0)
-
-        sign = 1.0
-        # clockwise is negative
-        if rotatedVectorProjectedXYPlane.Y() < 0:
-            sign = -1.0
-        
-                
-        rotationAboutZ = sign*vectorAlongX.Angle(rotatedVectorProjectedXYPlane)
-        print "Rotz = ",rotationAboutZ
-        
-
-
-        
-print sys.argv
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadinAlignmentData.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadinAlignmentData.py
deleted file mode 100755
index 739bbdae76384c64a62dded9fbd431985b590a8d..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadinAlignmentData.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#=======================================================#
-#==========Reading in the data==========================#
-#=======================================================#
-
-#====get the current directory===
-currentdir = os.getcwd()
-
-isOk(dirHead)
-os.chdir(dirHead)
-print "Reading", dirHead
-
-Chi2Method = getChi2Method()
-
-for iter in range(numIter):
-    if (iter < numIter): 
-        isOk(dirPrefix + str(iter+skipIter))
-        os.chdir(dirPrefix + str(iter+skipIter))
-        isOk(alignlogfilename)
-        file = open(alignlogfilename)
-        print "Reading From Directory ", dirPrefix+str(iter+skipIter)
-        totChi2[iter] = 0
-        readhalf = False
-        for line in file:
-            words = string.split(line)
-            if words.__len__() >0:
-                if( words.__len__()>4 and words[3] == "processed" and words[4] == "tracks:" and not numSubJobs): 
-                    procTracks[iter] = int(words[5])
-                if( words.__len__()>4 and words[3] == "processed" and words[4] == "hits:" and not numSubJobs): 
-                    procHits[iter] = int(words[5])
-                if( words.__len__()>4 and words[1] == "total" and words[2] == "chisquare" and not numSubJobs):
-                    totChi2[iter] = float(words[5])
-                if( not Chi2Method and words.__len__()>4 and words[1] == "chisquare/ndof" ):#change in chi2 in the local method
-                    chngChi2[iter] = float(words[6].split('/')[0])
-                if ( Chi2Method and words[0] == 'chisquare/ndof' and words[5] == "(global-method):" ):#change in chi2 in the global method
-                    chngChi2[iter] = float(words[6])
-                if( Chi2Method and words.__len__() > 2 and words[1] == "Aligning" and words[3] == "global"):
-                    readhalf = True
-                if( not Chi2Method or readhalf):#Stupid Hack b/c in global method, both global and local solutions are written
-                    if len(words) == 5 and words[0] == "new" and words[1] == "alignment" and words[2] == "parameters":
-                        keys =  words[4].split("_")
-                        bec = int(keys[1])
-                        phi = int(keys[2])
-                        lay = 0
-                        if len(keys) > 3:
-                            lay = int(keys[3])
-                        moduleNum = getModuleNumber(bec,lay,phi)
-
-                    if ( words[0] == "number" and words[2] == "hits" and moduleNum in modDict):
-                        modDict[moduleNum].AddNHits(words[4])
-                    if ( words[0] == "dx" and moduleNum in modDict):
-                        modDict[moduleNum].AddDxIter(words[1],words[3])
-                    if ( words[0] == "dy" and moduleNum in modDict):
-                        modDict[moduleNum].AddDyIter(words[1],words[3])
-                    if ( words[0] == "dz" and moduleNum in modDict):
-                        modDict[moduleNum].AddDzIter(words[1],words[3])
-                    if ( words[0] == "rotx" and moduleNum in modDict):
-                        modDict[moduleNum].AddRotxIter(words[1],words[3])
-                    if ( words[0] == "roty" and moduleNum in modDict):
-                        modDict[moduleNum].AddRotyIter(words[1],words[3])
-                    if ( words[0] == "rotz" and moduleNum in modDict):
-                        modDict[moduleNum].AddRotzIter(words[1],words[3])
-                    if ( not Chi2Method and words[0] == 'chisquare/dof' and words[3] == "alignment" and moduleNum in modDict ): #module only have a change in chi2 for the local method
-                        modDict[moduleNum].AddChi2Iter(words[5])
-                    
-        file.close()
-        os.chdir("..")
-
-print "================== Reading the subjobs ==========================="
-if numSubJobs:
-    os.chdir(dirHead)
-    print os.getcwd()
-    for iter in range(numIter):
-        procTracks[iter] = 0
-        procHits[iter] = 0
-        totChi2[iter] = 0
-        print "Reading From Sub-Directories in ", dirPrefix+str(iter+skipIter)
-        for subJob in range(numSubJobs):
-            if isOkJustGiveWarning(dirPrefix + str(iter+skipIter)+"_"+str(subJob)):
-                os.chdir(dirPrefix + str(iter+skipIter)+"_"+str(subJob))
-                if isOkJustGiveWarning(alignlogfilename):
-                    file = open(alignlogfilename)
-                    for line in file:
-                        words = string.split(line)
-                        if words.__len__() >0:
-                            if( words.__len__()>4 and words[3] == "processed" and words[4] == "tracks:"): 
-                                procTracks[iter] += int(words[5])
-                            if( words.__len__()>4 and words[3] == "processed" and words[4] == "hits:"): 
-                                procHits[iter] += int(words[5])
-                            if( words.__len__()>4 and words[1] == "total" and words[2] == "chisquare"):
-                                totChi2[iter] += float(words[5])
-                        
-                    file.close()
-                os.chdir("..")
-
-print "================== Getting the EigenValues  ==========================="
-if Chi2Method:
-    os.chdir(dirHead+dirPrefix + str(numIter-1))
-    file = open(alignlogfilename)
-    readDataFlag = False
-    for line in file:
-        words = string.split(line)
-        #Trun off the reading of eigen values
-        if words.__len__() == 3 and words[0] == "End" and words[1] == "Eigenvalue" :
-            readDataFlag = False
-
-        #read the eigen values
-        if readDataFlag:
-            if words[0] == "solveLapack:":
-                eigenValues.append(float(words[3]))
-            else:
-                eigenValues.append(float(words[0]))
-
-        #Trun on the reading of eigen values
-        if words.__len__() ==3 and words[0] == "The" and words[1] == "Eigenvalue" :
-            readDataFlag = True
-    eigenValues.sort()
-    file.close()
-    
-    
-#===return to the original directory====
-os.chdir(currentdir)
-print "We've read in all the data ============= Exiting ReadinAlignmentData.py"
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadinAlignmentDataNew.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadinAlignmentDataNew.py
deleted file mode 100755
index 0257d781017d42c1739f934cba5c9f32ef37fff8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/ReadinAlignmentDataNew.py
+++ /dev/null
@@ -1,115 +0,0 @@
-#=======================================================#
-#==========Reading in the data==========================#
-#=======================================================#
-
-#====get the current directory===
-currentdir = os.getcwd()
-
-isOk(dirHead)
-os.chdir(dirHead)
-print "Reading", dirHead
-
-if doNew:
-    Chi2Method = getChi2MethodNew()
-else:
-    Chi2Method = getChi2Method()
-    
-for iter in range(numIter):
-    if (iter < numIter): 
-        isOk(dirPrefix + str(iter+skipIter))
-        os.chdir(dirPrefix + str(iter+skipIter))
-        isOk(alignlogfilename)
-        file = open(alignlogfilename)
-        print "Reading From Directory ", dirPrefix+str(iter+skipIter)
-        totChi2[iter] = 0
-        readhalf = False
-        for line in file:
-            words = string.split(line)
-            if words.__len__() >0:
-                if( words.__len__()>5 and words[3] == "accumulated" and words[4] == "tracks:" and not numSubJobs): 
-                    procTracks[iter] = int(words[5])
-                if( words.__len__()>5 and words[3] == "processed" and words[4] == "hits:" and not numSubJobs): 
-                    procHits[iter] = int(words[5])
-                if( words.__len__()>5 and words[1] == "total" and words[2] == "chi2" and not numSubJobs):
-                    totChi2[iter] = float(words[5])
-                if( Chi2Method and words.__len__() > 2 and words[1] == "solving" and words[3] == "Global"):
-                    readhalf = True
-                if( not Chi2Method or readhalf):#Stupid Hack b/c in global method, both global and local solutions are written
-                    if len(words) > 4 and words[0] == "Alignment" and words[1] == "parameters" and words[3] == "module:":
-                        moduleNum = getThisModuleNumber(words)
-
-                    if ( words[0] == "Number" and words[2] == "hits" and moduleNum in modDict):
-                        modDict[moduleNum].AddNHits(words[4])
-                    if ( words[0] == "TransX" and moduleNum in modDict):
-                        modDict[moduleNum].AddDxIter(words[1],words[3])
-                    if ( words[0] == "TransY" and moduleNum in modDict):
-                        modDict[moduleNum].AddDyIter(words[1],words[3])
-                    if ( words[0] == "TransZ" and moduleNum in modDict):
-                        modDict[moduleNum].AddDzIter(words[1],words[3])
-                    if ( words[0] == "RotX" and moduleNum in modDict):
-                        modDict[moduleNum].AddRotxIter(words[1],words[3])
-                    if ( words[0] == "RotY" and moduleNum in modDict):
-                        modDict[moduleNum].AddRotyIter(words[1],words[3])
-                    if ( words[0] == "RotZ" and moduleNum in modDict):
-                        modDict[moduleNum].AddRotzIter(words[1],words[3])
-                    
-        file.close()
-        os.chdir("..")
-
-print "================== Reading the subjobs ==========================="
-if numSubJobs:
-    os.chdir(dirHead)
-    print os.getcwd()
-    for iter in range(numIter):
-        procTracks[iter] = 0
-        procHits[iter] = 0
-        totChi2[iter] = 0
-        print "Reading From Sub-Directories in ", dirPrefix+str(iter+skipIter)
-        for subJob in range(numSubJobs):
-            if isOkJustGiveWarning(dirPrefix + str(iter+skipIter)+"_"+str(subJob)):
-                os.chdir(dirPrefix + str(iter+skipIter)+"_"+str(subJob))
-                if isOkJustGiveWarning(alignlogfilename):
-                    file = open(alignlogfilename)
-                    for line in file:
-                        words = string.split(line)
-                        if words.__len__() >0:
-                            if( words.__len__()>4 and words[3] == "processed" and words[4] == "tracks:"): 
-                                procTracks[iter] += int(words[5])
-                            if( words.__len__()>4 and words[3] == "processed" and words[4] == "hits:"): 
-                                procHits[iter] += int(words[5])
-                            if( words.__len__()>4 and words[1] == "total" and words[2] == "chisquare"):
-                                totChi2[iter] += float(words[5])
-                        
-                    file.close()
-                os.chdir("..")
-
-print "================== Getting the EigenValues  ==========================="
-if Chi2Method:
-    os.chdir(dirHead+"/"+dirPrefix + str(numIter-1))
-    file = open(alignlogfilename)
-    readDataFlag = False
-    for line in file:
-        words = string.split(line)
-        #Trun off the reading of eigen values
-        if words.__len__() == 3 and words[0] == "End" and words[1] == "Eigenvalue" :
-            readDataFlag = False
-
-        #read the eigen values
-        if readDataFlag:
-            if words[0] == "solveLapack:":
-                eigenValues.append(float(words[3]))
-            else:
-                eigenValues.append(float(words[0]))
-
-        #Trun on the reading of eigen values
-        if words.__len__() ==3 and words[0] == "The" and words[1] == "Eigenvalue" :
-            readDataFlag = True
-    eigenValues.sort()
-    file.close()
-    
-    
-#===return to the original directory====
-os.chdir(currentdir)
-print "We've read in all the data ============= Exiting ReadinAlignmentData.py"
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/RootSetup.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/RootSetup.py
deleted file mode 100755
index 83fa8c2441f86440ed70db996657f94de8c84793..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/RootSetup.py
+++ /dev/null
@@ -1,22 +0,0 @@
-
-from ROOT import *
-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)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/WriteAlignmentAnalysis.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/WriteAlignmentAnalysis.py
deleted file mode 100755
index f2cfc8be2de13fb04e12b50450bcaa0c9599f0fd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/WriteAlignmentAnalysis.py
+++ /dev/null
@@ -1,120 +0,0 @@
-from math import log
-#=======================================================#
-#Make the Root file by calling the afore defined functions==========
-#=======================================================#
-rootfile = TFile(Outputfile, "RECREATE")
-
-# If we do L2
-if LevelOfAlignment == 1:
-    
-    dir = rootfile.mkdir("TRT_Barrel", "TRT Barrel")
-    dir.cd()
-    drawL2Barrel()
-
-    dir = rootfile.mkdir("TRT_EndcapC", "TRT Endcap C")
-    dir.cd()
-    drawL2Endcap(-2)
-
-    dir = rootfile.mkdir("TRT_EndcapA", "TRT Endcap A")
-    dir.cd()
-    drawL2Endcap(2)
-    
-    print "|=================================================================================================================================|"
-    print "|==========================================     New L2 Alignment Constants    ====================================================|"
-    print "|=================================================================================================================================|"
-    print "|      Module       |",
-    if "Dx" not in DofNotAligned:
-        print "       Dx           |",
-    if "Dz" not in DofNotAligned:
-        print "       Dz           |",
-    if "Rotx" not in DofNotAligned:
-        print "       Rotx         |",
-    if "Roty" not in DofNotAligned:
-        print "       Roty         |",
-    if "Rotz" not in DofNotAligned:
-        print "       Rotz         |",
-
-    print ""
-    print "|---------------------------------------------------------------------------------------------------------------------------------|"    
-
-    for modId in modDict:
-        m_lay = modDict[modId].lay
-        m_phi = modDict[modId].phi
-        m_bec = modDict[modId].bec
-
-        if m_bec == -1:
-            rootfile.cd("TRT_Barrel")
-        elif m_bec == -2:
-            rootfile.cd("TRT_EndcapC")
-        elif m_bec == 2:
-            rootfile.cd("TRT_EndcapA")
-
-        dirname = "Module_"+str(m_bec)+"_"+str(m_lay)+"_"+str(m_phi)
-        gDirectory.mkdir(dirname,"TRT_/"+dirname).cd()
-        drawModule(modDict[modId])
-
-    print "|=================================================================================================================================|"
-    print "|=================================================================================================================================|"
-    print "|=================================================================================================================================|"
-
-if LevelOfAlignment == 0:
-    drawStats()
-
-    print "|=================================================================================================================================|"
-    print "|==========================================     New L1 Alignment Constants    ====================================================|"
-    print "|=================================================================================================================================|"
-    print "|      Module       |",
-
-    if "Dx" not in DofNotAligned:
-        print "       Dx           |",
-    if "Dy" not in DofNotAligned:
-        print "       Dy           |",
-    if "Dz" not in DofNotAligned:
-        print "       Dz           |",
-    if "Rotx" not in DofNotAligned:
-        print "       Rotx         |",
-    if "Roty" not in DofNotAligned:
-        print "       Roty         |",
-    if "Rotz" not in DofNotAligned:
-        print "       Rotz         |",
-
-    print ""
-    print "|---------------------------------------------------------------------------------------------------------------------------------|" 
-
-
-    if -2 in modDict:
-        dir = rootfile.mkdir("TRT_EndCapC", "TRT EndCap C")
-        dir.cd()
-        drawModule(modDict[-2])
-    if -1 in modDict:
-        dir = rootfile.mkdir("TRT_Barrel", "TRT Barrel")
-        dir.cd()
-        drawModule(modDict[-1])
-    if +2 in modDict:
-        dir = rootfile.mkdir("TRT_EndCapA", "TRT EndCap A")
-        dir.cd()
-        drawModule(modDict[2])
-
-
-rootfile.cd()
-if Chi2Method:
-    c0 = TCanvas("Eigen Value Spectrum")
-    c0.SetGridx()
-    c0.SetGridy()
-    c0.SetLogy(1)
-    eigenValueHist = TH1F("m_eigenValueHist","Eigen value spectrum",100,-20,20)
-    for i in range(eigenValues.__len__()):
-        eigenValueHist.Fill(log(eigenValues[i],10))
-    eigenValueHist.SetFillColor(kGray+1)
-    
-    eigenValueHist.Draw()
-    c0.Write()
-
-    print "|=================================================================================================================================|"
-    print "|=================================================================================================================================|"
-    print "|=================================================================================================================================|"
-    
-
-rootfile.Close()
-
-print "|=================================================================================================================================|"
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/analyzeAlignmentTools.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/analyzeAlignmentTools.py
deleted file mode 100644
index ddd0d317cfd370855e46a2fe884ddf41724ed2cc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/analyzeAlignmentTools.py
+++ /dev/null
@@ -1,746 +0,0 @@
-#======function for printing the errors in a decent manner
-from math import *
-
-def printerror(val, err):
-    if err:
-        prec = int(abs(round(log10(err))))
-    else:
-        prec = 3
-    #print str(round(val, prec))+"("+"%.1g)" % err,
-    return str(round(val, prec+1))+"("+"%.1g)" % err
-
-#===error handling functions=====
-def isOk(dirOrfile):
-    if not os.access(dirOrfile,os.F_OK):
-        print "The directory/file: "+dirOrfile+" is bogus, or cant be reached from where you are."
-        print "Check the path and the spelling."
-        sys.exit()
-    return ""
-
-def isOkJustGiveWarning(dirOrfile):
-    if not os.access(dirOrfile,os.F_OK):
-        print "WARNING: The file: "+dirOrfile+" is bogus, looks like failed job."
-        return 0
-    else:
-        return 1
-
-# returns a list of the dof not aligned
-def getDofNotAligned():
-    currentdir = os.getcwd()
-
-    DofNotAligned = []
-
-    didDx = False
-    didDy = False
-    didDz = False
-    didRotx = False
-    didRoty = False
-    didRotz = False
-    
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        if len(words) == 0:
-            continue
-        if words[0] == 'dx' and not didDx:
-            didDx = True
-            print words[0],"aligned"
-        if words[0] == 'dy' and not didDy:
-            didDy = True
-            print words[0],"aligned"
-        if words[0] == 'dz' and not didDz:
-            didDz = True
-            print words[0],"aligned"
-        if words[0] == 'rotx' and not didRotx:
-            didRotx = True
-            print words[0],"aligned"
-        if words[0] == 'roty' and not didRoty:
-            didRoty = True
-            print words[0],"aligned"
-        if words[0] == 'rotz' and not didRotz:
-            didRotz = True
-            print words[0],"aligned"
-    file.close()
-
-
-    if not didDx:
-        print "Dx NOT Aligned"
-        DofNotAligned.append("Dx")
-    if not didDy:
-        print "Dy NOT Aligned"
-        DofNotAligned.append("Dy")
-    if not didDz:
-        print "Dz NOT Aligned"
-        DofNotAligned.append("Dz")
-    if not didRotx:
-        print "rotx NOT Aligned"
-        DofNotAligned.append("Rotx")
-    if not didRoty:
-        print "roty NOT Aligned"
-        DofNotAligned.append("Roty")
-    if not didRotz:
-        print "rotz NOT Aligned"
-        DofNotAligned.append("Rotz")
-
-    os.chdir(currentdir)
-
-    return DofNotAligned
-
-
-# returns a list of the dof not aligned
-def getDofNotAlignedNew():
-    currentdir = os.getcwd()
-
-    DofNotAligned = []
-
-    didDx = False
-    didDy = False
-    didDz = False
-    didRotx = False
-    didRoty = False
-    didRotz = False
-    
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        if len(words) == 0:
-            continue
-        if words[0] == 'TransX' and not didDx:
-            didDx = True
-            print words[0],"aligned"
-        if words[0] == 'TransY' and not didDy:
-            didDy = True
-            print words[0],"aligned"
-        if words[0] == 'TransZ' and not didDz:
-            didDz = True
-            print words[0],"aligned"
-        if words[0] == 'RotX' and not didRotx:
-            didRotx = True
-            print words[0],"aligned"
-        if words[0] == 'RotY' and not didRoty:
-            didRoty = True
-            print words[0],"aligned"
-        if words[0] == 'RotZ' and not didRotz:
-            didRotz = True
-            print words[0],"aligned"
-    file.close()
-
-
-    if not didDx:
-        print "Dx NOT Aligned"
-        DofNotAligned.append("Dx")
-    if not didDy:
-        print "Dy NOT Aligned"
-        DofNotAligned.append("Dy")
-    if not didDz:
-        print "Dz NOT Aligned"
-        DofNotAligned.append("Dz")
-    if not didRotx:
-        print "rotx NOT Aligned"
-        DofNotAligned.append("Rotx")
-    if not didRoty:
-        print "roty NOT Aligned"
-        DofNotAligned.append("Roty")
-    if not didRotz:
-        print "rotz NOT Aligned"
-        DofNotAligned.append("Rotz")
-
-    os.chdir(currentdir)
-
-    return DofNotAligned
-
-
-
-# returns the chi2method used
-def getChi2Method():
-    # local is 0, gobal is 1
-    Chi2Method = 0
-
-    currentdir = os.getcwd()
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        if len(words) == 6 and words[1] == "Aligning" and words[3] == "global":
-            Chi2Method = 1
-
-    file.close()
-    os.chdir(currentdir)
-
-    if Chi2Method:
-        print "Aligned using the global method"
-    else:
-        print "Aligned using the local method"
-
-
-    return Chi2Method
-
-def getChi2MethodNew():
-    # local is 0, gobal is 1
-    Chi2Method = 0
-
-    currentdir = os.getcwd()
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        if len(words) == 6 and words[1] == "solving" and words[3] == "Global":
-            Chi2Method = 1
-
-    file.close()
-    os.chdir(currentdir)
-
-    if Chi2Method:
-        print "Aligned using the global method"
-    else:
-        print "Aligned using the local method"
-
-
-    return Chi2Method
-
-
-# returns the chi2method used
-def getLevelOfAlignment():
-    # 0 L1, 1 is L2 
-    LevelOfAlignment = 0
-
-    currentdir = os.getcwd()
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        #['new', 'alignment', 'parameters', 'for', 'TRT/Endcap/Module_-2_0_0']
-        if len(words) == 5 and words[0] == "new":
-            if len(words[4].split("_")) == 4 and words[4].split("_")[3] != "0":
-                LevelOfAlignment = 1
-            
-
-    file.close()
-    os.chdir(currentdir)
-
-    if LevelOfAlignment:
-        print "Reading in the L2 alignment"
-    else:
-        print "Reading in the L1 alignment"
-
-
-    return LevelOfAlignment
-
-def getLevelOfAlignmentNew():
-    # 0 L1, 1 is L2 
-    LevelOfAlignment = 0
-
-    currentdir = os.getcwd()
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        #['new', 'alignment', 'parameters', 'for', 'TRT/Endcap/Module_-2_0_0']
-        if len(words) == 5 and words[0] == "Alignment" and words[1] == "parameters":
-            if len(words[4].split("_")) == 4 and words[4].split("_")[3] != "0":
-                LevelOfAlignment = 1
-            
-
-    file.close()
-    os.chdir(currentdir)
-
-    if LevelOfAlignment:
-        print "Reading in the L2 alignment"
-    else:
-        print "Reading in the L1 alignment"
-
-
-    return LevelOfAlignment
-
-
-
-
-
-def getModuleNumber(bec,lay,phi):
-    # Case of L1
-    if not LevelOfAlignment:
-        if bec == -2:
-            return -2
-        elif bec == -1:
-            return -1
-        elif bec == 2:
-            return 2
-    # Case of L2
-    else:
-        sign = 1
-        if bec<0:
-            sign = -1
-        if bec == -1:
-            #print "returning ",sign*(abs(bec)*1000+lay*100+phi), bec, lay, phi
-            return sign*(abs(bec)*1000+lay*100+phi)
-        else:
-            #print "returning ",sign*(abs(bec)*10000+phi*100+lay), bec, lay, phi
-            return sign*(abs(bec)*10000+phi*100+lay)
-
-def getModules():
-    modDict = {}
-
-    currentdir = os.getcwd()
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        #['new', 'alignment', 'parameters', 'for', 'TRT/Endcap/Module_-2_0_0']
-        if len(words) == 5 and words[0] == "new" and words[1] == "alignment" and words[2] == "parameters":
-            keys =  words[4].split("_")
-            bec = int(keys[1])
-            phi = int(keys[2])
-            lay = 0
-            if len(keys) > 3:
-                lay = int(keys[3])
-            moduleNum = getModuleNumber(bec,lay,phi)
-            mod = Module(bec,lay,phi)
-            modDict[moduleNum] = mod    
-
-    file.close()
-    os.chdir(currentdir)
-    return modDict
-
-def getThisModule(words):
-
-    if LevelOfAlignment == 0:
-        if len(words) == 6 and words[4] == "TRT" and words[5] == "Barrel" :
-            mod = Module(-1,0,0)
-        elif len(words) == 7 and words[4] == "TRT" and words[5] == "EndCap" and words[6] == "A":
-            mod = Module(2,0,0)
-        elif len(words) == 7 and words[4] == "TRT" and words[5] == "EndCap" and words[6] == "C":
-            mod = Module(-2,0,0)
-    else:
-        if len(words) == 5:
-            ids = words[4].split("_")
-            if len(ids) == 4:
-                bec = int(ids[1])
-                phi = int(ids[2])
-                lay = int(ids[3])
-                mod = Module(bec,lay,phi)
-        
-    return mod
-
-def getThisModuleNumber(words):
-
-    if LevelOfAlignment == 0:
-        if len(words) == 6 and words[4] == "TRT" and words[5] == "Barrel" :
-            moduleNum  = getModuleNumber(-1,0,0)
-        elif len(words) == 7 and words[4] == "TRT" and words[5] == "EndCap" and words[6] == "A":
-            moduleNum  = getModuleNumber(2,0,0)
-        elif len(words) == 7 and words[4] == "TRT" and words[5] == "EndCap" and words[6] == "C":
-            moduleNum  = getModuleNumber(-2,0,0)
-    else:
-        if len(words) == 5:
-            ids = words[4].split("_")
-            if len(ids) == 4:
-                bec = int(ids[1])
-                phi = int(ids[2])
-                lay = int(ids[3])
-                moduleNum = getModuleNumber(bec,lay,phi)
-        
-    return moduleNum
-
-def getModulesNew():
-    modDict = {}
-
-    currentdir = os.getcwd()
-    isOk(dirHead)
-    os.chdir(dirHead)
-    
-    isOk(dirPrefix + str(0+skipIter))
-    os.chdir(dirPrefix + str(0+skipIter))
-    isOk(alignlogfilename)
-    file = open(alignlogfilename)
-
-    for line in file:
-        words = line.split()
-        
-        #['Alignment', 'parameters', 'for', 'module:', 'TRT', 'EndCap', 'C']
-        if len(words) > 4 and words[0] == "Alignment" and words[1] == "parameters" and words[3] == "module:":
-            mod = getThisModule(words)
-            moduleNum = getThisModuleNumber(words)
-            #else:
-            #    keys =  words[4].split("_")
-            #    bec = int(keys[1])
-            #    phi = int(keys[2])
-            #    lay = 0
-            #    if len(keys) > 3:
-            #        lay = int(keys[3])
-            #        moduleNum = getModuleNumber(bec,lay,phi)
-            #        mod = Module(bec,lay,phi)
-            modDict[moduleNum] = mod    
-
-    file.close()
-    os.chdir(currentdir)
-    return modDict
-
-
-def makeCanAndGraph(title,min,max,units):
-    can = TCanvas(title,title,700,500)
-    graph = TGraphErrors(numIter)
-    graph.GetXaxis().SetLimits(-0.2,(numIter)+0.2)
-    graph.SetTitle(title)
-    graph.SetMaximum(max)
-    graph.SetMinimum(min)
-    graph.GetXaxis().SetTitle("Iteration")
-    graph.GetYaxis().SetTitle(units)
-    return can,graph
-
-def makeGraph(title,min,max):
-    graph = TGraphErrors(numIter)
-    graph.SetTitle(title)
-    graph.GetXaxis().SetTitle("Iteration")
-    graph.GetXaxis().SetLimits(-0.2,(numIter+1)-0.8)
-    graph.SetMaximum(max)
-    graph.SetMinimum(min)
-    graph.SetMarkerStyle(7)
-    graph.SetMarkerSize(2)
-    graph.SetLineWidth(2)
-
-    return graph
-
-def drawL2Barrel():
-    drawStats()
-    #drawModulePlots(newpositionfile)
-    if doCSCTruth:
-        gDirectory.mkdir("CSCTruth","TRT_Barrel/CSCTruth").cd()
-        drawCSCTruth(newpositionfile)
-
-    dxCanAndGraph = [makeCanAndGraph("Change in x Layer 0",-0.2,0.2,"mm")
-                     ,makeCanAndGraph("Change in x Layer 1",-0.2,0.2,"mm")
-                     ,makeCanAndGraph("Change in x Layer 2",-0.2,0.2,"mm")]
-
-    totxCanAndGraph = [makeCanAndGraph("Total Change in x Layer 0",-0.6,0.6,"mm")
-                     ,makeCanAndGraph("Total Change in x Layer 1",-0.6,0.6,"mm")
-                     ,makeCanAndGraph("Total Change in x Layer 2",-0.6,0.6,"mm")]
-
-    dyCanAndGraph = [makeCanAndGraph("Change in y Layer 0",-0.2,0.2,"mm")
-                     ,makeCanAndGraph("Change in y Layer 1",-0.2,0.2,"mm")
-                     ,makeCanAndGraph("Change in y Layer 2",-0.2,0.2,"mm")]
-
-    totyCanAndGraph = [makeCanAndGraph("Total Change in y Layer 0",-0.6,0.6,"mm")
-                     ,makeCanAndGraph("Total Change in y Layer 1",-0.6,0.6,"mm")
-                     ,makeCanAndGraph("Total Change in y Layer 2",-0.6,0.6,"mm")]
-
-    dzCanAndGraph = [makeCanAndGraph("Change in z Layer 0",-0.2,0.2,"mm")
-                     ,makeCanAndGraph("Change in z Layer 1",-0.2,0.2,"mm")
-                     ,makeCanAndGraph("Change in z Layer 2",-0.2,0.2,"mm")]
-
-    totzCanAndGraph = [makeCanAndGraph("Total Change in z Layer 0",-0.6,0.6,"mm")
-                     ,makeCanAndGraph("Total Change in z Layer 1",-0.6,0.6,"mm")
-                     ,makeCanAndGraph("Total Change in z Layer 2",-0.6,0.6,"mm")]
-
-    rotxCanAndGraph = [makeCanAndGraph("Change in Rotx Layer 0",-1e-3,1e-3,"rad")
-                       ,makeCanAndGraph("Change in Rotx Layer 1",-1e-3,1e-3,"rad")
-                       ,makeCanAndGraph("Change in Rotx Layer 2",-1e-3,1e-3,"rad")]
-
-    totRotxCanAndGraph = [makeCanAndGraph("Total Change in Rotx Layer 0",-1e-2,1e-2,"rad")
-                          ,makeCanAndGraph("Total Change in Rotx Layer 1",-1e-2,1e-2,"rad")
-                          ,makeCanAndGraph("Total Change in Rotx Layer 2",-1e-2,1e-2,"rad")]
-
-    rotyCanAndGraph = [makeCanAndGraph("Change in Roty Layer 0",-1e-3,1e-3,"rad")
-                       ,makeCanAndGraph("Change in Roty Layer 1",-1e-3,1e-3,"rad")
-                       ,makeCanAndGraph("Change in Roty Layer 2",-1e-3,1e-3,"rad")]
-
-    totRotyCanAndGraph = [makeCanAndGraph("Total Change in Roty Layer 0",-1e-2,1e-2,"rad")
-                          ,makeCanAndGraph("Total Change in Roty Layer 1",-1e-2,1e-2,"rad")
-                          ,makeCanAndGraph("Total Change in Roty Layer 2",-1e-2,1e-2,"rad")]
-
-    rotzCanAndGraph = [makeCanAndGraph("Change in Rotz Layer 0",-1e-3,1e-3,"rad")
-                       ,makeCanAndGraph("Change in Rotz Layer 1",-1e-3,1e-3,"rad")
-                       ,makeCanAndGraph("Change in Rotz Layer 2",-1e-3,1e-3,"rad")]
-
-    totRotzCanAndGraph = [makeCanAndGraph("Total Change in Rotz Layer 0",-1e-2,1e-2,"rad")
-                          ,makeCanAndGraph("Total Change in Rotz Layer 1",-1e-2,1e-2,"rad")
-                          ,makeCanAndGraph("Total Change in Rotz Layer 2",-1e-2,1e-2,"rad")]
-
-    chi2CanAndGraph = [makeCanAndGraph("Change in Chi2 Layer 0",1e-8,1e4,"#Delta #Chi^{2}")
-                       ,makeCanAndGraph("Change in Chi2 Layer 1",1e-8,1e4,"#Delta #Chi^{2}")
-                       ,makeCanAndGraph("Change in Chi2 Layer 2",1e-8,1e4,"#Delta #Chi^{2}")]
-
-
-    for i in range(len(dxCanAndGraph)):
-        dxCanAndGraph[i][0].cd()
-        dxCanAndGraph[i][1].Draw("APL")
-        totxCanAndGraph[i][0].cd()
-        totxCanAndGraph[i][1].Draw("APL")
-
-        dyCanAndGraph[i][0].cd()
-        dyCanAndGraph[i][1].Draw("APL")
-        totyCanAndGraph[i][0].cd()
-        totyCanAndGraph[i][1].Draw("APL")
-
-        dzCanAndGraph[i][0].cd()
-        dzCanAndGraph[i][1].Draw("APL")
-        totzCanAndGraph[i][0].cd()
-        totzCanAndGraph[i][1].Draw("APL")
-
-        rotxCanAndGraph[i][0].cd()
-        rotxCanAndGraph[i][1].Draw("APL")
-        totRotxCanAndGraph[i][0].cd()
-        totRotxCanAndGraph[i][1].Draw("APL")
-
-        rotyCanAndGraph[i][0].cd()
-        rotyCanAndGraph[i][1].Draw("APL")
-        totRotyCanAndGraph[i][0].cd()
-        totRotyCanAndGraph[i][1].Draw("APL")
-
-        rotzCanAndGraph[i][0].cd()
-        rotzCanAndGraph[i][1].Draw("APL")
-        totRotzCanAndGraph[i][0].cd()
-        totRotzCanAndGraph[i][1].Draw("APL")
-
-        chi2CanAndGraph[i][0].cd()
-        gPad.SetLogy(1)
-        chi2CanAndGraph[i][1].Draw("APL")
-
-
-    for modId in modDict:
-        if modDict[modId].bec == -1:
-            lay = modDict[modId].lay
-
-            dxCanAndGraph[lay][0].cd()
-            modDict[modId].drawDx("PL")
-            totxCanAndGraph[lay][0].cd()
-            modDict[modId].drawTotDx("PL")
-
-            dyCanAndGraph[lay][0].cd()
-            modDict[modId].drawDy("PL")
-            totyCanAndGraph[lay][0].cd()
-            modDict[modId].drawTotDy("PL")
-
-            dzCanAndGraph[lay][0].cd()
-            modDict[modId].drawDz("PL")
-            totzCanAndGraph[lay][0].cd()
-            modDict[modId].drawTotDz("PL")
-
-            rotxCanAndGraph[lay][0].cd()
-            modDict[modId].drawRotx("PL")
-            totRotxCanAndGraph[lay][0].cd()
-            modDict[modId].drawTotRotx("PL")
-
-            rotyCanAndGraph[lay][0].cd()
-            modDict[modId].drawRoty("PL")
-            totRotyCanAndGraph[lay][0].cd()
-            modDict[modId].drawTotRoty("PL")
-
-            rotzCanAndGraph[lay][0].cd()
-            modDict[modId].drawRotz("PL")
-            totRotzCanAndGraph[lay][0].cd()
-            modDict[modId].drawTotRotz("PL")
-
-            if not Chi2Method:
-                chi2CanAndGraph[lay][0].cd()
-                modDict[modId].drawChi2("PL")
-
-    for i in range(len(dxCanAndGraph)):
-        if "Dx" not in DofNotAligned:
-            dxCanAndGraph[i][0].Write()
-            totxCanAndGraph[i][0].Write()
-
-        if "Dy" not in DofNotAligned:
-            dyCanAndGraph[i][0].Write()
-            totyCanAndGraph[i][0].Write()
-            
-        if "Dz" not in DofNotAligned:
-            dzCanAndGraph[i][0].Write()
-            totzCanAndGraph[i][0].Write()
-            
-        if "Rotx" not in DofNotAligned:
-            rotxCanAndGraph[i][0].Write()
-            totRotxCanAndGraph[i][0].Write()
-
-        if "Roty" not in DofNotAligned:
-            rotyCanAndGraph[i][0].Write()
-            totRotyCanAndGraph[i][0].Write()
-
-        if "Rotz" not in DofNotAligned:
-            rotzCanAndGraph[i][0].Write()
-            totRotzCanAndGraph[i][0].Write()
-
-        if not Chi2Method:
-            chi2CanAndGraph[i][0].Write()
-        
-    if not Chi2Method and False:
-        for i in range(numIter):
-            TotalChi2Graph.SetPoint(i,i,totChi2[i] )
-            ctot.cd()
-            TotalChi2Graph.Draw("APL")
-
-    if makeVisualization:
-        include("TRT_AlignAlgs/visualizeTRTAlignment.py")
-        isOk(newpositionfile)
-        isOk(referencefile)
-        drawVisualization(newpositionfile, referencefile)
-
-
-def drawL2Endcap(thisEndCap):
-    side = "A"
-    if thisEndCap == -2:
-        side = "C"
-        
-    dxCanAndGraph = makeCanAndGraph("Change in x Endcap "+side,-0.2,0.2,"mm")
-    totxCanAndGraph = makeCanAndGraph("Total Change in x Endcap "+side,-0.6,0.6,"mm")
-
-    dyCanAndGraph = makeCanAndGraph("Change in y Endcap "+side,-0.2,0.2,"mm")
-    totyCanAndGraph = makeCanAndGraph("Total Change in y Endcap "+side,-0.6,0.6,"mm")
-
-    dzCanAndGraph = makeCanAndGraph("Change in z Endcap "+side,-0.2,0.2,"mm")
-    totzCanAndGraph = makeCanAndGraph("Total Change in z Endcap "+side,-0.6,0.6,"mm")
-
-    rotxCanAndGraph = makeCanAndGraph("Change in Rotx Endcap "+side,-1e-3,1e-3,"rad")
-    totRotxCanAndGraph = makeCanAndGraph("Total Change in Rotx Endcap "+side,-1e-2,1e-2,"rad")
-                         
-    rotyCanAndGraph = makeCanAndGraph("Change in Roty Endcap "+side,-1e-3,1e-3,"rad")
-    totRotyCanAndGraph = makeCanAndGraph("Total Change in Roty Endcap "+side,-1e-2,1e-2,"rad")
-                         
-    rotzCanAndGraph = makeCanAndGraph("Change in Rotz Endcap "+side,-1e-3,1e-3,"rad")
-    totRotzCanAndGraph = makeCanAndGraph("Total Change in Rotz Endcap "+side,-1e-2,1e-2,"rad")
-                         
-    chi2CanAndGraph = makeCanAndGraph("Change in Chi2 Endcap "+side,1e-8,1e4,"#Delta #Chi^{2}")
-                      
-
-    dxCanAndGraph[0].cd()
-    dxCanAndGraph[1].Draw("APL")
-    totxCanAndGraph[0].cd()
-    totxCanAndGraph[1].Draw("APL")
-    
-    dyCanAndGraph[0].cd()
-    dyCanAndGraph[1].Draw("APL")
-    totyCanAndGraph[0].cd()
-    totyCanAndGraph[1].Draw("APL")
-    
-    dzCanAndGraph[0].cd()
-    dzCanAndGraph[1].Draw("APL")
-    totzCanAndGraph[0].cd()
-    totzCanAndGraph[1].Draw("APL")
-    
-    rotxCanAndGraph[0].cd()
-    rotxCanAndGraph[1].Draw("APL")
-    totRotxCanAndGraph[0].cd()
-    totRotxCanAndGraph[1].Draw("APL")
-    
-    rotyCanAndGraph[0].cd()
-    rotyCanAndGraph[1].Draw("APL")
-    totRotyCanAndGraph[0].cd()
-    totRotyCanAndGraph[1].Draw("APL")
-    
-    rotzCanAndGraph[0].cd()
-    rotzCanAndGraph[1].Draw("APL")
-    totRotzCanAndGraph[0].cd()
-    totRotzCanAndGraph[1].Draw("APL")
-    
-    chi2CanAndGraph[0].cd()
-    gPad.SetLogy(1)
-    chi2CanAndGraph[1].Draw("APL")
-    
-    for modId in modDict:
-        if modDict[modId].bec == thisEndCap:
-
-            dxCanAndGraph[0].cd()
-            modDict[modId].drawDx("PL")
-            totxCanAndGraph[0].cd()
-            modDict[modId].drawTotDx("PL")
-
-            dyCanAndGraph[0].cd()
-            modDict[modId].drawDy("PL")
-            totyCanAndGraph[0].cd()
-            modDict[modId].drawTotDy("PL")
-
-            dzCanAndGraph[0].cd()
-            modDict[modId].drawDz("PL")
-            totzCanAndGraph[0].cd()
-            modDict[modId].drawTotDz("PL")
-
-            rotxCanAndGraph[0].cd()
-            modDict[modId].drawRotx("PL")
-            totRotxCanAndGraph[0].cd()
-            modDict[modId].drawTotRotx("PL")
-
-            rotyCanAndGraph[0].cd()
-            modDict[modId].drawRoty("PL")
-            totRotyCanAndGraph[0].cd()
-            modDict[modId].drawTotRoty("PL")
-
-            rotzCanAndGraph[0].cd()
-            modDict[modId].drawRotz("PL")
-            totRotzCanAndGraph[0].cd()
-            modDict[modId].drawTotRotz("PL")
-
-            if not Chi2Method:
-                chi2CanAndGraph[0].cd()
-                modDict[modId].drawChi2("PL")
-
-    if "Dx" not in DofNotAligned:
-        dxCanAndGraph[0].Write()
-        totxCanAndGraph[0].Write()
-
-    if "Dy" not in DofNotAligned:
-        dyCanAndGraph[0].Write()
-        totyCanAndGraph[0].Write()
-            
-    if "Dz" not in DofNotAligned:
-        dzCanAndGraph[0].Write()
-        totzCanAndGraph[0].Write()
-            
-    if "Rotx" not in DofNotAligned:
-        rotxCanAndGraph[0].Write()
-        totRotxCanAndGraph[0].Write()
-
-    if "Roty" not in DofNotAligned:
-        rotyCanAndGraph[0].Write()
-        totRotyCanAndGraph[0].Write()
-
-    if "Rotz" not in DofNotAligned:
-        rotzCanAndGraph[0].Write()
-        totRotzCanAndGraph[0].Write()
-
-    if not Chi2Method:
-        chi2CanAndGraph[0].Write()
-        
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/batchJobGenTools.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/batchJobGenTools.py
deleted file mode 100644
index 6ae64376f1f94ea6e0936bb9986bab69f71ce4a6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/batchJobGenTools.py
+++ /dev/null
@@ -1,149 +0,0 @@
-import os, string
-
-#========================================
-def getFileListFromCastor(runNumber,inputdirectory,maxNFiles=-1,skipNFiles=0):
-   """ This takes a runNumber and an inputdirectory and returns a list of the inputFile files.
-       It can deal with a maximum number of files and skipping the first skipNFiles files.
-   """
-   collection = []
-   badList = ["data09_cos.00121330.physics_IDCosmic.merge.DPD_IDCOMM.f118_m106._0009.1\n",
-              "data09_cos.00121330.physics_IDCosmic.merge.DPD_IDCOMM.f118_m106._0373.1\n"]
-   for m_run in runNumber:
-      filelist = os.popen("nsls "+inputdirectory+" |grep "+m_run).readlines()
-      for i in filelist:
-         if (string.find(i,"pool.root")>0 or string.find(i,"IDCosmic")>0 or string.find(i,".root") )>0:
-            if i not in badList:
-               collection.append(inputdirectory+"/"+string.strip(i)) 
-
-      
-   inputFiles=[]
-   max = maxNFiles
-   if maxNFiles == -1:
-      max=len(collection)
-
-   for i in range(0,max):
-      inputFiles.append(collection[i+skipNFiles])
-   
-   print "|====================================================================================================================|"
-   print "The input files are:"
-   for n in range(inputFiles.__len__()):
-     print inputFiles[n]
-   print "|====================================================================================================================|"
-
-   return inputFiles
-
-
-
-#========================================
-def getInputFileToNumEventMapping(m_list):
-   """ Returns a dictionary of the file names
-        and the number of events in each file
-   """
-   print "|====================================================================================================================|"
-   print "|                                         Doing the mapping from file to number of events                            |"
-   print "|====================================================================================================================|"
-   m_numEventsPerFile = {}
-
-   import PyUtils.PoolFile as PF
-
-   failedFiles = ["/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91890_lb7.root","/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91891_lb13.root","/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91891_lb24.root"]
-
-   for i in range(m_list.__len__()):
-      if m_list[i] not in failedFiles:
-         poolFile = PF.PoolFile( m_list[i] )
-         m_numEventsPerFile[m_list[i]] = int(poolFile.fileInfos().split()[6])
-   
-   print m_numEventsPerFile
-   return m_numEventsPerFile
-
-
-
-#===========================================
-# Creates the input files to be used and
-#  determines the num of sub jobs and returns it
-#===========================================
-def createInputFiles(m_list, m_numEventsPerFile, m_nEvents, m_outputDir, m_maxNumSubJobs, readFromCastor=True):
-   """ Returns the number of subjobs needed.
-   """
-   failedFiles = ["/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91890_lb7.root","/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91891_lb13.root","/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91891_lb24.root"]
-
-   
-   # Get the number of subjobs
-   totalNumEvents = 0
-   for i in range( m_list.__len__() ):
-      if m_list[i] not in failedFiles:
-         totalNumEvents += m_numEventsPerFile[m_list[i]]
-
-   numSubJobs = int(totalNumEvents/m_nEvents)
-   
-   if numSubJobs > m_maxNumSubJobs:
-      numSubJobs = m_maxNumSubJobs
-
-   print "|====================================================================================================================|"
-   print "|  There are "+str(totalNumEvents)+" total number of events"
-   print "|  We'll do "+str(numSubJobs)+" sub jobs, with "+str(m_nEvents)+" events each"
-   print "|====================================================================================================================|"
-
-   failedFiles = ["/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91890_lb7.root","/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91891_lb13.root","/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91891_lb24.root"]
-
-   # for the subjobs
-   m_usedFiles = 0
-   m_numberEventsUsed =0
-   for i in range(numSubJobs):
-      print "Making input file "+ str(i)
-      subJobInputFile=open(m_outputDir+"/inputFiles_"+str(i)+".py","w")
-      subJobInputFile.write("theApp.EvtMax="+str(m_nEvents)+" \n")
-
-      # add the inputFiles 
-      m_eventsNeeded = m_nEvents
-      m_addedInputFile = False
-      while(m_eventsNeeded != 0 and m_usedFiles < m_list.__len__()):
-         if m_list[m_usedFiles] in failedFiles:
-            m_usedFiles+=1
-            continue
-         
-         # Used for DeBugging
-         #print "m_usedFiles",m_usedFiles,"m_numberEventsUsed",m_numberEventsUsed,"m_eventsNeeded",m_eventsNeeded,m_list[m_usedFiles][0],m_numEventsPerFile[ m_list[m_usedFiles][0] ]
-         if m_eventsNeeded <= m_numEventsPerFile[ m_list[m_usedFiles] ]:
-            if not m_addedInputFile:
-               subJobInputFile.write("ServiceMgr.EventSelector.SkipEvents = "+str(m_numberEventsUsed)+"\n")
-               m_addedInputFile = True
-
-            m_numberEventsUsed += m_eventsNeeded
-            m_numEventsPerFile[ m_list[m_usedFiles] ] -= m_eventsNeeded
-            if readFromCastor:
-               subJobInputFile.write("ServiceMgr.EventSelector.InputCollections += ['castor:"+m_list[m_usedFiles]+"'] \n")
-            else:
-               subJobInputFile.write("ServiceMgr.EventSelector.InputCollections += ['"+m_list[m_usedFiles]+"'] \n")
-            m_eventsNeeded = 0
-            
-         else:
-            if not m_addedInputFile:
-               subJobInputFile.write("ServiceMgr.EventSelector.SkipEvents = "+str(m_numberEventsUsed)+"\n")
-               m_addedInputFile = True
-
-            if readFromCastor:
-               subJobInputFile.write("ServiceMgr.EventSelector.InputCollections += ['castor:"+m_list[m_usedFiles]+"'] \n")
-            else:
-               subJobInputFile.write("ServiceMgr.EventSelector.InputCollections += ['"+m_list[m_usedFiles]+"'] \n")
-            m_eventsNeeded -= m_numEventsPerFile[ m_list[m_usedFiles] ]
-            m_usedFiles += 1
-            m_numberEventsUsed = 0
-         
-         
-      subJobInputFile.write("iterationN=1 \n")#needed? historical
-      subJobInputFile.write('StoreGateSvc = Service ("StoreGateSvc" ) \n')
-      subJobInputFile.close()
-
-   # for the combinations
-   comboInputFile=open(m_outputDir+"/comboInput.py","w")
-   comboInputFile.write("theApp.EvtMax=1 \n")
-   if readFromCastor:
-      comboInputFile.write("ServiceMgr.EventSelector.InputCollections += ['castor:"+m_list[0]+"' ]\n")
-   else:
-      comboInputFile.write("ServiceMgr.EventSelector.InputCollections += [ '"+m_list[0]+"' ]\n")
-   comboInputFile.write("iterationN=911 \n") #needed ? historical.
-   comboInputFile.write('StoreGateSvc = Service ("StoreGateSvc" ) \n')
-   comboInputFile.close()
-
-   return numSubJobs
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/makeAnalysis.py b/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/makeAnalysis.py
deleted file mode 100644
index 1d4452de7e1166f0b7e1db52396aee470ebf90b6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TRTplotting/makeAnalysis.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#============= Use some initial positions (Eg: known alignment in CSC)
-# Turning on CSC Truth, compares the L2 alignments derived here to
-# the true L2 misalignments present in the CSC data.  A truth directory with 
-# comparisons of the module final positions (compompared to truth) will 
-# be created and the Total Dx and Dz will now include the initial CSC 
-# misalignments.
-doCSCTruth = False
-
-#============= Name of the alignment log file ==============
-#alignlogfilename = "trtalignlog.txt"
-alignlogfilename = "alignlogfile.txt"
-
-#= New file the result of the last iteration
-newpositionfile = dirHead+"/"+dirPrefix+str(numIter-1)+"/"+alignlogfilename
-
-#= To compare alignment in the first iteration
-referencefile = dirHead+"/"+dirPrefix+str(0+skipIter)+"/"+alignlogfilename
-if doCSCTruth:
-    path = str(os.environ['TestArea'])+"/InnerDetector/InDetAlignAlgs/TRT_AlignAlgs/share/"
-    referencefile = path+"CSCPerfectAlignments.txt"
-#= To compare to the M6 after L1 alignment
-#referencefile = "M6L2NominalCogs.txt"
-
-#=============================================
-#======= imports/includes ====================
-#=============================================
-import sys, os, string
-from ROOT import *
-gStyle.SetLineWidth(2)
-include("InDetAlignExample/RootSetup.py")
-
-#=========Barrel Module data structure============
-include("InDetAlignExample/BarrelModule.py")
-
-#=========Load Functions to draw graphs===========
-include("InDetAlignExample/AlignmentHistoSetup.py")
-
-#=========Read in alignment data==================
-include("InDetAlignExample/ReadinAlignmentDataNew.py")
-#include("InDetAlignExample/ReadinAlignmentData.py")
-    
-#=========Write out alignment data==================
-include("InDetAlignExample/WriteAlignmentAnalysis.py")
-
-
-    
-#==========Exit after writing root file===========
-sys.exit()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TestInDetAlignment_jobOptions.py b/InnerDetector/InDetExample/InDetAlignExample/share/TestInDetAlignment_jobOptions.py
deleted file mode 100755
index d8f3005bdc7bf0396fa5e087c945bcd49dcb9d5d..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TestInDetAlignment_jobOptions.py
+++ /dev/null
@@ -1,196 +0,0 @@
-###############################################################
-#
-# Job options file to test silicon alignments
-# It loops through all detector elements and prints out the
-# shifts from their nominal position.
-#
-# usage:
-#   athena InDetAlignExample/TestInDetAlignment_jobOptions.py
-# or 
-#   athena -c 'testCase = 1' InDetAlignExample/TestInDetAlignment_jobOptions.py
-#
-#==============================================================
-
-# There are several cases
-# Case 1. Simulation with generation on the fly
-# Case 2. Simulation reading in generation pool file
-# Case 3. Reconstruction
-# Case 4. Test call backs without input pool file.
-
-# In Case 1 and 2, alignments will be read in during initialization
-# In Case 3 and 4, they are read in after initialization but before
-#  the first event.
-
-if not 'testCase'  in dir() :
-    testCase = 4;
-
-# To override the run number set this variable.
-# Only has an effect in cases 1 and 4 and conditions read in during initialization phase in case 2.
-# runNumber = 12345
-
-#
-#==============================================================
-# Load Detector Description for Pixel and SCT.
-#==============================================================
-#
-from AthenaCommon.GlobalFlags import globalflags
-from AthenaCommon.DetFlags import DetFlags
-
-# Select which detectors
-DetFlags.detdescr.ID_setOn()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.detdescr.SCT_setOn()
-#DetFlags.detdescr.TRT_setOn()
-
-globalflags.DataSource='geant4'
-#globalflags.DataSource='data'
-
-#DetDescrVersion = "DC2"
-#DetDescrVersion = "Rome-Initial"
-DetDescrVersion = "ATLAS-CSC-01-02-00"
-#DetDescrVersion = "CTB"
-globalflags.DetDescrVersion = DetDescrVersion
-
-# Initialize geometry
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-
-# To use the same as was used in the simulation comment this out.
-from IOVDbSvc.CondDB import conddb
-conddb.setGlobalTag("OFLCOND-CSC-00-01-00")
-#conddb.setGlobalTag("OFLCOND-CSC-00-00-00")
-
-# Reading of alignment from COOL by defualt
-
-# This is default anyway
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-#GeoModelSvc.AutomaticGeometryVersion = False
-#GeoModelSvc.AlignCallbacks = True
-
-# To ignore tag differences
-# GeoModelSvc.IgnoreTagDifference = True
-
-# To read in Pool file without IOV.
-#include ("ReadPool.py")
-
-## If you want to override the alignment sets add similar lines to below.
-## Look at InDetAlignExample/InDetAlignableOverride.py for more examples.
-#from IOVDbSvc.CondDB import conddb
-## Override tag
-#conddb.addOverride('/Indet/Align','InDetAlign_CSC_02')
-## Use sqlite file mycool.db
-#conddb.blockFolder("/Indet/Align")
-#conddb.addFolderWithTag("LOCAL","/Indet/Align","mytag",force=True)
-
-if testCase == 1 :
-    # for simulation like jobs
-    import AthenaCommon.AtlasUnixGeneratorJob
-    GeoModelSvc.AlignCallbacks = False
-    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    svcMgr.EventSelector.OverrideRunNumber = True
-    svcMgr.EventSelector.RunNumber         = 1
-    svcMgr.EventSelector.FirstLB           = 1
-    svcMgr.EventSelector.InitialTimeStamp  = 0
-
-if testCase == 2 or testCase == 3 :
-    # For cases that have an input file. Its not used so any file will do. 
-    PoolEvgenInput = ["/afs/cern.ch/atlas/offline/data/testfile/calib1_csc11.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000301_tid003138._00016_extract_10evt.pool.root"]
-    import AthenaPoolCnvSvc.ReadAthenaPool
-    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    svcMgr.EventSelector.InputCollections = PoolEvgenInput
-
-if testCase == 2 :
-    # For simulation that read in generator pool file
-    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    svcMgr.EventSelector.OverrideRunNumber = True
-    svcMgr.EventSelector.RunNumber         = 1
-    svcMgr.EventSelector.FirstLB           = 1
-    svcMgr.EventSelector.InitialTimeStamp  = 0
-    GeoModelSvc.AlignCallbacks = False
-
-# For case 4 nothing extra to do unless run number set.
-if testCase == 4 :
-    import AthenaCommon.AtlasUnixGeneratorJob
-  
-
-# Override run number.
-if ('runNumber' in dir()):
-    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    svcMgr.EventSelector.RunNumber         = runNumber
-    #svcMgr.EventSelector.FirstEvent        = 0
-    #svcMgr.EventSelector.FirstLB           = 0
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-job = AlgSequence()
-
-
-if DetFlags.detdescr.pixel_on():
-    from InDetDetDescrExample.InDetDetDescrExampleConf import TestSiAlignment
-    job += TestSiAlignment("TestPixelAlignment")
-    job.TestPixelAlignment.ManagerName="Pixel"
-    job.TestPixelAlignment.LongPrintOut=False
-    print job.TestPixelAlignment
-
-if DetFlags.detdescr.SCT_on():
-    from InDetDetDescrExample.InDetDetDescrExampleConf import TestSiAlignment
-    job += TestSiAlignment("TestSCT_Alignment")
-    job.TestSCT_Alignment.ManagerName="SCT"
-    job.TestSCT_Alignment.LongPrintOut=False
-    print job.TestSCT_Alignment
-
-if DetFlags.detdescr.TRT_on():
-    from InDetDetDescrExample.InDetDetDescrExampleConf import TestTRT_Alignment
-    job += TestTRT_Alignment()
-    #job.TestTRT_Alignment.LongPrintOut  = False
-    #job.TestTRT_Alignment.TestAllStraws = False
-    #job.TestTRT_Alignment.TestAllElements = False
-    #job.TestTRT_Alignment.HardwiredShifts = False
-    #job.TestTRT_Alignment.Precision = 6
-    print job.TestTRT_Alignment
-
-
-#--------------------------------------------------------------
-# Algorithms Options
-#--------------------------------------------------------------
-#
-# TestSiAlignment properties
-#
-# ManagerName:      Manager name.
-# LongPrintOut:     If true prints out changes in the axes as well as center
-# ErrorRotation:    Error used when checking if delta is identity (rotation part). Default is 1e-15
-# ErrorTranslation: Error used when checking if delta is identity (translation part). Default is 1e-12
-#
-# TestTRT_Alignment properties
-#
-# LongPrintOut:     If true prints out changes in the straw axes as well as center
-# TestAllElements:  Printout for every element. If false only corner straws for each module will be printed.
-#                   If true and TestAllStraws is false only first and last straw is printed.
-# TestAllStraws:    Printout for every straw. Ignored if TestAllElements is false
-# HardwiredShifts:  Use some hardcoded shifts rather than IOV.
-# Precision:        Precision used to printout numbers.
-# ErrorRotation:    Error used when checking if delta is identity (rotation part). Default is 1e-15
-# ErrorTranslation: Error used when checking if delta is identity (translation part). Default is 1e-12
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-#--------------------------------------------------------------
-# To set global output level use
-# athena -l DEBUG
-
-from AthenaCommon.AppMgr import ServiceMgr
-ServiceMgr.IOVSvc.OutputLevel=DEBUG
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-# Number of events to be processed (default is 10)
-theApp.EvtMax = 1
-
-
-#==============================================================
-#
-# End of job options file
-#
-###############################################################
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/TotalIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/TotalIterator.py
deleted file mode 100644
index ae865562f1536c575a1491feffa7cf63cbe925d2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/TotalIterator.py
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-# =====================================================================
-# Iterates in two steps
-# 1) L11 (RunIterator_L11) with no LB splitting 
-# 2) L16 (RunIterator_L16) with the possibility of LB splitting
-# =====================================================================
-import os
-import sys
-
-debug = True
-##########################################################
-#             Inline Options Definition                  #
-##########################################################
-
-def optParsing():
-    from optparse import OptionParser
-    parser = OptionParser()
-    parser.add_option("--inputList", dest="inputList", help="Input txt File with the list of the files you want to run on", default="")
-    parser.add_option("--eventType", dest="eventType", help="Which type of events: collisions / cosmics", default="collisions")
-    parser.add_option("--isData",dest="isData", help="Set itif you want to run on real data (Default: False)",action="store_true", default=False)
-    parser.add_option("--inputBowingDb", dest="inputBowingDb", help="In the case you want to use a specific IBL bowing  write here the absolute path to the cool file", default="")
-    parser.add_option("--inputConstantsFile", dest="inputConstantsFile", help="In the case you want to use a specific set of initial constants write here the absolute path to the pool file", default="")
-    parser.add_option("--nEvents", dest="nEvents", help="Maximum number of events to use", default="")
-    parser.add_option("--nCpus", dest="nCpus", help="Number of CPUs to be used",default="")
-    parser.add_option("--errorScalingTag",dest="errorScalingTag", help="Name of the error scaling tag or ES file to use",default="")
-    parser.add_option("--ptmin",dest="userPtMin", help="Minimum pt of tracks to enter the align track selection *** in MeV ***", default = "")
-    parser.add_option("--FirstLB",dest="inputFirstLB", help = " First LumiBlock to be considered ", default = 1)
-    parser.add_option("--LastLB",dest="inputLastLB", help = " Last LumiBlock to be considered (default all)", default = -1 )
-    parser.add_option("--NLB",dest = "inputNLB", help = " Number of lumiblocks per job ", default = 10)
-    parser.add_option("--nIter",dest="inputnIter", help="Number of iterations to be executed", default = "1")
-    parser.add_option("--queue",dest="inputQueue", help="name of the LSF queue were jobs will be submitted", default="")
-    parser.add_option("--suffix",dest = "inputSuffix", help = " Suffix for the jobs", default ="")
-    parser.add_option("--useLBselector", dest = "inputUseLBselector", help = "If True use the athena LB selector. If false, file list is split by LB.",action="store_true", default=False) 
-    
-    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
-
-    return config
-    
-
-##########################################################
-#               Option Initialisation                    #
-##########################################################
-config = optParsing()
-userFile=config.inputList
-eventType=config.eventType
-userConstantsFile=config.inputConstantsFile
-usernEvents=str(config.nEvents)
-isData=config.isData
-userErrorScalingTag=config.errorScalingTag
-usernCpus= str(config.nCpus)  
-userPtMin = str(config.userPtMin)
-userFirstLB = int(config.inputFirstLB)
-userLastLB = int(config.inputLastLB)
-userNLB = int(config.inputNLB)
-userBowingDB = str(config.inputBowingDb)
-userSuffix = str(config.inputSuffix)
-userUseLBselector = config.inputUseLBselector
-usernIter = str(config.inputnIter)
-userQueue = str(config.inputQueue)
-
-multiplicativeFactor = 1
-
-if (userUseLBselector):
-    multiplicativeFactor = 3
-
-
-
-##########################################################           
-#  copy the two RunIterators                             #
-##########################################################           
-os.system("get_files -jo InDetAlignExample/RunIterator_L11.py > /dev/null")
-print os.system("get_files -jo InDetAlignExample/RunIterator_L11.py")
-
-os.system("get_files -jo InDetAlignExample/RunIterator_L16.py > /dev/null")
-print os.system("get_files -jo InDetAlignExample/RunIterator_L16.py")
-
-
-
-##########################################################
-#  split the input file according to the lumiblocks      #
-##########################################################
-initialLB = userFirstLB 
-finalLB = userFirstLB - 1# intialization
-upperLB = finalLB+1 # maximum value, a value that allows to enter the loop
-if (userLastLB > 0): upperLB = userLastLB 
-ListOfDaughterFiles = []
-ListOfNFiles = []
-ListOfLBranges = []
-
-with open(userFile, 'rb') as inFile:
-    while (finalLB < upperLB and finalLB < userLastLB):
-        initialLB = finalLB + 1 # go for next LB
-        finalLB = initialLB + userNLB - 1 #to correct for the first one. This way one may do from 1 to 10 and so on 
-        if (finalLB > userLastLB): finalLB = userLastLB
-        # -- open output file
-        outputFileName = "SelectedLB_" + str(initialLB) + "_" + str(finalLB) + ".txt"
-        if ( userNLB == 1): outputFileName = "SelectedLB_" + str(initialLB) +  ".txt"
-        outFile = open(outputFileName, 'w')
-        writtenLines = 0
-        
-        # -- write list of input files into the output files 
-        for line in inFile:
-            whereLB = line.find("_lb") 
-            thisLB = int(line[whereLB+3:whereLB+7])
-            #print whereLB, thisLB
-            if ((initialLB <= thisLB and thisLB <=finalLB) or userUseLBselector):
-                outFile.write(line)
-                writtenLines += 1
-            if (thisLB > upperLB): upperLB = thisLB
-        if (writtenLines>0): print " <LumiBlockIterator> ouput file ", outputFileName, " has ", writtenLines, " lines"
-        if (writtenLines > 0): 
-            ListOfDaughterFiles.append(outputFileName)
-            ListOfNFiles.append(writtenLines)
-        else: #delete empty files
-            os.remove(outputFileName)
-        inFile.seek(0,0) # rewind
-
-        # store the list of LB ranges
-        ListOfLBranges.append(initialLB)
-        ListOfLBranges.append(finalLB)
-        
-    print " <LumiBlockIterator> Lumiblock file splitting completed. In total ", len(ListOfDaughterFiles) ," daughter files with active LumiBlocks have been created"
-    
-#############################################################
-# Execute first the L11 (no LB splitting)                   #
-#############################################################
-# deal with user options
-execCommandOptions = ""
-execCommandOptions1 = ""
-execCommandOptions2 = "" # input bowing file
-execCommandOptions3 = "" # for LB selections
-
-outcommandFile = open("CommandsFile.txt","w")
-
-
-if (len(userConstantsFile)>0): execCommandOptions1 = execCommandOptions1 + " --inputConstantsFile " + userConstantsFile
-if (len(userErrorScalingTag)>0): execCommandOptions1 = execCommandOptions1 + " --errorScalingTag " + userErrorScalingTag
-if (len(usernEvents)>0):execCommandOptions1 = execCommandOptions1 + " --nEvents " + usernEvents 
-execCommandOptions1 = execCommandOptions1 + " --isData True" 
-if (len(userPtMin)>0): execCommandOptions1 = execCommandOptions1 + " --ptmin " + userPtMin
-if (debug): print " <LumiBlockIterator> execCommandOptions1 = ", execCommandOptions1
-if (len(userBowingDB)>0):  execCommandOptions2 = execCommandOptions2 + " --inputBowingDb "+userBowingDB 
-
-execCommandOptions0 = " --inputList " + userFile
-theTail = userSuffix + "_L11" 
-execCommandOptions0 = execCommandOptions0 + " --suffix " + theTail
-
-thisnCpus = usernCpus
-if (len(usernCpus)>0): execCommandOptions0 = execCommandOptions0 + " --nCpus " +  str(thisnCpus)
-if (len(usernIter)>0): execCommandOptions0 = execCommandOptions0 + " --nIter " +  str(usernIter)
-if (len(userQueue)>0): execCommandOptions0 = execCommandOptions0 + " --queue " +  str(userQueue)
-    
-
-execCommandOptions = execCommandOptions0 + execCommandOptions1 + execCommandOptions2 + execCommandOptions3
-
-if (debug): print " <LumiBlockIterator> execCommandOptions = ", execCommandOptions 
-
-outcommandFile.write("python RunIterator_L11.py "+execCommandOptions+"\n\n\n\n")
-
-os.system("python RunIterator_L11.py "+execCommandOptions)
-
-lastIterID = int(usernIter)-1
-userConstantsFile = os.getcwd() + "/Iter" + str(lastIterID) + "_" + theTail + "/Iter"+ str(lastIterID) +"_AlignmentConstants.root"
-userBowingDB = os.getcwd() + "/Iter" + str(lastIterID) + "_" + theTail + "/mycool.db"
-print " -- L11 constants file: ", userConstantsFile
-print " -- "
-#exit()
-
-#############################################################
-# Loop over the daughter files and submit the jobs  for L16 #
-#############################################################
-subJob=0
-if len(ListOfDaughterFiles) > 0:
-    thisfile = 0
-
-    # deal with user options
-    execCommandOptions = ""
-    execCommandOptions1 = ""
-    execCommandOptions2 = "" # input bowing file
-    execCommandOptions3 = "" # for LB selections
-
-    # as input constants file one should use the L11 results
-    if (len(userConstantsFile)>0): execCommandOptions1 = execCommandOptions1 + " --inputConstantsFile " + userConstantsFile
-    if (len(userErrorScalingTag)>0): execCommandOptions1 = execCommandOptions1 + " --errorScalingTag " + userErrorScalingTag
-    if (len(usernEvents)>0):execCommandOptions1 = execCommandOptions1 + " --nEvents " + usernEvents 
-    execCommandOptions1 = execCommandOptions1 + " --isData True" 
-    if (len(userPtMin)>0): execCommandOptions1 = execCommandOptions1 + " --ptmin " + userPtMin
-    if (debug): print " <LumiBlockIterator> execCommandOptions1 = ", execCommandOptions1
-    if (len(userBowingDB)>0):  execCommandOptions2 = execCommandOptions2 + " --inputBowingDb "+userBowingDB     
-        
-    for daughterFile in ListOfDaughterFiles:
-        print "\n  <LumiBlockIterator> going to process lumiblocks in file ",  daughterFile
-        whereLB = daughterFile.find("LB_")
-        whereDotTxt = daughterFile.find(".txt")
-        theTail = daughterFile[whereLB:whereDotTxt]
-        if (len(userSuffix)>0): theTail = userSuffix + "_L16_" + daughterFile[whereLB:whereDotTxt]
-        
-        #if (debug): print " <LumiBlockIterator> theTail = ", theTail
-
-        execCommandOptions0 = " --inputList " + daughterFile
-        execCommandOptions0 = execCommandOptions0 + " --suffix " + theTail
-
-        thisnCpus = usernCpus
-        #if (ListOfNFiles[subJob] < usernCpus): thisnCpus = ListOfNFiles[subJob] 
-        if (len(usernCpus)>0): execCommandOptions0 = execCommandOptions0 + " --nCpus " +  str( int(thisnCpus) * multiplicativeFactor)
-        if (len(usernIter)>0): execCommandOptions0 = execCommandOptions0 + " --nIter " +  str(usernIter)
-        if (len(userQueue)>0): execCommandOptions0 = execCommandOptions0 + " --queue " +  str(userQueue)
-
-
-        # LB selection    
-        execCommandOptions3 = "" # reset
-        firtLB = ListOfLBranges[thisfile*2]
-        lastLB = ListOfLBranges[thisfile*2+1]
-        if (userUseLBselector): execCommandOptions3 =  " --LBrangeFirst " + str(firtLB) + " --LBrangeLast " + str(lastLB)
-        
-        # build the command options for RunIterator
-        execCommandOptions = execCommandOptions0 + execCommandOptions1 + execCommandOptions2 + execCommandOptions3
-
-        if (debug): print " <LumiBlockIterator> execCommandOptions = ", execCommandOptions 
-        outcommandFile.write("python RunIterator_L16.py "+execCommandOptions+" &"+"\n\n\n\n\n\n")
-        os.system("python RunIterator_L16.py "+execCommandOptions+" &")
-
-        subJob += 1
-        thisfile += 1
-
-        os.system("sleep 2")
-outcommandFile.close()
-exit()    
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/beamspotExample.py b/InnerDetector/InDetExample/InDetAlignExample/share/beamspotExample.py
deleted file mode 100644
index 7337ae612834476002e8aab9238821cd6c7679f9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/beamspotExample.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# $Id: beamspotExample.py,v 1.15 2008-08-29 12:56:52 lacuesta Exp $
-# Sample python script to determine beamspot.
-# Written by Juerg Beringer in April 2008.
-
-from InDetAlignExample.InDetAlignJobRunner import InDetAlignJobRunner as JobRunner
-import os
-
-# Change the following two lines for your environment: workdir is where
-# you'd like your jobs to run, and mycmthome is where you keep the
-# requirements (or rather setup.sh) file for the test release you
-# are going to use.
-try: OutputPath
-except:
-    workdir = os.getcwd()+'/bs'
-    FirstBS = True
-else:
-    print "Output path get from superscript - BS"
-    if FirstBS:
-        workdir = OutputPath+'/FirstBs'
-    else:
-        workdir = OutputPath+'/LastBs'
-    
-mycmthome = '$HOME/athena/14.2.2X.Y.rel_3/'
-
-#
-####################################################################
-# Run jobs producing AOD files
-####################################################################
-#
-try: sGlobalTag
-except:
-    GlobalTag = "OFLCOND-CSC-00-00-00"
-else:
-    GlobalTag = sGlobalTag
-    print "GlobalTag get from superscript and set to '",GlobalTag,"'"
-
-print
-print "Producing AOD files ..."
-if FirstBS:
-    aodrunner = JobRunner(startdirTemplate=workdir+'/%(jobname)s',
-                          batchType='LSF',
-                          batchQueue='atlasidali',
-                          logmail='moles,sevilla',
-                          #logmail='beringer,lacuesta,moles,sevilla',
-                          EvtMax=-1,
-                          DetDescrVersion="ATLAS-CSC-02-00-00",
-                          GlobalTag=GlobalTag,
-                          release='14.2.2X.Y,rel_3,AtlasTier0,opt,32,setup,runtime',
-                          cmthome=mycmthome,
-                          jobnameTemplate='bsaod%(jobnr)03i',
-                          joboptionPath=os.getcwd()+'/InDetAlignBeamspotAOD.py',
-                          doReadBS=True)
-else:
-    scriptTemplate = """#!/bin/sh
-    source %(cmthome)s/setup.sh -tag=%(release)s
-    mkdir -p %(rundir)s
-    cd %(rundir)s
-    pool_insertFileToCatalog %(alignmentFile)s
-    athena.py %(configfile)s %(joboptionPath)s
-    """
-    aodrunner = JobRunner(startdirTemplate=workdir+'/%(jobname)s',
-                          batchType='LSF',
-                          batchQueue='atlasidali',
-                          #logmail='beringer,lacuesta',
-                          logmail='moles,sevilla',
-                          EvtMax=-1,
-                          DetDescrVersion="ATLAS-CSC-02-00-00",
-                          GlobalTag=GlobalTag,
-                          alignmentFile = cogpoolfile,
-                          release='14.2.2X.Y,rel_3,AtlasTier0,opt,32,setup,runtime',
-                          cmthome=mycmthome,
-                          jobnameTemplate='bsaod%(jobnr)03i',
-                          scriptTemplate = scriptTemplate,
-                          joboptionPath=os.getcwd()+'/InDetAlignBeamspotAOD.py',
-                          doReadBS=True)
-    
-        
-# Preliminary - just for testing
-# HOW DO WE KNOW WHAT FILES TO RUN OVER?
-# dir = 'rfio:/castor/cern.ch/user/h/hawkings/calibstream/fdr1/'
-dir = '/afs/cern.ch/user/a/atlidali/w0/data/FDR2_IDCalibStream/'
-fileList=os.listdir(dir)
-for fname in fileList:
-    if fname.rfind('data')!=-1:
-        aodrunner.addFiles([dir+fname])
-##dir = 'rfio:/castor/cern.ch/user/h/hawkings/calibstream/fdr1/'
-##aodrunner.addFiles([dir+'idcalib_5802_fdr1_0001.data'])
-## aodrunner.addFiles([dir+'idcalib_5802_fdr1_0003.data'])
-## aodrunner.addFiles([dir+'idcalib_5802_fdr1_0004.data'])
-
-## dir = '/afs/cern.ch/user/a/atlidali/w0/FDR2_IDCalibStream/'
-## aodrunner.addFiles([dir+'CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_1.data'])
-## aodrunner.addFiles([dir+'CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_2.data'])
-## aodrunner.addFiles([dir+'CSC.007422.singlepart_singlepi_pt10_50_Calib_1000_3.data'])
-aodrunner.run()
-aodrunner.wait()
-outputFiles = aodrunner.getOutputFiles()
-print
-print "The following AOD files were produced:"
-print outputFiles
-
-#
-####################################################################
-# Determine beamspot using AOD files (single job over all AOD files)
-####################################################################
-#
-print
-print "Calculating beamspot on AOD files..."
-
-finder = JobRunner(startdirTemplate=workdir,
-                   outputfileTemplate='%(startdir)s/beamspot.db',
-                   batchType='LSF',
-                   batchQueue='atlasidali',
-                   logmail='moles,sevilla',
-                   #logmail='lacuesta,beringer',
-                   EvtMax=-1,
-                   release='14.2.2X.Y,rel_3,AtlasTier0,opt,32,setup,runtime',
-                   useNLumiBlocksPerBeamspot=5,
-                   maxCountPerBeamspot=-1,
-                   cmthome=mycmthome,
-                   jobnameTemplate='bsfind',
-                   joboptionPath=os.getcwd()+'/InDetAlignBeamspotFinder.py')
-
-finder.addFiles(outputFiles)
-finder.setOption('filesPerJob', len(outputFiles))
-finder.run()
-finder.wait()
-
-print
-os.system('ls -l %s' % workdir)
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/dumpBeamspot.py b/InnerDetector/InDetExample/InDetAlignExample/share/dumpBeamspot.py
deleted file mode 100755
index 698a66ab6166de60c032ffe50f12b55c4e7d145f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/dumpBeamspot.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-#
-# Dump contents of a beamspot.db COOL file using AtlCoolTool.
-#
-# Juerg Beringer, May 2008.
-
-import sys
-from CoolConvUtilities import AtlCoolTool
-
-if len(sys.argv)<2:
-    print "Usage: dumpBeamspot.py beamspot.db"
-    exit(1)
-
-dbconn = "sqlite://;schema="+sys.argv[1]+";dbname=TESTCOOL"
-#dbconn = "COOLONL_INDET/OFLP200"
-folder = "/Indet/Beampos"
-tool = AtlCoolTool.AtlCoolTool(dbconn)
-print "Beam spot information in file %s:\n" % sys.argv[1]
-tool.usetag("nominal")
-print tool.listinfo(folder)
-print
-print tool.lstags(folder)
-print
-print tool.more(folder)
-print
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py
deleted file mode 100644
index ab10cb7fd1c3084415357c61a0d80ea1eb7cb223..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py
+++ /dev/null
@@ -1,203 +0,0 @@
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"applyLBibldistTweak" : True
-                        ,"globalTag" : ""
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"trtAlignmentTagL3":""
-                        ,"lorentzAngleTag":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"DigitalClustering": False
-                        ,"TRTCalibTextFile":""
-                        ,"TRTCalibT0TagCos":""
-                        ,"TRTCalibRtTagCos":""
-                        ,"Cosmics":False
-                        ,"BField":False
-                        ,"readConstantsFromPool" : False       #  whether to read initial alignment constants from pool file
-                        ,"readBowingFromCool" : False          #  whether to read initial IBL bowing from cool file
-                        ,"readSilicon" : True                  #  whether to read initial Si alignment constants from pool file
-                        ,"readTRT" : True                      #  whether to read initial TRT alignment constnats from pool file
-                        ,"readTRTL3" : False                   #  whether to read initial TRT L3 alignment constnats from pool file
-                        ,"inputPoolFiles" : ["IDalignment_nominal.pool.root"]  #  pool files to read the constants from,
-                        ,"inputBowingDatabase"  : "" #cool file to read the bowing from
-                        }
-
-
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-  if var in dir():
-    loadInDetRec_Options[var] = eval(var)
-
-'''
-# Enable LB-IOV sensitive L3 transform tweak (we don't want this in the solving job)
-if not loadInDetRec_Options["applyLBibldistTweak"]:
-  from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool
-  pixelTool =  PixelDetectorTool()
-  pixelTool.TweakIBLDist = False
-'''
-    
-
-from IOVDbSvc.CondDB import conddb
-  #conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterial','AtlasLayerMat_v15_ATLAS-IBL3D25-04-00-01')
-#conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterialV2','AtlasLayerMat_v18_ATLAS-R2-2015-01')
-
-
-if not loadInDetRec_Options["BField"] and loadInDetRec_Options["Cosmics"]:
-  InDetTrackFitter.GetMaterialFromTrack = False
-  InDetTrackFitter.Momentum = 100000. *MeV
-
-
-if loadInDetRec_Options["siPoolFile"]:
-  include ("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-  from IOVDbSvc.CondDB import conddb
-    # block folders that you want to override
-  conddb.blockFolder("/Indet/Align")
-  conddb.blockFolder("/TRT/Align")
-  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-  from AthenaCommon.AppMgr import ServiceMgr
-  ServiceMgr += CondProxyProvider()
-  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-  print 'Loading initial alignment File'
-  ServiceMgr.CondProxyProvider.InputCollections = [ loadInDetRec_Options["siPoolFile"] ]
-  ServiceMgr.CondProxyProvider.OutputLevel=INFO
-  print ServiceMgr.CondProxyProvider
-  IOVSvc = Service("IOVSvc")
-  IOVSvc.preLoadData = True
-
-else:
-  if loadInDetRec_Options["siAlignmentTag"]:
-    conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-  if loadInDetRec_Options["trtAlignmentTag"]:
-    conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-  if loadInDetRec_Options["trtAlignmentTagL3"] and not loadInDetRec_Options["Cosmics"]:
-    conddb.addOverride('/TRT/Calib/DX',loadInDetRec_Options["trtAlignmentTagL3"])
-
-
-# Read in constants from Pool file
-if loadInDetRec_Options["readConstantsFromPool"]:
-  from IOVDbSvc.CondDB import conddb
-  
-  if loadInDetRec_Options["readSilicon"]:
-    conddb.blockFolder("/Indet/Align")
-    
-  if loadInDetRec_Options["readTRT"]:
-    conddb.blockFolder("/TRT/Align")
-      
-  if loadInDetRec_Options["readTRTL3"]:
-    conddb.blockFolder("/TRT/Calib/DX")
-
-  #if loadInDetRec_Options["readBowingFromCool"]:
-  #  conddb.blockFolder("/Indet/IBLDist")
-  #  conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+loadInDetRec_Options["inputBowingDatabase"]+';dbname=CONDBR2</dbConnection>/Indet/IBLDist','IndetIBLDist',True);
-    
-  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-  from AthenaCommon.AppMgr import ServiceMgr
-  ServiceMgr += CondProxyProvider()
-  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-  # set this to the file containing AlignableTransform objects
-  ServiceMgr.CondProxyProvider.InputCollections += loadInDetRec_Options["inputPoolFiles"]
-  print "INPUT POOL FILES COLLECTION", ServiceMgr.CondProxyProvider.InputCollections 
-  ServiceMgr.CondProxyProvider.OutputLevel = DEBUG
-  print ServiceMgr.CondProxyProvider
-  # this preload causes callbacks for read in objects to be activated,
-  # allowing GeoModel to pick up the transforms
-  ServiceMgr.IOVSvc.preLoadData = True
-  ServiceMgr.IOVSvc.OutputLevel = DEBUG
-  
-
-
-if loadInDetRec_Options["errorScalingTag"]:
-  if ".db" in loadInDetRec_Options["errorScalingTag"]:
-    conddb.blockFolder("/Indet/TrkErrorScaling")
-    
-    #conddb.addFolder("","<dbConnection>sqlite://X;schema="+loadInDetRec_Options["errorScalingTag"]+";dbname=CONDBR2</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_nominal</tag>", force=True)
-    #conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+loadInDetRec_Options["errorScalingTag"]+';dbname=OFLP200</dbConnection>/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal',True ); 
-    conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+loadInDetRec_Options["errorScalingTag"]+';dbname=CONDBR2</dbConnection>/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal',True );
-    #conddb.addFolderWithTag(loadInDetRec_Options["errorScalingTag"],'/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal',True );
-    print "INFO:: ErrorScaling from local Database"
-  else:
-    conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_Options["errorScalingTag"])
-#Added if you put an empty ErrorScalingTag
-#else:
-#  conddb.addOverride('/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal')
-
-
-if loadInDetRec_Options["beamSpotTag"] and not loadInDetRec_Options["Cosmics"]:
-  conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-
-if loadInDetRec_Options["lorentzAngleTag"] and not loadInDetRec_Options["Cosmics"]:
-  conddb.addOverride('/PIXEL/LorentzAngleScale',loadInDetRec_Options["lorentzAngleTag"])
-  
-from AthenaCommon.AppMgr import ToolSvc
-from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackErrorScalingTool
-InDetRotErrorScalingTool = Trk__RIO_OnTrackErrorScalingTool( name = 'RIO_OnTrackErrorScalingTool',
-                                                             overrideDatabaseID = False,
-                                                             overrideScalePixBarX = 1,
-                                                             overrideScalePixBarY = 1,
-                                                             overrideScalePixECsX = 1,
-                                                             overrideScalePixECsY = 1,
-                                                             overrideScaleSCTBar = 1,
-                                                             overrideScaleSCTECs = 1,
-                                                             overrideScaleTRTBar = 1,
-                                                             overrideScaleTRTECs = 1,
-                                                             OutputLevel = INFO )
-#InDetRotErrorScalingTool.overrideDatabaseID=False
-#InDetRotErrorScalingTool.overrideScaleTRT=3
-#InDetRotErrorScalingTool.overrideScaleSCT=3
-#InDetRotErrorScalingTool.overrideScalePix=30
-
-ToolSvc += InDetRotErrorScalingTool
-print InDetRotErrorScalingTool
-
-  
-# Correct TRT calibration for cosmics
-if loadInDetRec_Options["TRTCalibTextFile"] and loadInDetRec_Options["Cosmics"]:
-  from AthenaCommon.AppMgr import ToolSvc
-  from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
-  TRTCalibDBSvc=TRT_CalDbSvc()
-  ServiceMgr+=TRTCalibDBSvc
-  
-  conddb.blockFolder("/TRT/Calib/RT" )
-  conddb.blockFolder("/TRT/Calib/T0" )
-  TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-
-if loadInDetRec_Options["TRTCalibT0TagCos"]:
-  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_Options["TRTCalibT0TagCos"])
-if loadInDetRec_Options["TRTCalibRtTagCos"]:
-  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_Options["TRTCalibRtTagCos"])
-
-#Trying to fix the Database problem
-if loadInDetRec_Options["globalTag"] == "OFLCOND-RUN12-SDR-14":    
-  conddb.addOverride('/PIXEL/PixdEdx','PixdEdx_January2011_mc-000-00')
-  from AthenaCommon.CfgGetter import getService
-  getService("AtlasFieldSvc").UseDCS = False
-
-doJiveXML=False  
-if doJiveXML:
-  ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"]
-
-
-
-#Run Digital
-if loadInDetRec_Options["DigitalClustering"]:
-    print "##### INFO: Running with Digital clustering"
-    ToolSvc.InDetPixelClusterOnTrackTool.PositionStrategy=0
-    ToolSvc.InDetPixelClusterOnTrackTool.ErrorStrategy=1
-
-
-
-if loadInDetRec_Options["inputBowingDatabase"]:
-  print "INFO:: parsed: ",loadInDetRec_Options["inputBowingDatabase"]
-  if ".db" in loadInDetRec_Options["inputBowingDatabase"]:
-    print "INFO:: blocking IBLDist Folder"
-    conddb.blockFolder("/Indet/IBLDist")
-    print "INFO:: Adding folder with tag"
-    from IOVDbSvc.CondDB import conddb
-    conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+loadInDetRec_Options["inputBowingDatabase"]+';dbname=CONDBR2</dbConnection>/Indet/IBLDist','IndetIBLDist',True);
-    #conddb.addFolderWithTag(loadInDetRec_Options["errorScalingTag"],'/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal',True );
-    print "INFO:: IBL Bowing from local Database"
-  else:
-    print "INFO:: Overriding Database Tag"
-    conddb.addOverride('/Indet/IBLDist',loadInDetRec_Options["inputBowingDatabase"])
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_RecExCommon.py b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_RecExCommon.py
deleted file mode 100755
index bc9553c9e160a4954776b7075837e1a381e974f7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_RecExCommon.py
+++ /dev/null
@@ -1,334 +0,0 @@
-## The Following options can be specified seperately in a file that include this one
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"doReadBS":False
-                        ,"realData":False
-                        ,"preIBLgeometry":False
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":False
-                        ,"numberOfEvents":30
-                        ,"DigitalClustering":False
-                        ,"useTRT": True
-                        ,"GoodRunList":""
-                        ,"inputFiles":["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"]
-                        ,"Cosmics":False
-                        ,"BField":False
-                        ,"SkipEvents":0
-                        ,"projectName" : ""
-                        ,"dataSource" : ""
-                        ,"HeavyIons" : False
-                        }
-
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-  if var in dir():
-    loadInDetRec_Options[var] = eval(var)
-
-print "Starting loadInDet_Rec"
-
-#--------------------------------------------------------------
-# Import config
-#--------------------------------------------------------------
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-
-
-from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
-ServiceMgr += AthenaEventLoopMgr()
-ServiceMgr.AthenaEventLoopMgr.EventPrintoutInterval = 100
-
-
-#--------------------------------------------------------------------------------
-#Setup jobProperties  - Override Autoconfiguration of the BField. Needed for MC BOFF-
-#--------------------------------------------------------------------------------
-from AthenaCommon.BeamFlags import jobproperties
-from AthenaCommon.BFieldFlags import jobproperties
-if not loadInDetRec_Options["realData"] and loadInDetRec_Options["Cosmics"]: # and not loadInDetRec_Options["BField"] PF: I think this causes the wrong setup in Cosmics MC
-  print "INFO::Setting Up Manually for MC Cosmics"
-  jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(0.0)
-  jobproperties.Beam.beamType.set_Value_and_Lock("cosmics")
-  jobproperties.BField.solenoidOn.set_Value_and_Lock	(loadInDetRec_Options["BField"])
-  jobproperties.BField.barrelToroidOn.set_Value_and_Lock(loadInDetRec_Options["BField"])
-  jobproperties.BField.endcapToroidOn.set_Value_and_Lock(loadInDetRec_Options["BField"])
-  #rec.doESD.set_Value_and_Lock(False)    #Important that this flag has to be true. Otherwise no recontruction algorithms are called
-  jobproperties.Beam.energy.set_Value_and_Lock(0)
-  jobproperties.Beam.bunchSpacing.set_Value_and_Lock(50)
-  
-if loadInDetRec_Options["HeavyIons"]:
-  jobproperties.Beam.bunchSpacing.set_Value_and_Lock(50)
-else:
-  jobproperties.Beam.bunchSpacing.set_Value_and_Lock(25)
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-athenaCommonFlags.FilesInput = loadInDetRec_Options["inputFiles"]
-
-from AthenaCommon.GlobalFlags import globalflags
-if len(loadInDetRec_Options["globalTag"])!=0:
-  globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-  globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-if len(loadInDetRec_Options["dataSource"])!=0:
-  globalflags.DataSource.set_Value_and_Lock(loadInDetRec_Options["dataSource"])
-
-if len(loadInDetRec_Options["projectName"])!=0:
-  rec.projectName.set_Value_and_Lock(loadInDetRec_Options["projectName"])
-
-
-if len(globalflags.ConditionsTag())!=0:
-  print "setting global tag"
-  print rec.projectName()
-  from IOVDbSvc.CondDB import conddb
-  conddb.setGlobalTag(globalflags.ConditionsTag())
-
-import MagFieldServices.SetupField
-
-# --- number of events to process
-athenaCommonFlags.EvtMax     = int(loadInDetRec_Options["numberOfEvents"])
-athenaCommonFlags.SkipEvents = 0
-
-doVP1 = False
-
-# --- disable error protection of RecExCommon
-athenaCommonFlags.AllowIgnoreConfigError.set_Value_and_Lock(False)
-
-#--------------------------------------------------------------
-# Additional Detector Setup
-#--------------------------------------------------------------
-
-from AthenaCommon.DetFlags import DetFlags 
-
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-# --- turn off Calo
-DetFlags.Calo_setOff()
-# --- and switch off Muons
-DetFlags.Muon_setOff()
-
-if loadInDetRec_Options["BField"]:
-  DetFlags.BField_setOn()
-else:
-  DetFlags.BField_setOff()
-if not loadInDetRec_Options["useTRT"]:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-rec.OutputLevel.set_Value_and_Lock       (INFO)
-
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-# --- ESD writing temporarily disabled post 2013 migration - to be reinstated! 
-
-from ParticleBuilderOptions.AODFlags import AODFlags
-AODFlags.TrackParticleSlimmer=False 
-AODFlags.TrackParticleLastHitAndPerigeeSlimmer=False
-
-rec.doWriteESD.set_Value_and_Lock        (False)
-rec.doAOD.set_Value_and_Lock             (False)
-rec.doWriteAOD.set_Value_and_Lock        (False)
-rec.doDPD.set_Value_and_Lock             (False)
-rec.doCBNT.set_Value_and_Lock            (False)
-rec.doWriteTAG.set_Value_and_Lock        (False)
-
-# --- turn on InDet
-rec.doInDet.set_Value_and_Lock           (True)
-# --- turn off calo
-rec.doCalo.set_Value_and_Lock            (False)
-# --- turn off muons
-rec.doMuon.set_Value_and_Lock            (False) 
-# --- turn off forward detectors
-rec.doForwardDet.set_Value_and_Lock      (False)
-# --- turn off trigger for Cosmics Data
-if loadInDetRec_Options["realData"] and loadInDetRec_Options["Cosmics"]:
-    rec.doTrigger.set_Value_and_Lock     (False)
-
-# --- turn off combined reconstruction
-rec.doEgamma.set_Value_and_Lock          (False)
-rec.doMuonCombined.set_Value_and_Lock    (False)
-rec.doTau.set_Value_and_Lock             (False)
-rec.doJetMissingETTag.set_Value_and_Lock (False)
-
-
-# --- turn off global monitoring 
-rec.doMonitoring.set_Value_and_Lock      (False)
-
-# --- Heavy Ions
-if loadInDetRec_Options["HeavyIons"]:
-  rec.doHeavyIon.set_Value_and_Lock      (True)
-  from HIRecExample.HIRecExampleFlags import jobproperties
-  jobproperties.HIRecExampleFlags.doHIGlobal.set_Value_and_Lock         (False)
-  rec.Commissioning.set_Value_and_Lock(True)
-  #rec.doExpressProcessing.set_Value_and_Lock(True);
-  
- 
-# --- For Commissioning phase
-#rec.Commissioning.set_Value_and_Lock     (True);  #should keep the InDet25nsec flag to False (check the implications). Relax max number of holes for the InDetTriggerTrackingCuts
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.InDet25nsec.set_Value_and_Lock(True)
-
-
-# --- turn of calo stuff we don't need anyway
-from CaloRec.CaloRecFlags import jobproperties
-jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock  (False)
-jobproperties.CaloRecFlags.doCaloEMTopoCluster.set_Value_and_Lock(False)
-jobproperties.CaloRecFlags.doCaloTopoTower.set_Value_and_Lock    (False)
-
-# --- turn off jets (Hack!!!)
-from JetRec.JetRecFlags import jetFlags
-jetFlags.Enabled.set_Value_and_Lock          (False)
-
-# --- turn off egamma Brem
-recAlgs.doEgammaBremReco.set_Value_and_Lock  (False)
-# --- turn off Eflow and missing ET
-recAlgs.doEFlow.set_Value_and_Lock           (False)
-recAlgs.doEFlowJet.set_Value_and_Lock        (False)
-recAlgs.doMissingET.set_Value_and_Lock       (False)
-recAlgs.doMissingETSig.set_Value_and_Lock    (False)
-recAlgs.doObjMissingET.set_Value_and_Lock    (False)
-# --- turn off combined muons
-recAlgs.doMuGirl.set_Value_and_Lock          (False)
-recAlgs.doMuTag.set_Value_and_Lock           (False)
-recAlgs.doMuidLowPt.set_Value_and_Lock       (False)
-recAlgs.doMuonIDCombined.set_Value_and_Lock  (False)
-recAlgs.doMuonIDStandAlone.set_Value_and_Lock(False)
-recAlgs.doMuonSpShower.set_Value_and_Lock    (False)
-recAlgs.doStaco.set_Value_and_Lock           (False)
-recAlgs.doCaloTrkMuId.set_Value_and_Lock     (False)
-recAlgs.doTileMuID.set_Value_and_Lock        (False)
-# --- trigger
-recAlgs.doTrigger.set_Value_and_Lock         (False)
-rec.doTagRawSummary.set_Value_and_Lock   (False)
-rec.doTrigger.set_Value_and_Lock             (False)
-
-
-#--------------------------------------------------------------
-# Printout config
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-print "globalflags configuration:"
-print globalflags
-
-print "detflags configuration:"
-DetFlags.Print()
-
-print "rec configuration:"
-print rec
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-# --- setup InDetJobProperties (default)
-from InDetRecExample.InDetJobProperties import InDetFlags
-#InDetFlags.doTruth.set_Value_and_Lock (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-InDetFlags.doTruth.set_Value_and_Lock (False)
-
-#Anthony's recommendation: Is to load old SCT conditions. To be off >= M8
-#InDetFlags.ForceCoraCool.set_Value_and_Lock                        (True)
-
-# --- enable brem recovery
-InDetFlags.doBremRecovery.set_Value_and_Lock                       (False)
-InDetFlags.doCaloSeededBrem.set_Value_and_Lock                     (False)
-# --- enable forward tracks
-InDetFlags.doForwardTracks.set_Value_and_Lock                      (False)
-# --- enable 
-InDetFlags.doTrackSegmentsPixelPrdAssociation.set_Value_and_Lock   (False)
-# --- enable low mu run setup
-InDetFlags.doLowMuRunSetup.set_Value_and_Lock                      (False)
-InDetFlags.doTRTSeededTrackFinder.set_Value_and_Lock               (False)
-InDetFlags.doBackTracking.set_Value_and_Lock                       (False)
-InDetFlags.doPseudoTracking.set_Value_and_Lock                     (False)
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal.set_Value_and_Lock                   (False)
-InDetFlags.doMonitoringPrimaryVertexingEnhanced.set_Value_and_Lock (False)
-InDetFlags.doMonitoringPixel.set_Value_and_Lock                    (False)
-InDetFlags.doMonitoringSCT.set_Value_and_Lock                      (False)
-InDetFlags.doMonitoringTRT.set_Value_and_Lock                      (False)
-InDetFlags.doMonitoringAlignment.set_Value_and_Lock                (False)
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables.set_Value_and_Lock                 (True)
-
-
-# deactivate slimming 
-InDetFlags.doSlimming.set_Value_and_Lock                           (False)
-
-# Store Gate deletion in case of HI to off
-if loadInDetRec_Options["HeavyIons"]:
-  InDetFlags.doSGDeletion.set_Value_and_Lock                            (False) 
-
-
-# --- Options that we may change in the alignment
-if loadInDetRec_Options["Cosmics"]:
-    print "#### INFO:: jobOptions_RecExCommon: Cosmics"
-    InDetFlags.doPixelClusterSplitting.set_Value_and_Lock          (False)
-    InDetFlags.doTIDE_Ambi.set_Value_and_Lock                      (False);
-    #InDetFlags.cutLevel.set_Value_and_Lock                             (8) #is for cosmics
-else:
-    # Disable seed TRT tracking
-  if loadInDetRec_Options["HeavyIons"]:
-    InDetFlags.cutLevel.set_Value_and_Lock                             (3)
-  else:
-    InDetFlags.cutLevel.set_Value_and_Lock                             (12)    
-    
-
-
-
-# Disable TRT only tracking  
-InDetFlags.doTRTStandalone.set_Value_and_Lock                      (False)
-InDetFlags.doBackTracking.set_Value_and_Lock                       (False)
-
-# --- We are in commissioning phase in case of cosmics and comm
-#if "cos" in loadInDetRec_Options["projectName"] or "comm" in loadInDetRec_Options["projectName"]:
-InDetFlags.doInnerDetectorCommissioning.set_Value_and_Lock         (False)
-InDetFlags.useBroadClusterErrors.set_Value_and_Lock(False);
-if loadInDetRec_Options["DigitalClustering"]:
-    print "jobOptions_RecExCommon: DigitalClustering"
-    InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False);
-    InDetFlags.doTIDE_Ambi.set_Value_and_Lock(False);
-else:
-    InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(True);
-    InDetFlags.doTIDE_Ambi.set_Value_and_Lock(True);
-
-#if "comm" in loadInDetRec_Options["projectName"]:
-#    InDetFlags.useDCS.set_Value_and_Lock(False)
-
-#InDetFlags.doTrackSegmentsPixel.set_Value_and_Lock                 (True) 
-#InDetFlags.doTrackSegmentsSCT.set_Value_and_Lock                   (True)
-#InDetFlags.doTrackSegmentsTRT.set_Value_and_Lock                   (True)
-
-# --- if we are using ESD (make flag) // Revist later
-#InDetFlags.doPRDFormation = False
-
-# Only for Data
-
-from AthenaCommon.AppMgr import ServiceMgr;
-import MuonRPC_Cabling.MuonRPC_CablingConfig;
-ServiceMgr.MuonRPC_CablingSvc.RPCTriggerRoadsfromCool=False
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-#Don't write any override here.
-#Use the jobOptions_ConditionsOverrider.py  
-
-
-if doVP1:
-  from VP1Algs.VP1AlgsConf import VP1Alg
-  topSequence += VP1Alg()
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py
deleted file mode 100644
index 63b253b11b4d33e41b82aa9c44f4a4320852cfcc..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py
+++ /dev/null
@@ -1,333 +0,0 @@
-# The Following options can be specified seperately in a file that include this one
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"doReadBS":True
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":True
-                        ,"doMonitoring":True
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"trtAlignmentTagL3":""
-                        ,"lorentzAngleTag":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"TRTCalibTextFile":""
-                        ,"TRTCalibT0TagCos":""
-                        ,"TRTCalibRtTagCos":""
-                        ,"numberOfEvents":30
-                        ,"useTRT": True
-                        ,"GoodRunList":""
-                        # 7 TeV Simulation Data
-                        ,"inputFiles":["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"]
-                       }
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-  if var in dir():
-    loadInDetRec_Options[var] = eval(var)
-
-if len(loadInDetRec_Options["globalTag"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-# OUT
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc.IgnoreTagDifference=True
-
-
-# Good run list
-if loadInDetRec_Options["GoodRunList"] != "":
-  from GoodRunsLists.GoodRunsListsConf import *
-  GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_Options["CollisionGRL"] ]
-  GoodRunsTool.EventSelectorMode = True
-  GoodRunsTool.OutputLevel = DEBUG
-  print GoodRunsTool
-
-  AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
-  AthenaEventLoopMgr.PreSelectTools+=[GoodRunsTool]
-  AthenaEventLoopMgr.OutputLevel = DEBUG
-  print AthenaEventLoopMgr
-
-
-
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_Options["doReadBS"]
-#if not doReadBS:
-#	PoolSvc=Service("PoolSvc")
-#	ServiceMgr += PoolSvc()
-#	ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-
-if "IDCosmic" in loadInDetRec_Options["inputFiles"][0]:
-	print "Switched manually to cosmics"
-	from AthenaCommon.BeamFlags import jobproperties
-	jobproperties.Beam.beamType.set_Value_and_Lock('cosmics')
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-
-athenaCommonFlags.FilesInput = loadInDetRec_Options["inputFiles"]
-
-
-import AthenaPython.ConfigLib as apcl
-cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig',
-                   input_files = athenaCommonFlags.FilesInput())
-cfg.configure_job()
-   
-
-theApp.EvtMax = loadInDetRec_Options["numberOfEvents"]
-
-
-if doReadBS:
-	from AthenaCommon.GlobalFlags import globalflags
-	if len(globalflags.ConditionsTag())!=0:
-		from IOVDbSvc.CondDB import conddb
-		conddb.setGlobalTag(globalflags.ConditionsTag())  
-from AthenaCommon.BeamFlags import jobproperties
-if jobproperties.Beam.beamType == 'cosmics':
-	Cosmics = True
-else:
-	Cosmics = False
-
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = True
-
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-
-
-from RecExConfig.RecFlags import rec
-if Cosmics:
-    rec.Commissioning = True
-    rec.doMonitoring = True
-else:
-    rec.Commissioning = False
-
- 
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-DetFlags.makeRIO.SCT_setOff()
-DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-DetFlags.SCT_setOff()
-DetFlags.detdescr.SCT_setOn()
-#if not loadInDetRec_Options["useTRT"]:
-DetFlags.TRT_setOff()
-DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-DetFlags.dcs.SCT_setOff()
-DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-# --- output level
-OutputLevel          = DEBUG
-
-  
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-# --- setup InDetJobProperties
-from AthenaCommon.GlobalFlags import globalflags
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-#InDetFlags.doTruth = False
-#if globalflags.InputFormat() == 'pool' and not globalflags.DataSource == 'geant4':
-  # ---- run over ESD files
-InDetFlags.preProcessing=True
-InDetFlags.doPRDFormation = True
-#else:
-#  InDetFlags.doPRDFormation = True
-
-# --- uncomment to change the default of one of the following options:
-InDetFlags.doNewTracking          = True
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-#if not Cosmics:
-InDetFlags.doxKalman              = False
-InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#if not Cosmics:
-#    InDetFlags.doTrackSegmentsPixel = True
-#    InDetFlags.doTrackSegmentsSCT   = True
- #   InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-#InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True)
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrkNtuple.set_Value_and_Lock( False )
-#InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrtTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-InDetFlags.doPixelClusterSplitting=False
-#if (hasattr(InDetFlags,"doPixelClusterSplitting")) :
-InDetFlags.doPixelClusterSplitting.set_Value_and_Lock( False )
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-TrkDetFlags.MaterialDatabaseLocal =False
-
-#--------------------------------------------------------------
-# configure IBL reco
-#--------------------------------------------------------------
-
-include("InDetIBL_Example/InDetIBLRecoPreInclude.py")
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-include("InDetRecExample/InDetRec_all.py")
- 
-#--------------------------------------------------------------
-# configure IBL reco
-#--------------------------------------------------------------
-
-include("InDetIBL_Example/InDetIBLRecoPostInclude.py")
-
-if loadInDetRec_Options["siPoolFile"]:
-    include ("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-    from IOVDbSvc.CondDB import conddb
-    # block folders that you want to override
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-    print 'Loading initial alignment File'
-    ServiceMgr.CondProxyProvider.InputCollections = [ loadInDetRec_Options["siPoolFile"] ]
-    ServiceMgr.CondProxyProvider.OutputLevel=INFO
-    print ServiceMgr.CondProxyProvider
-    IOVSvc = Service("IOVSvc")
-    IOVSvc.preLoadData = True
-
-else:
-    if loadInDetRec_Options["siAlignmentTag"]:
-        conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-    if loadInDetRec_Options["trtAlignmentTag"]:
-        conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-    if loadInDetRec_Options["trtAlignmentTagL3"]:
-        conddb.addOverride('/TRT/Calib/DX',loadInDetRec_Options["trtAlignmentTagL3"])
-
-
-if loadInDetRec_Options["errorScalingTag"]:
-    if ".db" in loadInDetRec_Options["errorScalingTag"]:
-        conddb.blockFolder("/Indet/TrkErrorScaling")
-        conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_nominal</tag>", force=True)
-    else:
-        conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_Options["errorScalingTag"])
-  
-if loadInDetRec_Options["beamSpotTag"] and not Cosmics:
-    conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-
-if loadInDetRec_Options["lorentzAngleTag"]:
-    conddb.addOverride('/PIXEL/LorentzAngleScale',loadInDetRec_Options["lorentzAngleTag"])
-  
-from AthenaCommon.AppMgr import ToolSvc
-from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackErrorScalingTool
-InDetRotErrorScalingTool = Trk__RIO_OnTrackErrorScalingTool( name        = 'RIO_OnTrackErrorScalingTool',
-                                                             OutputLevel = INFO )
-ToolSvc += InDetRotErrorScalingTool
-#print InDetRotErrorScalingTool
-
-  
-# Correct TRT calibration for cosmics
-if loadInDetRec_Options["TRTCalibTextFile"] and Cosmics:
-  from AthenaCommon.AppMgr import ToolSvc
-  from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
-  TRTCalibDBSvc=TRT_CalDbSvc()
-  ServiceMgr+=TRTCalibDBSvc
-  
-  conddb.blockFolder("/TRT/Calib/RT" )
-  conddb.blockFolder("/TRT/Calib/T0" )
-  TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-
-if loadInDetRec_Options["TRTCalibT0TagCos"]:
-  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_Options["TRTCalibT0TagCos"])
-if loadInDetRec_Options["TRTCalibRtTagCos"]:
-  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_Options["TRTCalibRtTagCos"])
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py
deleted file mode 100755
index 3ec848ba23b7dedbc1c607c061da26a5b2b3a282..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py
+++ /dev/null
@@ -1,209 +0,0 @@
-#example of personal topOptions
-#
-# to use it  
-# athena >! athena.log
-#  ( myTopOptions.py is defaulted through jobOptions.py soft link)
-# 
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-#
-# doESD, DetDescrVersion and other flags 
-# needs be set before the include, since several
-# secondary flags are configured according to that one
-#
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"doReadBS":True
-                        ,"globalTag" : ""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"trtAlignmentTagL3":""
-                        ,"alignmentPoolFile":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"numberOfEvents":30
-                        ,"GoodRunList":""
-                        ,"inputPoolFiles":""
-                        # 7 TeV Simulation Data
-                        ,"inputFiles":["rfio:/castor/cern.ch/grid/atlas/atlasdatadisk/data11_7TeV/DESD_SGLEL/f396_m946/data11_7TeV.00187815.physics_Egamma.merge.DESD_SGLEL.f396_m946/data11_7TeV.00187815.physics_Egamma.merge.DESD_SGLEL.f396_m946._lb0005-lb0011._0001.1"]
-                        }
-for var in loadInDetRec_Options:
-  if var in dir():
-    loadInDetRec_Options[var] = eval(var)
-
-from glob import glob
-
-
-PoolInput =  loadInDetRec_Options["inputFiles"]
-
-
-#PoolRDOInput = ["rfio:/castor/cern.ch/grid/atlas/atlasdatadisk/data11_7TeV/ESD/v51/data11_7TeV.00187815.express_express.recon.ESD.v51/data11_7TeV.00187815.express_express.recon.ESD.v51._lb0005._SFO-ALL._0001.1"]
-# number of event to process
-Events= loadInDetRec_Options["numberOfEvents"]
-SkipEvents = 0
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-
-
-from GoodRunsLists.GoodRunsListsConf import *
-ToolSvc += GoodRunsListSelectorTool()
-GoodRunsListSelectorTool.GoodRunsListVec  = [loadInDetRec_Options["GoodRunList"]]
-
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-job = AlgSequence()
-seq = AthSequencer("AthFilterSeq")
-
-from GoodRunsListsUser.GoodRunsListsUserConf import *
-seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-seq.GRLTriggerAlg1.GoodRunsListArray = ['Eg_standard']        ## pick up correct name from inside xml file!
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-
-athenaCommonFlags.EvtMax = Events
-athenaCommonFlags.SkipEvents = SkipEvents
-athenaCommonFlags.PoolRDOInput.set_Value_and_Lock(PoolInput)
-#athenaCommonFlags.PoolRDOInput = PoolInput
-#from AthenaCommon.GlobalFlags import globalflags
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from AthenaCommon.GlobalFlags import globalflags
-if len(loadInDetRec_Options["globalTag"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(False)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(False)
-rec.doTruth.set_Value_and_Lock(False)
-
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-DetFlags.Calo_setOn()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-#DetFlags.TRT_setOff()
-
-if len(loadInDetRec_Options["inputPoolFiles"][0]) > 0:
-	readPool  = True 
-	inputCollections = loadInDetRec_Options["inputPoolFiles"]
-else:
-	readPool = False
-from IOVDbSvc.CondDB import conddb
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverPv2.3_2011_E')
-#conddb.addOverride('/TRT/Align', 'TRTAlign_EoverPv2_2011_E')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverPv3.1_2011_E')
-
-from IOVDbSvc.CondDB import conddb
-if not conddb.folderRequested('PIXEL/PixReco'):
-    conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
-
-if len(loadInDetRec_Options["beamSpotTag"]) > 0:
-  conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-  
-if readPool :
-	conddb.blockFolder("/Indet/Align")
-	conddb.blockFolder("/TRT/Align")
-	#conddb.blockFolder("/TRT/Calib/DX")
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	# set this to the file containing AlignableTransform objects
-	ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-	ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-	print ServiceMgr.CondProxyProvider
-	# this preload causes callbacks for read in objects to be activated,
-	# allowing GeoModel to pick up the transforms
-	ServiceMgr.IOVSvc.preLoadData=True
-	ServiceMgr.IOVSvc.OutputLevel=INFO
-else:
-    if loadInDetRec_Options["siAlignmentTag"]:
-        conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-    if loadInDetRec_Options["trtAlignmentTag"]:
-        conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-##     if loadInDetRec_Options["trtAlignmentTagL3"]:
-##         conddb.addOverride('/TRT/Calib/DX',loadInDetRec_Options["trtAlignmentTagL3"])
-if loadInDetRec_Options["trtAlignmentTagL3"]:
-        conddb.addOverride('/TRT/Calib/DX',loadInDetRec_Options["trtAlignmentTagL3"])
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-
-print svcMgr.IOVDbSvc
-
-
-#print SkipEvents
-from GaudiSvc.GaudiSvcConf import THistSvc
-#ServiceMgr += THistSvc()
-#ServiceMgr.THistSvc.Output += ["egTestOutPut DATAFILE='ElectronExtrapolationOut.root' OPT='RECREATE'"]
-ServiceMgr += THistSvc()
-ServiceMgr.THistSvc.Output += ["eoverpValidation DATAFILE='eoverpValidationOut.root' OPT='RECREATE'"]
-ServiceMgr.THistSvc.Output += ["eoverpValidation2 DATAFILE='eoverpValidationOut.root' OPT='RECREATE'"]
-
-
-include ("InDetAlignExample/ElectronEoverPTracking.py")
-from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonEoverP
-funIDPerfMonEoverP = IDPerfMonEoverP(name = 'IDPerfMonEoverP',
-                                     ReFitterTool = ElectronRefitterTool,
-                                     ReFitterTool2 = ElectronRefitterTool2,
-                                     InputElectronContainerName = "ElectronAODCollection",
-                                     RefittedElectronTrackContainer1 = GSFTrackCollection,
-                                     RefittedElectronTrackContainer2 = DNATrackCollection,
-                                     InputJetContainerName = "AntiKt4LCTopoJets", #AntiKt4TopoJets
-                                     RefitTracks = True,
-                                     isDATA = True,
-                                     OutputLevel =INFO)
-
-job += funIDPerfMonEoverP
-#from ElectronRefit.ElectronRefitConf import ElectronExtrapolation
-#ElectronRefitter = ElectronExtrapolation(name = 'ElectronRefitter',
-#                                    ReFitterTool = ElectronRefitterTool,
-#																		ReFitterTool2 = ElectronRefitterTool2,
-#																		InputElectronContainerName = "ElectronAODCollection",
-#																		RefittedElectronTrackContainer1 = GSFTrackCollection,
-#																		RefittedElectronTrackContainer2 = DNATrackCollection,
-#																		BremBuilder = bremBuilder,
-#																		RefitTracks = True,
-#																		isDATA = True,
-#																		OutputLevel =4)
-
-
-
-#job += ElectronRefitter
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py
deleted file mode 100644
index 582db965065182a8af79acee1656fcc18142c299..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py
+++ /dev/null
@@ -1,397 +0,0 @@
-## The Following options can be specified seperately in a file that include this one
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"doReadBS":False
-                        ,"realData":False
-                        ,"preIBLgeometry":False
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":True
-                        ,"doMonitoring":True
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"trtAlignmentTagL3":""
-                        ,"lorentzAngleTag":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"TRTCalibTextFile":""
-                        ,"TRTCalibT0TagCos":""
-                        ,"TRTCalibRtTagCos":""
-                        ,"numberOfEvents":30
-                        ,"useTRT": True
-                        ,"GoodRunList":""
-                        # 7 TeV Simulation Data
-                        ,"inputFiles":["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"]
-                        ,"Cosmics":False
-                        ,"BField":True
-                        ,"SkipEvents":0
-                        }
-
-
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-  if var in dir():
-    loadInDetRec_Options[var] = eval(var)
-
-#print 'HERE test ',loadInDetRec_Options["Cosmics"]
-#Just make sure for now it is set. Might needs further changes in the future
-if loadInDetRec_Options["preIBLgeometry"] == False:
-  from IOVDbSvc.CondDB import conddb
-  conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterial','AtlasLayerMat_v15_ATLAS-IBL3D25-04-00-01')
-
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc.IgnoreTagDifference=True
-
-
-# Good run list
-if loadInDetRec_Options["GoodRunList"] != "":
-  from GoodRunsLists.GoodRunsListsConf import *
-  GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_Options["GoodRunList"] ]
-  GoodRunsTool.EventSelectorMode = True
-  GoodRunsTool.OutputLevel = DEBUG
-  print GoodRunsTool
-  AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
-  AthenaEventLoopMgr.PreSelectTools+=[GoodRunsTool]
-  AthenaEventLoopMgr.OutputLevel = DEBUG
-  print AthenaEventLoopMgr
-
-
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_Options["doReadBS"]
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-
-athenaCommonFlags.FilesInput = loadInDetRec_Options["inputFiles"]
-
-if not loadInDetRec_Options["Cosmics"]:
-  import AthenaPython.ConfigLib as apcl
-  cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig',
-                     input_files = athenaCommonFlags.FilesInput())
-  cfg.configure_job()
-   
-theApp.EvtMax = int(loadInDetRec_Options["numberOfEvents"])
-#ServiceMgr.EventSelector.SkipEvents = int(loadInDetRec_Options["SkipEvents"])
-
-if doReadBS:
-  from AthenaCommon.GlobalFlags import globalflags
-  if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-    
-    if loadInDetRec_Options["Cosmics"]:
-      from AthenaCommon.AppMgr import ServiceMgr
-        ##ServiceMgr Is included if SiPool is defined. If it is not defined it is not included. If doReadBS and UseCosmics are both true probably the script will crash
-      ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-      ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_Options["inputFiles"]
-        
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = True
-
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-#-------------------------------------------------------
-#Load globalFlags and set Defaults
-#-------------------------------------------------------
-from AthenaCommon.GlobalFlags import globalflags
-##From the cosmics script this flag was set
-if loadInDetRec_Options["Cosmics"]:
-  globalflags.DetGeo = 'atlas'
-  
-if doReadBS:
-  globalflags.InputFormat   = 'bytestream'
-else:
-  globalflags.InputFormat = 'pool'
-if loadInDetRec_Options["realData"]:
-  globalflags.DataSource = 'data'
-else:
-  globalflags.DataSource = 'geant4'
-
-if len(loadInDetRec_Options["globalTag"])!=0:
-  #from AthenaCommon.GlobalFlags import globalflags
-  globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-  #from AthenaCommon.GlobalFlags import globalflags
-  globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-if len(globalflags.ConditionsTag())!=0:
-  from IOVDbSvc.CondDB import conddb
-  conddb.setGlobalTag(globalflags.ConditionsTag())
-  
-globalflags.print_JobProperties()
-
-#---------------------------------------------------------
-#Setup jobProperties
-#---------------------------------------------------------
-from AthenaCommon.BeamFlags import jobproperties
-from AthenaCommon.BFieldFlags import jobproperties
-if loadInDetRec_Options["Cosmics"]:
-  jobproperties.Beam.numberOfCollisions = 0.0  
-  jobproperties.Beam.beamType="cosmics"
-  jobproperties.BField.solenoidOn=loadInDetRec_Options["BField"]
-
-#------------------------------------------------------
-#Set Detector Setup
-#------------------------------------------------------
-from AthenaCommon.DetFlags import DetFlags 
-
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.SCT_setOff()
-#DetFlags.detdescr.SCT_setOn()
-if not loadInDetRec_Options["useTRT"]:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-# --- output level
-#OutputLevel          = DEBUG
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-if loadInDetRec_Options["Cosmics"]:
-  rec.Commissioning = True
-  rec.doMonitoring = True
-else:
-  rec.Commissioning = False
-  ##In the original loadDetInRec_new.py for collisions the rec.doMonitoring was not set
-  #rec.doMonitoring = True
-    
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-#InDetFlags.doTruth = False
-if globalflags.InputFormat() == 'pool' and not globalflags.DataSource == 'geant4':
-  # ---- run over ESD files
-  #  InDetFlags.preProcessing=True
-  #This is not originally defined in the Cosmics jobOption, but i add it here
-  InDetFlags.doPRDFormation = False
-else:
-  InDetFlags.doPRDFormation = True
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-if not loadInDetRec_Options["Cosmics"]:
-  InDetFlags.doxKalman              = False
-  InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#if not Cosmics:
-#    InDetFlags.doTrackSegmentsPixel = True
-#    InDetFlags.doTrackSegmentsSCT   = True
- #   InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-#InDetFlags.doMonitoringAlignment = loadInDetRec_Options["doMonitoring"]
-InDetFlags.doMonitoringAlignment = False
-#InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True)
-
-if loadInDetRec_Options["Cosmics"]:
-  InDetFlags.doCosmics.set_Value_and_Lock(True)
-  #InDetFlags.doMonitoringAlignment = loadInDetRec_Options["doMonitoring"]
-  #InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True)
-  InDetFlags.doCTBTracking.set_Value_and_Lock(False)# = False
-  InDetFlags.doCTBTrackSegmentsPixel.set_Value_and_Lock(False)
-  InDetFlags.doCTBTrackSegmentsSCT.set_Value_and_Lock(False)
-  InDetFlags.doCTBTrackSegmentsTRT.set_Value_and_Lock(False)
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doTrkNtuple.set_Value_and_Lock( False )
-InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doTrtTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-if (hasattr(InDetFlags,"doPixelClusterSplitting")) :
-  InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False)
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-TrkDetFlags.MaterialDatabaseLocal =False
-
-InDetFlags.doPixelClusterNtuple = False
-
-# For Rel17 we need pre and post include
-#--------------------------------------------------------------
-# configure IBL reco
-#--------------------------------------------------------------
-
-if loadInDetRec_Options["preIBLgeometry"] == False:
-  include("InDetIBL_Example/InDetIBLRecoPreInclude.py")
- 
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
- 
-include("InDetRecExample/InDetRec_all.py")
- 
-#--------------------------------------------------------------
-# configure IBL reco
-#--------------------------------------------------------------
-
-if loadInDetRec_Options["preIBLgeometry"] == False:
-  include("InDetIBL_Example/InDetIBLRecoPostInclude.py")
-
-
-if not loadInDetRec_Options["BField"] and loadInDetRec_Options["Cosmics"]:
-  InDetTrackFitter.GetMaterialFromTrack = False
-  InDetTrackFitter.Momentum = 100000. *MeV
-
-
-if loadInDetRec_Options["siPoolFile"]:
-  include ("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-  from IOVDbSvc.CondDB import conddb
-    # block folders that you want to override
-  conddb.blockFolder("/Indet/Align")
-  conddb.blockFolder("/TRT/Align")
-  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-  from AthenaCommon.AppMgr import ServiceMgr
-  ServiceMgr += CondProxyProvider()
-  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-  print 'Loading initial alignment File'
-  ServiceMgr.CondProxyProvider.InputCollections = [ loadInDetRec_Options["siPoolFile"] ]
-  ServiceMgr.CondProxyProvider.OutputLevel=INFO
-  print ServiceMgr.CondProxyProvider
-  IOVSvc = Service("IOVSvc")
-  IOVSvc.preLoadData = True
-
-else:
-  if loadInDetRec_Options["siAlignmentTag"]:
-    conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-  if loadInDetRec_Options["trtAlignmentTag"]:
-    conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-  if loadInDetRec_Options["trtAlignmentTagL3"] and not loadInDetRec_Options["Cosmics"]:
-    conddb.addOverride('/TRT/Calib/DX',loadInDetRec_Options["trtAlignmentTagL3"])
-
-
-if loadInDetRec_Options["errorScalingTag"]:
-  if ".db" in loadInDetRec_Options["errorScalingTag"]:
-    conddb.blockFolder("/Indet/TrkErrorScaling")
-    conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_nominal</tag>", force=True)
-  else:
-    conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_Options["errorScalingTag"])
-##Added if you put an empty ErrorScalingTag
-else:
-  conddb.addOverride('/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal')
-
-
-if loadInDetRec_Options["beamSpotTag"] and not loadInDetRec_Options["Cosmics"]:
-  conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-
-if loadInDetRec_Options["lorentzAngleTag"] and not loadInDetRec_Options["Cosmics"]:
-  conddb.addOverride('/PIXEL/LorentzAngleScale',loadInDetRec_Options["lorentzAngleTag"])
-  
-from AthenaCommon.AppMgr import ToolSvc
-from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackErrorScalingTool
-InDetRotErrorScalingTool = Trk__RIO_OnTrackErrorScalingTool( name        = 'RIO_OnTrackErrorScalingTool',
-                                                             OutputLevel = INFO )
-ToolSvc += InDetRotErrorScalingTool
-print InDetRotErrorScalingTool
-
-  
-# Correct TRT calibration for cosmics
-if loadInDetRec_Options["TRTCalibTextFile"] and loadInDetRec_Options["Cosmics"]:
-  from AthenaCommon.AppMgr import ToolSvc
-  from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
-  TRTCalibDBSvc=TRT_CalDbSvc()
-  ServiceMgr+=TRTCalibDBSvc
-  
-  conddb.blockFolder("/TRT/Calib/RT" )
-  conddb.blockFolder("/TRT/Calib/T0" )
-  TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-
-if loadInDetRec_Options["TRTCalibT0TagCos"]:
-  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_Options["TRTCalibT0TagCos"])
-if loadInDetRec_Options["TRTCalibRtTagCos"]:
-  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_Options["TRTCalibRtTagCos"])
-
-if doJiveXML:
-  ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"]
-
-  
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py
deleted file mode 100644
index 2098028b05d9bda892041e20dba650f72e4092b8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py
+++ /dev/null
@@ -1,343 +0,0 @@
-## The Following options can be specified seperately in a file that include this one
-print " <loadInDetRec> Starting loadInDet_Rec"
-
-if loadInDetRec_Options["realData"]:    
-  rec.projectName="Cosm14"
-
-#Just make sure for now it is set. Might needs further changes in the future
-
-
-print "conddb loaded"
-  
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc.IgnoreTagDifference=True
-
-
-
-# Good run list
-if loadInDetRec_Options["GoodRunList"] != "":
-  from GoodRunsLists.GoodRunsListsConf import *
-  GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_Options["GoodRunList"] ]
-  GoodRunsTool.EventSelectorMode = True
-  GoodRunsTool.OutputLevel = DEBUG
-  print GoodRunsTool
-  AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
-  AthenaEventLoopMgr.PreSelectTools+=[GoodRunsTool]
-  AthenaEventLoopMgr.OutputLevel = DEBUG
-  print AthenaEventLoopMgr
-
-
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_Options["doReadBS"]
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-
-athenaCommonFlags.FilesInput = loadInDetRec_Options["inputFiles"]
-
-
-print "Before Autoconfig"
-
-
-if not loadInDetRec_Options["Cosmics"]:
-  import AthenaPython.ConfigLib as apcl
-  cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig',
-                     input_files = athenaCommonFlags.FilesInput())
-  cfg.configure_job()
- 
-
-   
-theApp.EvtMax = int(loadInDetRec_Options["numberOfEvents"])
-#ServiceMgr.EventSelector.SkipEvents = int(loadInDetRec_Options["SkipEvents"])
-
-
-
-#-------------------------------------------------------
-#Load globalFlags and set Defaults
-#-------------------------------------------------------
-from AthenaCommon.GlobalFlags import globalflags
-##From the cosmics script this flag was set
-if loadInDetRec_Options["Cosmics"]:
-  #globalflags.DetGeo = 'atlas'
-  globalflags.DetGeo='commis' #PF 2014/25/10
-  
-if doReadBS:
-  globalflags.InputFormat   = 'bytestream'
-else:
-  globalflags.InputFormat = 'pool'
-if loadInDetRec_Options["realData"]:
-  globalflags.DataSource = 'data'
-else:
-  globalflags.DataSource = 'geant4'
-
-if len(loadInDetRec_Options["globalTag"])!=0:
-  #from AthenaCommon.GlobalFlags import globalflags
-  globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-  #from AthenaCommon.GlobalFlags import globalflags
-  globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-if len(globalflags.ConditionsTag())!=0:
-  from IOVDbSvc.CondDB import conddb
-  conddb.setGlobalTag(globalflags.ConditionsTag())
-
-
-print "INFO:: JobProperties Printing "
-globalflags.print_JobProperties()
-
-
-
-
-
-if loadInDetRec_Options["preIBLgeometry"] == False:
-  from IOVDbSvc.CondDB import conddb
-  #conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterial','AtlasLayerMat_v15_ATLAS-IBL3D25-04-00-01')
-  conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterialV2','AtlasLayerMat_v18_ATLAS-R2-2015-01')
-
-if doReadBS:
-  #ByteStreamInputSvc this is needed for 2014 cosmic ray data
-  from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamEventStorageInputSvc
-  ByteStreamInputSvc = ByteStreamEventStorageInputSvc("ByteStreamInputSvc",
-                                                        FullFileName = ["RawEvent.re"])
-  ServiceMgr            += ByteStreamInputSvc
-  print                    ByteStreamInputSvc
-  
-  from AthenaCommon.GlobalFlags import globalflags
-  if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-    
-    if loadInDetRec_Options["Cosmics"]:
-        from AthenaCommon.AppMgr import ServiceMgr
-        ##ServiceMgr Is included if SiPool is defined. If it is not defined it is not included. If doReadBS and UseCosmics are both true probably the script will crash
-        ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-        ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_Options["inputFiles"]
-        
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = False
-
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-
-#---------------------------------------------------------
-#Setup jobProperties
-#---------------------------------------------------------
-from AthenaCommon.BeamFlags import jobproperties
-from AthenaCommon.BFieldFlags import jobproperties
-if loadInDetRec_Options["Cosmics"]:
-  jobproperties.Beam.numberOfCollisions = 0.0  
-  jobproperties.Beam.beamType="cosmics"
-  jobproperties.BField.solenoidOn=loadInDetRec_Options["BField"]
-
-#------------------------------------------------------
-#Set Detector Setup
-#------------------------------------------------------
-from AthenaCommon.DetFlags import DetFlags 
-
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-#DetFlags.SCT_setOff()
-#DetFlags.detdescr.SCT_setOn()
-if not loadInDetRec_Options["useTRT"]:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-print "INFO:: Printing DetFlags"
-DetFlags.Print()
-
-# --- output level
-#OutputLevel          = DEBUG
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-if loadInDetRec_Options["Cosmics"]:
-  rec.Commissioning = True 
-  #rec.doMonitoring = True
-else:
-  rec.Commissioning = False
-  ##In the original loadDetInRec_new.py for collisions the rec.doMonitoring was not set
-  #rec.doMonitoring = True
-
-
-##Implementing x277 requirements  PF 26/10/2014
-#rec.doJetMissingETTag=False  -> Not needed for this Jo since it properly set the Calo off
-rec.doTau=False
-from TrigHLTMonitoring.HLTMonFlags import HLTMonFlags
-HLTMonFlags.doBphys=False
-from AthenaMonitoring import DQMonFlags
-DQMonFlags.doJetMon=False
-DQMonFlags.doMissingEtMon=False
-DQMonFlags.enableLumiAccess=False
-DQMonFlags.doStreamAwareMon=False
-from JetRec.JetRecFlags import jetFlags
-jetFlags.useTracks=False
-
-
-    
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-#InDetFlags.doTruth = False
-if globalflags.InputFormat() == 'pool' and not globalflags.DataSource == 'geant4':
-  # ---- run over ESD files
-  #  InDetFlags.preProcessing=True
-  #This is not originally defined in the Cosmics jobOption, but i add it here
-  InDetFlags.doPRDFormation = False
-else:
-  InDetFlags.doPRDFormation = True
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False 
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-if not loadInDetRec_Options["Cosmics"]:
-  InDetFlags.doxKalman              = False
-  InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#if not Cosmics:
-#InDetFlags.doTrackSegmentsPixel = True
-#InDetFlags.doTrackSegmentsSCT   = True
-#InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-#InDetFlags.doMonitoringAlignment = loadInDetRec_Options["doMonitoring"]
-InDetFlags.doMonitoringAlignment = False
-#InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True)
-
-if loadInDetRec_Options["Cosmics"]:
-  InDetFlags.doCosmics.set_Value_and_Lock(True)
-  #InDetFlags.doMonitoringAlignment = loadInDetRec_Options["doMonitoring"]
-  #InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True)
-  
-#CTBTracking not anymore in release 19
- 
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doTrkNtuple.set_Value_and_Lock( False )
-InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doTrtTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = False
-
-#Commissioning Flags
-InDetFlags.useBroadClusterErrors = False
-InDetFlags.doTrackSegmentsPixel = False 
-InDetFlags.doTrackSegmentsSCT   = False 
-InDetFlags.doTrackSegmentsTRT   = False
-
-#if (hasattr(InDetFlags,"doPixelClusterSplitting")) :
-#  InDetFlags.doPixelClusterSplitting=False
-#conddb.addOverride("/PIXEL/PixelClustering/PixelClusNNCalib","PixClusNNCalib-IBL3D25-00-00-02")
-InDetFlags.doPixelClusterSplitting.set_Value_and_Lock(False);
-InDetFlags.doPixelClusterNtuple = False
-
-
-
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-TrkDetFlags.MaterialDatabaseLocal =False
-
-
-
-# no clue about that one at moment!!!
-import MagFieldServices.SetupField
-
-#another hack!!
-#from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool
-#pixelTool           = PixelDetectorTool()
-#pixelTool.Alignable = True
-
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-print 'before Rec all'
- 
-include("InDetRecExample/InDetRec_all.py")
- 
-print 'after Rec all'
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py
deleted file mode 100644
index 7aecc8e52e8451bcd363b819ee1a8026f719efdd..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py
+++ /dev/null
@@ -1,361 +0,0 @@
-# The Following options can be specified seperately in a file that include this one
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"doReadBS":True
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":True
-                        ,"doMonitoring":True
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"trtAlignmentTagL3":""
-                        ,"lorentzAngleTag":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"TRTCalibTextFile":""
-                        ,"TRTCalibT0TagCos":""
-                        ,"TRTCalibRtTagCos":""
-                        ,"numberOfEvents":30
-                        ,"useTRT": True
-                        ,"GoodRunList":""
-                        # 7 TeV Simulation Data
-                        ,"inputFiles":["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_7TeV.105200.T1_McAtNlo_Jimmy.digit.RDO.e510_s624_s633_d287_tid112426_00/RDO.112426._000007.pool.root.1"]
-                        # Real ESD Cosmics
-                        #,"inputFiles":["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/data10_cos.00151040.physics_IDCosmic.recon.ESD.f220/data10_cos.00151040.physics_IDCosmic.recon.ESD.f220._lb0002._0001.1"]
-                        }
-#!! Just a test
-#from IOVDbSvc.CondDB import conddb
-#conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterial','AtlasLayerMat_v15_ATLAS-IBL3D25-04-00-01')
-
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_Options:
-  if var in dir():
-    loadInDetRec_Options[var] = eval(var)
-
-if len(loadInDetRec_Options["globalTag"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
-
-if len(loadInDetRec_Options["detectorDescription"])!=0:
-	from AthenaCommon.GlobalFlags import globalflags
-	globalflags.DetDescrVersion.set_Value_and_Lock(loadInDetRec_Options["detectorDescription"])
-
-
-# OUT
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc.IgnoreTagDifference=True
-
-
-
-# Good run list
-if loadInDetRec_Options["GoodRunList"] != "":
-  from GoodRunsLists.GoodRunsListsConf import *
-  GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_Options["CollisionGRL"] ]
-  GoodRunsTool.EventSelectorMode = True
-  GoodRunsTool.OutputLevel = DEBUG
-  print GoodRunsTool
-
-  AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
-  AthenaEventLoopMgr.PreSelectTools+=[GoodRunsTool]
-  AthenaEventLoopMgr.OutputLevel = DEBUG
-  print AthenaEventLoopMgr
-
-
-
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_Options["doReadBS"]
-#if not doReadBS:
-#	PoolSvc=Service("PoolSvc")
-#	ServiceMgr += PoolSvc()
-#	ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-
-if "IDCosmic" in loadInDetRec_Options["inputFiles"][0]:
-	print "Switched manually to cosmics"
-	from AthenaCommon.BeamFlags import jobproperties
-	jobproperties.Beam.beamType.set_Value_and_Lock('cosmics')
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-
-athenaCommonFlags.FilesInput = loadInDetRec_Options["inputFiles"]
-
-
-import AthenaPython.ConfigLib as apcl
-cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig',
-                   input_files = athenaCommonFlags.FilesInput())
-cfg.configure_job()
-   
-
-theApp.EvtMax = loadInDetRec_Options["numberOfEvents"]
-
-
-if doReadBS:
-	from AthenaCommon.GlobalFlags import globalflags
-	if len(globalflags.ConditionsTag())!=0:
-		from IOVDbSvc.CondDB import conddb
-		conddb.setGlobalTag(globalflags.ConditionsTag())  
-from AthenaCommon.BeamFlags import jobproperties
-if jobproperties.Beam.beamType == 'cosmics':
-	Cosmics = True
-else:
-	Cosmics = False
-
-#--------------------------------------------------------------
-# Control
-#--------------------------------------------------------------
-
-# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-OutputLevel     = INFO
-# --- produce an atlantis data file
-doJiveXML       = False
-# --- run the Virtual Point 1 event visualisation
-doVP1           = False
-# --- controls what is written out. ESD includes AOD, so it's normally enough
-doWriteESD      = False
-doWriteAOD      = False
-# --- do auditors ?
-doAuditors      = True
-
-
-import os
-if os.environ['CMTCONFIG'].endswith('-dbg'):
-  # --- do EDM monitor (debug mode only)
-  doEdmMonitor    = True 
-  # --- write out a short message upon entering or leaving each algorithm
-  doNameAuditor   = True
-else:
-  doEdmMonitor    = False
-  doNameAuditor   = False
-
-
-
-from RecExConfig.RecFlags import rec
-if Cosmics:
-    rec.Commissioning = True
-    rec.doMonitoring = True
-else:
-    rec.Commissioning = False
-
- 
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-#DetFlags.makeRIO.pixel_setOff()
-DetFlags.makeRIO.SCT_setOff()
-DetFlags.makeRIO.TRT_setOff()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# ---- switch parts of ID off/on as follows (always use both lines)
-#DetFlags.pixel_setOff()
-#DetFlags.detdescr.pixel_setOn()
-DetFlags.SCT_setOff()
-DetFlags.detdescr.SCT_setOn()
-#if not loadInDetRec_Options["useTRT"]:
-DetFlags.TRT_setOff()
-DetFlags.detdescr.TRT_setOn()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-DetFlags.dcs.SCT_setOff()
-DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-# --- output level
-OutputLevel          = DEBUG
-
-  
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-# --- setup InDetJobProperties
-from AthenaCommon.GlobalFlags import globalflags
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-#InDetFlags.doTruth = False
-#if globalflags.InputFormat() == 'pool' and not globalflags.DataSource == 'geant4':
-  # ---- run over ESD files
-InDetFlags.preProcessing=True
-InDetFlags.doPRDFormation = True
-#else:
-#  InDetFlags.doPRDFormation = True
-
-# --- uncomment to change the default of one of the following options:
-InDetFlags.doNewTracking          = True
-#InDetFlags.doLowPt                = True
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-#if not Cosmics:
-InDetFlags.doxKalman              = False
-InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-#InDetFlags.doLowBetaFinder        = False
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#if not Cosmics:
-#    InDetFlags.doTrackSegmentsPixel = True
-#    InDetFlags.doTrackSegmentsSCT   = True
- #   InDetFlags.doTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-# --- activate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-#InDetFlags.doMonitoringAlignment.set_Value_and_Lock(True)
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon        = True
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-# --- active storegate delection
-#InDetFlags.doSGDeletion  = True
-
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrkNtuple.set_Value_and_Lock( False )
-#InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrtTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-# CHECK HERE.....
-#if InDetFlags.doLowPt() or InDetFlags.doVeryLowPt():
-#  InDetTrackFitter=InDetTrackFitterLowPt
-
-# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
-# This way RecExCommon just needs to import the properties without doing anything else!
-# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-
-InDetFlags.doPixelClusterSplitting=False
-#if (hasattr(InDetFlags,"doPixelClusterSplitting")) :
-InDetFlags.doPixelClusterSplitting.set_Value_and_Lock( False )
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-TrkDetFlags.MaterialDatabaseLocal =False
-
-include("InDetRecExample/InDetRec_all.py")
-
-#InDetFlags.doPixelClusterNtuple = False
-
-# My change
-#--------------------------------------------------------------
-# configure IBL reco
-#--------------------------------------------------------------
-print 'MATTHIAS testing' 
-include("InDetIBL_Example/InDetIBLRecoPreInclude.py")
-
-#--------------------------------------------------------------
-# load master joboptions file
-#--------------------------------------------------------------
-print 'MATTHIAS testing 2' 
-include("InDetRecExample/InDetRec_all.py")
-
- 
-#--------------------------------------------------------------
-# configure IBL reco
-#--------------------------------------------------------------
-print 'MATTHIAS testing 3'
-include("InDetIBL_Example/InDetIBLRecoPostInclude.py")
-
-
-
-#if (hasattr(InDetFlags,"doPixelClusterSplitting")) :
- # InDetFlags.doPixelClusterSplitting.set_Value_and_Lock( False )
-
-#include("InDetIBL_Example/jobOptions_tracking_IBL_trf.py")
-
-
-print 'MATTHIAS testing 4'
-
-if loadInDetRec_Options["siPoolFile"]:
-    include ("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
-    from IOVDbSvc.CondDB import conddb
-    # block folders that you want to override
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-    print 'Loading initial alignment File'
-    ServiceMgr.CondProxyProvider.InputCollections = [ loadInDetRec_Options["siPoolFile"] ]
-    ServiceMgr.CondProxyProvider.OutputLevel=INFO
-    print ServiceMgr.CondProxyProvider
-    IOVSvc = Service("IOVSvc")
-    IOVSvc.preLoadData = True
-
-else:
-    if loadInDetRec_Options["siAlignmentTag"]:
-        conddb.addOverride('/Indet/Align',loadInDetRec_Options["siAlignmentTag"])
-    if loadInDetRec_Options["trtAlignmentTag"]:
-        conddb.addOverride('/TRT/Align',loadInDetRec_Options["trtAlignmentTag"])
-    if loadInDetRec_Options["trtAlignmentTagL3"]:
-        conddb.addOverride('/TRT/Calib/DX',loadInDetRec_Options["trtAlignmentTagL3"])
-
-
-if loadInDetRec_Options["errorScalingTag"]:
-    if ".db" in loadInDetRec_Options["errorScalingTag"]:
-        conddb.blockFolder("/Indet/TrkErrorScaling")
-        conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_nominal</tag>", force=True)
-    else:
-        conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_Options["errorScalingTag"])
-  
-if loadInDetRec_Options["beamSpotTag"] and not Cosmics:
-    conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-
-if loadInDetRec_Options["lorentzAngleTag"]:
-    conddb.addOverride('/PIXEL/LorentzAngleScale',loadInDetRec_Options["lorentzAngleTag"])
-  
-from AthenaCommon.AppMgr import ToolSvc
-from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackErrorScalingTool
-InDetRotErrorScalingTool = Trk__RIO_OnTrackErrorScalingTool( name        = 'RIO_OnTrackErrorScalingTool',
-                                                             OutputLevel = INFO )
-ToolSvc += InDetRotErrorScalingTool
-#print InDetRotErrorScalingTool
-
-  
-# Correct TRT calibration for cosmics
-if loadInDetRec_Options["TRTCalibTextFile"] and Cosmics:
-  from AthenaCommon.AppMgr import ToolSvc
-  from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
-  TRTCalibDBSvc=TRT_CalDbSvc()
-  ServiceMgr+=TRTCalibDBSvc
-  
-  conddb.blockFolder("/TRT/Calib/RT" )
-  conddb.blockFolder("/TRT/Calib/T0" )
-  TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-
-if loadInDetRec_Options["TRTCalibT0TagCos"]:
-  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_Options["TRTCalibT0TagCos"])
-if loadInDetRec_Options["TRTCalibRtTagCos"]:
-  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_Options["TRTCalibRtTagCos"])
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/mycool_cscasbuilt_00.db b/InnerDetector/InDetExample/InDetAlignExample/share/mycool_cscasbuilt_00.db
deleted file mode 100644
index 5deced8611e7468e129284060e08ef72dd71b35a..0000000000000000000000000000000000000000
Binary files a/InnerDetector/InDetExample/InDetAlignExample/share/mycool_cscasbuilt_00.db and /dev/null differ
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/newlinks.sh b/InnerDetector/InDetExample/InDetAlignExample/share/newlinks.sh
deleted file mode 100755
index 0c8592bbf8df4993ccbc0c9c8d49848d16604d0c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/newlinks.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-echo "Creating required links for InDetAlignExample"
-
-ln -s /afs/cern.ch/atlas/project/database/DBREL/packaging/DBRelease/current/geomDB .
-# ln -s /afs/cern.ch/user/a/atlcond/coolrep/sqlite200 .
-cp ../share/mycool_cscasbuilt_00.db .
-
-ln -s ../scripts/InDetCAF_Flags.py
-ln -s ../scripts/InDetAlignExample_SuperScript.py
-ln -s ../scripts/InDetAlignExample_IteratorForSi.py
-ln -s ../scripts/beamspotExample.py
-ln -s ../scripts/runBeamspotOnESD
-ln -s ../scripts/InDetAlignExample_RunCog.py
-ln -s ../scripts/RunTRTAlignment.py
-
-ln -s ../share/InDetAlignBeamspotAOD.py
-ln -s ../share/InDetAlignBeamspotFinder.py 
-ln -s ../share/InDetAlignCog.py
-ln -s ../share/InDetAlignExample_topOptions.py jobOptions.py
-ln -s ../share/InDetAlignExample_Cosmic_topOptions.py jobOptions_Cosmic.py
-ln -s ../share/InDetAlignBeamspotESDtoAOD.py
-ln -s ../share/InDetAlignBeamspotVertexFinder.py
-ln -s ../share/InDetAlignExample_Halo_topOptions.py jobOptions_Halo.py
-ln -s ../share/InDetAlignExample_Gas_topOptions.py jobOptions_Gas.py
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/pool2DB.py b/InnerDetector/InDetExample/InDetAlignExample/share/pool2DB.py
deleted file mode 100644
index 461fc746b588c915198d2c24b1500856bc0d8426..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/pool2DB.py
+++ /dev/null
@@ -1,88 +0,0 @@
-###############################################################
-# This is the same as PoolToDB.py script from Grant
-# I have just modifed the initial names
-#
-# maybe in a future release I can fetch directly this file and
-# replace the names in a script
-#
-# A. Bocci
-#
-###############################################################
-#
-# Job options file to read input POOL file using CondProxyProvider
-# a new pool file and sqlite file
-#
-#==============================================================
-
-inputCollections = ["alignmentoutput.root"]
-outputFile = "indetalignment.root"
-objectList = [ "AlignableTransformContainer#/Indet/Align",
-               "AlignableTransformContainer#/TRT/Align"]
-tagList = ["IndetAlign_fdr2",
-           "TRTAlign_fdr2"]
-
-#==============================================================
-
-from AthenaCommon.GlobalFlags import GlobalFlags
-
-#GlobalFlags.DetGeo.set_ctbh8()
-GlobalFlags.DetGeo.set_atlas()
-#GlobalFlags.DetGeo.set_commis()
-
-GlobalFlags.DataSource.set_geant4()
-#GlobalFlags.DataSource.set_data()
-
-# If you need the geometry
-#from AthenaCommon.DetFlags import DetFlags
-#DetFlags.detdescr.ID_setOn()
-#from AtlasGeoModel import GeoModelInit
-#from AtlasGeoModel import SetGeometryVersion
-#from AthenaCommon.GlobalFlags import globalflags
-#globalflags.DetDescrVersion = 'ATLAS-CSC-02-00-00'
-
-
-from IOVDbSvc.CondDB import conddb
-
-from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-from AthenaCommon.AppMgr import ServiceMgr
-ServiceMgr += CondProxyProvider()
-ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-# set this to the file containing AlignableTransform objects
-ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-print ServiceMgr.CondProxyProvider
-
-# this preload causes callbacks for read in objects to be activated,
-# allowing GeoModel to pick up the transforms
-ServiceMgr.IOVSvc.preLoadData=True
-ServiceMgr.IOVSvc.OutputLevel=DEBUG
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-OutputConditionsAlg=OutputConditionsAlg(outputFile=outputFile,
-                                        ObjectList=objectList,
-                                        IOVTagList=tagList)
-#OutputConditionsAlg.Run1=3
-#OutputConditionsAlg.Event1=4
-#OutputConditionsAlg.Run2=9999
-#OutputConditionsAlg.Event2=999999
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-#--------------------------------------------------------------
-# To set global output level use
-# athena -l DEBUG
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-# Number of events to be processed (default is 10)
-theApp.EvtMax = 1
-
-#==============================================================
-#
-# End of job options file
-#
-###############################################################
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/poolToDB.py b/InnerDetector/InDetExample/InDetAlignExample/share/poolToDB.py
deleted file mode 100644
index a8c690dfb35fcc9d485c39b8612de97ce85bd178..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/poolToDB.py
+++ /dev/null
@@ -1,79 +0,0 @@
-###############################################################
-#
-# Job options file to read input POOL file using CondProxyProvider
-# and output a new pool file and sqlite file
-#
-#==============================================================
-
-inputCollections = ["alignment_in.root"]
-outputFile = "indetalignment_cscalign_test.root"
-objectList = [ "AlignableTransformContainer#/Indet/Align",
-               "AlignableTransformContainer#/TRT/Align"]
-tagList = ["IndetAlign_cscalign_test",
-           "TRTAlign_cscalign_test"]
-
-#==============================================================
-
-from AthenaCommon.GlobalFlags import GlobalFlags
-
-#GlobalFlags.DetGeo.set_ctbh8()
-GlobalFlags.DetGeo.set_atlas()
-#GlobalFlags.DetGeo.set_commis()
-
-GlobalFlags.DataSource.set_geant4()
-#GlobalFlags.DataSource.set_data()
-
-# If you need the geometry
-#from AthenaCommon.DetFlags import DetFlags
-#DetFlags.detdescr.ID_setOn()
-#from AtlasGeoModel import GeoModelInit
-#from AtlasGeoModel import SetGeometryVersion
-#from AthenaCommon.GlobalFlags import globalflags
-#globalflags.DetDescrVersion = 'ATLAS-CSC-02-00-00'
-
-
-from IOVDbSvc.CondDB import conddb
-
-from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-from AthenaCommon.AppMgr import ServiceMgr
-ServiceMgr += CondProxyProvider()
-ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-# set this to the file containing AlignableTransform objects
-ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-print ServiceMgr.CondProxyProvider
-
-# this preload causes callbacks for read in objects to be activated,
-# allowing GeoModel to pick up the transforms
-ServiceMgr.IOVSvc.preLoadData=True
-ServiceMgr.IOVSvc.OutputLevel=DEBUG
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-OutputConditionsAlg=OutputConditionsAlg(outputFile=outputFile,
-                                        ObjectList=objectList,
-                                        IOVTagList=tagList)
-#OutputConditionsAlg.Run1=3
-#OutputConditionsAlg.Event1=4
-#OutputConditionsAlg.Run2=9999
-#OutputConditionsAlg.Event2=999999
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-#--------------------------------------------------------------
-# To set global output level use
-# athena -l DEBUG
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-# Number of events to be processed (default is 10)
-theApp.EvtMax = 1
-
-#==============================================================
-#
-# End of job options file
-#
-###############################################################
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxt.py b/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxt.py
deleted file mode 100644
index fcffce34feea55e918b497090b11ee930c5f4ec6..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxt.py
+++ /dev/null
@@ -1,255 +0,0 @@
-###############################################################
-#
-# Job options file to convert between text file and POOL file.
-#
-# For common use cases set the variable config to one of the following.
-#   'TxtToPool'
-#   'PoolToTxt'
-#   'PoolToPool'
-#   'DBToTxt'
-#   'DBToPool'
-#
-# Note that the options which write out a pool file also write an sqlite file.
-#
-# You can also leave config unset and set the following
-#
-# readTextFile : If True will read alignments from a text file (textFileInSi/TRT)
-#                If False alignments will be those read from the conditions
-#                database (or a pool file if readPool is True) 
-# writeTextFile: If True will write alignments to a text file (textFileOutSi/TRT)
-# readPool:      If True will read alignments from pool file specified in
-#                inputCollections. NB, readTextFile should be set to False.             
-# writeDB:       If True will write sqlite file and pool file. The name
-#                of the pool file is given by outputFile.
-#
-# Default settings are the same as PoolToTxt.
-#
-#==============================================================
-
-#config = 'TxtToPool'
-config = 'PoolToTxt'
-#config = 'PoolToPool'
-#config = 'DBToTxt'
-#config = 'DBToPool'
-
-inputCollections = ["testInputFile/alignment_out_RandomStrawMisalignments.root"]
-outputFile = "alignment_out.root"
-tagSi  = "IndetAlign_test"
-tagTRT = "TRTAlign_test"
-
-textFileInSi  = "alignmentSi_in.txt"
-textFileOutSi = "alignmentSi_out.txt"
-textFileInTRT  = "NoTRTModuleAlignment.txt"
-textFileInTRTStraw  = "CreatedStrawAlignments2.txt"
-textFileOutTRT = "alignmentTRT_out.txt"
-textFileOutTRTStraw = "alignmentTRTStraw_out.txt"
-
-doSilicon = False
-doTRT = True
-
-doPrintDectectorPositions = True
-
-#==============================================================
-
-# These will be overwritten if config is set
-readTextFile = False
-writeTextFile = True
-readPool  = True
-writeDB   = False
-
-# To extract constants from the database select the appropriate database tag.
-from AthenaCommon.GlobalFlags import globalflags
-globalflags.DataSource='geant4'
-#globalflags.DataSource='data'
-
-from IOVDbSvc.CondDB import conddb
-#conddb.setGlobalTag("OFLCOND-CSC-00-00-00")
-conddb.setGlobalTag("OFLCOND-SIM-BS7T-00")
-#conddb.setGlobalTag("COMCOND-HLTC-000-00")
-#conddb.addOverride('/Indet/Align','InDetSi_CSCMisaligned_RDeltaPhi_03')
-#conddb.addOverride('/TRT/Align','InDetTRT_CSCMisaligned_RDeltaPhi_03')
-
-# To override the run number set this variable. Only has an affect for
-# DBToTxt and DBToPool options.
-#runNumber = 12345
-
-#==============================================================
-
-# You shouldn't need to change anything below here.
-
-if ('config' not in dir()):
-    config = ''
-if (config == 'PoolToTxt') :
-    readTextFile = False
-    writeTextFile = True
-    readPool  = True
-    writeDB   = False
-if (config == 'TxtToPool') :
-    readTextFile = True
-    writeTextFile = False
-    readPool  = False
-    writeDB   = True
-if (config == 'PoolToPool') :
-    readTextFile = False
-    writeTextFile = False
-    readPool  = True
-    writeDB   = True
-if (config == 'DBToTxt') :
-    readTextFile = False
-    writeTextFile = True
-    readPool  = False
-    writeDB   = False
-if (config == 'DBToPool') :
-    readTextFile = False
-    writeTextFile = False
-    readPool  = False
-    writeDB   = True
-
-
-# Setup geometry
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-# The geometry version does not really matter. Any will do.
-globalflags.DetDescrVersion = 'ATLAS-GEO-03-00-00'
-
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-
-from IOVDbSvc.CondDB import conddb
-
-# Its normally OK to read in some database so this can be left True.
-# In case you want to force it not to read in anything you can set this to False.
-readDB = True
-if not readDB :
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-
-if readPool :
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-    # set this to the file containing AlignableTransform objects
-    ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-    ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-    print ServiceMgr.CondProxyProvider
-
-    # this preload causes callbacks for read in objects to be activated,
-    # allowing GeoModel to pick up the transforms
-    ServiceMgr.IOVSvc.preLoadData=True
-    ServiceMgr.IOVSvc.OutputLevel=DEBUG
-
-# Options for IOVRegistrationSvc
-# Select the following to delete and recreate the folders. Default is
-# NOT to recreate
-#import RegistrationServices.IOVRegistrationSvc
-#regSvc = svcMgr.IOVRegistrationSvc
-#regSvc.RecreateFolders = True
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-from AthenaCommon.AppMgr import ToolSvc
-
-if doSilicon:
-    from InDetAlignGenAlgs.InDetAlignGenAlgsConf import InDetAlignWrt
-    from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignDBTool
-
-    InDetDBTool = InDetAlignDBTool()
-    ToolSvc += InDetDBTool
-
-    InDetAlignWrt = InDetAlignWrt()
-
-    if readDB or readPool :
-        InDetAlignWrt.Create=False
-    else :
-        InDetAlignWrt.Create=True
-    
-    # We use OutputConditionsAlg to write pool file and register IOV so set to False.
-    InDetAlignWrt.Write=False 
-    InDetAlignWrt.WriteIOV=False
-    if writeTextFile :
-        InDetAlignWrt.Write=True
-        InDetAlignWrt.WFile=textFileOutSi
-    if readTextFile :
-        InDetAlignWrt.RFile=textFileInSi
-    # .DispDet=0: none, otherwise creates some random misalignments
-    InDetAlignWrt.DispDet=0
-
-    topSequence += InDetAlignWrt
-
-    print InDetAlignWrt
-    print InDetDBTool
-
-if doTRT:
-    from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTStrawAlign
-    TRTStrawAlign = TRTStrawAlign()
-    # We use OutputConditionsAlg to write pool file and register IOV so set to False.
-    TRTStrawAlign.Write=False
-    TRTStrawAlign.RegisterIOV=False
-    TRTStrawAlign.DoModuleAlign=True
-    TRTStrawAlign.DoStrawAlign=True
-    #if writeTextFile :
-    TRTStrawAlign.TextOutputFile=textFileOutTRT
-    TRTStrawAlign.StrawAlignmentTextOutputFile = textFileOutTRTStraw
-
-    if readTextFile :
-        TRTStrawAlign.InputFile=textFileInTRT
-        TRTStrawAlign.InputStrawAlignmentFile = textFileInTRTStraw
-    topSequence+=TRTStrawAlign
-    print TRTStrawAlign
-
-if writeDB:
-    objectList = []
-    tagList = []
-    if doSilicon:
-        objectList += [ "AlignableTransformContainer#/Indet/Align"]
-        tagList += [tagSi]
-    if doTRT:
-        objectList += [ "AlignableTransformContainer#/TRT/Align"]
-        objectList += [ "TRTCond::StrawDxContainer#/TRT/Calib/DX"]
-        tagList += [tagTRT]
-                            
-    ## These lines can be excluded and it will by default connect to SQlite file mycool.db    
-    ## If you want a different sqlite db file name or db name edit as appropriate
-    #from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    #svcMgr.IOVDbSvc.dbConnection="sqlite://;schema=mycool.db;dbname=OFLP200"
-
-    from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-    myOCA=OutputConditionsAlg(outputFile=outputFile)
-    myOCA.ObjectList=objectList
-    myOCA.IOVTagList=tagList
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-#--------------------------------------------------------------
-# To set global output level use
-# athena -l DEBUG
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-# Specify run number
-if ('runNumber' in dir()):
-    import AthenaCommon.AtlasUnixGeneratorJob
-    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    svcMgr.EventSelector.RunNumber         = runNumber
-    #svcMgr.EventSelector.FirstEvent        = 0
-    #svcMgr.EventSelector.FirstLB           = 0
-
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax = 1
-
-if doPrintDectectorPositions:
-    include("InDetSimpleVisual/GetDetectorPositions.py")
-    job.GetDetectorPositions.DetailLevel = 2
-
-#==============================================================
-#
-# End of job options file
-#
-###############################################################
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxtTRT.py b/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxtTRT.py
deleted file mode 100644
index fd49bd42f2324295a4dc4a47c0f2c58a6bc5b124..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxtTRT.py
+++ /dev/null
@@ -1,257 +0,0 @@
-###############################################################
-#
-# Job options file to convert between text file and POOL file.
-#
-# For common use cases set the variable config to one of the following.
-#   'TxtToPool'
-#   'PoolToTxt'
-#   'PoolToPool'
-#   'DBToTxt'
-#   'DBToPool'
-#
-# Note that the options which write out a pool file also write an sqlite file.
-#
-# You can also leave config unset and set the following
-#
-# readTextFile : If True will read alignments from a text file (textFileInSi/TRT)
-#                If False alignments will be those read from the conditions
-#                database (or a pool file if readPool is True) 
-# writeTextFile: If True will write alignments to a text file (textFileOutSi/TRT)
-# readPool:      If True will read alignments from pool file specified in
-#                inputCollections. NB, readTextFile should be set to False.             
-# writeDB:       If True will write sqlite file and pool file. The name
-#                of the pool file is given by outputFile.
-#
-# Default settings are the same as PoolToTxt.
-#
-#==============================================================
-
-#config = 'TxtToPool'
-#config = 'PoolToTxt'
-#config = 'PoolToPool'
-#config = 'DBToTxt'
-#config = 'DBToPool'
-
-inputCollections = ["alignment_in.root"]
-outputFile = "alignment_out.root"
-tagSi  = "IndetAlign_test"
-tagTRT = "TRTAlign_test"
-
-textFileInSi  = "alignmentSi_in.txt"
-textFileOutSi = "alignmentSi_out.txt"
-#textFileInTRT  = "alignmentinput.txt"
-#textFileInTRT  = "/afs/cern.ch/user/a/atlidali/w1/users/johnda/TRT_Cosmic_2008_11.txt"
-textFileInTRT  = "/afs/cern.ch/user/a/atlidali/w1/users/johnda/TRT_Cosmic_2008_11_WithECL2.txt"
-
-#textFileInTRT  = "Noalignmentinput.txt"
-textFileOutTRT = "alignmentTRT_out.txt"
-
-doSilicon = False
-doTRT = True
-
-#==============================================================
-
-# These will be overwritten if config is set
-readTextFile = True
-writeTextFile = True
-readPool  = False
-writeDB   = False
-
-# To extract constants from the database select the appropriate database tag.
-from AthenaCommon.GlobalFlags import globalflags
-globalflags.DataSource='geant4'
-#globalflags.DataSource='data'
-
-from IOVDbSvc.CondDB import conddb
-conddb.setGlobalTag("OFLCOND-CSC-01-00-00")
-#conddb.setGlobalTag("OFLCOND-CSC-00-02-00")
-#conddb.setGlobalTag("COMCOND-HLTC-000-00")
-
-# For the endcap tests
-conddb.blockFolder("/TRT/Align")
-
-# To override the run number set this variable. Only has an affect for
-# DBToTxt and DBToPool options.
-#runNumber = 12345
-
-#==============================================================
-
-# You shouldn't need to change anything below here.
-
-if ('config' not in dir()):
-    config = ''
-if (config == 'PoolToTxt') :
-    readTextFile = False
-    writeTextFile = True
-    readPool  = True
-    writeDB   = False
-if (config == 'TxtToPool') :
-    readTextFile = True
-    writeTextFile = False
-    readPool  = False
-    writeDB   = True
-if (config == 'PoolToPool') :
-    readTextFile = False
-    writeTextFile = False
-    readPool  = True
-    writeDB   = True
-if (config == 'DBToTxt') :
-    readTextFile = False
-    writeTextFile = True
-    readPool  = False
-    writeDB   = False
-if (config == 'DBToPool') :
-    readTextFile = False
-    writeTextFile = False
-    readPool  = False
-    writeDB   = True
-
-
-# Setup geometry
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-# The geometry version does not really matter. Any will do.
-globalflags.DetDescrVersion = 'ATLAS-GEO-03-00-00'
-
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-
-from IOVDbSvc.CondDB import conddb
-
-# Its normally OK to read in some database so this can be left True.
-# In case you want to force it not to read in anything you can set this to False.
-readDB = True
-if not readDB :
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-
-if readPool :
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-    # set this to the file containing AlignableTransform objects
-    ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-    ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-    print ServiceMgr.CondProxyProvider
-
-    # this preload causes callbacks for read in objects to be activated,
-    # allowing GeoModel to pick up the transforms
-    ServiceMgr.IOVSvc.preLoadData=True
-    ServiceMgr.IOVSvc.OutputLevel=DEBUG
-
-# Options for IOVRegistrationSvc
-# Select the following to delete and recreate the folders. Default is
-# NOT to recreate
-#import RegistrationServices.IOVRegistrationSvc
-#regSvc = svcMgr.IOVRegistrationSvc
-#regSvc.RecreateFolders = True
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-from AthenaCommon.AppMgr import ToolSvc
-
-if doSilicon:
-    from InDetAlignGenAlgs.InDetAlignGenAlgsConf import InDetAlignWrt
-    from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignDBTool
-
-    InDetDBTool = InDetAlignDBTool()
-    ToolSvc += InDetDBTool
-
-    InDetAlignWrt = InDetAlignWrt()
-
-    if readDB or readPool :
-        InDetAlignWrt.Create=False
-    else :
-        InDetAlignWrt.Create=True
-    
-    # We use OutputConditionsAlg to write pool file and register IOV so set to False.
-    InDetAlignWrt.Write=False 
-    InDetAlignWrt.WriteIOV=False
-    if writeTextFile :
-        InDetAlignWrt.Write=True
-        InDetAlignWrt.WFile=textFileOutSi
-    if readTextFile :
-        InDetAlignWrt.RFile=textFileInSi
-    # .DispDet=0: none, otherwise creates some random misalignments
-    InDetAlignWrt.DispDet=0
-
-    topSequence += InDetAlignWrt
-
-    print InDetAlignWrt
-    print InDetDBTool
-
-if doTRT:
-    from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_AlignDbSvc
-    thisTRTAlignDbTool = TRT_AlignDbSvc()
-    thisTRTAlignDbTool.OutputLevel = VERBOSE
-    thisTRTAlignDbTool.alignTextFile = "initialAlignment.txt"
-    ServiceMgr+=thisTRTAlignDbTool
-    
-    from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTStrawAlign
-    TRTStrawAlign = TRTStrawAlign()
-    TRTStrawAlign.OutputLevel = INFO
-    # We use OutputConditionsAlg to write pool file and register IOV so set to False.
-    TRTStrawAlign.Write=False
-    TRTStrawAlign.RegisterIOV=False
-    TRTStrawAlign.DoModuleAlign=True
-    TRTStrawAlign.DoStrawAlign=False
-    TRTStrawAlign.AlignDbTool = thisTRTAlignDbTool
-    if writeTextFile :
-        TRTStrawAlign.TextOutputFile=textFileOutTRT
-    if readTextFile :
-        TRTStrawAlign.InputFile=textFileInTRT
-    topSequence+=TRTStrawAlign
-    print TRTStrawAlign
-
-if writeDB:
-    objectList = []
-    tagList = []
-    if doSilicon:
-        objectList += [ "AlignableTransformContainer#/Indet/Align"]
-        tagList += [tagSi]
-    if doTRT:
-        objectList += [ "AlignableTransformContainer#/TRT/Align"]
-        tagList += [tagTRT]
-                            
-    ## These lines can be excluded and it will by default connect to SQlite file mycool.db    
-    ## If you want a different sqlite db file name or db name edit as appropriate
-    #from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    #svcMgr.IOVDbSvc.dbConnection="sqlite://;schema=mycool.db;dbname=OFLP200"
-
-    from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-    myOCA=OutputConditionsAlg(outputFile=outputFile)
-    myOCA.ObjectList=objectList
-    myOCA.IOVTagList=tagList
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-#--------------------------------------------------------------
-# To set global output level use
-# athena -l DEBUG
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-# Specify run number
-if ('runNumber' in dir()):
-    import AthenaCommon.AtlasUnixGeneratorJob
-    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    svcMgr.EventSelector.RunNumber         = runNumber
-    #svcMgr.EventSelector.FirstEvent        = 0
-    #svcMgr.EventSelector.FirstLB           = 0
-
-
-# Number of events to be processed (default is 10)
-include("TRT_AlignAlgs/PrintAlignmentPositions_jobOptions.py")
-theApp.EvtMax = 1
-
-#==============================================================
-#
-# End of job options file
-#
-###############################################################
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxt_Rel20.py b/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxt_Rel20.py
deleted file mode 100644
index 12289b3309af3f1e9ebbc1c5a4e5858c3faa2a90..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxt_Rel20.py
+++ /dev/null
@@ -1,309 +0,0 @@
-###############################################################
-#
-# Job options file to convert between text file and POOL file.
-#
-# For common use cases set the variable config to one of the following.
-#   'TxtToPool'
-#   'PoolToTxt'
-#   'PoolToPool'
-#   'DBToTxt'
-#   'DBToPool'
-#
-# Note that the options which write out a pool file also write an sqlite file.
-#
-# You can also leave config unset and set the following
-#
-# readTextFile : If True will read alignments from a text file (textFileInSi/TRT)
-#                If False alignments will be those read from the conditions
-#                database (or a pool file if readPool is True) 
-# writeTextFile: If True will write alignments to a text file (textFileOutSi/TRT)
-# readPool:      If True will read alignments from pool file specified in
-#                inputCollections. NB, readTextFile should be set to False.             
-# writeDB:       If True will write sqlite file and pool file. The name
-#                of the pool file is given by outputFile.
-#
-# Default settings are the same as PoolToTxt.
-#
-#==============================================================
-
-#config = 'TxtToPool'
-#config = 'PoolToTxt'
-#config = 'PoolToPool'
-config = 'DBToTxt'
-#config = 'DBToPool'
-
-#-- input/output root files
-#inputCollections = ["InDetAlign_Output.root"]
-inputCollections = ["BLK_280614.root"]
-outputFile = "25ns_SiTag.pool.root"
-tagSi  = "InDetAlign_test"
-tagTRT = "TRTAlign_test"
-
-#-- text files (input and output)
-#textFileInSi  = "SiAlignmentM9_Withshift.txt"
-textFileInSi  = "OldSiAlignment.txt"
-textFileOutSi = "OuputSiAlignment_280614.txt"
-textFileInTRT  = "TRTAligned_L2.txt"
-textFileInTRTStraw  = "TRTAligned_L2_straw.txt"
-textFileOutTRT =      "OutputTRTAlignment.txt"              # not needed
-textFileOutTRTStraw = "OutputTRTAlignment_Straw_out.txt"    # not needed
-
-doSilicon = True
-doTRT = False
-
-doPrintDectectorPositions = False
-print " <poolToTxt> config mode = ", config
-print " <poolToTxt> doSilicon   = ", doSilicon
-print " <poolToTxt> doTRT       = ", doTRT
-
-if (doSilicon):
-    if (config == 'TxtToPool'):
-        if os.path.isfile(textFileInSi):
-            print " <poolToTxt> textFileInSi = ", textFileInSi, "   output = ",textFileOutSi
-        else:
-            print " <poolToTxt> ** ERROR ** input file:", textFileInSi, " does not exist "
-
-if (doTRT):
-    if os.path.isfile(textFileInTRT):
-        print " <poolToTxt> textFileInTRT = ", textFileInTRT, "   output = ",textFileOutTRT
-    else:
-        print " <poolToTxt> ** ERROR ** input file:", textFileInTRT, " does not exist "
-    
-    if os.path.isfile(textFileInTRT):
-        print " <poolToTxt> textFileInTRTStraw = ", textFileInTRTStraw, "   output = ",textFileOutTRTStraw
-    else:
-        print " <poolToTxt> ** ERROR ** input file:", textFileInTRTStraw, " does not exist "
-    
-#==============================================================
-
-# These will be overwritten if config is set
-readTextFile = True
-writeTextFile = False
-readPool  = False
-writeDB   = True
-
-# To extract constants from the database select the appropriate database tag.
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.DataSource='geant4'   #geant4 for MC
-globalflags.DataSource.set_Value_and_Lock('data')
-#from RecExConfig.RecFlags import rec
-#rec.projectName.set_Value_and_Lock('data15_cos')
-
-
-from IOVDbSvc.CondDB import conddb
-#conddb.setGlobalTag("OFLCOND-RUN12-SDR-28") # latest and greates
-conddb.setGlobalTag("CONDBR2-BLKPA-2015-14") # latest and greates
-
-# The geometry version does not really matter. Any will do.
-#globalflags.DetDescrVersion = 'ATLAS-R1-2012-02-00-00'  # latest and greatest
-#conddb.addOverride('/Indet/Align','InDetAlign-RUN2-25NS')
-#conddb.addOverride('/Indet/Align','InDetAlign_IOVDEP-02')
-#conddb.addOverride('/Indet/Align','InDetAlign_R2_IBLDistortion_p02C_4muPixY')
-#conddb.addOverride('/Indet/Align','InDetAlign_R2_Initial_fixed')
-#conddb.addOverride('/TRT/Align','TRTAlign-RUN2-BLK-UPD4-09')
-
-#From local .db
-#conddb.blockFolder('/Indet/Align')
-
-#BON
-#conddb.addFolderWithTag('','<dbConnection>sqlite://;schema=/afs/cern.ch/user/p/pbutti/spacework/20.1.4.1/InnerDetector/InDetExample/InDetAlignExample/share/M8_Constants_IOV.db;dbname=CONDBR2</dbConnection>/Indet/Align','InDetAlign_R2_M8_IBLzGeoShifted_IOV',True );
-
-#BOFF
-#conddb.addFolderWithTag('','<dbConnection>sqlite://;schema=/afs/cern.ch/user/p/pbutti/spacework/20.1.4.1/InnerDetector/InDetExample/InDetAlignExample/share/M8_BOFF_2T_AlignmentConstants_IBLzCorrected_ExtendedRuns.db;dbname=CONDBR2</dbConnection>/Indet/Align','InDetAlign_R2_M8_BOFF_ExtendedRuns',True );
-
-#COMBINED IOV M8_Constants_IOV.db 
-
-#conddb.addFolderWithTag('','<dbConnection>sqlite://;schema=/afs/cern.ch/user/p/pbutti/spacework/20.1.4.1/InnerDetector/InDetExample/InDetAlignExample/share/M8_Constants_IOV.db;dbname=CONDBR2</dbConnection>/Indet/Align','InDetAlign_R2_M8_IBLzGeoShifted_IOV',True );
-
-
-
-
-globalflags.DetDescrVersion = 'ATLAS-R2-2015-03-01-00'
-
-# To override the run number set this variable. Only has an affect for
-# DBToTxt and DBToPool options.
-runNumber = 280806
-
-
-
-#==============================================================
-
-# You shouldn't need to change anything below here.
-
-if ('config' not in dir()):
-    config = ''
-if (config == 'PoolToTxt') :
-    readTextFile = False
-    writeTextFile = True
-    readPool  = True
-    writeDB   = True
-if (config == 'TxtToPool') :
-    readTextFile = True
-    writeTextFile = False
-    readPool  = False
-    writeDB   = True
-if (config == 'PoolToPool') :
-    readTextFile = False
-    writeTextFile = False
-    readPool  = True
-    writeDB   = True
-if (config == 'DBToTxt') :
-    readTextFile = False
-    writeTextFile = True
-    readPool  = False
-    writeDB   = False
-if (config == 'DBToPool') :
-    readTextFile = False
-    writeTextFile = False
-    readPool  = False
-    writeDB   = True
-
-
-# Setup geometry
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-
-
-#from IOVDbSvc.CondDB import conddb
-
-# Its normally OK to read in some database so this can be left True.
-# In case you want to force it not to read in anything you can set this to False.
-readDB = True
-if not readDB :
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-#    conddb.blockFolder("/TRT/Calib/DX")
-
-if readPool :
-    conddb.blockFolder("/Indet/Align")
-    conddb.blockFolder("/TRT/Align")
-#    conddb.blockFolder("/TRT/Calib/DX")
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-    from AthenaCommon.AppMgr import ServiceMgr
-    ServiceMgr += CondProxyProvider()
-    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-    # set this to the file containing AlignableTransform objects
-    ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-    ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-    print ServiceMgr.CondProxyProvider
-
-    # this preload causes callbacks for read in objects to be activated,
-    # allowing GeoModel to pick up the transforms
-    ServiceMgr.IOVSvc.preLoadData=True
-    ServiceMgr.IOVSvc.OutputLevel=DEBUG
-
-# Options for IOVRegistrationSvc
-# Select the following to delete and recreate the folders. Default is
-# NOT to recreate
-#import RegistrationServices.IOVRegistrationSvc
-#regSvc = svcMgr.IOVRegistrationSvc
-#regSvc.RecreateFolders = True
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-from AthenaCommon.AppMgr import ToolSvc
-
-if doSilicon:
-    from InDetAlignGenAlgs.InDetAlignGenAlgsConf import InDetAlignWrt
-    from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignDBTool
-
-    InDetDBTool = InDetAlignDBTool()
-    ToolSvc += InDetDBTool
-
-    InDetAlignWrt = InDetAlignWrt()
-
-    if readDB or readPool :
-        InDetAlignWrt.Create=False
-    else :
-        InDetAlignWrt.Create=True
-    
-    # We use OutputConditionsAlg to write pool file and register IOV so set to False.
-    InDetAlignWrt.Write=False 
-    InDetAlignWrt.WriteIOV=False
-    if writeTextFile :
-        InDetAlignWrt.Write=True
-        InDetAlignWrt.WFile=textFileOutSi
-    if readTextFile :
-        InDetAlignWrt.RFile=textFileInSi
-    # .DispDet=0: none, otherwise creates some random misalignments
-    InDetAlignWrt.DispDet=0
-
-    topSequence += InDetAlignWrt
-
-    print InDetAlignWrt
-    print InDetDBTool
-
-if doTRT:
-    from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTStrawAlign
-    TRTStrawAlign = TRTStrawAlign()
-    # We use OutputConditionsAlg to write pool file and register IOV so set to False.
-    TRTStrawAlign.Write=False
-    TRTStrawAlign.RegisterIOV=False
-    TRTStrawAlign.DoModuleAlign=True
-    TRTStrawAlign.DoStrawAlign=True
-    #if writeTextFile :
-    TRTStrawAlign.TextOutputFile=textFileOutTRT
-    TRTStrawAlign.StrawAlignmentTextOutputFile = textFileOutTRTStraw
-
-    if readTextFile :
-        TRTStrawAlign.InputFile=textFileInTRT
-        #TRTStrawAlign.InputStrawAlignmentFile = textFileInTRTStraw
-    topSequence+=TRTStrawAlign
-    print TRTStrawAlign
-
-if writeDB:
-    objectList = []
-    tagList = []
-    if doSilicon:
-        objectList += [ "AlignableTransformContainer#/Indet/Align"]
-        tagList += [tagSi]
-    if doTRT:
-        objectList += [ "AlignableTransformContainer#/TRT/Align"]
- #       objectList += [ "TRTCond::StrawDxContainer#/TRT/Calib/DX"]
-        tagList += [tagTRT]
-                            
-    ## These lines can be excluded and it will by default connect to SQlite file mycool.db    
-    ## If you want a different sqlite db file name or db name edit as appropriate
-    #from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-    #svcMgr.IOVDbSvc.dbConnection="sqlite://;schema=mycool.db;dbname=OFLP200"
-
-    from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
-    myOCA=OutputConditionsAlg(outputFile=outputFile)
-    myOCA.ObjectList=objectList
-    myOCA.IOVTagList=tagList
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
-#--------------------------------------------------------------
-# To set global output level use
-#athena -l DEBUG
-
-#--------------------------------------------------------------
-# Event related parameters
-#--------------------------------------------------------------
-# Specify run number
-import AthenaCommon.AtlasUnixGeneratorJob
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-svcMgr.EventSelector.RunNumber         = runNumber
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax = 1
-
-if doPrintDectectorPositions:
-    include("InDetSimpleVisual/GetDetectorPositions.py")
-    job.GetDetectorPositions.DetailLevel = 2
-
-#==============================================================
-#
-# End of job options file
-#
-###############################################################
-
-
-# Disable StatusCodeSvc 
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr 
-svcMgr.StatusCodeSvc.SuppressCheck = True
-svcMgr.StatusCodeSvc.AbortOnError = False
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/prepareRun.py b/InnerDetector/InDetExample/InDetAlignExample/share/prepareRun.py
deleted file mode 100644
index 8a3d80129e65615093378abcb3b36d632b25f869..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/prepareRun.py
+++ /dev/null
@@ -1,71 +0,0 @@
-##########################################################
-#             Auxiliary code                             #
-##########################################################
-def getLBrange (runNumber):
-    firstLB = 1
-    lastLB = 1200
-    if (runNumber == 280464): firstLB = 401; lastLB = 900
-        
-    if (runNumber == 281411): firstLB = 1; lastLB = 1000
-    if (runNumber == 282625): firstLB = 1; lastLB = 200
-    if (runNumber == 282631): firstLB = 101; lastLB = 300
-    if (runNumber == 282712): firstLB = 301; lastLB = 900
-    if (runNumber == 282784): firstLB = 101; lastLB = 300
-    if (runNumber == 282992): firstLB = 101; lastLB = 800
-    if (runNumber == 283074): firstLB = 101; lastLB = 500
-    if (runNumber == 283155): firstLB = 101; lastLB = 300
-    if (runNumber == 283270): firstLB = 1; lastLB = 100
-    if (runNumber == 283429): firstLB = 101; lastLB = 1500
-    if (runNumber == 283608): firstLB = 1; lastLB = 200
-    if (runNumber == 283780): firstLB = 201; lastLB = 1100
-    if (runNumber == 284006): firstLB = 1; lastLB = 400
-    if (runNumber == 284154): firstLB = 101; lastLB = 300
-    if (runNumber == 284213): firstLB = 1; lastLB = 1100
-    if (runNumber == 284285): firstLB = 201; lastLB = 1500
-    if (runNumber == 284420): firstLB = 101; lastLB = 400
-    if (runNumber == 284427): firstLB = 101; lastLB = 300
-    if (runNumber == 284473): firstLB = 101; lastLB = 400
-    if (runNumber == 284484): firstLB = 1; lastLB = 600
-        
-    lbList = [firstLB, lastLB]
-    return lbList
-
-
-##########################################################
-#             Main code                                  #
-##########################################################
-
-if __name__ == '__main__':
-    import shutil
-    import os
-    import sys
-    from optparse import OptionParser
-    
-    parser = OptionParser()
-    parser.add_option("--run", type="int", dest="num")
-    (options, args) = parser.parse_args()
-
-    print '###############################################'
-    print '####### Setting up directory for Run', options.num
-    print '###############################################'
-    
-    
-    testarea = os.environ['TestArea']
-    mypath = './Run_%i' % options.num
-    run_command = '%s/run_command' % mypath
-    if not os.path.isdir(mypath):
-        os.makedirs(mypath)
-        
-    # find out LBranges
-    lbrange = getLBrange(options.num)
-    firstLB = lbrange[0]
-    lastLB = lbrange[1]
-    #print " LBrange: ", firstLB, " --> ", lastLB 
-        
-    f1=open(run_command, 'w+')
-    f1.write("python TotalIterator.py --inputList \"/afs/cern.ch/work/m/martis/public/athena/BowTest/data15_13TeV/data/Run_%i_calibration_IDTracks.txt\" --eventType \"collisions\" --isData True --nEvents 100000 --nCpus 20 --ptmin 5000 --inputBowingDb \"%s/InnerDetector/InDetExample/InDetAlignExample/BowingDB/BowingNULL.db\" --useLBselector --FirstLB %i --LastLB %i --NLB 100 --suffix %i --nIter 2 --queue 8nh" % (options.num, testarea, firstLB, lastLB, options.num))
-        
-    iterFile = '%s/TotalIterator.py' % mypath
-    getFile = '%s/InnerDetector/InDetExample/InDetAlignExample/share/TotalIterator.py' % testarea
-    shutil.copy2(getFile, iterFile)
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/runBeamspotOnESD b/InnerDetector/InDetExample/InDetAlignExample/share/runBeamspotOnESD
deleted file mode 100755
index 558834596fb8f7e5cec77fd0f9642c6ca1bc1fd8..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/runBeamspotOnESD
+++ /dev/null
@@ -1,105 +0,0 @@
-#! /usr/bin/env python
-# Run beam spot determination on a set of ESD files using JobRunner
-#
-# Written by Juerg Beringer in July 2008.
-
-import sys
-import glob
-import os
-import re
-from PyUtils import castor
-from InDetAlignExample.InDetAlignJobRunner import InDetAlignJobRunner as JobRunner
-from InDetAlignExample.InDetAlignJobRunner import InDetAlignJobRunnerError as JobRunnerError
-
-if len(sys.argv)<=2:
-    print "Usage: runBeamspotOnESD name castorpath [alignmentConstantFile]"
-    exit(1)
-name = sys.argv[1]
-castorPath = sys.argv[2]
-if len(sys.argv)>2:
-    alignmentConstantFile = sys.argv[3]
-else:
-    alignmentConstantFile = ''
-
-workdir = name
-mycmthome = '$HOME/athena/14.2.X.rel_5/'
-myrelease = '14.2.X,val,rel_5,saved,opt,32,setup,runtime'
-mylogmail = 'beringer,lacuesta'
-
-try:
-    esdFiles = []
-    castorFiles = castor.nsls(castorPath)
-    pattern = re.compile('.*ESD.*')
-    for f in castorFiles:
-        if pattern.search(f):
-            esdFiles.append('rfio:'+f)
-    #print "Input file(s) =", esdFiles
-
-    print
-    print "Running over ESD files ..."
-    aodrunner = JobRunner(startdirTemplate=workdir+'/%(jobname)s',
-                          batchType='LSF',
-                          batchQueue='atlasidali',
-                          logmail=mylogmail,
-                          EvtMax=-1,
-                          alignmentFile=alignmentConstantFile,
-                          DetDescrVersion="ATLAS-CSC-02-00-00",
-                          #GlobalTag="OFLCOND-FDR-02-01-00",   # Not used when running on ESD
-                          release=myrelease,
-                          cmthome=mycmthome,
-                          jobnameTemplate='bsaod%(jobnr)03i',
-                          joboptionPath=os.getcwd()+'/InDetAlignBeamspotESDtoAOD.py')
-
-    aodrunner.addFiles(esdFiles)
-    aodrunner.setOption('filesPerJob', 1)
-
-    if alignmentConstantFile:
-        scriptTemplate = """#!/bin/sh
-source %(cmthome)s/setup.sh -tag=%(release)s
-mkdir -p %(rundir)s
-cd %(rundir)s
-pool_insertFileToCatalog %(alignmentFile)s
-athena.py %(configfile)s %(joboptionPath)s
-"""
-        aodrunner.setOption('scriptTemplate',scriptTemplate)
-
-    aodrunner.showOptions()
-    aodrunner.run()
-    aodrunner.wait()
-    outputFiles = aodrunner.getOutputFiles()
-    print
-    print "The following AOD files were produced:"
-    print outputFiles
-
-    #
-    # Determine beamspot using AOD files (single job over all AOD files)
-    #
-    print
-    print "Calculating beamspot on AOD files..."
-    finder = JobRunner(startdirTemplate=workdir,
-                       outputfileTemplate='%(startdir)s/vtxbeamspot.db',
-                       histfileTemplate='%(startdir)s/vtxbeamspot.root',
-                       batchType='LSF',
-                       batchQueue='atlasidali',
-                       logmail=mylogmail,
-                       EvtMax=-1,
-                       release=myrelease,
-                       vertexContainer='NewVxPrimaryCandidate',
-                       useNLumiBlocksPerBeamspot=10,
-                       maxCountPerBeamspot=-1,
-                       cmthome=mycmthome,
-                       jobnameTemplate='vtxbeamspot',
-                       joboptionPath=os.getcwd()+'/InDetAlignBeamspotVertexFinder.py')
-
-    finder.addFiles(outputFiles)
-    finder.setOption('filesPerJob', len(outputFiles))
-    finder.run()
-    finder.wait()
-
-except JobRunnerError, err:
-    print '\nERROR:',err
-    print
-    exit(1)
-
-print
-os.system('ls -l %s' % workdir)
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/runbyrun-test.py b/InnerDetector/InDetExample/InDetAlignExample/share/runbyrun-test.py
deleted file mode 100755
index f0822577b97cd01e32810cd792c95df5a341ce16..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/runbyrun-test.py
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/afs/cern.ch/sw/lcg/external/Python/2.5.4/slc4_ia32_gcc34/bin/python
-
-#================================
-# Example to run over several runs and obtain
-# a set of alignment constants for each run
-#===============================
-
-runlist = [152220, 152221, 167885 , 167680 , 167661 , 167607 , 167576 , 167575 , 167573 , 166964 , 166927 , 166925 , 166924 , 166856 , 166850 ,
-166786 , 166658 , 166466 , 166383 , 166305 , 166198 , 166143 , 166142 , 166097 , 166094 , 165956 , 165954 , 165821 , 165818 , 165817 , 165815 ,
-165767 , 165732 , 165703 , 165632 , 165591 , 162882 , 162843 , 162764 , 162690 , 162623 , 162620 , 162577 , 162576 , 162526 , 162347 , 161948 ,
-161562 , 161520 , 161407 , 161379 , 161118 , 161116 , 161114 , 160980 , 160975 , 160963 , 160958 , 160954 , 160953 , 160899 , 160879 , 160801 ,
-160800 , 160736 , 160613 , 160530 , 160479 , 160472 , 160387 , 160303 , 159224 , 159203 , 159202 , 159179 , 159113 , 159086 , 159041 , 158975 ,
-158801 , 158632 , 158582 , 158549 , 158548 , 158545 , 158466 , 158443 , 158392 , 158299 , 158269 , 158116 , 158045 , 156682 , 156463 , 155794 ,
-155697 , 155678 , 155669 , 155634 , 155569 , 155280 , 155228 , 155160 , 155116 , 155112 , 155073 , 154822 , 154817 , 154815 , 154813 , 154810 ,
-154471 , 154469 , 154465 , 154126 , 153599 , 153565 , 153200 , 153159 , 153136 , 153135 , 153134 , 153030 , 152994 , 152933 , 152878 , 152845 ,
-152844 , 152779 , 152777 , 152508 , 152441 , 152409 , 152345]
-
-import os,sys
-filesPerCPU = 10
-FirstIteration = 0 
-Iterations     = 2
-preName        = 'L1-2010-Align'
-runMode        = 'batch'
-QUEUE 	       = 'atlasb1'
-HOME 	       = os.environ['HOME']
-OutputPath     = "/afs/cern.ch/user/s/spedraza/work/alignment/repro2010/L1-L2PixEC/" 
-CMTDIR 	       = HOME+"/athena/cmthome/"
-ASetupOptions  = "single"
-OutputLevel    = 'INFO'
-
-from InDetAlignExample.NewInDet_SetupData import setupData
-DataToRun = []
-Data1 =[]
-counter = 0
-for run in runlist:
-
-	#
-	# Delete the lines below if you dont have the 
-	# %s_IDTracks.txt file for each run
-	###############
-	try:
-		f = open("%s_IDTracks.txt"%(run),'r')
-	except:
-		continue
-	numberCPUs = len(f.readlines())/filesPerCPU
-	if numberCPUs == 0:
-		numberCPUs = 1
-	f.close()
-	###############
-	Data1.append(setupData('%s'%(run))) # line to replace
-	Data1[counter].setDataType("IDTracks")
-	Data1[counter].setRuns([run]) # line to replace
-	Data1[counter].setCPUs([numberCPUs,numberCPUs]) # line to replace
-	Data1[counter].setEvents([-1,-1])
-	Data1[counter].CreateFileList()
-	Data1[counter].setGlobalTag("COMCOND-BLKPA-006-10")
-	Data1[counter].setDetDescrVersion("ATLAS-GEO-20-19-01")
-	DataToRun.append(Data1[counter])
-	counter += 1
-print len(DataToRun), counter
-
-AlignmentMethod = "GX2"
-
-inputAlignmentPoolFile = ""
-doDetailedSplitting = False
-useTFiles = True
-extraOptions = {}
-extraOptions["doMonitoring"] = True
-extraOptions["doTrkNtuple"] = False
-extraOptions["PtCut"]               = 5000 #Pt in MeV, comment the line to use default value (10000)
-extraOptions["lorentzAngleTag"]     ="PIXELLorentzAngleScale-Data-001"
-extraOptions["siAlignmentTag"]      = "InDetAlign_Repro2012_d0z0p_constrained"
-extraOptions["trtAlignmentTag"]     = "TRTAlign_Repro2012_d0z0p_constrained"
-extraOptions["trtAlignmentTagL3"]   = "TRTCalibDX_EoverP_189598_189845v1"
-extraOptions["ModCut"]				= 0
-extraOptions["softModeCut"]			= 0.
-extraOptions["doBSConstraint"]		= False 
-extraOptions["doPVConstraint"]		= False
-extraOptions["useOldPreProcessor"]	= False
-## TRT
-extraOptions["useTRT"] 			= True
-extraOptions["trtAlignBarrelZ"] = False
-extraOptions["trtAlignEndcapZ"] = False
-## PIXEL
-extraOptions["pixelAlignBarrelX"] 	= False
-extraOptions["pixelAlignBarrelY"] 	= False
-extraOptions["pixelAlignBarrelZ"] 	= False
-extraOptions["pixelAlignBarrelRotX"]= False
-extraOptions["pixelAlignBarrelRotY"]= False
-extraOptions["pixelAlignBarrelRotZ"]= False
-## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] 	= True
-extraOptions["pixelAlignEndcapY"] 	= True
-extraOptions["pixelAlignEndcapZ"] 	= False
-extraOptions["pixelAlignEndcapRotX"]= False
-extraOptions["pixelAlignEndcapRotY"]= False
-extraOptions["pixelAlignEndcapRotZ"]= True
-## SCT
-extraOptions["sctAlignBarrelX"]		= True
-extraOptions["sctAlignBarrelY"]		= True
-extraOptions["sctAlignBarrelZ"]		= True
-extraOptions["sctAlignBarrelRotX"]	= True
-extraOptions["sctAlignBarrelRotY"]	= True
-extraOptions["sctAlignBarrelRotZ"]	= True
-## alignment parameters Endcap
-extraOptions["sctAlignEndcapX"]		= True
-extraOptions["sctlAlignEndcapY"]	= True
-extraOptions["sctAlignEndcapZ"]		= True
-extraOptions["sctAlignEndcapRotX"]	= True
-extraOptions["sctAlignEndcapRotY"]	= True
-extraOptions["sctAlignEndcapRotZ"]	= True
-
-doSolve = True
-
-AlignPixel                 = [True,True]
-AlignPixelBarrel           = [True,True]
-AlignPixelEndcaps          = [True,True]
-PixelAlignmentLevel        = [ 2, 2]
-PixelAlignmentLevelBarrel  = [-1,-1]
-PixelAlignmentLevelEndcaps = [-1,-1]
-
-AlignSCT                  =  [True,True]
-AlignSCTBarrel            =  [True,True]
-AlignSCTEndcaps           =  [True,True]
-SCTAlignmentLevel         =  [ 1, 1]
-SCTAlignmentLevelBarrel   =  [-1,-1]
-SCTAlignmentLevelEndcaps  =  [-1,-1]
-
-AlignTRT            = [True,True]
-TRTAlignmentLevel   = [1, 1]
-
-ErrorScaling        = [True,True]
-errorScalingTag		= ''
-MonitoringScript	= ""
-
-os.system("get_files -jo InDetAlignExample/NewInDetIterator.py >/dev/null")
-print os.system("get_files -jo InDetAlignExample/NewInDetIterator.py")
-execfile("NewInDetIterator.py")
diff --git a/InnerDetector/InDetExample/InDetAlignExample/test/InDetAlignExample_TestConfiguration.xml b/InnerDetector/InDetExample/InDetAlignExample/test/InDetAlignExample_TestConfiguration.xml
deleted file mode 100644
index 3fbde2e0484b88ac59764c28b86b84430077531d..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/test/InDetAlignExample_TestConfiguration.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd">
-
-<unifiedTestConfiguration>
- <atn>
-   <TEST name="InDetAlignExample_ATNSimple" type="athena" suite="Examples">
-     <options_atn>InDetAlignExample/AlignmentATNSimple.py</options_atn>
-     <author> Atlas Developer </author>
-     <mailto>lacuesta@ific.uv.es, john.alison@cern.ch, anthony.morley@cern.ch, salvador.marti@ific.uv.es, jike.wang@cern.ch, regina.moles.valls@cern.ch</mailto>
-     <expectations>
-       <returnValue>0</returnValue>
-     </expectations>
-   </TEST>
-   
- </atn>
-
- <rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt">
-   <rttContactPerson>InDetAlignment Monitoring Group</rttContactPerson>
-   <mailto>Salvador.Marti@ific.uv.es, moles@ific.uv.es, lacuesta@ific.uv.es</mailto>
-   <refRelease>15.0.0</refRelease>
-   <jobList>
-      <classification>
-         <displayClass>OfflineValidation</displayClass>
-         <displayProcess>Reco</displayProcess>
-         <displayComponent>Det-InDet</displayComponent>
-      </classification>
-      <jobTransform userJobId="NewInDetSiLevel1Alignment"> 
-	<doc>Script to run 2 iterations of level 1 silicon only alignment.</doc> 
-	<jobTransformJobName>NewInDetSiLevel1Alignment</jobTransformJobName>
-        <jobTransformCmd>RunIterator.py</jobTransformCmd>
-        <group>NewInDetSiLevel1Alignment</group>
-        <queue>long</queue>
-	<castorSvcClass>atlasgroupdisk</castorSvcClass>
-	<castorStageHost>castoratlas</castorStageHost>
-      </jobTransform> 
-   
-   </jobList>
-   
-   <jobGroups>
-     <jobGroup name="NewInDetSiLevel1Alignment" parent="Transform">
-       <keepFilePattern>Iter0/*</keepFilePattern>
-       <keepFilePattern>Iter0/logs/*</keepFilePattern>
-       <keepFilePattern>Iter0/Collision/*</keepFilePattern>
-       <keepFilePattern>Iter1/*</keepFilePattern>
-       <keepFilePattern>Iter1/logs/*</keepFilePattern>
-       <keepFilePattern>Iter1/Collision/*</keepFilePattern>
-       <keepFilePattern>*.html</keepFilePattern>
-       <keepFilePattern>*.eps</keepFilePattern>
-       <keepFilePattern>*.png</keepFilePattern>
-       <keepFilePattern>*.html</keepFilePattern>
-       <auxFilePattern>NewSiL1AlignRTT.cc</auxFilePattern>
-       <auxFilePattern>Constants_L1.cc</auxFilePattern>
-       <auxFilePattern>InDetAlignExample_NewInDetSiLevel1Alignment.html</auxFilePattern>
-       <action>
-	 <modulename>RttLibraryTools</modulename>
-	 <testname>ROOTMacroRunner</testname>
-	 <arg>
-           <argname>macro</argname>
-           <argvalue>NewSiL1AlignRTT.cc</argvalue>
-	 </arg>
-	 <arg>
-           <argname>macro</argname>
-           <argvalue>Constants_L1.cc</argvalue>
-	 </arg>
-       </action>
-       <testToRemove>
-         <jobGroupName>Top</jobGroupName> 
-	 <testidentifier>CheckFileRunner0</testidentifier> 
-       </testToRemove>
-     </jobGroup>
-   </jobGroups>
-      
- </rtt>
-</unifiedTestConfiguration>
-
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt
index 6f3b348e364ea3e08790d581f64c9a6c60f200dc..51cf78c9a4da50f3a6fcebedb8aee2650f2681c4 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt
@@ -6,62 +6,56 @@
 atlas_subdir( InDetAlignmentMonitoring )
 
 # Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   GaudiKernel
-   PRIVATE
-   Commission/CommissionEvent
-   Control/AthenaBaseComps
-   Control/AthenaMonitoring
-   Control/DataModel
-   DetectorDescription/AtlasDetDescr
-   DetectorDescription/Identifier
-   Event/EventPrimitives
-   Event/xAOD/xAODEventInfo
-   Event/xAOD/xAODTracking
-   InnerDetector/InDetAlignTools/InDetAlignGenTools
-   InnerDetector/InDetConditions/InDetBeamSpotService
-   InnerDetector/InDetConditions/TRT_ConditionsServices
-   InnerDetector/InDetDetDescr/InDetIdentifier
-   InnerDetector/InDetDetDescr/InDetReadoutGeometry
-   InnerDetector/InDetRecEvent/InDetPrepRawData
-   InnerDetector/InDetRecEvent/InDetRIO_OnTrack
-   InnerDetector/InDetRecTools/InDetTrackSelectionTool
-   InnerDetector/InDetValidation/InDetTrackSplitterTool
-   Reconstruction/Particle
-   Tools/LWHists
-   Tracking/TrkDetDescr/TrkGeometry
-   Tracking/TrkDetDescr/TrkSurfaces
-   Tracking/TrkEvent/TrkEventPrimitives
-   Tracking/TrkEvent/TrkParameters
-   Tracking/TrkEvent/TrkParticleBase
-   Tracking/TrkEvent/TrkPseudoMeasurementOnTrack
-   Tracking/TrkEvent/TrkRIO_OnTrack
-   Tracking/TrkEvent/TrkTrack
-   Tracking/TrkEvent/TrkTrackSummary
-   Tracking/TrkEvent/TrkTruthData
-   Tracking/TrkEvent/VxVertex
-   Tracking/TrkExtrapolation/TrkExInterfaces
-   Tracking/TrkTools/TrkToolInterfaces
-   Tracking/TrkVertexFitter/TrkVertexFitterInterfaces )
+atlas_depends_on_subdirs( PUBLIC
+                          GaudiKernel
+                          PRIVATE
+                          Commission/CommissionEvent
+                          Control/AthenaBaseComps
+                          Control/AthenaMonitoring
+                          Control/DataModel
+                          DetectorDescription/AtlasDetDescr
+                          DetectorDescription/Identifier
+                          Event/EventPrimitives
+                          Event/xAOD/xAODEventInfo
+                          Event/xAOD/xAODTracking
+                          InnerDetector/InDetAlignTools/InDetAlignGenTools
+                          InnerDetector/InDetConditions/InDetBeamSpotService
+                          InnerDetector/InDetConditions/TRT_ConditionsServices
+                          InnerDetector/InDetDetDescr/InDetIdentifier
+                          InnerDetector/InDetDetDescr/InDetReadoutGeometry
+                          InnerDetector/InDetRecEvent/InDetPrepRawData
+                          InnerDetector/InDetRecEvent/InDetRIO_OnTrack
+                          InnerDetector/InDetRecTools/InDetTrackSelectionTool
+                          InnerDetector/InDetValidation/InDetTrackSplitterTool
+                          Reconstruction/Particle
+                          Tools/LWHists
+                          Tracking/TrkDetDescr/TrkGeometry
+                          Tracking/TrkDetDescr/TrkSurfaces
+                          Tracking/TrkEvent/TrkEventPrimitives
+                          Tracking/TrkEvent/TrkParameters
+                          Tracking/TrkEvent/TrkParticleBase
+                          Tracking/TrkEvent/TrkPseudoMeasurementOnTrack
+                          Tracking/TrkEvent/TrkRIO_OnTrack
+                          Tracking/TrkEvent/TrkTrack
+                          Tracking/TrkEvent/TrkTrackSummary
+                          Tracking/TrkEvent/TrkTruthData
+                          Tracking/TrkEvent/VxVertex
+                          Tracking/TrkExtrapolation/TrkExInterfaces
+                          Tracking/TrkTools/TrkToolInterfaces
+                          Tracking/TrkVertexFitter/TrkVertexFitterInterfaces )
 
 # External dependencies:
 find_package( CLHEP )
 find_package( HepMC )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO MathMore Gpad Matrix )
+find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint )
 
 # Component(s) in the package:
 atlas_add_component( InDetAlignmentMonitoring
-   src/*.h src/*.cxx src/components/*.cxx
-   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES}
-   GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib DataModel
-   AtlasDetDescr Identifier EventPrimitives xAODEventInfo xAODTracking
-   TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry
-   InDetPrepRawData InDetRIO_OnTrack Particle LWHists TrkGeometry TrkSurfaces
-   TrkEventPrimitives TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack
-   TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData VxVertex TrkExInterfaces
-   TrkToolInterfaces TrkVertexFitterInterfaces InDetTrackSelectionToolLib )
+                     src/*.cxx
+                     src/components/*.cxx
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib DataModel AtlasDetDescr Identifier EventPrimitives xAODEventInfo xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetPrepRawData InDetRIO_OnTrack Particle LWHists TrkGeometry TrkSurfaces TrkEventPrimitives TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces )
 
 # Install files from the package:
+atlas_install_headers( InDetAlignmentMonitoring )
 atlas_install_joboptions( share/*.py )
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/cmt/requirements b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/cmt/requirements
deleted file mode 100755
index a57ec237be0ac3e96d7418384e0edc2e3434f90a..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/cmt/requirements
+++ /dev/null
@@ -1,79 +0,0 @@
-package InDetAlignmentMonitoring
-
-author Beate Heinemann <BHEHeinemann@lbl.gov>
-
-# General
-use AtlasPolicy AtlasPolicy-*
-
-private
-apply_tag ROOTMathLibs
-#use EventInfo		           EventInfo-*                    Event
-use xAODEventInfo		   xAODEventInfo-*                Event/xAOD
-
-
-use InDetIdentifier                InDetIdentifier-*              InnerDetector/InDetDetDescr
-use InDetReadoutGeometry           InDetReadoutGeometry-*         InnerDetector/InDetDetDescr
-use InDetPrepRawData               InDetPrepRawData-*             InnerDetector/InDetRecEvent
-use InDetRIO_OnTrack               InDetRIO_OnTrack-*             InnerDetector/InDetRecEvent
-use TrkGeometry                    TrkGeometry-*                  Tracking/TrkDetDescr
-use TrkSurfaces                    TrkSurfaces-*                  Tracking/TrkDetDescr
-use TrkExInterfaces                TrkExInterfaces-*              Tracking/TrkExtrapolation
-use TrkTrackSummary                TrkTrackSummary-*              Tracking/TrkEvent
-use TrkRIO_OnTrack                 TrkRIO_OnTrack-*               Tracking/TrkEvent
-
-use TrkPseudoMeasurementOnTrack    TrkPseudoMeasurementOnTrack-*  Tracking/TrkEvent
-
-use LWHists                        LWHists-*                      Tools
-
-use AtlasCLHEP                     AtlasCLHEP-*                   External
-use AtlasDetDescr                  AtlasDetDescr-*                DetectorDescription
-use AtlasHepMC                     AtlasHepMC-*                   External
-use TrkParticleBase                TrkParticleBase-*              Tracking/TrkEvent
-
-use TrkTruthData                   TrkTruthData-*                 Tracking/TrkEvent
-#use TrkValInterfaces              TrkValInterfaces-*             Tracking/TrkValidation
-
-use InDetAlignGenTools             InDetAlignGenTools-*           InnerDetector/InDetAlignTools
-use InDetTrackSelectionTool        InDetTrackSelectionTool-*      InnerDetector/InDetRecTools    
-
-use InDetTrackSplitterTool         InDetTrackSplitterTool-*       InnerDetector/InDetValidation
-use InDetBeamSpotService           InDetBeamSpotService-*         InnerDetector/InDetConditions
-use TRT_ConditionsServices         TRT_ConditionsServices-*       InnerDetector/InDetConditions
-
-use Identifier                     Identifier-*                   DetectorDescription
-use TrkEventPrimitives             TrkEventPrimitives-*           Tracking/TrkEvent
-use TrkTrack                       TrkTrack-*                     Tracking/TrkEvent
-use VxVertex                       VxVertex-*                     Tracking/TrkEvent
-
-use Particle                   Particle-*            Reconstruction
-use TrkVertexFitterInterfaces  TrkVertexFitterInterfaces-*     Tracking/TrkVertexFitter
-use xAODTracking	         xAODTracking-*		           Event/xAOD
-use AthenaBaseComps                AthenaBaseComps-*              Control
-use AthenaMonitoring               AthenaMonitoring-*             Control
-use CommissionEvent                CommissionEvent-*              Commission
-use DataModel                      DataModel-*                    Control
-use EventPrimitives		   EventPrimitives-*		  Event    
-use TrkParameters                  TrkParameters-*                Tracking/TrkEvent
-use TrkToolInterfaces              TrkToolInterfaces-*            Tracking/TrkTools
-
-# needed for the event phase
-
-public
-
-#use IdDictDetDescr                 IdDictDetDescr-*               DetectorDescription
-use AtlasROOT                      AtlasROOT-*                    External
-use GaudiInterface                 GaudiInterface-*               External
-
-
-
-
-
-
-
-
-library  InDetAlignmentMonitoring *.cxx components/*.cxx
-apply_pattern component_library
-#apply_pattern dual_use_library files=*.cxx
-apply_pattern declare_joboptions files="*.py"
-
-macro_append cppflags ""
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/InDetMonitoringTRTCosmics.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/InDetMonitoringTRTCosmics.py
deleted file mode 100644
index 9bc957cf259a533a0dd51f0d4553cd728be9647e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/InDetMonitoringTRTCosmics.py
+++ /dev/null
@@ -1,264 +0,0 @@
-print "Custom Monitoring from InDetMontoringBon.py"
-## set to true in case you would like to write out your own InDetAlignMon.root
-InDetAlignMonDoOutput = False
-
-## Set to True if you want to run the TruthComparison
-InDetAlignMonDoTruth = False
-
-# Setup vertexing sequence without beam constraint.
-# NOTE: Include the following BEFORE adding InDetAlignMonManager to topSequence.
-# include('InDetAlignmentMonitoring/InDetAlignmentMonitoring_vertexing.py')
-
-# Setup Track Selection
-from TRT_AlignAlgs.TRT_AlignAlgsConf import TRTTrackSelectionAlg
-m_minPix = [3,2,-1000,-1000,-1000]
-m_minSCT = [9,9,-1000,-1000,5]
-m_minTRT = [45,45,45,45,10]
-m_maxD0 = [ 500,100, 1000,100,1000]
-
-m_name = ["SelectIDAlignMonTracksCombined"
-          ,"SelectIDAlignMonTracksCombinedD0Cut"
-          ,"SelectIDAlignMonTracksTRT"
-          ,"SelectIDAlignMonTracksTRTD0Cut"
-          ,"SelectIDAlignMonTracksEndcap"]
-
-m_tracksName = ["IDAlignMonTracksCombined"
-                ,"IDAlignMonTracksCombinedD0Cut"
-                ,"IDAlignMonTracksTRT"
-                ,"IDAlignMonTracksTRTD0Cut"
-                ,"IDAlignMonTracksEndcap"]
-
-m_inTracks = [InDetKeys.Tracks()
-              ,InDetKeys.Tracks()
-              ,InDetKeys.TRTTracks_CTB()
-              ,InDetKeys.TRTTracks_CTB()
-              ,InDetKeys.Tracks()]
-
-m_outputLevel = [ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR]
-
-SelectIDAlignMonTracksList = []
-
-for i in range(5):
-    SelectIDAlignMonTracksList.append( TRTTrackSelectionAlg( name = m_name[i],
-                                                             inputTrackList = m_inTracks[i],
-                                                             outputTrackList = m_tracksName[i],
-                                                             SummaryTool = InDetTrackSummaryTool,
-                                                             MaxChisqPerDof = 1000000,
-                                                             PtMin = 2000,
-                                                             MinPixelHits = m_minPix[i],
-                                                             MinSCTHits = m_minSCT[i],
-                                                             MinTRTHits = m_minTRT[i],
-                                                             MinEndcapHits = 9999,
-                                                             D0Max = m_maxD0[i],
-                                                             UseCosmicTrackSelection = True,
-                                                             MinEventPhase = 5,
-                                                             MaxEventPhase = 30,
-                                                             OneTrackPerEvent = True,
-                                                             OutputLevel = m_outputLevel[i]) )
-    
-    # Settings for the endcap tracks
-    if i == 4:
-        SelectIDAlignMonTracksList[i].RequireEndcapHits = True
-        SelectIDAlignMonTracksList[i].MinEndcapHits = 10
-        SelectIDAlignMonTracksList[i].MinBarrelHits = 0
-    
-    if not jobproperties.BField.solenoidOn:
-        SelectIDAlignMonTracksList[i].DoPtCut = False
-        
-    topSequence += SelectIDAlignMonTracksList[i]
-    print          SelectIDAlignMonTracksList[i]
-
-
-
-from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetCosmicTrackSelectorTool
-InDetAlignCosmicTrackSelectorTool = InDet__InDetCosmicTrackSelectorTool(name = "InDetAlignCosmicTrackSelectorTool",
-                                                                        maxZ0 = 100000.0, #overriding default
-                                                                        maxD0 = 100000.0, #overriding default
-                                                                        minPt = 0.0, #overriding default
-                                                                        numberOfTRTHits = 0, #overriding default
-                                                                        numberOfSiliconHits = 0, #overriding default
-                                                                        numberOfSiliconHitsTop = -1, #default
-                                                                        numberOfSiliconHitsBottom = -1, #default
-                                                                        OutputLevel = ERROR,
-                                                                        TrackSummaryTool = InDetTrackSummaryTool)
-ToolSvc += InDetAlignCosmicTrackSelectorTool
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignCosmicTrackSelectorTool
-
-#all configuration of track selection cuts should be done using TrkSelectorTool above
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMon__TrackSelectionTool
-InDetAlignMonTrackSelectionTool = InDetAlignMon__TrackSelectionTool(name = "InDetAlignMonTrackSelectionTool",
-                                                                    PassAllTracks = True, ## Uncomment this line to bypass track slection
-                                                                    OutputLevel = ERROR,
-                                                                    TrackSelectorTool = InDetAlignCosmicTrackSelectorTool)
-
-
-ToolSvc += InDetAlignMonTrackSelectionTool
-if (InDetFlags.doPrintConfigurables()):
-   print InDetAlignMonTrackSelectionTool
-    
-#================================
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonResiduals
-InDetAlignMonResidualsList = []
-m_resName = ["InDetAlignMonResidualsComb"
-             ,"InDetAlignMonResidualsCombD0Cut"
-             ,"InDetAlignMonResidualsTRT"
-             ,"InDetAlignMonResidualsTRTD0Cut"
-             ,"InDetAlignMonResidualsEndcap"]
-             
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonEfficiencies
-InDetAlignMonEfficienciesList = []
-m_effName = ["InDetAlignMonEfficienciesComb"
-             ,"InDetAlignMonEfficienciesCombD0Cut"
-             ,"InDetAlignMonEfficienciesTRT"
-             ,"InDetAlignMonEfficienciesTRTD0Cut"
-             ,"InDetAlignMonEfficienciesEndcap"]
-
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks
-InDetAlignMonGenericTracksList = []
-m_genTrkName = ["InDetAlignMonGenericTracksComb"
-                ,"InDetAlignMonGenericTracksCombD0Cut"
-                ,"InDetAlignMonGenericTracksTRT"
-                ,"InDetAlignMonGenericTracksTRTD0Cut"
-                ,"InDetAlignMonGenericTracksEndcap"]
-
-from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool
-InDetTrackSplitterToolList=[]
-m_trkSplitterName = ["Combined","CombinedD0","TRT","TRTD0","Endcap"]
-
-from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonTrackSegments
-InDetAlignMonTrackSegmentsList = []
-m_trkSegName = ["InDetAlignMonTrackSegmentsComb"
-                ,"InDetAlignMonTrackSegmentsCombD0Cut"
-                ,"InDetAlignMonTrackSegmentsTRT"
-                ,"InDetAlignMonTrackSegmentsTRTD0Cut"
-                ,"InDetAlignMonTrackSegmentsEndcap"]
-
-m_deltaPhi = [0.005,0.005,0.01,0.05,0.005]
-m_deltaPhi2D = [0.02,0.02,0.05,0.05,0.02]
-m_deltaD0 = [0.8,0.8,8,16,8]
-m_deltaD02D = [5,5,10,16,5]
-m_d0Range = [200,200,800,200,200]
-m_deltaQoverPt = [0.02,0.02,0.1,0.1,0.02]
-
-
-for i in range(5):
-    InDetAlignMonResidualsList.append(IDAlignMonResiduals (name = m_resName[i],
-                                                           Pixel_Manager = InDetKeys.PixelManager(),
-                                                           SCT_Manager = InDetKeys.SCT_Manager(),
-                                                           tracksName = m_tracksName[i],
-                                                           OutputLevel = m_outputLevel[i],
-                                                           trackSelection = InDetAlignMonTrackSelectionTool,
-                                                           TRT_Manager = InDetKeys.TRT_Manager())  )
-    
-    ToolSvc += InDetAlignMonResidualsList[i]
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonResidualsList[i]
-
-
-    InDetAlignMonEfficienciesList.append(IDAlignMonEfficiencies (name = m_effName[i],
-                                                                 HoleSearch = InDetExtendedHoleSearchTool,
-                                                                 Pixel_Manager = InDetKeys.PixelManager(),
-                                                                 SCT_Manager = InDetKeys.SCT_Manager(),
-                                                                 tracksName = m_tracksName[i],
-                                                                 trackSelection = InDetAlignMonTrackSelectionTool,
-                                                                 TRT_Manager = InDetKeys.TRT_Manager())    )
-
-    ToolSvc += InDetAlignMonEfficienciesList[i]
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonEfficienciesList[i]
-
-
-    InDetAlignMonGenericTracksList.append(IDAlignMonGenericTracks (name = m_genTrkName[i],
-                                                                   tracksName= m_tracksName[i],
-                                                                   trackSelection = InDetAlignMonTrackSelectionTool,
-                                                                   VxPrimContainerName = InDetKeys.PrimaryVertices())   )
-
-    ToolSvc += InDetAlignMonGenericTracksList[i]
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonGenericTracksList[i]
-
-
-    InDetTrackSplitterToolList.append(InDet__InDetTrackSplitterTool(name = "TrackSplitterTool_"+m_trkSplitterName[i],
-                                                                    TrackFitter = InDetTrackFitter,
-                                                                    OutputUpperTracksName = m_trkSplitterName[i]+"_Upper",
-                                                                    OutputLowerTracksName = m_trkSplitterName[i]+"_Lower",
-                                                                    OutputLevel = ERROR) )
-                                           
-    ToolSvc += InDetTrackSplitterToolList[i]
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetTrackSplitterToolList[i]
-        
-    InDetAlignMonTrackSegmentsList.append(IDAlignMonTrackSegments ( name = m_trkSegName[i],
-                                                                    InputTracksName = m_tracksName[i],
-                                                                    UpperTracksName = m_trkSplitterName[i]+"_Upper",
-                                                                    LowerTracksName = m_trkSplitterName[i]+"_Lower",
-                                                                    UseCTBSplitTracks = False,
-                                                                    TrackSplitter =  InDetTrackSplitterToolList[i],
-                                                                    trackSelectionUp = InDetAlignMonTrackSelectionTool,
-                                                                    trackSelectionLow = InDetAlignMonTrackSelectionTool,
-                                                                    DeltaD0Range = m_deltaD0[i],
-                                                                    DeltaD0Range2D = m_deltaD02D[i],
-                                                                    DeltaPhiRange = m_deltaPhi[i],
-                                                                    DeltaPhiRange2D = m_deltaPhi2D[i],
-                                                                    DeltaQoverPtRange = m_deltaQoverPt[i],
-                                                                    OutputLevel = ERROR,
-                                                                    D0Range = m_d0Range[i] ))
-    ToolSvc += InDetAlignMonTrackSegmentsList[i]
-    if (InDetFlags.doPrintConfigurables()):
-        print InDetAlignMonTrackSegmentsList[i]
-#==============================================================
-
-    
-
-## add an AthenaMonManager algorithm to the list of algorithms to be ran
-#from DataQualityTools.DQMonFlags import DQMonFlags
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-InDetAlignMonManager = AthenaMonManager( name = "InDetAlignMonManager",
-                                      FileKey = DQMonFlags.monManFileKey(),
-                                      ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                      DataType            = DQMonFlags.monManDataType(),
-                                      Environment         = DQMonFlags.monManEnvironment(),
-                                      ManualRunLBSetup    = DQMonFlags.monManManualRunLBSetup(),
-                                      Run                 = DQMonFlags.monManRun(),
-                                      LumiBlock           = DQMonFlags.monManLumiBlock())
-if jobproperties.Beam.beamType()=='cosmics':
-    InDetAlignMonManager.DataType="cosmics"
-    #InDetAlignMonManager.AthenaMonTools += [ IDAlignMonTrackSegments_UpLowAll ]
-    #InDetAlignMonManager.AthenaMonTools += [ IDAlignMonTrackSegments_UpLowCombined ]
-    #InDetAlignMonManager.AthenaMonTools += [ IDAlignMonTrackSegments_UpLowTRT ]
-
-for i in range(5):
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResidualsList[i] ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonEfficienciesList[i] ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracksList[i] ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonTrackSegmentsList[i] ]
-
-if InDetAlignMonDoTruth:
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonTruthComparison ]
-if not hasattr(ToolSvc, 'monTrigDecTool'):
-    print "InDetAlignmentMonitoring_InDetRec_jobOptions.py: trigger decision tool not found: don't run trigger-aware monitoring" 
-elif jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam':
-    print "singlebeam or cosmics: don't run trigger-aware monitoring"
-else:
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonEfficiencies ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonBeamSpot ]
-    InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonSivsTRT ]
-
-## Setup the output histogram file(s):
-if not hasattr(ServiceMgr, 'THistSvc'):
-    from GaudiSvc.GaudiSvcConf import THistSvc
-    ServiceMgr += THistSvc()
-if InDetAlignMonDoOutput:
-    THistSvc = Service( "THistSvc" )
-    histOutput = "IDAlignMon DATAFILE='./IDAlignMon.root' OPT='RECREATE'"
-    THistSvc.Output += [histOutput]
-    InDetAlignMonManager.FileKey = "IDAlignMon"   
-
-
-topSequence += InDetAlignMonManager
-if (InDetFlags.doPrintConfigurables()):
-    print InDetAlignMonManager
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_ForCosmics.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_ForCosmics.py
deleted file mode 100755
index ea63ff85e8f1ab3b96c626cbd3916172240f7b80..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeAlignmentMonitoringPlots_ForCosmics.py
+++ /dev/null
@@ -1,732 +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_ForCosmics.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,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)
-
-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)
-
-# 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)
-
-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)
-
-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)
-
-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)
-
-
-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)
-
-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)
-
-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)
-
-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)
-
-
-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)
-
-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)
-
-
-## 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
-
-PIXECAX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_eca_residualx","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","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)
-
-SCTECAX = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_eca_residualx","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","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)
-
-
-# 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)
-
-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)
-
-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)
-
-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)
-
-# 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)
-
-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)
-
-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)
-
-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)
-
-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)
-
-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)
-
-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)
-
-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)
-
-
-# Add TRT endcap plots e.g. trt_ec_aveResVsPhiSec_Endcap_A, trt_ec_rmsResVsPhiSec_Endcap_A, trt_ec_aveResVsRing_Endcap_A, trt_ec_rmsResVsRing_Endcap_A
-
-
-
-
-## 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)
-
-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_nolog","noFit",rootFiles,nFiles,normaliseHistos)
-DrawPlots(TrackPT, outputDir+"/"+"pT.png", "", "N Tracks",
-          "pT", 0.19, 0.9, "",
-          canvasText,makeOutput)
-
-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)
-
-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)
-
-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)
-
-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)
-
-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)
-
-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)
-
-#TRTECAHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_wheel_trt_ea","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)
-#
-#TRTECCHitEff = MakePlots(hitEffDir,legendTitles,markerColors,markerStyles,"hits_eff_vs_wheel_trt_ec","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)
-
-
-# Split track distributions
-
-DELTAD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_d0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAD0,outputDir+"/"+"DELTAD0.png","#Delta(Up-Down) Tracks","number of tracks",
-          "#Delta d0 [mm]",0.2,0.9,"#mum",
-          canvasText,makeOutput);
-
-DELTAPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_phi0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAPHI0,outputDir+"/"+"DELTAPHI0.png","#Delta(Up-Down) Tracks","number of tracks",
-          "#Delta phi [radians]",0.2,0.95,"mrad",
-          canvasText,makeOutput);
-
-DELTAETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_eta0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAETA,outputDir+"/"+"DELTAETA.png","#Delta(Up-Down) Tracks","number of tracks",
-          "#Delta #eta",0.2,0.95,"",
-          canvasText,makeOutput);
-
-DELTAQOPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_qOverPt","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAQOPT,outputDir+"/"+"DELTAQOPT.png","#Delta(Up-Down) Tracks","number of tracks",
-          "#Delta Q/p_{T}  [GeV^{-1}]",0.2,0.95,"TeV^{-1}",
-          canvasText,makeOutput);
-
-DELTAZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"delta_z0","noFitWithStats",rootFiles,nFiles,normaliseHistos)
-DrawPlots(DELTAZ0,outputDir+"/"+"DELTAZ0.png","#Delta(Up-Down) Tracks","number of tracks"
-          ,"#Delta z0 [mm]",0.2,0.90,"#mum",
-          canvasText,makeOutput);
-
-
-
-SIGMAQPTVSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_qOverPtVsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(SIGMAQPTVSPT,outputDir+"/"+"SIGMAQPTVSPT.png","","#sigma(q/p_{T}) [1/GeV]"
-          ,"#p_{T}^{upper} [GeV]",0.4,0.80,"#mum",
-          canvasText,makeOutput,0.60,0.91,True,"SmallLegend");
-
-SIGMAD0VSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"sigma_delta_d0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(SIGMAD0VSPT,outputDir+"/"+"SIGMAD0VSPT.png","","#sigma(d_{0})"
-          ,"#p_{T}^{upper} [GeV]",0.4,0.80,"#mum",
-          canvasText,makeOutput,0.60,0.91,True,"SmallLegend");
-
-## Split track distributions as function of other parameters
-#
-## vs eta
-DELTAD0VSETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_d0VsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAD0VSETA,outputDir+"/"+"DELTAD0VSETA.png","","<#Deltad0(Up-Down Tracks>"
-          ,"#eta^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAZ0VSETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_z0VsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAZ0VSETA,outputDir+"/"+"DELTAZ0VSETA.png","","<#Deltaz0(Up-Down Tracks>"
-          ,"#eta^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAPHI0VSETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_phi0VsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAPHI0VSETA,outputDir+"/"+"DELTAPHI0VSETA.png","","<#Deltaphi0(Up-Down Tracks>"
-          ,"#eta^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAQOVERPTVSETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_qOverPtVsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAQOVERPTVSETA,outputDir+"/"+"DELTAQOVERPTVSETA.png","","<#DeltaqOverPt(Up-Down Tracks>"
-          ,"#eta^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAETA0VSETA = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_eta0VsEta","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAETA0VSETA,outputDir+"/"+"DELTAETA0VSETA.png","","<#Deltaeta0(Up-Down Tracks>"
-          ,"#eta^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-# vs phi
-DELTAD0VSPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_d0VsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAD0VSPHI0,outputDir+"/"+"DELTAD0VSPHI0.png","","<#Deltad0(Up-Down Tracks>"
-          ,"#phi0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAZ0VSPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_z0VsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAZ0VSPHI0,outputDir+"/"+"DELTAZ0VSPHI0.png","","<#Deltaz0(Up-Down Tracks>"
-          ,"#phi0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAPHI0VSPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_phi0VsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAPHI0VSPHI0,outputDir+"/"+"DELTAPHI0VSPHI0.png","","<#Deltaphi0(Up-Down Tracks>"
-          ,"#phi0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAQOVERPTVSPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_qOverPtVsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAQOVERPTVSPHI0,outputDir+"/"+"DELTAQOVERPTVSPHI0.png","","<#DeltaqOverPt(Up-Down Tracks>"
-          ,"#phi0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAETA0VSPHI0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_eta0VsPhi0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAETA0VSPHI0,outputDir+"/"+"DELTAETA0VSPHI0.png","","<#Deltaeta0(Up-Down Tracks>"
-          ,"#phi0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-# vs d0
-DELTAD0VSD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_d0VsD0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAD0VSD0,outputDir+"/"+"DELTAD0VSD0.png","","<#Deltad0(Up-Down Tracks>"
-          ,"#d0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAZ0VSD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_z0VsD0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAZ0VSD0,outputDir+"/"+"DELTAZ0VSD0.png","","<#Deltaz0(Up-Down Tracks>"
-          ,"#d0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAPHI0VSD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_phi0VsD0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAPHI0VSD0,outputDir+"/"+"DELTAPHI0VSD0.png","","<#Deltaphi0(Up-Down Tracks>"
-          ,"#d0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAQOVERPTVSD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_qOverPtVsD0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAQOVERPTVSD0,outputDir+"/"+"DELTAQOVERPTVSD0.png","","<#DeltaqOverPt(Up-Down Tracks>"
-          ,"#d0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAETA0VSD0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_eta0VsD0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAETA0VSD0,outputDir+"/"+"DELTAETA0VSD0.png","","<#Deltaeta0(Up-Down Tracks>"
-          ,"#d0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-
-# vs z0
-DELTAD0VSZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_d0VsZ0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAD0VSZ0,outputDir+"/"+"DELTAD0VSZ0.png","","<#Deltad0(Up-Down Tracks>"
-          ,"#z0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAZ0VSZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_z0VsZ0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAZ0VSZ0,outputDir+"/"+"DELTAZ0VSZ0.png","","<#Deltaz0(Up-Down Tracks>"
-          ,"#z0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAPHI0VSZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_phi0VsZ0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAPHI0VSZ0,outputDir+"/"+"DELTAPHI0VSZ0.png","","<#Deltaphi0(Up-Down Tracks>"
-          ,"#z0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAQOVERPTVSZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_qOverPtVsZ0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAQOVERPTVSZ0,outputDir+"/"+"DELTAQOVERPTVSZ0.png","","<#DeltaqOverPt(Up-Down Tracks>"
-          ,"#z0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAETA0VSZ0 = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_eta0VsZ0","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAETA0VSZ0,outputDir+"/"+"DELTAETA0VSZ0.png","","<#Deltaeta0(Up-Down Tracks>"
-          ,"#z0^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-# vs pT
-DELTAD0VSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_d0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAD0VSPT,outputDir+"/"+"DELTAD0VSPT.png","","<#Deltad0(Up-Down Tracks>"
-          ,"#p_{T}^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAZ0VSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_z0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAZ0VSPT,outputDir+"/"+"DELTAZ0VSPT.png","","<#Deltaz0(Up-Down Tracks>"
-          ,"#p_{T}^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAPHI0VSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_phi0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAPHI0VSPT,outputDir+"/"+"DELTAPHI0VSPT.png","","<#Deltaphi0(Up-Down Tracks>"
-          ,"#p_{T}^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAQOVERPTVSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_qOverPtVsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAQOVERPTVSPT,outputDir+"/"+"DELTAQOVERPTVSPT.png","","<#DeltaqOverPt(Up-Down Tracks>"
-          ,"#p_{T}^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-DELTAETA0VSPT = MakePlots(splitTracksDir,legendTitles,markerColors,markerStyles,"average_delta_eta0VsPt","noFit",rootFiles,nFiles,False)
-DrawPlots(DELTAETA0VSPT,outputDir+"/"+"DELTAETA0VSPT.png","","<#Deltaeta0(Up-Down Tracks>"
-          ,"#p_{T}^{upper}",0.2,0.45,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-
-
-## We draw the curve for positive and negative tracks on top of each other for each file (so files are not compared in this case)
-newLegendTitles = ["Negative Tracks","Positive Tracks"]
-
-# as function of eta
-histogramNames = ["average_delta_d0VsEta_n","average_delta_d0VsEta_p"]
-for i in range(nFiles):
-    DELTAD0VSETA = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAD0VSETA,outputDir+"/"+"DELTAD0VSETA_"+str(i)+".png",legendTitles[i],"<#Deltad0(Up-Down) Tracks>"
-          ,"#eta^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_z0VsEta_n","average_delta_z0VsEta_p"]
-for i in range(nFiles):
-    DELTAZ0VSETA = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAZ0VSETA,outputDir+"/"+"DELTAZ0VSETA_"+str(i)+".png",legendTitles[i],"<#Deltaz0(Up-Down) Tracks>"
-          ,"#eta^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_phi0VsEta_n","average_delta_phi0VsEta_p"]
-for i in range(nFiles):
-    DELTAPHI0VSETA = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAPHI0VSETA,outputDir+"/"+"DELTAPHI0VSETA_"+str(i)+".png",legendTitles[i],"<#Deltaphi0(Up-Down) Tracks>"
-          ,"#eta^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_qOverPtVsEta_n","average_delta_qOverPtVsEta_p"]
-for i in range(nFiles):
-    DELTAQOVERPTVSETA = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAQOVERPTVSETA,outputDir+"/"+"DELTAQOVERPTVSETA_"+str(i)+".png",legendTitles[i],"<#DeltaqOverPt(Up-Down) Tracks>"
-          ,"#eta^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_eta0VsEta_n","average_delta_eta0VsEta_p"]
-for i in range(nFiles):
-    DELTAETA0VSETA = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAETA0VSETA,outputDir+"/"+"DELTAETA0VSETA_"+str(i)+".png",legendTitles[i],"<#Deltaeta0(Up-Down) Tracks>"
-          ,"#eta^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-
-
-# as function of d0
-histogramNames = ["average_delta_d0VsD0_n","average_delta_d0VsD0_p"]
-for i in range(nFiles):
-    DELTAD0VSD0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAD0VSD0,outputDir+"/"+"DELTAD0VSD0_"+str(i)+".png",legendTitles[i],"<#Deltad0(Up-Down) Tracks>"
-          ,"d0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_z0VsD0_n","average_delta_z0VsD0_p"]
-for i in range(nFiles):
-    DELTAZ0VSD0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAZ0VSD0,outputDir+"/"+"DELTAZ0VSD0_"+str(i)+".png",legendTitles[i],"<#Deltaz0(Up-Down) Tracks>"
-          ,"d0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_phi0VsD0_n","average_delta_phi0VsD0_p"]
-for i in range(nFiles):
-    DELTAPHI0VSD0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAPHI0VSD0,outputDir+"/"+"DELTAPHI0VSD0_"+str(i)+".png",legendTitles[i],"<#Deltaphi0(Up-Down) Tracks>"
-          ,"d0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-istogramNames = ["average_delta_qOverPtVsD0_n","average_delta_qOverPtVsD0_p"]
-or i in range(nFiles):
-   DELTAQOVERPTVSD0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-   DrawPlots(DELTAQOVERPTVSD0,outputDir+"/"+"DELTAQOVERPTVSD0_"+str(i)+".png",legendTitles[i],"<#DeltaqOverPt(Up-Down) Tracks>"
-         ,"d0^{upper}",0.2,0.90,"#mum",
-         canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_eta0VsD0_n","average_delta_eta0VsD0_p"]
-for i in range(nFiles):
-    DELTAETA0VSD0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAETA0VSD0,outputDir+"/"+"DELTAETA0VSD0_"+str(i)+".png",legendTitles[i],"<#Deltaeta0(Up-Down) Tracks>"
-          ,"d0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-# as function of z0
-histogramNames = ["average_delta_d0VsZ0_n","average_delta_d0VsZ0_p"]
-for i in range(nFiles):
-    DELTAD0VSZ0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAD0VSZ0,outputDir+"/"+"DELTAD0VSZ0_"+str(i)+".png",legendTitles[i],"<#Deltad0(Up-Down) Tracks>"
-          ,"z0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_z0VsZ0_n","average_delta_z0VsZ0_p"]
-for i in range(nFiles):
-    DELTAZ0VSZ0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAZ0VSZ0,outputDir+"/"+"DELTAZ0VSZ0_"+str(i)+".png",legendTitles[i],"<#Deltaz0(Up-Down) Tracks>"
-          ,"z0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_phi0VsZ0_n","average_delta_phi0VsZ0_p"]
-for i in range(nFiles):
-    DELTAPHI0VSZ0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAPHI0VSZ0,outputDir+"/"+"DELTAPHI0VSZ0_"+str(i)+".png",legendTitles[i],"<#Deltaphi0(Up-Down) Tracks>"
-          ,"z0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-istogramNames = ["average_delta_qOverPtVsZ0_n","average_delta_qOverPtVsZ0_p"]
-or i in range(nFiles):
-   DELTAQOVERPTVSZ0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-   DrawPlots(DELTAQOVERPTVSZ0,outputDir+"/"+"DELTAQOVERPTVSZ0_"+str(i)+".png",legendTitles[i],"<#DeltaqOverPt(Up-Down) Tracks>"
-         ,"z0^{upper}",0.2,0.90,"#mum",
-         canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_eta0VsZ0_n","average_delta_eta0VsZ0_p"]
-for i in range(nFiles):
-    DELTAETA0VSZ0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAETA0VSZ0,outputDir+"/"+"DELTAETA0VSZ0_"+str(i)+".png",legendTitles[i],"<#Deltaeta0(Up-Down) Tracks>"
-          ,"z0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-# as function of pT
-histogramNames = ["average_delta_d0VsPt_n","average_delta_d0VsPt_p"]
-for i in range(nFiles):
-    DELTAD0VSPT = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAD0VSPT,outputDir+"/"+"DELTAD0VSPT_"+str(i)+".png",legendTitles[i],"<#Deltad0(Up-Down) Tracks>"
-          ,"p_{T}^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_z0VsPt_n","average_delta_z0VsPt_p"]
-for i in range(nFiles):
-    DELTAZ0VSPT = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAZ0VSPT,outputDir+"/"+"DELTAZ0VSPT_"+str(i)+".png",legendTitles[i],"<#Deltaz0(Up-Down) Tracks>"
-          ,"p_{T}^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_phi0VsPt_n","average_delta_phi0VsPt_p"]
-for i in range(nFiles):
-    DELTAPHI0VSPT = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAPHI0VSPT,outputDir+"/"+"DELTAPHI0VSPT_"+str(i)+".png",legendTitles[i],"<#Deltaphi0(Up-Down) Tracks>"
-          ,"p_{T}^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-istogramNames = ["average_delta_qOverPtVsPt_n","average_delta_qOverPtVsPt_p"]
-or i in range(nFiles):
-   DELTAQOVERPTVSPT = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-   DrawPlots(DELTAQOVERPTVSPT,outputDir+"/"+"DELTAQOVERPTVSPT_"+str(i)+".png",legendTitles[i],"<#DeltaqOverPt(Up-Down) Tracks>"
-         ,"p_{T}^{upper}",0.2,0.90,"#mum",
-         canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_eta0VsPt_n","average_delta_eta0VsPt_p"]
-for i in range(nFiles):
-    DELTAETA0VSPT = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAETA0VSPT,outputDir+"/"+"DELTAETA0VSPT_"+str(i)+".png",legendTitles[i],"<#Deltaeta0(Up-Down) Tracks>"
-          ,"p_{T}^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-
-# as function of phi0
-histogramNames = ["average_delta_d0VsPhi0_n","average_delta_d0VsPhi0_p"]
-for i in range(nFiles):
-    DELTAD0VSPHI0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAD0VSPHI0,outputDir+"/"+"DELTAD0VSPHI0_"+str(i)+".png",legendTitles[i],"<#Deltad0(Up-Down) Tracks>"
-          ,"phi0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_z0VsPhi0_n","average_delta_z0VsPhi0_p"]
-for i in range(nFiles):
-    DELTAZ0VSPHI0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAZ0VSPHI0,outputDir+"/"+"DELTAZ0VSPHI0_"+str(i)+".png",legendTitles[i],"<#Deltaz0(Up-Down) Tracks>"
-          ,"phi0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_phi0VsPhi0_n","average_delta_phi0VsPhi0_p"]
-for i in range(nFiles):
-    DELTAPHI0VSPHI0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAPHI0VSPHI0,outputDir+"/"+"DELTAPHI0VSPHI0_"+str(i)+".png",legendTitles[i],"<#Deltaphi0(Up-Down) Tracks>"
-          ,"phi0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_qOverPtVsPhi0_n","average_delta_qOverPtVsPhi0_p"]
-for i in range(nFiles):
-    DELTAQOVERPTVSPHI0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAQOVERPTVSPHI0,outputDir+"/"+"DELTAQOVERPTVSPHI0_"+str(i)+".png",legendTitles[i],"<#DeltaqOverPt(Up-Down) Tracks>"
-          ,"phi0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
-
-histogramNames = ["average_delta_eta0VsPhi0_n","average_delta_eta0VsPhi0_p"]
-for i in range(nFiles):
-    DELTAETA0VSPHI0 = MakeTwoPlotsFromSameFile(splitTracksDir,newLegendTitles,markerColors,markerStyles,histogramNames,"noFit",rootFiles,i,False)
-    DrawPlots(DELTAETA0VSPHI0,outputDir+"/"+"DELTAETA0VSPHI0_"+str(i)+".png",legendTitles[i],"<#Deltaeta0(Up-Down) Tracks>"
-          ,"phi0^{upper}",0.2,0.90,"#mum",
-          canvasText,makeOutput,0.60,0.91,False,"SmallLegend");
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 80d322fefe69eb43d48d66708320da3924149e77..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/makeMonitoringPlots_HandsOn.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeMonitoringPlots_HandsOn.py
deleted file mode 100644
index df20f43c114f224d72a74c23de7f49fafe04a12e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/makeMonitoringPlots_HandsOn.py
+++ /dev/null
@@ -1,38 +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 = ["",   #Put here the cosmic sample
-                 "",   #Put here the collision sample
-                 "",
-                 "",
-                 ""
-                 ]
-
-
-
-# this sets the output directory where plot gifs will be saved. REMEMBER TO CREATE THE DIRECTORY
-outputDir = "HandsOn" #Change this name if you want
-
-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
-
-#Example on how to fill the residualsDir. Watch out for the order. It must respect the inputFiles order
-residualsDir = ["/IDAlignMon/CombinedInDetTracks_alignSelection/Residuals/",
-                "/IDAlignMon/ExtendedTracks_alignSelection/Residuals/"]
-
-genericTracksDir = [] #You have to fill this
-hitEffDir=[] #You have to fill this
-
-#following array determines ROOT file directory from which TRT residual plots are taken
-#for each of the (up to) 4 files
-
- 
-    
-
-#following array determines ROOT file directory from which the BeamSpot plots are taken
-#for each of the (up to) 4 files
-markerStyles = [kOpenCircle,kFullCircle,kOpenSquare, kFullSquare] #determines marker styles for plots
-markerColors = [kRed,kBlue,kBlack,kBlack] #determines marker colors for plots
-legendTitles = ["","","",""] #determines legend titles
-canvasText = [","","",""] #specifies additional canvas text
-##----------------------------
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/myTopOptions_runReco.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/myTopOptions_runReco.py
deleted file mode 100644
index cae154921c5f2eb8f0e3edb7764bd28403011a59..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/myTopOptions_runReco.py
+++ /dev/null
@@ -1,309 +0,0 @@
-#example of personal topOptions
-#
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-
-# will use list of input files if filelist is defined
-# otherwise will use a castorDataSet if defined
-# otherwise will use file defined by dataPath + fileName (see defaults below)
-
-
-
-if 'fileList' in dir():
-    print "BDC: fileList = ",fileList
-
-if 'castorDataSet' in dir():
-    print "BDC: castorDataSet = ",castorDataSet
-    
-if 'dataPath' in dir():
-    print "BDC: dataPath = ",dataPath
-else:
-    dataPath = '/afs/cern.ch/atlas/www/GROUPS/DATAPREPARATION/DataSkims/Zmumu/user.varoucas.data10_7TeV.periodD4.physics_MuonswBeam.PhysCont.ZtomumuSkim.ESD.t0repro04_v01.cern/'
-    if not 'fileList' in dir():
-        print "BDC: setting dataPath to: ",dataPath
-    
-if 'fileName' in dir():
-    print "BDC: fileName = ",fileName
-else:
-    fileName = 'user.varoucas.data10_7TeV.periodD4.physics_MuonswBeam.PhysCont.ZtomumuSkim.ESD.t0repro04_v01.cern.ESD._00001.pool.root'
-    if not 'fileList' in dir():
-        print "BDC: setting fileName to: ",fileName
-    
-if 'nEvents' in dir():
-    print "BDC: nEvents = ",nEvents
-else:
-    nEvents = -1
-    print "BDC: setting nEvents to: ",nEvents
-
-if 'runReco' in dir():
-    print "BDC: runReco = ",runReco
-else:
-    runReco = False
-    print "BDC: setting runReco to: ",runReco
-
-if 'cosmicData' in dir():
-    print "BDC: cosmicData = ",cosmicData
-else:
-    cosmicData = False
-    print "BDC: setting cosmicData to: ",cosmicData
-
-if 'IDRecoOnly' in dir():
-    print "BDC: IDRecoOnly = ",IDRecoOnly
-else:
-    IDRecoOnly = False
-    print "BDC: setting IDRecoOnly to: ",IDRecoOnly    
-
-# if we don't specify the alignment tags then these do not get overridden in reco
-if 'siAlignTag' in dir():
-    print "BDC: siAlignTag = ",siAlignTag
-if 'trtAlignTag' in dir():    
-    print "BDC: trtAlignTag = ",trtAlignTag
-if 'esTag' in dir():    
-    print "BDC: esTag = ",esTag
-
-if 'rootAlignFile' in dir():
-    print "BDC: rootAlignFile = ",rootAlignFile
-
-if 'goodRunList' in dir():
-    print "BDC: goodRunList = ",goodRunList
-else :
-    goodRunList = ''
-
-if 'goodRunListArray' in dir():
-    print "BDC: goodRunListArray = ",goodRunListArray
-
-if 'applyReweight' in dir():
-    InDetAlignMonDoReweight = applyReweight
-    print "BDC: applyReweight = ", applyReweight
-else :
-    InDetAlignMonDoReweight = False
-    print "BDC: applyReweight = ", InDetAlignMonDoReweight
-
-if 'runOnESD' in dir():
-    InDetAlignMonRunOnESD = runOnESD
-    print "BDC: runOnESD = ", InDetAlignMonRunOnESD
-else :
-    InDetAlignMonRunOnESD = False
-    print "BDC: runOnESD = ", InDetAlignMonRunOnESD
-    
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-
-
-#set input file. Note that this triggers autoconfiguration automatically (see RecExCommonAutoConfiguration wiki)
-# here a MC RDO is specified, but this can also be a data BS, an ESD AOD or TAG
-if athenaCommonFlags.FilesInput.isDefault(): # check if not already set upstream
-    #athenaCommonFlags.FilesInput=["/tmp/bdcooper/CosmicsBField_160387_00.ESD.root"] # on lxplus304
-    #athenaCommonFlags.FilesInput=["/castor/cern.ch/user/a/atlidali/calibration_IDTracks/Collision_160472_19.ESD.root"]
-
-    if 'fileList' in dir() and fileList!='':
-        include(fileList)
-    elif 'castorDataSet' in dir() and castorDataSet!='':
-        include("castorDataSets.py")
-    elif "castor" in dataPath:
-        athenaCommonFlags.FilesInput=[dataPath + fileName] #castor files has to be run on like this
-    else:
-        DATAPATH = dataPath # with this method the fileName can include a wildcard e.g. '*.root'
-        from glob import glob # however, this won't work on castor (wildcards don't work on castor)
-        INPUT = glob(DATAPATH + fileName)
-        print INPUT
-        athenaCommonFlags.FilesInput = INPUT
-
-athenaCommonFlags.EvtMax=nEvents  # number of events to process run on all file
-
-
-
-# switch on detectors
-rec.doForwardDet=True
-rec.doInDet=True
-rec.doCalo=True
-rec.doMuon=True
-
-if runReco and IDRecoOnly:
-    #these settings mean only ID reconstruction is done
-    rec.doForwardDet=False
-    rec.doInDet=True
-    rec.doMuon=False
-    rec.doCalo=False
-    rec.doEgamma=False
-    rec.doMuonCombined=False
-    rec.doJetMissingETTag=False
-    rec.doTau=False
-   
-#need some special settings for cosmics
-if cosmicData:
-    if runReco==False:
-        #if we are looking at cosmics we don't care about the other detectors
-        rec.doForwardDet=False
-        rec.doCalo=False
-        rec.doMuon=False
-
-if runReco and IDRecoOnly or cosmicData:        
-    rec.doTrigger = False; recAlgs.doTrigger=False
-
-
-# autoconfiguration might trigger undesired feature
-rec.doESD.set_Value_and_Lock(runReco) # uncomment if do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG
-rec.doCBNT.set_Value_and_Lock(False) # uncomment if do not make CBNT
-
-# to enable monitoring that works on ESDs (i.e. InDetPerformanceMonitoring)
-rec.doMonitoring.set_Value_and_Lock(True)
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0ESD')#produces run directories
-DQMonFlags.monManEnvironment.set_Value_and_Lock('user')#doesn't produce run directories
-
-DQMonFlags.doInDetAlignMon.set_Value_and_Lock(True)
-
-#disable all monitoring other than alignment (too susceptible to crashes)
-DQMonFlags.doPixelMon.set_Value_and_Lock(False)
-DQMonFlags.doSCTMon.set_Value_and_Lock(False)
-DQMonFlags.doTRTMon.set_Value_and_Lock(False)
-DQMonFlags.doInDetGlobalMon.set_Value_and_Lock(False)
-DQMonFlags.doGlobalMon.set_Value_and_Lock(False)
-DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False)
-DQMonFlags.doCTPMon.set_Value_and_Lock(False)
-DQMonFlags.doHLTMon.set_Value_and_Lock(False)
-DQMonFlags.doTRTElectronMon.set_Value_and_Lock(False)
-DQMonFlags.doTileMon.set_Value_and_Lock(False)
-DQMonFlags.doLArMon.set_Value_and_Lock(False)
-DQMonFlags.doCaloMon.set_Value_and_Lock(False)
-DQMonFlags.doEgammaMon.set_Value_and_Lock(False)
-DQMonFlags.doMissingEtMon.set_Value_and_Lock(False)
-DQMonFlags.doJetMon.set_Value_and_Lock(False)
-DQMonFlags.doTauMon.set_Value_and_Lock(False)
-DQMonFlags.doJetTagMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonRawMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonSegmentMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonTrackMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonAlignMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonPhysicsMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonCombinedMon.set_Value_and_Lock(False)
-DQMonFlags.doLucidMon.set_Value_and_Lock(False)
-
-if IDRecoOnly:
-    DQMonFlags.doInDetPerfMon.set_Value_and_Lock(False)#makes no sense to run PerfMon if ID only reco
-    
-if cosmicData: 
-    DQMonFlags.doInDetPerfMon.set_Value_and_Lock(False)#makes no sense to run PerfMon on cosmics
-    from AthenaCommon.BeamFlags import jobproperties
-    jobproperties.Beam.beamType.set_Value_and_Lock("cosmics")#needed so that monitoring runs with cosmic configuration
-
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doStatistics.set_Value_and_Lock(False)
-InDetFlags.doNewTracking.set_Value_and_Lock(True)
-#InDetFlags.doSlimming.set_Value_and_Lock(False)
-#InDetFlags.doSiSPSeededTrackFinder.set_Value_and_Lock(True)
-
-if  InDetAlignMonRunOnESD :
-    InDetFlags.doPRDFormation.set_Value_and_Lock(False)
-else :
-    InDetFlags.doPRDFormation.set_Value_and_Lock(True)
-
-
-#print "PP PP PP PP   Config"
-#InDetNewTrackingCuts      = ConfiguredNewTrackingCuts("Offline")
-#InDetNewTrackingCuts.printInfo()
-
-if not InDetAlignMonRunOnESD :
-    from AthenaCommon.GlobalFlags import globalflags
-    globalflags.ConditionsTag.set_Value_and_Lock( 'COMCOND-BLKPST-004-07' ) 
-
-
-#main jobOptions
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-
-
-if not InDetAlignMonRunOnESD :
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-
-addLumiBlockTools = False
-if InDetAlignMonRunOnESD :
-    if not 'IS_SIMULATION' in inputFileSummary['evt_type'] and 'goodRunList' in dir() and goodRunList!='' and 'goodRunListArray' in dir() and goodRunListArray!='':
-        addLumiBlockTools = True
-else :
-    if goodRunList!='' and 'goodRunListArray' in dir() and goodRunListArray!='':
-        addLumiBlockTools = True
-    
-if  addLumiBlockTools :
-    # add LumiBlockMetaDataTool to ToolSvc and configure
-    from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
-    ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
-    LumiBlockMetaDataTool.calcLumi = False # False by default
-    LumiBlockMetaDataTool.storeXMLFiles = True
-    LumiBlockMetaDataTool.applyDQCuts = True
-    LumiBlockMetaDataTool.OutputLevel = INFO
-
-    # add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
-    svcMgr += MetaDataSvc( "MetaDataSvc" )
-    svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
-
-    # Configure the goodrunslist selector tool
-    from GoodRunsLists.GoodRunsListsConf import *
-    ToolSvc += GoodRunsListSelectorTool() 
-    GoodRunsListSelectorTool.OutputLevel = INFO
-    GoodRunsListSelectorTool.GoodRunsListVec = [ goodRunList ] 
-    GoodRunsListSelectorTool.PassThrough = False
-    
-    # This Athena job consists of algorithms that loop over events;
-    # here, the (default) top sequence is used:
-    from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-    job = AlgSequence()
-    seq = AthSequencer("AthFilterSeq")
-
-    from GoodRunsListsUser.GoodRunsListsUserConf import *
-    seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-    # In the next line, pick up correct name from inside xml file!
-    seq.GRLTriggerAlg1.GoodRunsListArray = [ goodRunListArray ]
-
-if InDetAlignMonRunOnESD :
-    if cosmicData and not 'IS_SIMULATION' in inputFileSummary['evt_type']:
-            #apply the TRT cosmics calibrations to cosmics data runs
-        conddb.addOverride('/TRT/Calib/T0','TrtCalibT0-AlignmentJune2010-00') 
-        conddb.addOverride('/TRT/Calib/RT','TrtCalibRt-AlignmentJune2010-00') 
-else :
-    if cosmicData:
-        conddb.addOverride('/TRT/Calib/T0','TrtCalibT0-AlignmentJune2010-00') 
-        conddb.addOverride('/TRT/Calib/RT','TrtCalibRt-AlignmentJune2010-00') 
-
-# use alignment constants specified in pool.root file if specified
-# pool.root file needs to be inserted into PoolFileCatalog
-if 'rootAlignFile' in dir() and rootAlignFile!='':
-        print "BDC: using pool.root file alignment constants"
-        conddb.blockFolder("/Indet/Align")
-        conddb.blockFolder("/TRT/Align")
-        from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-        from AthenaCommon.AppMgr import ServiceMgr
-        ServiceMgr += CondProxyProvider()
-        ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-        ServiceMgr.CondProxyProvider.InputCollections += [ rootAlignFile ]
-        ServiceMgr.CondProxyProvider.OutputLevel=INFO
-        print ServiceMgr.CondProxyProvider
-        ServiceMgr.IOVSvc.preLoadData=True 
-
-# overriding alignment constants if specified
-if 'siAlignTag' in dir() and siAlignTag!='':
-    conddb.addOverride('/Indet/Align', siAlignTag)
-
-if 'trtAlignTag' in dir() and trtAlignTag!='':
-    conddb.addOverride('/TRT/Align', trtAlignTag)
-
-if 'trtCalibTag' in dir() and trtCalibTag!='':
-    conddb.addOverride('/TRT/Calib/DX', trtCalibTag)
-
-if 'esTag' in dir() and esTag!='':    
-    conddb.addOverride('/Indet/TrkErrorScaling', esTag)
-
-
-# user modifier of properties should come here
-#topSequence.myAlg.someProperty=3.14
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/myTopOptions_runRecoRAW.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/myTopOptions_runRecoRAW.py
deleted file mode 100644
index a731e61dddca36141c0ad9d74b85ea4a9ab067a1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/myTopOptions_runRecoRAW.py
+++ /dev/null
@@ -1,279 +0,0 @@
-#example of personal topOptions
-#
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-
-# will use list of input files if filelist is defined
-# otherwise will use a castorDataSet if defined
-# otherwise will use file defined by dataPath + fileName (see defaults below)
-
-
-
-if 'fileList' in dir():
-    print "BDC: fileList = ",fileList
-
-if 'castorDataSet' in dir():
-    print "BDC: castorDataSet = ",castorDataSet
-    
-if 'dataPath' in dir():
-    print "BDC: dataPath = ",dataPath
-else:
-    dataPath = '/afs/cern.ch/atlas/www/GROUPS/DATAPREPARATION/DataSkims/Zmumu/user.varoucas.data10_7TeV.periodD4.physics_MuonswBeam.PhysCont.ZtomumuSkim.ESD.t0repro04_v01.cern/'
-    if not 'fileList' in dir():
-        print "BDC: setting dataPath to: ",dataPath
-    
-if 'fileName' in dir():
-    print "BDC: fileName = ",fileName
-else:
-    fileName = 'user.varoucas.data10_7TeV.periodD4.physics_MuonswBeam.PhysCont.ZtomumuSkim.ESD.t0repro04_v01.cern.ESD._00001.pool.root'
-    if not 'fileList' in dir():
-        print "BDC: setting fileName to: ",fileName
-    
-if 'nEvents' in dir():
-    print "BDC: nEvents = ",nEvents
-else:
-    nEvents = -1
-    print "BDC: setting nEvents to: ",nEvents
-
-if 'runReco' in dir():
-    print "BDC: runReco = ",runReco
-else:
-    runReco = False
-    print "BDC: setting runReco to: ",runReco
-
-if 'cosmicData' in dir():
-    print "BDC: cosmicData = ",cosmicData
-else:
-    cosmicData = False
-    print "BDC: setting cosmicData to: ",cosmicData
-
-if 'IDRecoOnly' in dir():
-    print "BDC: IDRecoOnly = ",IDRecoOnly
-else:
-    IDRecoOnly = False
-    print "BDC: setting IDRecoOnly to: ",IDRecoOnly    
-
-# if we don't specify the alignment tags then these do not get overridden in reco
-if 'siAlignTag' in dir():
-    print "BDC: siAlignTag = ",siAlignTag
-if 'trtAlignTag' in dir():    
-    print "BDC: trtAlignTag = ",trtAlignTag
-if 'esTag' in dir():    
-    print "BDC: esTag = ",esTag
-
-if 'rootAlignFile' in dir():
-    print "BDC: rootAlignFile = ",rootAlignFile
-
-if 'goodRunList' in dir():
-    print "BDC: goodRunList = ",goodRunList
-else :
-    goodRunList = ''
-if 'goodRunListArray' in dir():
-    print "BDC: goodRunListArray = ",goodRunListArray
-
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-
-
-
-
-#set input file. Note that this triggers autoconfiguration automatically (see RecExCommonAutoConfiguration wiki)
-# here a MC RDO is specified, but this can also be a data BS, an ESD AOD or TAG
-if athenaCommonFlags.FilesInput.isDefault(): # check if not already set upstream
-    #athenaCommonFlags.FilesInput=["/tmp/bdcooper/CosmicsBField_160387_00.ESD.root"] # on lxplus304
-    #athenaCommonFlags.FilesInput=["/castor/cern.ch/user/a/atlidali/calibration_IDTracks/Collision_160472_19.ESD.root"]
-
-    if 'fileList' in dir() and fileList!='':
-        include(fileList)
-    elif 'castorDataSet' in dir() and castorDataSet!='':
-        include("castorDataSets.py")
-    elif "castor" in dataPath:
-        athenaCommonFlags.FilesInput=[dataPath + fileName] #castor files has to be run on like this
-    else:
-        DATAPATH = dataPath # with this method the fileName can include a wildcard e.g. '*.root'
-        from glob import glob # however, this won't work on castor (wildcards don't work on castor)
-        INPUT = glob(DATAPATH + fileName)
-        print INPUT
-        athenaCommonFlags.FilesInput = INPUT
-
-athenaCommonFlags.EvtMax=nEvents  # number of events to process run on all file
-
-
-
-# switch on detectors
-rec.doForwardDet=True
-rec.doInDet=True
-rec.doCalo=True
-rec.doMuon=True
-
-if runReco and IDRecoOnly:
-    #these settings mean only ID reconstruction is done
-    rec.doForwardDet=False
-    rec.doInDet=True
-    rec.doMuon=False
-    rec.doCalo=False
-    rec.doEgamma=False
-    rec.doMuonCombined=False
-    rec.doJetMissingETTag=False
-    rec.doTau=False
-   
-#need some special settings for cosmics
-if cosmicData:
-    if runReco==False:
-        #if we are looking at cosmics we don't care about the other detectors
-        rec.doForwardDet=False
-        rec.doCalo=False
-        rec.doMuon=False
-
-if runReco and IDRecoOnly or cosmicData:        
-    rec.doTrigger = False; recAlgs.doTrigger=False
-
-
-# autoconfiguration might trigger undesired feature
-rec.doESD.set_Value_and_Lock(runReco) # uncomment if do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG
-rec.doCBNT.set_Value_and_Lock(False) # uncomment if do not make CBNT
-
-# to enable monitoring that works on ESDs (i.e. InDetPerformanceMonitoring)
-rec.doMonitoring.set_Value_and_Lock(True)
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0ESD')#produces run directories
-DQMonFlags.monManEnvironment.set_Value_and_Lock('user')#doesn't produce run directories
-
-DQMonFlags.doInDetAlignMon.set_Value_and_Lock(True)
-
-#disable all monitoring other than alignment (too susceptible to crashes)
-DQMonFlags.doPixelMon.set_Value_and_Lock(False)
-DQMonFlags.doSCTMon.set_Value_and_Lock(False)
-DQMonFlags.doTRTMon.set_Value_and_Lock(False)
-DQMonFlags.doInDetGlobalMon.set_Value_and_Lock(False)
-DQMonFlags.doGlobalMon.set_Value_and_Lock(False)
-DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False)
-DQMonFlags.doCTPMon.set_Value_and_Lock(False)
-DQMonFlags.doHLTMon.set_Value_and_Lock(False)
-DQMonFlags.doTRTElectronMon.set_Value_and_Lock(False)
-DQMonFlags.doTileMon.set_Value_and_Lock(False)
-DQMonFlags.doLArMon.set_Value_and_Lock(False)
-DQMonFlags.doCaloMon.set_Value_and_Lock(False)
-DQMonFlags.doEgammaMon.set_Value_and_Lock(False)
-DQMonFlags.doMissingEtMon.set_Value_and_Lock(False)
-DQMonFlags.doJetMon.set_Value_and_Lock(False)
-DQMonFlags.doTauMon.set_Value_and_Lock(False)
-DQMonFlags.doJetTagMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonRawMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonSegmentMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonTrackMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonAlignMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonPhysicsMon.set_Value_and_Lock(False)
-DQMonFlags.doMuonCombinedMon.set_Value_and_Lock(False)
-DQMonFlags.doLucidMon.set_Value_and_Lock(False)
-
-if IDRecoOnly:
-    DQMonFlags.doInDetPerfMon.set_Value_and_Lock(False)#makes no sense to run PerfMon if ID only reco
-    
-if cosmicData: 
-    DQMonFlags.doInDetPerfMon.set_Value_and_Lock(False)#makes no sense to run PerfMon on cosmics
-    from AthenaCommon.BeamFlags import jobproperties
-    jobproperties.Beam.beamType.set_Value_and_Lock("cosmics")#needed so that monitoring runs with cosmic configuration
-
-from AthenaCommon.DetFlags import DetFlags
-DetFlags.ID_setOn()
-
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doStatistics.set_Value_and_Lock(False)
-InDetFlags.doNewTracking.set_Value_and_Lock(True)
-#InDetFlags.doSlimming.set_Value_and_Lock(False)
-#InDetFlags.doSiSPSeededTrackFinder.set_Value_and_Lock(True)
-InDetFlags.doPRDFormation.set_Value_and_Lock(True)
-
-#print "PP PP PP PP   Config"
-#InDetNewTrackingCuts      = ConfiguredNewTrackingCuts("Offline")
-#InDetNewTrackingCuts.printInfo()
-
-from AthenaCommon.GlobalFlags import globalflags
-globalflags.ConditionsTag.set_Value_and_Lock( 'COMCOND-BLKPST-004-07' ) 
-
-#main jobOptions
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-
-print "PPPPP   "+ globalflags.ConditionsTag()
-conddb.setGlobalTag(globalflags.ConditionsTag())
-
-
-if goodRunList!='' and 'goodRunListArray' in dir() and goodRunListArray!='':
-    
-    # add LumiBlockMetaDataTool to ToolSvc and configure
-    from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
-    ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
-    LumiBlockMetaDataTool.calcLumi = False # False by default
-    LumiBlockMetaDataTool.storeXMLFiles = True
-    LumiBlockMetaDataTool.applyDQCuts = True
-    LumiBlockMetaDataTool.OutputLevel = INFO
-
-    # add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
-    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
-    svcMgr += MetaDataSvc( "MetaDataSvc" )
-    svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
-
-    # Configure the goodrunslist selector tool
-    from GoodRunsLists.GoodRunsListsConf import *
-    ToolSvc += GoodRunsListSelectorTool() 
-    GoodRunsListSelectorTool.OutputLevel = INFO
-    GoodRunsListSelectorTool.GoodRunsListVec = [ goodRunList ] 
-    GoodRunsListSelectorTool.PassThrough = False
-    
-    # This Athena job consists of algorithms that loop over events;
-    # here, the (default) top sequence is used:
-    from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-    job = AlgSequence()
-    seq = AthSequencer("AthFilterSeq")
-
-    from GoodRunsListsUser.GoodRunsListsUserConf import *
-    seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-    # In the next line, pick up correct name from inside xml file!
-    seq.GRLTriggerAlg1.GoodRunsListArray = [ goodRunListArray ]
-
-
-if cosmicData:
-    #apply the TRT cosmics calibrations to cosmics data runs
-    conddb.addOverride('/TRT/Calib/T0','TrtCalibT0-AlignmentJune2010-00') 
-    conddb.addOverride('/TRT/Calib/RT','TrtCalibRt-AlignmentJune2010-00') 
-
-# use alignment constants specified in pool.root file if specified
-# pool.root file needs to be inserted into PoolFileCatalog
-if 'rootAlignFile' in dir() and rootAlignFile!='':
-        print "BDC: using pool.root file alignment constants"
-        conddb.blockFolder("/Indet/Align")
-        conddb.blockFolder("/TRT/Align")
-        from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-        from AthenaCommon.AppMgr import ServiceMgr
-        ServiceMgr += CondProxyProvider()
-        ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-        ServiceMgr.CondProxyProvider.InputCollections += [ rootAlignFile ]
-        ServiceMgr.CondProxyProvider.OutputLevel=INFO
-        print ServiceMgr.CondProxyProvider
-        ServiceMgr.IOVSvc.preLoadData=True 
-
-# overriding alignment constants if specified
-if 'siAlignTag' in dir() and siAlignTag!='':
-    conddb.addOverride('/Indet/Align', siAlignTag)
-
-if 'trtAlignTag' in dir() and trtAlignTag!='':
-    conddb.addOverride('/TRT/Align', trtAlignTag)
-
-if 'trtCalibTag' in dir() and trtCalibTag!='':
-    conddb.addOverride('/TRT/Calib/DX', trtCalibTag)
-
-if 'esTag' in dir() and esTag!='':    
-    conddb.addOverride('/Indet/TrkErrorScaling', esTag)
-
-
-# user modifier of properties should come here
-#topSequence.myAlg.someProperty=3.14
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
index 32114ec887645de25bdf890860259613ace12cbc..e4fe1ee2b5b22a02ec20f1c1b143d1677b9033a2 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
@@ -63,7 +63,7 @@
 #include "TrackSelectionTool.h"
 #include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h"
 
-#include "InDetReadoutGeometry/PixelDetectorManager.h"                    
+#include "InDetReadoutGeometry/PixelDetectorManager.h"
 #include "InDetReadoutGeometry/SCT_DetectorManager.h"
 
 // *********************************************************************
@@ -72,17 +72,17 @@
 
 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 
+  (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;
 
@@ -102,14 +102,14 @@ struct IDAlignMonEfficiencies::TRTBarrelHistograms{
   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 
+  /** 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 = 0;
     outliers_vs_StrawLay = 0;
     hits_vs_StrawLay = 0;
@@ -117,7 +117,7 @@ struct IDAlignMonEfficiencies::TRTBarrelHistograms{
     outliers_eff_vs_StrawLay = 0;
     hits_eff_vs_StrawLay = 0;
     tubeHits_eff_vs_StrawLay = 0;
-    
+
     for(unsigned int lay=0; lay<3; ++lay){
       totHits_vs_phiSector[lay] = 0;
       outliers_vs_phiSector[lay] =0;
@@ -130,8 +130,8 @@ struct IDAlignMonEfficiencies::TRTBarrelHistograms{
 
 
     }
-    
-  
+
+
   };
 
 };
@@ -164,9 +164,9 @@ struct IDAlignMonEfficiencies::TRTEndcapHistograms{
   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] = 0;
       outliers_vs_ring[side] = 0;
@@ -175,7 +175,7 @@ struct IDAlignMonEfficiencies::TRTEndcapHistograms{
       outliers_eff_vs_ring[side] = 0;
       hits_eff_vs_ring[side] = 0;
       tubeHits_eff_vs_ring[side] = 0;
-      
+
       totHits_vs_phiSector[side] = 0;
       outliers_vs_phiSector[side] = 0;
       hits_vs_phiSector[side] = 0;
@@ -184,7 +184,7 @@ struct IDAlignMonEfficiencies::TRTEndcapHistograms{
       hits_eff_vs_phiSector[side] = 0;
       tubeHits_eff_vs_phiSector[side] = 0;
     }
-    
+
   };
 
 };
@@ -214,7 +214,7 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const
   m_hitQualityTool = ToolHandle<IInDetAlignHitQualSelTool>("");
   m_holeSearchTool = ToolHandle<Trk::ITrackHoleSearchTool>("InDetHoleSearchTool");
   m_trackSumTool        = ToolHandle<Trk::ITrackSummaryTool>("Trk::TrackSummaryTool/InDetTrackSummaryTool");
-    
+
   m_tracksName = "ExtendedTracks";
   m_minSiliconEffWindow = 0.8;
   m_maxSiliconEffWindow = 1.05;
@@ -222,9 +222,10 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const
   m_doHoleSearch = true;
   m_extendedPlots= false;
   m_mapSplit=1;
+  m_useLowStat = true;
 
   InitializeHistograms();
-  
+
   declareProperty("tracksName"             , m_tracksName);
   declareProperty("CheckRate"              , m_checkrate=1000);
   declareProperty("HoleSearch"             , m_holeSearchTool);
@@ -240,17 +241,18 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const
   declareProperty("trackSumTool"           , m_trackSumTool);
   declareProperty("NSplitMap"              , m_mapSplit);
   declareProperty("useExtendedPlots"       , m_extendedPlots);
+  declareProperty("useLowStat"             , m_useLowStat);
 }
 
 
-IDAlignMonEfficiencies::~IDAlignMonEfficiencies() { 
+IDAlignMonEfficiencies::~IDAlignMonEfficiencies() {
   delete m_trt_b_hist;
   delete m_trt_ec_hist;
 }
 
 void IDAlignMonEfficiencies::InitializeHistograms()
 {
-  
+
   m_hits_vs_layer_barrel = 0;
   m_hits_vs_layer_eca = 0;
   m_hits_vs_layer_ecc = 0;
@@ -262,11 +264,11 @@ void IDAlignMonEfficiencies::InitializeHistograms()
   m_outliers_vs_layer_barrel = 0;
   m_outliers_vs_layer_eca = 0;
   m_outliers_vs_layer_ecc = 0;
-  
+
   m_holes_vs_layer_barrel = 0;
   m_holes_vs_layer_eca = 0;
   m_holes_vs_layer_ecc = 0;
-  
+
   m_noholes_vs_layer_barrel = 0;
   m_noholes_vs_layer_eca = 0;
   m_noholes_vs_layer_ecc = 0;
@@ -285,11 +287,11 @@ void IDAlignMonEfficiencies::InitializeHistograms()
   m_outliers_eff_vs_layer_barrel = 0;
   m_outliers_eff_vs_layer_eca = 0;
   m_outliers_eff_vs_layer_ecc = 0;
-  
+
   m_holes_eff_vs_layer_barrel = 0;
   m_holes_eff_vs_layer_eca = 0;
   m_holes_eff_vs_layer_ecc = 0;
-  
+
   m_noholes_eff_vs_layer_barrel = 0;
   m_noholes_eff_vs_layer_eca = 0;
   m_noholes_eff_vs_layer_ecc = 0;
@@ -332,7 +334,7 @@ void IDAlignMonEfficiencies::InitializeHistograms()
 
 StatusCode IDAlignMonEfficiencies::initialize()
 {
-  StatusCode sc; 
+  StatusCode sc;
 
   m_events=0;
   m_histosBooked = 0;
@@ -340,92 +342,92 @@ StatusCode IDAlignMonEfficiencies::initialize()
   //ID Helper
   sc = detStore()->retrieve(m_idHelper, "AtlasID" );
   if (sc.isFailure()) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endreq;
+    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" << endreq;
+    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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
-  //SCT Manager 
-  
+  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 !" << endreq;
+    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" << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTManager" << endmsg;
 
 
   if ( m_holeSearchTool.retrieve().isFailure() ) {
-    msg(MSG::WARNING) << "Failed to retrieve tool " << m_holeSearchTool << endreq;
+    msg(MSG::WARNING) << "Failed to retrieve tool " << m_holeSearchTool << endmsg;
     return StatusCode::SUCCESS;
   } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_holeSearchTool << endreq;
+    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 << endreq;
+    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 << endreq;
-  }                                  
- 
+    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!" << endreq;
+    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) << 
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
       "No hit quality tool configured - not hit quality cuts will be imposed"
-	<< endreq;
+	<< 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) "<< endreq;
+    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) 
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
 	<< "Hit quality tool setup "
-	<< "- hit quality cuts will be applied to Si hits" << endreq;
+	<< "- hit quality cuts will be applied to Si hits" << endmsg;
     m_doHitQuality = true;
   }
 
   // get TrackSummaryTool
   if ( m_trackSumTool.retrieve().isFailure() ) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_trackSumTool << endreq;
+    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 << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSumTool << endmsg;
   }
 
   return StatusCode::SUCCESS;
@@ -444,161 +446,163 @@ StatusCode IDAlignMonEfficiencies::bookHistograms()
   std::string outputDirName = "IDAlignMon/" + m_tracksName + "_" + m_triggerChainName + "/HitEfficiencies";
   MonGroup al_mon ( this, outputDirName, run );
   MonGroup al_mon_ls ( this, outputDirName, lowStat );
-  
-  
 
-  if ( newLowStatFlag() ) {  
+  if ( newLowStatFlag() ) {
   }
-  if ( newLumiBlockFlag() ) {  
+  if ( newLumiBlockFlag() ) {
   }
-  if ( newRunFlag() ) {  
-    
+  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"};    
+    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]);    
+    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) ;  
+    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]);    
+	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]);    
+	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_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) ; 
+	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) ; 
-	
+	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) ; 
+
+
+    //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]);
+    if ( m_useLowStat) RegisterHisto(al_mon_ls, m_measurements_eff_vs_layer_barrel) ;
+    if (!m_useLowStat) RegisterHisto(al_mon,    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]);
+    if ( m_useLowStat) RegisterHisto(al_mon_ls, m_measurements_eff_vs_layer_eca) ;
+    if (!m_useLowStat) RegisterHisto(al_mon,    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) ;  
+    for (int i=2; i<=nx;i++) m_measurements_eff_vs_layer_ecc->GetXaxis()->SetBinLabel(i-1,siliconLayers[i-1]);
+    if ( m_useLowStat) RegisterHisto(al_mon_ls, m_measurements_eff_vs_layer_ecc) ;
+    if (!m_useLowStat) RegisterHisto(al_mon,    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_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) ; 
+    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) ; 
+    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) ; 
+    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) ; 
-    
+    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.);
@@ -640,7 +644,7 @@ StatusCode IDAlignMonEfficiencies::bookHistograms()
 	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");
@@ -676,7 +680,7 @@ StatusCode IDAlignMonEfficiencies::bookHistograms()
     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
     //============================================= */
@@ -718,8 +722,8 @@ TProfile* IDAlignMonEfficiencies::MakeProfile(const std::string & name, const st
   profile->GetXaxis()->SetLabelSize(0.03);
   profile->GetYaxis()->SetLabelSize(0.03);
   profile->GetXaxis()->SetTitle(xAxisTitle.c_str());
-  profile->GetYaxis()->SetTitle(yAxisTitle.c_str());    
-  
+  profile->GetYaxis()->SetTitle(yAxisTitle.c_str());
+
   return profile;
 }
 
@@ -728,88 +732,88 @@ 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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
   }
-  histo->GetYaxis()->SetTitle("Number of Hits on Tracks"); 
+  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");   
+  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 != NULL) histo->GetXaxis()->SetTitle("Module Phi Identifier"); 
-  pch = strstr (HistName,"Eta"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Eta Identifier");  
-  pch = strstr (HistName,"pT"); if (pch != NULL) histo->GetXaxis()->SetTitle("Signed Track pT [GeV]"); 
+  pch = strstr (HistName,"Phi"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Phi Identifier");
+  pch = strstr (HistName,"Eta"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Eta Identifier");
+  pch = strstr (HistName,"pT"); if (pch != NULL) 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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
   }
-  histo->GetYaxis()->SetTitle("Number of Hits on Tracks"); 
+  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");   
+  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 != NULL) histo->GetXaxis()->SetTitle("Module Phi Identifier"); 
-  pch = strstr (HistName,"Eta"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Eta Identifier");  
-  pch = strstr (HistName,"pT"); if (pch != NULL) histo->GetXaxis()->SetTitle("Signed Track pT [GeV]"); 
+  pch = strstr (HistName,"Phi"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Phi Identifier");
+  pch = strstr (HistName,"Eta"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Eta Identifier");
+  pch = strstr (HistName,"pT"); if (pch != NULL) 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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
   }
 
   if(yAxisName != ""){
-    histo->GetYaxis()->SetTitle(yAxisName.c_str()); 
+    histo->GetYaxis()->SetTitle(yAxisName.c_str());
   }else{
-    histo->GetYaxis()->SetTitle("Hit Efficiency"); 
+    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");     
+  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 != NULL) histo->GetXaxis()->SetTitle("Module Phi Identifier"); 
-  pch = strstr (HistName,"Eta"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Eta Identifier"); 
-  pch = strstr (HistName,"pT"); if (pch != NULL) histo->GetXaxis()->SetTitle("Signed Track pT [GeV]"); 
+  pch = strstr (HistName,"Phi"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Phi Identifier");
+  pch = strstr (HistName,"Eta"); if (pch != NULL) histo->GetXaxis()->SetTitle("Module Eta Identifier");
+  pch = strstr (HistName,"pT"); if (pch != NULL) 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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
   }
-  histo->GetXaxis()->SetTitle("Module Eta Identifier"); 
-  histo->GetYaxis()->SetTitle("Module Phi Identifier"); 
+  histo->GetXaxis()->SetTitle("Module Eta Identifier");
+  histo->GetYaxis()->SetTitle("Module Phi Identifier");
 }
 
 void IDAlignMonEfficiencies::RegisterHisto(MonGroup& mon, TProfile2D* histo) {
-  
+
   //histo->Sumw2();
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile2D Histogram:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile2D Histogram:" << endmsg;
   }
-  histo->GetXaxis()->SetTitle("Module Eta Identifier"); 
-  histo->GetYaxis()->SetTitle("Module Phi Identifier");     
+  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 != NULL) histo->GetXaxis()->SetTitle("Pixel ECA Disk"); 
-  pch = strstr (HistName,"pix_ecc"); if (pch != NULL) histo->GetXaxis()->SetTitle("Pixel ECC Disk"); 
-  pch = strstr (HistName,"sct_eca"); if (pch != NULL) histo->GetXaxis()->SetTitle("SCT ECA Disk"); 
-  pch = strstr (HistName,"sct_ecc"); if (pch != NULL) histo->GetXaxis()->SetTitle("SCT ECC Disk"); 
+  pch = strstr (HistName,"pix_eca"); if (pch != NULL) histo->GetXaxis()->SetTitle("Pixel ECA Disk");
+  pch = strstr (HistName,"pix_ecc"); if (pch != NULL) histo->GetXaxis()->SetTitle("Pixel ECC Disk");
+  pch = strstr (HistName,"sct_eca"); if (pch != NULL) histo->GetXaxis()->SetTitle("SCT ECA Disk");
+  pch = strstr (HistName,"sct_ecc"); if (pch != NULL) histo->GetXaxis()->SetTitle("SCT ECC Disk");
 }
 
 
@@ -820,23 +824,23 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 
   const DataHandle<xAOD::EventInfo> eventInfo;
   if (StatusCode::SUCCESS != evtStore()->retrieve( eventInfo ) ){
-    msg(MSG::ERROR) << "Cannot get event info." << endreq;
+    msg(MSG::ERROR) << "Cannot get event info." << endmsg;
     return StatusCode::FAILURE;
   }
   unsigned int LumiBlock = eventInfo->lumiBlock();
-  
+
   if (!evtStore()->contains<TrackCollection>(m_tracksName)) {
-    if(m_events == 1) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get " << m_tracksName << " TrackCollection" << endreq;}
-    else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_tracksName << " TrackCollection" << endreq;
+    if(m_events == 1) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get " << m_tracksName << " TrackCollection" << endmsg;}
+    else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_tracksName << " TrackCollection" << endmsg;
     return StatusCode::SUCCESS;
   }
-  
+
   // get TrackCollection
   DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
   DataVector<Trk::Track>::const_iterator trksItr  = trks->begin();
   DataVector<Trk::Track>::const_iterator trksItrE = trks->end();
   for (; trksItr != trksItrE; ++trksItr) {
-    
+
     //float trkd0          = -999;
     //float trkz0          = -999;
     //float trkphi         = -999;
@@ -851,53 +855,53 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
     // chi2Prob = TMath::Prob(chi2,DoF) ROOT function
     //const Trk::Perigee* startPerigee = (*trksItr)->perigeeParameters();
     //const Trk::MeasuredPerigee* measPer = dynamic_cast<const Trk::MeasuredPerigee*>( startPerigee );
-    
+
     //if (measPer==0) {
-    //  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq; 
+    //  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg;
     //}
-    //else{  
-    //  CLHEP::HepVector perigeeParams = measPer->parameters();    
-    //  trkd0    = perigeeParams[Trk::d0];  
-    //  trkz0    = perigeeParams[Trk::z0];    
-    //  trkphi   = perigeeParams[Trk::phi0];  
+    //else{
+    //  CLHEP::HepVector 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.;  
-    //  trkpt    = measPer->pT()/1000.;  
+    //  trketa   = measPer->eta();
+    //  qOverP   = perigeeParams[Trk::qOverP]*1000.;
+    //  trkpt    = measPer->pT()/1000.;
     //  if (qOverP<0) charge=-1;
-    //  else charge=+1; 
-    //  abs_trkpt = charge*trkpt;                     
+    //  else charge=+1;
+    //  abs_trkpt = charge*trkpt;
     //}
 
 
     const Trk::Perigee* measPer = (*trksItr)->perigeeParameters();
     const AmgSymMatrix(5)* covariance = measPer ? measPer->covariance() : NULL;
-    
+
     if (measPer && covariance) {
       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.;  
-      trkpt    = measPer->pT()/1000.;  	      
-      if (qOverP<0) charge=-1;		      
-      else charge=+1; 			      
-      abs_trkpt = charge*trkpt;                        
+      //trkd0    = perigeeParams(Trk::d0);
+      //trkz0    = perigeeParams(Trk::z0);
+      //trkphi   = perigeeParams(Trk::phi0);
+      //trktheta = perigeeParams(Trk::theta);
+      //trketa   = measPer->eta();
+      qOverP   = perigeeParams(Trk::qOverP)*1000.;
+      trkpt    = measPer->pT()/1000.;
+      if (qOverP<0) charge=-1;
+      else charge=+1;
+      abs_trkpt = charge*trkpt;
     }
     else
       {
-	if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq; 
+	if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg;
       }
     //if (trkphi<0) trkphi+=2*m_Pi;
-    
+
 //     //some good quality requirements (will need to refine them later)
 //     bool good=(fabs(trketa<2.5)&&fabs(trkz0)<150 && trkpt>1);
-    
+
 //     if (!good) continue;
 
-    
+
     // holes + outliers + measurements + etc.
     // these two are identical in the ID:
     ////const Trk::Track* trackWithHoles = m_holeSearchTool->getTrackWithHoles(**trksItr);
@@ -910,31 +914,31 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
     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"<<endreq;
-     
+    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(MSG::DEBUG) << "hit skipped because no associated track parameters" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit skipped because no associated track parameters" << endmsg;
 	continue;
       }
-      
+
       Identifier surfaceID;
       const Trk::MeasurementBase* mesb=(*TSOSItr)->measurementOnTrack();
 
       // hits, outliers
       if (mesb != 0 && mesb->associatedSurface().associatedDetectorElement()!=NULL) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
 
-      // holes, perigee 
-      else surfaceID = (*TSOSItr)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier(); 
-      
+      // 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!" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "found a pseudomeasurement skipping it!" << endmsg;
 	continue;
       }
 
@@ -947,19 +951,19 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
       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);
@@ -969,16 +973,16 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 
 
 	if(m_doHitQuality) {
-	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to Silicon hit..." << endreq;
-	  
+	  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==NULL) {
-	    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit failed quality cuts and is rejected." << endreq;
+	    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" << endreq;
+	    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." << endreq;
+	else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit quality cuts NOT APPLIED to Silicon hit." << endmsg;
       }
 
       /** Get information for the TRT hits */
@@ -998,8 +1002,8 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 
       // 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"<<endreq;
+
+	if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"have a measurement/outlier/hole"<<endmsg;
 
 	// all possible hits
 	// dealing with PIXEL tsos
@@ -1013,13 +1017,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	    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); 
+	  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){ 
+	  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));
@@ -1029,40 +1033,40 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	// 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_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){ 
+	  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){ 
+	  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(m_barrel_ec,m_layer_or_wheel,m_phi_module,m_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"<<endreq;
-	
+
+	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
@@ -1070,11 +1074,11 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	//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" << endreq;
+	  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" << endreq;
+	  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;
@@ -1084,22 +1088,22 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	// measurements per possible hit
 	// --- pixel
 	if (detType==0){
-	  if(barrelEC == 0){ 	  
-	    m_measurements_vs_layer_barrel -> Fill(layerDisk);  
+	  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) <<endreq;
-	    
-	    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"found pixel barrel hit"<<endreq;
+
+
+
+
+	    //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){
@@ -1111,13 +1115,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 		  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){	    
-	    //msg(MSG::WARNING) <<"Pix eca, layer_disk=" << m_pixelID->layer_disk(surfaceID) << ", eta=" << m_pixelID->eta_module(surfaceID) << ", phi=" << m_pixelID->phi_module(surfaceID) <<endreq;
-	    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"found pixel eca hit"<<endreq;
+	  } // end of PIX barrel
+
+	  else if (barrelEC == 2){
+	    //msg(MSG::WARNING) <<"Pix eca, 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 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);
@@ -1132,41 +1136,41 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 		m_overlapY_vs_Phi_pix_eca[layerDisk] -> Fill(modPhi);
 	      }
 	    }
-	    
+
 	    m_measurements_vs_Eta_Phi_pix_eca -> Fill(layerDisk, modPhi);
 	  } // ECA
-	  else if (barrelEC == -2){ 
-	    
-	    //msg(MSG::WARNING) <<"Pix ecc, layer_disk=" << layerDisk << ", eta=" << m_pixelID->eta_module(surfaceID) << ", phi=" << m_pixelID->phi_module(surfaceID) <<endreq;
-	    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"found pixel ecc hit"<<endreq;
+	  else if (barrelEC == -2){
+
+	    //msg(MSG::WARNING) <<"Pix ecc, layer_disk=" << layerDisk << ", eta=" << m_pixelID->eta_module(surfaceID) << ", phi=" << m_pixelID->phi_module(surfaceID) <<endmsg;
+	    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_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_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) <<endreq;
-	    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"found sct barrel hit"<<endreq;
+	  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);
@@ -1176,22 +1180,22 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	    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"<<endreq;
+		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"<<endreq;
+		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){ 
-	    
-	    //msg(MSG::WARNING) <<"SCT eca, layer_disk=" << m_sctID->layer_disk(surfaceID) << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << m_sctID->phi_module(surfaceID) << ", side=" << m_sctID->side(surfaceID) <<endreq;
-	    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"found sct eca hit"<<endreq;
+	  else if (barrelEC == 2){
+
+	    //msg(MSG::WARNING) <<"SCT eca, 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 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);
@@ -1214,9 +1218,9 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	      }
 	  }//ECA
 	  else if (barrelEC == -2){
-	    
-	    //msg(MSG::WARNING) <<"SCT ecc, layer_disk=" << layerDisk << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << m_sctID->phi_module(surfaceID) << ", side=" << sctSide <<endreq;
-	    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE)<<"found sct ecc hit"<<endreq;
+
+	    //msg(MSG::WARNING) <<"SCT ecc, layer_disk=" << layerDisk << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << m_sctID->phi_module(surfaceID) << ", side=" << sctSide <<endmsg;
+	    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);
@@ -1226,7 +1230,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	      {
 		if(foundXOverlap){
 		  m_overlapX_vs_layer_ecc-> Fill(3 + 2*layerDisk + sctSide);
-		  m_overlapX_vs_Phi_sct_ecc[layerDisk] -> Fill(modPhi);  
+		  m_overlapX_vs_Phi_sct_ecc[layerDisk] -> Fill(modPhi);
 		}
 		if(foundYOverlap){
 		  m_overlapY_vs_layer_ecc-> Fill(3 + 2*layerDisk + sctSide);
@@ -1238,21 +1242,21 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 
 	  }//ECC
 	}//SCT
-	
+
 	if (detType==2){
 	  fillTRTHits(m_barrel_ec,m_layer_or_wheel,m_phi_module,m_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){ 	    
-	    // msg(MSG::WARNING) << " ** OULIER FOUND ** Pix barrel layer_disk=" << layerDisk << ", eta=" << modEta << ", phi=" << modPhi <<endreq;   
+	  if (barrelEC == 0){
+	    // msg(MSG::WARNING) << " ** OULIER FOUND ** Pix barrel layer_disk=" << layerDisk << ", eta=" << modEta << ", phi=" << modPhi <<endmsg;
 	    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);
@@ -1262,7 +1266,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	    m_outliers_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt);
 	  }//barrel
 
-	  else if (barrelEC == 2){ 
+	  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));
@@ -1270,7 +1274,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	  }//ECA
 
 	  // ECC
-	  else if (barrelEC == -2){ 
+	  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);
@@ -1280,56 +1284,56 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 
 	// --- sct -- outliers in SCT
 	else if (detType==1){
-	  if (barrelEC == 0){ 
-	    //msg(MSG::WARNING) <<"SCT barrel outlier, layer_disk=" << layerDisk << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << m_sctID->phi_module(surfaceID) << ", side=" << sctSide <<endreq;
-	    
+	  if (barrelEC == 0){
+	    //msg(MSG::WARNING) <<"SCT barrel outlier, layer_disk=" << layerDisk << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << m_sctID->phi_module(surfaceID) << ", side=" << sctSide <<endmsg;
+
 	    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); 
+	    m_outliers_vs_pT_sct_b[layerDisk] -> Fill(abs_trkpt);
 	  }//barrel
-	  else if (barrelEC == 2){ 
+	  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){ 
+
+	  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(m_barrel_ec,m_layer_or_wheel,m_phi_module,m_straw_layer);
 	}
-	
-      } // end of outliers 
-    } // TSOS on track 
-    
+
+      } // end of outliers
+    } // TSOS on track
+
     const Trk::TrackSummary* summary = m_trackSumTool->createSummary(**trksItr);
     if( !summary->get(Trk::numberOfPixelHits) && !summary->get(Trk::numberOfSCTHits) && (summary->get(Trk::numberOfPixelHoles)==0) && (summary->get(Trk::numberOfSCTHoles)==0) && (m_doHoleSearch)){
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No Pixel or SCT hits skip hole search" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No Pixel or SCT hits skip hole search" << endmsg;
       continue;
     }
     delete summary;
 
     const DataVector<const Trk::TrackStateOnSurface>* HTSOS;
-    HTSOS = m_holeSearchTool->getHolesOnTrack(**trksItr); 
+    HTSOS = m_holeSearchTool->getHolesOnTrack(**trksItr);
     DataVector<const Trk::TrackStateOnSurface>::const_iterator HTSOSItr  = HTSOS->begin();
     DataVector<const Trk::TrackStateOnSurface>::const_iterator HTSOSItrE = HTSOS->end();
 
-    for (; HTSOSItr != HTSOSItrE; ++HTSOSItr) { // Loop on Holes on Track (HTSOS)    
+    for (; HTSOSItr != HTSOSItrE; ++HTSOSItr) { // Loop on Holes on Track (HTSOS)
       Identifier surfaceID;
       const Trk::MeasurementBase* mesb=(*HTSOSItr)->measurementOnTrack();
       // hits, outliers
       if (mesb != 0 && mesb->associatedSurface().associatedDetectorElement()!=NULL) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
-      // holes, perigee 
-      else surfaceID = (*HTSOSItr)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier(); 
+      // holes, perigee
+      else surfaceID = (*HTSOSItr)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier();
 
       int detType = 99;
       int barrelEC = 99;
@@ -1343,14 +1347,14 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
       //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);
@@ -1358,27 +1362,27 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	  sctSide   = m_sctID->side(surfaceID);
 	}
 	if(m_doHitQuality) {
-	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hole quality cuts to Silicon hole..." << endreq;
-	  
+	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hole quality cuts to Silicon hole..." << endmsg;
+
 	  if(!m_hitQualityTool->getGoodHole(*HTSOSItr)) {
-	    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hole failed quality cuts and is rejected." << endreq;
+	    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hole failed quality cuts and is rejected." << endmsg;
 	    continue;
 	  }
-	  else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hole passed quality cuts" << endreq;
+	  else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hole passed quality cuts" << endmsg;
 	}
-	else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hole quality cuts NOT APPLIED to Silicon hole." << endreq;
+	else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hole quality cuts NOT APPLIED to Silicon hole." << endmsg;
       }
-      
-      
+
+
       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) << endreq;
-	  
-	   
+	    // 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;
@@ -1393,25 +1397,25 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	      //std::cout << " Type: Hole ";
 	    }
 	    if (!knownType)  std::cout << "IDAlignment Monitoring HitEfficiencies Type: -- UNKNOWN -- "<<std::endl;
-	    
-  
+
+
 	     m_hits_vs_layer_barrel -> Fill(layerDisk);
-	    m_hits_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta,modPhi); 
+	    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){ 
+	  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){ 
+	  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));
@@ -1422,11 +1426,11 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	// --- sct
 	else if (detType==1){
 	  if (barrelEC == 0)
-	    { 
-	      //msg(MSG::WARNING) <<"SCT barrel hole, layer_disk=" << m_sctID->layer_disk(surfaceID) << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << modPhi << ", side=" << m_sctID->side(surfaceID) << endreq;
+	    {
+	      //msg(MSG::WARNING) <<"SCT barrel hole, layer_disk=" << m_sctID->layer_disk(surfaceID) << ", eta=" << m_sctID->eta_module(surfaceID) << ", phi=" << modPhi << ", side=" << m_sctID->side(surfaceID) << endmsg;
 
 	      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);
@@ -1435,16 +1439,16 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	      m_hits_vs_pT_sct_b[layerDisk] -> Fill(abs_trkpt);
 	      m_hits_vs_LB_sct_b[layerDisk] -> Fill(float(LumiBlock));
 	    }
-	  else if (barrelEC == 2){ 
+	  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){ 
+	  else if (barrelEC == -2){
 	    m_hits_vs_layer_ecc -> Fill(3 + 2*layerDisk + sctSide);
 	    //if(layerDisk == 0)   ???? (PF: why this is here?)
-	    m_hits_vs_Phi_sct_ecc[layerDisk] -> Fill(modPhi);	  
+	    m_hits_vs_Phi_sct_ecc[layerDisk] -> Fill(modPhi);
 	    m_hits_vs_Eta_Phi_sct_ecc -> Fill(layerDisk, modPhi);
 	  }
 	}//sct
@@ -1465,13 +1469,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	    m_holes_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt);
 	  }
 	  // ----------- eca
-	  else if (barrelEC == 2){ 
+	  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){ 
+	  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);
@@ -1481,30 +1485,30 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	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){ 
+	  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){ 
+
+	  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     
+      } // 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){
@@ -1517,13 +1521,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	    m_holes_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt);
 	  }
 	  // ----------- eca
-	  else if (barrelEC == 2){ 
+	  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){ 
+	  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);
@@ -1534,26 +1538,26 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	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){ 
+	  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){ 
+
+	  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     
+      } // holes as outliers
 
-      // filling histograms for holes being measurements 
+      // 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
@@ -1570,13 +1574,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	    m_holes_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt);
 	  }
 	  // ----------- eca
-	  else if (barrelEC == 2){ 
+	  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){ 
+	  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);
@@ -1587,28 +1591,28 @@ StatusCode IDAlignMonEfficiencies::fillHistograms()
 	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){ 
+	  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){ 
+
+	  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 (?)    
-    }   
-    delete HTSOS;   
-  } 
-  delete trks; 
+      } // holes as measurements (?)
+    }
+    delete HTSOS;
+  }
+  delete trks;
   return StatusCode::SUCCESS;
 }
 
@@ -1631,7 +1635,7 @@ void IDAlignMonEfficiencies::makeEffHisto(TH1F* h_num, TH1F* h_denom, TProfile*
       h_eff->Fill(x,0.);
     }
   }
-  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow); 
+  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow);
 }
 
 void IDAlignMonEfficiencies::makeEffHisto(TH1F_LW* h_num, TH1F_LW* h_denom, TProfile* h_eff) {
@@ -1639,34 +1643,34 @@ void IDAlignMonEfficiencies::makeEffHisto(TH1F_LW* h_num, TH1F_LW* h_denom, TPro
       h_eff->Reset("ICE");
   }
 
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in makeEffHisto  " << endreq;
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in makeEffHisto  " << endmsg;
   int Nbins;
   Nbins = h_num->GetNbinsX();
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Nbins is  " << Nbins << endreq;
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Nbins is  " << Nbins << endmsg;
   for (int bin=0; bin!=Nbins; ++bin) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "bin is  " << bin << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "bin is  " << bin << endmsg;
     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->GetBinCenter(bin+1);
     double x = h_denom->getXMin() + binSize * bin + binSize/2;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Npass is  " << Npass << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Npass is  " << Npass << endmsg;
     for (int pass=0; pass<Npass; ++pass) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "pass is  " << pass << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "pass is  " << pass << endmsg;
       h_eff->Fill(x,1.);
     }
 
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Nfail is  " << Nfail << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Nfail is  " << Nfail << endmsg;
     for (int fail=0; fail<Nfail; ++fail) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "fail is  " << fail << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "fail is  " << fail << endmsg;
       h_eff->Fill(x,0.);
     }
   }
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Out of loop  " << endreq;
-  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow); 
-  
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "leaving makeEffHisto  " << Nbins << endreq;
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Out of loop  " << endmsg;
+  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow);
+
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "leaving makeEffHisto  " << Nbins << endmsg;
   return;
 }
 
@@ -1689,7 +1693,7 @@ void IDAlignMonEfficiencies::makeOverlapFracHisto(TH1F* h_num, TH1F* h_denom, TP
       h_eff->Fill(x,0.);
     }
   }
-  SetMinWindow(h_eff, 0., .3); 
+  SetMinWindow(h_eff, 0., .3);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
@@ -1716,7 +1720,7 @@ void IDAlignMonEfficiencies::makeEffHisto(TH2F* h_num, TH2F* h_denom, TProfile2D
       }
     }
   }
-  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow); 
+  SetMinWindow(h_eff, m_minSiliconEffWindow, m_maxSiliconEffWindow);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
@@ -1735,14 +1739,13 @@ void IDAlignMonEfficiencies::makeEffHisto(TH2F* h_num, TH2F* h_denom, TH2F* h_ef
       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 (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);
       }
-      // std::cout << " -- SALVA -- eff for module ( " << bin << ", " << binY << ")  Nseen= " << NSeenHits << "  NExpected= " << NExpected;
       // std::cout << "  ComputeEff= " << doComputeEff;
       if (doComputeEff) std::cout << "  Eff= " << myEff;
       std::cout << std::endl;
@@ -1768,7 +1771,7 @@ void IDAlignMonEfficiencies::makeEffHistoWithCut(TH2F* h_num, TH2F* h_denom, TPr
       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 (NExpected > 10) doComputeEff = true;
       if (NSeenHits >  3) doComputeEff = true;
       if (doComputeEff) {
 	myEff = NSeenHits / NExpected;
@@ -1786,8 +1789,6 @@ void IDAlignMonEfficiencies::makeEffHistoWithCut(TH2F* h_num, TH2F* h_denom, TPr
 	  }
 	}
       }
-      std::cout << " -- SALVA -- eff for module ( " << bin << ", " << binY << ")  Nseen= " << NSeenHits << "  NExpected= " << NExpected;
-      std::cout << "  ComputeEff= " << doComputeEff;
       // if (doComputeEff) std::cout << "  Eff= " << myEff;
       if (doComputeEff) std::cout << "  Eff= " << h_eff->GetBinContent(bin, binY);
       std::cout << std::endl;
@@ -1799,7 +1800,7 @@ void IDAlignMonEfficiencies::makeEffHistoWithCut(TH2F* h_num, TH2F* h_denom, TPr
 
 StatusCode IDAlignMonEfficiencies::procHistograms()
 {
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In procHistograms" << endreq;
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In procHistograms" << endmsg;
   if( endOfLowStatFlag() ) {
   }
   if( endOfLumiBlockFlag() ) {
@@ -1809,10 +1810,10 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
     //
     // 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"<<endreq;
+	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]);
@@ -1832,15 +1833,15 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 	  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
@@ -1850,16 +1851,16 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
       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"<<endreq;
+	    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)
 	    {
@@ -1867,26 +1868,26 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 	      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) 
+
+    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"<<endreq;
+	  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_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]);
@@ -1909,8 +1910,8 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 	    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)
@@ -1919,32 +1920,32 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 	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"<<endreq;
+	      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_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);
@@ -1956,7 +1957,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
     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);
@@ -1968,11 +1969,11 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
       }
 
     /**  TRT Processing */
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Doint the TRT pocessing" << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Doint the TRT pocessing" << endmsg;
     /** TRT Barrel */
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Barrel" << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Barrel" << endmsg;
     for(int i=0; i<3;i++) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "layer is " << i << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "layer is " << i << endmsg;
       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]);
@@ -1980,40 +1981,40 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
     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);
-    
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Endcap" << endreq;
+
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Endcap" << endmsg;
     /**  TRT Endcap */
     for(unsigned int endcap = 0; endcap<2; ++endcap){
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "endcap is " << endcap << endreq;
-      makeEffHisto(m_trt_ec_hist->outliers_vs_ring[endcap], 
-		   m_trt_ec_hist->totHits_vs_ring[endcap], 
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "endcap is " << endcap << endmsg;
+      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], 
+
+      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], 
+
+      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], 
+
+      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], 
+
+      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]);
     }
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done TRT Processing" << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done TRT Processing" << endmsg;
     //========================
-  
-    
-    
+
+
+
 //     // normalize: divide outliers by number of hits
 //     for (int i=1;i<=m_hits_vs_Eta_Phi_pix_b0->GetNbinsX();i++){
 //       for (int j=1;j<=m_hits_vs_Eta_Phi_pix_b0->GetNbinsY();j++){
@@ -2021,7 +2022,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_pix_b0->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_pix_b0->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_pix_b0->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_pix_b0->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_pix_b0->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_pix_b0->SetBinContent(i,j,holes / hits);
@@ -2039,7 +2040,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_pix_b1->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_pix_b1->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_pix_b1->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_pix_b1->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_pix_b1->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_pix_b1->SetBinContent(i,j,holes / hits);
@@ -2057,7 +2058,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_pix_b2->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_pix_b2->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_pix_b2->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_pix_b2->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_pix_b2->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_pix_b2->SetBinContent(i,j,holes / hits);
@@ -2075,7 +2076,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_sct_b0->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_sct_b0->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_sct_b0->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_sct_b0->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_sct_b0->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_sct_b0->SetBinContent(i,j,holes / hits);
@@ -2093,7 +2094,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_sct_b1->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_sct_b1->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_sct_b1->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_sct_b1->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_sct_b1->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_sct_b1->SetBinContent(i,j,holes / hits);
@@ -2111,7 +2112,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_sct_b2->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_sct_b2->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_sct_b2->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_sct_b2->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_sct_b2->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_sct_b2->SetBinContent(i,j,holes / hits);
@@ -2129,7 +2130,7 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	float outliers=m_outliers_vs_Eta_Phi_sct_b3->GetBinContent(i,j);
 // 	float holes=m_holes_vs_Eta_Phi_sct_b3->GetBinContent(i,j);
 // 	float hits=m_hits_vs_Eta_Phi_sct_b3->GetBinContent(i,j);
-// 	if(hits > 0){ 
+// 	if(hits > 0){
 // 	  m_measurements_vs_Eta_Phi_sct_b3->SetBinContent(i,j,measurements / hits);
 // 	  m_outliers_vs_Eta_Phi_sct_b3->SetBinContent(i,j,outliers / hits);
 // 	  m_holes_vs_Eta_Phi_sct_b3->SetBinContent(i,j,holes / hits);
@@ -2140,17 +2141,17 @@ StatusCode IDAlignMonEfficiencies::procHistograms()
 // 	}
 //       }
 //     }
-    
+
   }
-  
+
   return StatusCode::SUCCESS;
 }
 
 //================================================================
-// Establishes a minimim window for the TProfile 
+// 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);
@@ -2161,7 +2162,7 @@ void IDAlignMonEfficiencies::SetMinWindow(TProfile* hProf, float windowMin, floa
 }
 
 void IDAlignMonEfficiencies::SetMinWindow(TProfile2D* hProf, float windowMin, float windowMax){
-  
+
   float min=hProf->GetMinimum();
   float max=hProf->GetMaximum();
   float margin=0.05*(max-min);
@@ -2179,20 +2180,20 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 
   // 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 
+  // - 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()"<< endreq;
+
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in  IDAlignMonEfficiencies::findOverlapHit()"<< endmsg;
 
   const Trk::TrackStateOnSurface* xOverlap = NULL;
   const Trk::TrackStateOnSurface* yOverlap = NULL;
 
   if(!hit) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit is NULL; abandoning overlap search"<< endreq;
+    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;
   }
@@ -2200,22 +2201,22 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
   Identifier hitId;
   if (hit->associatedSurface().associatedDetectorElement()!=NULL) hitId = hit->associatedSurface().associatedDetectorElement()->identify();
   else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit doesn't have an associated detector element; abandoning overlap search"<< endreq;
+    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"<< endreq;
-  int detType = 99; 
+  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "obtained hit identifier"<< endmsg;
+  int detType = 99;
   int barrelEC = 99;
   int layerDisk = 99;
-  int modEta = 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 << endreq;
+  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "determined hit detector type = "<< detType << endmsg;
 
   //determining Si module physical position
   if (detType==0){//pixel
@@ -2233,33 +2234,33 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
     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 << endreq;
+  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "**************looking for overlaps for new hit detType = " << detType
+	    << ", modEta = " << modEta << ", modPhi = " << modPhi << endmsg;
 
 
   int nHits = 0;
   for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos2=trk->trackStateOnSurfaces()->begin();tsos2!=trk->trackStateOnSurfaces()->end(); ++tsos2) {
 
-    int detType2 = -99; 
+    int detType2 = -99;
     int barrelEC2 = -99;
     int layerDisk2 = -99;
-    int modEta2 = -99; 
+    int modEta2 = -99;
     int modPhi2 = -99;
     const Trk::MeasurementBase* hit2 =(*tsos2)->measurementOnTrack();
     if (hit2== NULL) continue;//the first hit on the track never has associated hit information - just stores track parameters
     nHits++;
-        
+
     Identifier hitId2;
     if (hit2->associatedSurface().associatedDetectorElement()!=NULL) hitId2 = hit2->associatedSurface().associatedDetectorElement()->identify();
     else {
-      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "hit tested for overlap doesn't have an associated detector element"<< endreq;
+      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);
@@ -2276,29 +2277,29 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       modPhi2 = m_sctID->phi_module(id);
     }
 
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "testing hit " << nHits << " for overlap, detType2 = " << detType2 
-	       << ", modEta2 = " << modEta2 << ", modPhi2 = " << modPhi2 << endreq;
+    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" << endreq;
+      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" << endreq;
+      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" << endreq;
+      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" << endreq;
+      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)" << endreq;
+      if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "overlap rejected because this is the original hit (or the opposite side for SCT)" << endmsg;
       continue;
     }
 
@@ -2309,7 +2310,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       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" << endreq;
+	if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "SCT overlap rejected because the modules are not both stereo/radial modules" << endmsg;
 	continue;
       }
     }
@@ -2321,34 +2322,34 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
     if (!TrackParameters)
       continue;
     const AmgSymMatrix(5)* covariance = TrackParameters->covariance();
-    
-    
+
+
     if(covariance==NULL) {
-      
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because overlap hit does not have associated measuredTrackParameters" << endreq;
+
+      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..." << endreq;
-	
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to overlap hit..." << endmsg;
+
 	hit2 = m_hitQualityTool->getGoodHit(*tsos2);
 	if(hit2==NULL) {
-	  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because failed hit quality cuts." << endreq;
+	  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" << endreq;
+	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." << endreq;
+      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
@@ -2360,7 +2361,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       } 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;    
+	close = true;
       } else if ( (detType==0 && barrelEC==0 && layerDisk==0) && modPhi-modPhi2 == -21){
 	close = true;
 	// SCT barrel special cases
@@ -2369,7 +2370,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       } 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;    
+	close = true;
       } else if ( (detType==1 && barrelEC==0 && layerDisk==0) && modPhi-modPhi2 == -31){
 	close = true;
 	// Pix EC special cases
@@ -2380,24 +2381,24 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	close = true;
       }
       if(close){  //end add by TG
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "***** identified local X overlap" << endreq;
-	//	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endreq;
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module phi, eta  = " << modEta <<", "<<modPhi<< endreq;
-	//if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endreq;
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "second module phi, eta  = " << modEta2 <<", "<<modPhi2<< endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "***** identified local X overlap" << endmsg;
+	//	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endmsg;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module phi, eta  = " << modEta <<", "<<modPhi<< endmsg;
+	//if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endmsg;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "second module phi, eta  = " << modEta2 <<", "<<modPhi2<< endmsg;
 	xOverlap = (*tsos2);
       } //added by LT
-      
+
     }
     if(modEta-modEta2 == 1 && modPhi==modPhi2){
-      
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "***** identified local Y overlap" << endreq;
-      //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endreq;
-      //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endreq;
+
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "***** identified local Y overlap" << endmsg;
+      //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endmsg;
+      //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endmsg;
       yOverlap = (*tsos2);
     }
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modEta2 = " << modEta2 << endreq;
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modPhi2 = " << modPhi2 << endreq;
+    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modEta2 = " << modEta2 << endmsg;
+    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "modPhi2 = " << modPhi2 << endmsg;
   }
 
 
@@ -2420,11 +2421,11 @@ void IDAlignMonEfficiencies::makeTRTHistograms(MonGroup& al_mon, MonGroup& al_mo
 
 void IDAlignMonEfficiencies::makePIXBarrelHistograms(MonGroup& al_mon){
   m_NPixLayers = m_PIX_Mgr->numerology().numLayers();
-  for (int iLayer=0; iLayer < m_PIX_Mgr->numerology().numLayers();++iLayer) 
+  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"<<endreq;
-	continue;}    
+	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
@@ -2436,160 +2437,160 @@ void IDAlignMonEfficiencies::makePIXBarrelHistograms(MonGroup& al_mon){
 	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));  
+      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)); 
+      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));  
+      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));  
+      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));  
+      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]); 
+	  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]); 
+      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]); 
+      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]); 
-      
+      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.));  
+      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_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.));  
+      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.));  
+      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]); 
+	  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.));  
+	  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]); 
+      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]) ; 
+      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));  
+      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));  
+      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));  
+	  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));  
+	  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));  
+      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));  
+      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]) ; 
+      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.));  
+	  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.));  
+	  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]) ; 
+      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]) ; 
+      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));  
+      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]) ; 
+      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));  
+      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));  
+      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.));  
+      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.));  
+      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]) ; 
+      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);
@@ -2597,7 +2598,7 @@ void IDAlignMonEfficiencies::makePIXEndCapsHistograms(MonGroup& al_mon){
 	{
 	  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"<<endreq;
+	    msg(MSG::WARNING) << "Wheel "<<iWheel<<" Not in Use"<<endmsg;
 	    continue;}
 	  else
 	    {
@@ -2608,136 +2609,136 @@ void IDAlignMonEfficiencies::makePIXEndCapsHistograms(MonGroup& al_mon){
 	    {
 	      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));  
+
+	      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.));  
+
+	      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.));  
+	      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.));  
+	      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.));  
+		  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]) ; 
+		  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]) ;  
+	      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]) ; 
-	      
+	      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));  
+	      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.));  
+
+	      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.));  
+	      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.));  
+	      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.));  
+		  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.));  
+		  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]) ;  
+	      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]) ; 
-	      	      
+	      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) 
+
+  for (int iLayer=0; iLayer < m_SCT_Mgr->numerology().numLayers();++iLayer)
     {
-      //ATH_MSG_INFO("iLayer= " << iLayer); 
+      //ATH_MSG_INFO("iLayer= " << iLayer);
       if (!m_SCT_Mgr->numerology().useLayer(iLayer)){
-	msg(MSG::WARNING) << "Layer "<<iLayer<<" Not Present"<<endreq;
+	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
@@ -2752,149 +2753,149 @@ void IDAlignMonEfficiencies::makeSCTBarrelHistograms(MonGroup &al_mon){
       //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.5,0.,1.));
       //RegisterHisto(al_mon,m_measurements_eff_vs_Eta_Phi_sct_b[iLayer]);
       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]);    
+      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));  
+      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.5,1.));  
-      RegisterHisto(al_mon,m_measurements_eff_vs_LB_sct_b[iLayer]); 
-      
-
-
-
-      
+      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++) {
 	// std::cout << " -- Salva -- hit map of SCT BAR layer " <<  iLayer << " side: " << side << "  Name: " << ("measurements_vs_Eta_Phi_sct_b"+intToString(iLayer)+"_s"+intToString(side)).c_str() << std::endl;
 	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]); 
+	  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]); 
+	  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]); 
+	  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));  
+	  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]); 
+	  // 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]); 
+	  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));  
+      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));  
+      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));  
+      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]); 
+	  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]); 
+	  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]); 
+      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]); 
+      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]); 
+      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.));  
+      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]); 
+      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.));  
+      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.));  
+      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.));  
+	  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.));  
+	  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.));  
+	  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.));  
+	  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.));  
+      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.));  
+      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]) ; 
-      
+      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]) ; 
+      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]) ; 
+      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));  
+      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]) ; 
+      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));  
+      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));  
+      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.));  
+      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.));  
+      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.));  
+      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]) ;
     }
 }
@@ -2907,7 +2908,7 @@ void IDAlignMonEfficiencies::makeSCTEndCapsHistograms(MonGroup& al_mon){
 	{
 	  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"<<endreq;
+	    msg(MSG::WARNING) << "Wheel "<<iWheel<<" Not in Use"<<endmsg;
 	    continue;}
 	  else
 	    {
@@ -2916,136 +2917,137 @@ void IDAlignMonEfficiencies::makeSCTEndCapsHistograms(MonGroup& al_mon){
 	  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));  
+
+	    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));  
+		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.));  
+		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]) ; 
-	    
-	     
-      
-	     
+	    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));  
+	    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));  
+		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));  
+		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.));  
+		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));  
+
+	    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.));  
+	    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.5,1.);  
+  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.5,1.);  
-  RegisterHisto(al_mon,m_measurements_eff_vs_LB_sct_ecc); 
+
+  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") ;  
+    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]) ;  
+    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") ;  
+    if ( m_useLowStat) RegisterHisto(al_mon_ls,m_trt_b_hist->hits_eff_vs_phiSector[lay],"Fraction of Precision Hits") ;
+    if (!m_useLowStat) RegisterHisto(al_mon,   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]) ;  
+    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") ;  
+    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]);  
+    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") ;  
+  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") ;  
-    
+  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") ;  
+  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);
@@ -3056,109 +3058,110 @@ void IDAlignMonEfficiencies::makeTRTBarrelHistograms(MonGroup& al_mon, MonGroup&
 
   return;
 }
-    
+
 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]);  
-    
+    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");  
-    
+    if ( m_useLowStat) RegisterHisto(al_mon_ls,m_trt_ec_hist->hits_eff_vs_ring[endcap],"Fraction of Precision Hits");
+    if (!m_useLowStat) RegisterHisto(al_mon,   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");  
-    
+    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");  
-    
+    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");  
-    
+    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");  
+    RegisterHisto(al_mon,m_trt_ec_hist->tubeHits_eff_vs_phiSector[endcap],"Fraction of Tube");
   }
-  
+
   return;
 }
 
 void IDAlignMonEfficiencies::fillTRTTotalMeasurements(int m_barrel_ec,int m_layer_or_wheel,int m_phi_module,int m_straw_layer){
-  
+
   //Barrel
   if ( m_barrel_ec == 1 || m_barrel_ec == -1) {
     fillTRTBarrelTotalMeasurements(m_layer_or_wheel,m_phi_module,m_straw_layer);
   }
-  
+
   //Endcap
   if ( m_barrel_ec == 2 || m_barrel_ec == -2) {
     fillTRTEndcapTotalMeasurements(m_barrel_ec,m_layer_or_wheel,m_phi_module,m_straw_layer);
   }
-  
+
   return;
 }
 
 void IDAlignMonEfficiencies::fillTRTHits(int m_barrel_ec,int m_layer_or_wheel,int m_phi_module,int m_straw_layer, bool isTubeHit){
-  
+
   //Barrel
   if ( m_barrel_ec == 1 || m_barrel_ec == -1) {
     fillTRTBarrelHits(m_layer_or_wheel,m_phi_module,m_straw_layer,isTubeHit);
   }
-  
+
   //Endcap
   if ( m_barrel_ec == 2 || m_barrel_ec == -2) {
     fillTRTEndcapHits(m_barrel_ec,m_layer_or_wheel,m_phi_module,m_straw_layer,isTubeHit);
   }
-  
+
   return;
 }
 
 void IDAlignMonEfficiencies::fillTRTOutliers(int m_barrel_ec,int m_layer_or_wheel,int m_phi_module,int m_straw_layer){
-  
+
   //Barrel
   if ( m_barrel_ec == 1 || m_barrel_ec == -1) {
     fillTRTBarrelOutliers(m_layer_or_wheel,m_phi_module,m_straw_layer);
   }
-  
+
   //Endcap
   if ( m_barrel_ec == 2 || m_barrel_ec == -2) {
     fillTRTEndcapOutliers(m_barrel_ec,m_layer_or_wheel,m_straw_layer);
   }
-  
+
   return;
 }
 
@@ -3173,7 +3176,7 @@ void IDAlignMonEfficiencies::fillTRTBarrelTotalMeasurements(int m_layer_or_wheel
     m_trt_b_hist->totHits_vs_StrawLay->Fill(19+m_straw_layer);
   if(m_layer_or_wheel == 2)
     m_trt_b_hist->totHits_vs_StrawLay->Fill(19+24+m_straw_layer);
-  
+
   for(int i=0; i<3; i++)
     if(m_layer_or_wheel == i)//Filling phi sectors of layer i
       m_trt_b_hist->totHits_vs_phiSector[i]->Fill(m_phi_module);
@@ -3182,7 +3185,7 @@ void IDAlignMonEfficiencies::fillTRTBarrelTotalMeasurements(int m_layer_or_wheel
 }
 
 void IDAlignMonEfficiencies::fillTRTBarrelHits(int m_layer_or_wheel,int m_phi_module,int m_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){
@@ -3193,7 +3196,7 @@ void IDAlignMonEfficiencies::fillTRTBarrelHits(int m_layer_or_wheel,int m_phi_mo
     if(m_layer_or_wheel == 2)
       m_trt_b_hist->hits_vs_StrawLay->Fill(19+24+m_straw_layer);
   }
-  
+
   if(isTubeHit){
     if(m_layer_or_wheel == 0)
       m_trt_b_hist->tubeHits_vs_StrawLay->Fill(m_straw_layer);
@@ -3202,7 +3205,7 @@ void IDAlignMonEfficiencies::fillTRTBarrelHits(int m_layer_or_wheel,int m_phi_mo
     if(m_layer_or_wheel == 2)
       m_trt_b_hist->tubeHits_vs_StrawLay->Fill(19+24+m_straw_layer);
   }
-  
+
   for(int i=0; i<3; i++){
     if(m_layer_or_wheel == i){//Filling phi sectors of layer i
       if(!isTubeHit)
@@ -3216,7 +3219,7 @@ void IDAlignMonEfficiencies::fillTRTBarrelHits(int m_layer_or_wheel,int m_phi_mo
 }
 
 void IDAlignMonEfficiencies::fillTRTBarrelOutliers(int m_layer_or_wheel,int m_phi_module,int m_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(m_layer_or_wheel == 0)
@@ -3225,27 +3228,27 @@ void IDAlignMonEfficiencies::fillTRTBarrelOutliers(int m_layer_or_wheel,int m_ph
     m_trt_b_hist->outliers_vs_StrawLay->Fill(19+m_straw_layer);
   if(m_layer_or_wheel == 2)
     m_trt_b_hist->outliers_vs_StrawLay->Fill(19+24+m_straw_layer);
-  
+
   for(int i=0; i<3; i++){
     if(m_layer_or_wheel == i)//Filling phi sectors of layer i
       m_trt_b_hist->outliers_vs_phiSector[i]->Fill(m_phi_module);
   }
-  
+
   return;
 }
 
 void IDAlignMonEfficiencies::fillTRTEndcapTotalMeasurements(int m_barrel_ec, int m_layer_or_wheel,int m_phi_module,int m_straw_layer){
-  
+
   for(unsigned int endcap=0; endcap<2; ++endcap){
     bool doFill = false;
     if(!endcap && m_barrel_ec == 2)
       doFill = true;
     else if(endcap && m_barrel_ec == -2)
       doFill = true;
-    
+
     if(!doFill)
       continue;
-    
+
     unsigned int ring = getRing(m_layer_or_wheel,m_straw_layer);
     m_trt_ec_hist->totHits_vs_ring[endcap]->Fill(ring);
     m_trt_ec_hist->totHits_vs_phiSector[endcap]->Fill(m_phi_module);
@@ -3262,7 +3265,7 @@ void IDAlignMonEfficiencies::fillTRTEndcapHits(int m_barrel_ec, int m_layer_or_w
       doFill = true;
     else if(endcap && m_barrel_ec == -2)
       doFill = true;
-    
+
     if(!doFill)
       continue;
 
@@ -3276,7 +3279,7 @@ void IDAlignMonEfficiencies::fillTRTEndcapHits(int m_barrel_ec, int m_layer_or_w
       m_trt_ec_hist->tubeHits_vs_phiSector[endcap]->Fill(m_phi_module);
     }
   }
-  
+
   return;
 }
 
@@ -3289,15 +3292,15 @@ void IDAlignMonEfficiencies::fillTRTEndcapOutliers(int m_barrel_ec, int m_layer_
       doFill = true;
     else if(endcap && m_barrel_ec == -2)
       doFill = true;
-    
+
     if(!doFill)
       continue;
-    
+
     unsigned int ring = getRing(m_layer_or_wheel,m_straw_layer);
     m_trt_ec_hist->outliers_vs_ring[endcap]->Fill(ring);
     m_trt_ec_hist->outliers_vs_phiSector[endcap]->Fill(ring);
   }
-  return;  
+  return;
 }
 
 unsigned int IDAlignMonEfficiencies::getRing(unsigned int wheel,unsigned int strawlayer){
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
index 922cfe7e1c267af2b54e6e3e7b04313c6e988d6d..183e863678a7b67841a98570ab0caf9b6983eb34 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonEfficiencies_H
@@ -448,6 +448,7 @@ class IDAlignMonEfficiencies : public ManagedMonitorToolBase
   int m_NPixLayers;
   int m_events;
   int m_mapSplit;
+  bool m_useLowStat;
   int m_histosBooked;
   bool m_doHitQuality;
   float m_minLB;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
index e35d73a90be6f760d1fb45016c83a65fe88f95e4..11fbbcaa9e2f496b9bc4ae4f8144900330ed9904 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
@@ -1,12 +1,13 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 // **********************************************************************
 // AlignmentMonTool.cxx
 // AUTHORS: Beate Heinemann, Tobias Golling
 // **********************************************************************
 
+#include "IDAlignMonGenericTracks.h"
+
 #include <sstream>
 #include <math.h>
 #include "TH1.h"
@@ -14,8 +15,6 @@
 #include "TProfile.h"
 #include "TMath.h"
 
-#include "LWHists/TH1F_LW.h"
-
 #include "GaudiKernel/IJobOptionsSvc.h"
 #include "GaudiKernel/MsgStream.h"
 
@@ -29,7 +28,6 @@
 #include "InDetPrepRawData/SiCluster.h"
 
 
-//#include "Particle/TrackParticleContainer.h"
 #include "Particle/TrackParticle.h"
 #include "TrkParticleBase/LinkToTrackParticleBase.h"
 
@@ -39,9 +37,6 @@
 #include "InDetBeamSpotService/IBeamCondSvc.h"
 #include "xAODEventInfo/EventInfo.h"
 
-
-//#include "AthenaMonitoring/AthenaMonManager.h"
-#include "IDAlignMonGenericTracks.h"
 #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
 
 #include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h"
@@ -68,22 +63,26 @@ IDAlignMonGenericTracks::IDAlignMonGenericTracks( const std::string & type, cons
 	m_vertices(0),
 	m_doHitQuality(0),
 	m_d0Range(2.0),
-	m_d0BsRange(0.5),
+	m_d0BsRange(0.2),
 	m_z0Range(250.0),
-	m_etaRange(3.0),
+	m_pTRange(100.0),
+	m_etaRange(2.5),
 	m_NTracksRange(200),
+	m_nBinsMuRange(100),
+	m_muRangeMin(0.5),
+	m_muRangeMax(100.5),
         m_beamCondSvc("BeamCondSvc",name),
         m_trackToVertexIPEstimator("Trk::TrackToVertexIPEstimator"), 
 	m_hWeightInFile(0),
-	m_etapTWeight(0)
-	
+	m_hInputTrackWeight(0),
+	m_userInputWeigthMethod(IDAlignMonGenericTracks::TRKETA_TRKPT),
+	m_useLowStat(false)
+
 {
   m_trackSelection = ToolHandle< InDetAlignMon::TrackSelectionTool >("InDetAlignMon::TrackSelectionTool");
   m_hitQualityTool = ToolHandle<IInDetAlignHitQualSelTool>("");
  
-  m_pTRange = 100.0;
-  
-  InitializeHistograms();
+  InitializeHistograms(); // histograms are now defined as NULL pointers. The actual booking comes later.
   
   declareProperty("tracksName"           , m_tracksName);
   declareProperty("CheckRate"            , m_checkrate=1000);
@@ -106,22 +105,23 @@ IDAlignMonGenericTracks::IDAlignMonGenericTracks( const std::string & type, cons
   declareProperty("hWeightInFileName"    , m_hWeightInFileName  = "hWeight.root" ); 
   declareProperty("hWeightHistName"      , m_hWeightHistName    = "trk_pT_vs_eta" );
   declareProperty("doIP"                 , m_doIP = false);
+  declareProperty("useLowStat"           , m_useLowStat);
 }
 
-
+//////////////////////////////////////////////////////////
 IDAlignMonGenericTracks::~IDAlignMonGenericTracks() { }
 
-
+//////////////////////////////////////////////////////////
 void IDAlignMonGenericTracks::InitializeHistograms() {
   
+  // set histograms to NULL
   m_summary = 0;
   
   m_trk_chi2oDoF = 0;
   m_trk_chi2Prob = 0;
 
 
-
-  //Histo for self beam spot calculatio = 0n
+  //Histo for self beam spot calculation
   m_trk_d0_vs_phi0_z0 = 0;
 
   // barrel
@@ -132,6 +132,7 @@ void IDAlignMonGenericTracks::InitializeHistograms() {
   m_trk_z0_barrel_zoomin = 0;
   m_trk_qopT_vs_phi_barrel = 0;
   m_trk_d0_vs_phi_barrel = 0;
+  m_trk_d0bs_vs_phi_barrel = 0;
   m_trk_d0_vs_z0_barrel = 0;
   m_trk_phi0_neg_barrel = 0;
   m_trk_phi0_pos_barrel = 0;
@@ -145,6 +146,7 @@ void IDAlignMonGenericTracks::InitializeHistograms() {
   m_chi2oDoF_barrel = 0;
   m_phi_barrel = 0;
   m_hitMap_barrel = 0;
+  m_hitMap_barrel_zoom = 0;
   m_hitMap_endcapA = 0;
   m_hitMap_endcapC = 0;
 
@@ -214,6 +216,8 @@ void IDAlignMonGenericTracks::InitializeHistograms() {
   m_nhits_per_track = 0;
   m_ntrk = 0;
   m_ngtrk = 0;
+  m_nsilhits_per_track = 0;
+  m_niblhits_per_track = 0;
   m_npixhits_per_track = 0;
   m_nscthits_per_track = 0;
   m_ntrthits_per_track = 0;
@@ -238,6 +242,9 @@ void IDAlignMonGenericTracks::InitializeHistograms() {
   m_trk_d0_wrtPV_vs_phi_vs_eta = 0;
   m_trk_z0_wrtPV_vs_phi_vs_eta = 0;
 
+  // number of interactions per event
+  m_eventMu_vs_TrkPt = 0;
+  m_eventMu_vs_TrkEta = 0;
 
   // extended plots
   m_trk_PIXvSCTHits = 0;
@@ -419,71 +426,122 @@ void IDAlignMonGenericTracks::InitializeHistograms() {
   m_trk_z0c_asym_eca = 0;
   m_trk_z0c_asym_ecc = 0;
 
-}
-
-
+  m_hTrackWeight = 0;
 
+  return;
+}
 
+//////////////////////////////////////////////////////////
 StatusCode IDAlignMonGenericTracks::initialize()
 {
   StatusCode sc;  
-  m_events=0;
-  m_histosBooked = 0;
+  m_events=0;  // event count 
+  m_histosBooked = 0; // flag to tell us if histograms have been already booked
                                     
   sc = ManagedMonitorToolBase::initialize();
-  if(!sc.isSuccess())
+  if(!sc.isSuccess()) {
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize ManagedMonitorToolBase! (return SUCCESS !!!)" << endmsg;
     return StatusCode::SUCCESS;
+  }
+
+  //initialize tools and services                                                                                                                                                  
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endmsg;
+  sc = this->SetupTools();
+  if (sc.isFailure()) {
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize tools/services!" << endmsg;
+    return StatusCode::SUCCESS;
+  }
+  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endmsg;
+  
+  // in case of histograms have to be filled with a weight
+  // 1) open the root file containing the weights histogram
+  // 2) retrieve the weights histogram
+  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("Succesful openning of file containing the track weight: " << m_hWeightInFileName);
+        
+    m_hInputTrackWeight = (TH2F*) m_hWeightInFile -> Get( m_hWeightHistName.c_str() );
+    if( !m_hInputTrackWeight ){
+      ATH_MSG_FATAL( " Problem getting input track weight histogram. Name " << m_hWeightHistName );
+      m_hWeightInFile -> Close();
+      delete m_hWeightInFile;
+      return StatusCode::FAILURE;
+    }
+    if( m_hInputTrackWeight ){
+      // the input histogram exists. Now, make sure the code knows how to deal with it
+      if (m_hWeightHistName.compare("trk_pT_vs_eta")    == 0) m_userInputWeigthMethod = IDAlignMonGenericTracks::TRKETA_TRKPT;
+      if (m_hWeightHistName.compare("h_eventMuVsTrkPt") == 0) m_userInputWeigthMethod = IDAlignMonGenericTracks::EVENTMU_TRKPT;
+      if (m_hWeightHistName.compare("h_eventMuVsTrkEta")== 0) m_userInputWeigthMethod = IDAlignMonGenericTracks::EVENTMU_TRKETA;
+    }
+    ATH_MSG_INFO( "Track weights histogram is " << m_hWeightHistName << "  m_userInputWeightMethod= " << m_userInputWeigthMethod);
+  } // retrieve track weights histogram 
+
+  return StatusCode::SUCCESS;
+}
+
+/////////////////////////////////////////////////
+StatusCode IDAlignMonGenericTracks::SetupTools()
+{
+  //initializing tools
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endmsg;
+  StatusCode sc;
 
   //ID Helper
   sc = detStore()->retrieve(m_idHelper, "AtlasID" );
   if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endreq;
+    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" << endreq;
+    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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 << endreq;
+    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 << endreq;
+    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"
-  << endreq;
+  << 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) "<< endreq;
+  <<" (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" << endreq;
+  << "- hit quality cuts will be applied to Si hits" << endmsg;
     m_doHitQuality = true;
   }
   
@@ -500,161 +558,147 @@ StatusCode IDAlignMonGenericTracks::initialize()
   }
   
   if ( m_beamCondSvc.retrieve().isFailure() ) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve beamspot service " << m_beamCondSvc << " - will use nominal beamspot at (0,0,0)" << endreq;
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve beamspot service " << m_beamCondSvc << " - will use nominal beamspot at (0,0,0)" << endmsg;
     m_hasBeamCondSvc = false;
   } 
   else {
     m_hasBeamCondSvc = true;
     ATH_MSG_DEBUG("Retrieved service " << m_beamCondSvc);
   }
-  
- 
-
-
-  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);
-    
-  }
-
 
-  return StatusCode::SUCCESS;
+  return sc;
 }
 
-
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 StatusCode IDAlignMonGenericTracks::bookHistograms()
 {
-
+  if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "bookHistograms() START ** track collection: " << m_tracksName 
+					<< "  trigchain: " << m_triggerChainName 
+					<< "  sequence m_histosBooked=" << m_histosBooked
+					<< " !!!" << endmsg;
 
   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 (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Running in online mode "<< endmsg;
   }
   
   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;
+    if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "bookHistograms() Running in cosmic mode "<< endmsg;
+  } 
+  else {
+    if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "bookHistograms() Running in collision mode "<< endmsg;
   }
 
   std::string outputDirName = "IDAlignMon/" + m_tracksName + "_" + m_triggerChainName + "/GenericTracks";
   MonGroup al_mon ( this, outputDirName, run );
-  MonGroup al_mon_ls ( this, outputDirName, lowStat );
 
-  if ( newLowStat ) {  
+  if ( newLowStatFlag() ) {  
   }
-  if ( newLumiBlock ) {  
+  if ( newLumiBlockFlag() ) {  
   }
-  if ( newRun ) {  
-
+  if ( newRunFlag() ) {  
+    if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "newRunFlag() true --> booking GenericTracks histograms for track collection: " << m_tracksName 
+					  << "  output dir: " << outputDirName.data()
+					  << "  AthenaMonManager::environment()=" << AthenaMonManager::environment()
+					  << endmsg;
     //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"};   
+    if(m_histosBooked!=0 && AthenaMonManager::environment()==AthenaMonManager::user) {
+      if (msgLvl(MSG::INFO))msg(MSG::INFO) << "** Beware !! histograms for  track collection: " << m_tracksName 
+					   << " trigchain: " << m_triggerChainName
+					   << "  ALREADY BOOKED -> return success" << endmsg;
+      return StatusCode::SUCCESS;
+    }
 
-    m_summary = TH1F_LW::create("summary","summary",12,-0.5,11.5); 
-    for (int i=1;i<=12;i++) m_summary->GetXaxis()->SetBinLabel(i,hitSummary[i-1]);  
+    // summary histo
+    const Int_t nx = 13;
+    TString hitSummary[nx] = {"IBLhits #geq 1", "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",13,-0.5,12.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 (msgLvl(MSG::INFO))msg(MSG::INFO) << " summary histogram already booked for histogram sequence: " << m_histosBooked << endmsg;
 
-
-     
+    // IP vs PV TH3 histograms
     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_d0_wrtPV_vs_phi_vs_eta       = new TH3F("trk_d0_wrtPV_vs_phi_vs_eta"       , "d0 vs phi vs eta"           , 100, -m_etaRange, m_etaRange, 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, -m_etaRange, m_etaRange, 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, -m_etaRange, m_etaRange, 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, -m_etaRange, m_etaRange, 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_trk_z0_wrtPV_vs_phi_vs_eta       = new TH3F("trk_z0_wrtPV_vs_phi_vs_eta"       , "d0 vs phi vs eta"           , 100, -m_etaRange, m_etaRange, 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, -m_etaRange, m_etaRange, 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, -m_etaRange, m_etaRange, 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, -m_etaRange, m_etaRange, 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_doIP
     
     
-    //###############
- 
     
-    m_nhits_per_event = TH1F_LW::create("Nhits_per_event","Number of hits per event",1024,-0.5,1023.5);  
+    m_nhits_per_event = new TH1F("Nhits_per_event","Number of hits per event",1024, -1., 2047.);  
     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 = TH1F_LW::create("ntracks","Number of Tracks",m_NTracksRange+1, -0.5, m_NTracksRange+0.5);
+    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_ngtrk = TH1F_LW::create("ngtracks","Number of Good Tracks",m_NTracksRange+1, -0.5, m_NTracksRange+0.5);
+    m_ngtrk = new TH1F("ngtracks","Number of Good Tracks",m_NTracksRange+1, -0.5, m_NTracksRange+0.5);
     RegisterHisto(al_mon,m_ngtrk);
-    m_nhits_per_track = TH1F_LW::create("Nhits_per_track","Number of hits per track",101,-0.5, 100.5);  
+
+    m_nhits_per_track = new TH1F("Nhits_per_track","Number of hits per track", 76, -0.5, 75.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 = TH1F_LW::create("Npixhits_per_track_barrel","Number of pixhits per track (Barrel)",14,-0.5,13.5);  
+    m_npixhits_per_track_barrel = new TH1F("Npixhits_per_track_barrel","Number of hits in Pixels and IBL per track (Barrel)",12,-0.5,11.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->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 = TH1F_LW::create("Nscthits_per_track_barrel","Number of scthits per track (Barrel)",30,-0.5,29.5);  
+
+    m_nscthits_per_track_barrel = new TH1F("Nscthits_per_track_barrel","Number of scthits per track (Barrel)",26,-0.5,25.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 = TH1F_LW::create("Ntrthits_per_track_barrel","Number of trthits per track (Barrel)",100,-0.5,99.5);  
+
+    m_ntrthits_per_track_barrel = new TH1F("Ntrthits_per_track_barrel","Number of TRT hits per track (Barrel)", 81,-0.5,80.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 = TH1F_LW::create("Npixhits_per_track_eca","Number of pixhits per track (Eca)",14,-0.5,13.5);  
+    m_npixhits_per_track_eca = new TH1F("Npixhits_per_track_eca","Number of pixhits per track (ECA)",12,-0.5,11.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 = TH1F_LW::create("Nscthits_per_track_eca","Number of scthits per track (Eca)",30,-0.5,29.5);  
+
+    m_nscthits_per_track_eca = new TH1F("Nscthits_per_track_eca","Number of scthits per track (ECA)",26,-0.5,25.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 = TH1F_LW::create("Ntrthits_per_track_eca","Number of trthits per track (Eca)",100,-0.5,99.5);  
+    m_ntrthits_per_track_eca = new TH1F("Ntrthits_per_track_eca","Number of trthits per track (ECA)", 81,-0.5,80.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 = TH1F_LW::create("Npixhits_per_track_ecc","Number of pixhits per track (Ecc)",14,-0.5,13.5);  
+    m_npixhits_per_track_ecc = new TH1F("Npixhits_per_track_ecc","Number of pixhits per track (ECC)",12,-0.5,11.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 = TH1F_LW::create("Nscthits_per_track_ecc","Number of scthits per track (Ecc)",30,-0.5,29.5);  
+    m_nscthits_per_track_ecc = new TH1F("Nscthits_per_track_ecc","Number of scthits per track (ECC)",26,-0.5,25.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 = TH1F_LW::create("Ntrthits_per_track_ecc","Number of trthits per track (Ecc)",100,-0.5,99.5);  
+    m_ntrthits_per_track_ecc = new TH1F("Ntrthits_per_track_ecc","Number of trthits per track (ECC)", 81,-0.5,80.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");  
@@ -662,52 +706,73 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     //Monitoring plots shown in the dqm web page
     ///////////////////////////////////////////////////////////////////////////////////////////////////
-    m_chi2oDoF = TH1F_LW::create("chi2oDoF","chi2oDoF",100,0,10);  
+    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 = TH1F_LW::create("eta","eta",100,-m_etaRange,m_etaRange);  
-    RegisterHisto(al_mon_ls,m_eta) ;  
+    m_eta = new TH1F("eta","eta",100,-m_etaRange,m_etaRange);  
+    RegisterHisto(al_mon,    m_eta) ;  
     m_eta->GetXaxis()->SetTitle("Track #eta"); 
     m_eta->GetYaxis()->SetTitle("Number of Tracks"); 
-    m_phi = TH1F_LW::create("phi","phi",100,0,2*m_Pi);  m_phi->SetMinimum(0);
-    RegisterHisto(al_mon_ls,m_phi) ;  
-    m_phi->GetXaxis()->SetTitle("Track #phi"); 
+
+    m_phi = new TH1F("phi","phi",100,0,2*m_Pi);  m_phi->SetMinimum(0);
+    RegisterHisto(al_mon,   m_phi);
+    m_phi->GetXaxis()->SetTitle("Track #phi [rad]"); 
     m_phi->GetYaxis()->SetTitle("Number of Tracks");  
-    m_d0_bscorr = TH1F_LW::create("d0_bscorr","d0 (corrected for beamspot); [mm]",400,-m_d0BsRange,m_d0BsRange);  
-    RegisterHisto(al_mon_ls,m_d0_bscorr) ;  
-    
-    m_z0 = TH1F_LW::create("z0","z0;[mm]",100,-m_z0Range,m_z0Range);  
-    RegisterHisto(al_mon,m_z0) ;  
-    m_z0sintheta = TH1F_LW::create("z0sintheta","z0sintheta",100,-m_z0Range,m_z0Range);  
+
+    m_d0_bscorr = new TH1F("d0_bscorr","d0 (corrected for beamspot); [mm]",250, -m_d0BsRange,m_d0BsRange);  
+    RegisterHisto(al_mon   ,m_d0_bscorr) ;  
+    m_d0_bscorr->GetXaxis()->SetTitle("Track d_{0} [mm]"); 
+    m_d0_bscorr->GetYaxis()->SetTitle("Number of Tracks");  
+
+    m_z0 = new TH1F("z0","z0;[mm]",100,-m_z0Range,m_z0Range);  
+    RegisterHisto(al_mon,    m_z0) ;  
+    m_z0->GetXaxis()->SetTitle("Track z_{0} [mm]"); 
+    m_z0->GetYaxis()->SetTitle("Number of Tracks");  
+    m_z0sintheta = new TH1F("z0sintheta","z0sintheta",100,-m_z0Range,m_z0Range);  
     RegisterHisto(al_mon,m_z0sintheta) ;  
-    m_d0 = TH1F_LW::create("d0","d0;[mm]",400,-m_d0Range,m_d0Range);  
+    m_z0sintheta->GetXaxis()->SetTitle("Track z_{0}sin#theta [mm]"); 
+    m_z0sintheta->GetYaxis()->SetTitle("Number of Tracks");  
+
+    m_d0 = new TH1F("d0","d0;[mm]",250,-m_d0Range,m_d0Range);  
     RegisterHisto(al_mon,m_d0) ;  
-    
 
+    m_nsilhits_per_track = new TH1F("Nsilhits_per_track","Number of hits in silicon (IBL+Pixels+SCT) per track",26,-0.5,25.5);  
+    RegisterHisto(al_mon,    m_nsilhits_per_track) ;  
+    m_nsilhits_per_track->GetXaxis()->SetTitle("Number of silicon hits per track"); 
+    m_nsilhits_per_track->GetYaxis()->SetTitle("Number of tracks"); 
+
+    m_niblhits_per_track = new TH1F("Niblhits_per_track","Number of hits in IBL per track",6,-0.5,5.5);  
+    RegisterHisto(al_mon,    m_niblhits_per_track) ;  
+    m_niblhits_per_track->GetXaxis()->SetTitle("Number of IBL hits per Track"); 
+    m_niblhits_per_track->GetYaxis()->SetTitle("Number of Tracks"); 
     
-    m_npixhits_per_track = TH1F_LW::create("Npixhits_per_track","Number of pixhits per track",14,-0.5,13.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 = new TH1F("Npixhits_per_track","Number of Pixels and IBL hits per track",12,-0.5,11.5);  
+    RegisterHisto(al_mon,    m_npixhits_per_track) ;  
+    m_npixhits_per_track->GetXaxis()->SetTitle("Number of Pixel and IBL hits per Track"); 
     m_npixhits_per_track->GetYaxis()->SetTitle("Number of Tracks"); 
-    m_nscthits_per_track = TH1F_LW::create("Nscthits_per_track","Number of scthits per track",30,-0.5,29.5);  
-    RegisterHisto(al_mon_ls,m_nscthits_per_track) ;  
+
+    m_nscthits_per_track = new TH1F("Nscthits_per_track","Number of SCT hits per track",26,-0.5,25.5);  
+    RegisterHisto(al_mon,    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 = TH1F_LW::create("Ntrthits_per_track","Number of trthits per track",100,-0.5,99.5);  
-    RegisterHisto(al_mon_ls,m_ntrthits_per_track) ;  
+
+    m_ntrthits_per_track = new TH1F("Ntrthits_per_track","Number of TRT hits per track",81,-0.5,80.5);  
+    RegisterHisto(al_mon,    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);  
+    m_trk_d0_vs_phi_barrel = new TProfile("trk_d0_vs_phi_barrel","Impact parameter (d_{0})versus phi0 (Barrel)",20,0,2*m_Pi,-5,5);  
     RegisterHisto(al_mon,m_trk_d0_vs_phi_barrel) ;
+    m_trk_d0bs_vs_phi_barrel = new TProfile("trk_d0bs_vs_phi_barrel","Impact parameter (d_{0BS}) versus phi0 (Barrel)",20,0,2*m_Pi,-5,5);  
+    RegisterHisto(al_mon,m_trk_d0bs_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);  
@@ -724,69 +789,94 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
 
     //Negative and positive tracks perigee parameters
     RegisterHisto(al_mon,m_trk_d0_vs_z0_barrel) ;
-    m_trk_phi0_neg_barrel = TH1F_LW::create("trk_phi0_neg_barrel","Phi distribution for negative tracks (Barrel)",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_phi0_pos_barrel","Phi distribution for positive tracks (Barrel)",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_pT_neg_barrel","pT distribution for negative tracks (Barrel)",50,0,100);
+    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 = TH1F_LW::create("trk_pT_pos_barrel","pT distribution for positive tracks (Barrel)",50,0,100);
+    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 = TH1F_LW::create("trk_phi0_neg_eca","Phi distribution for negative tracks (Endcap A)",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_phi0_pos_eca","Phi distribution for positive tracks (Endcap A)",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_pT_neg_eca","pT distribution for negative tracks (Endcap A)",50,0,100);
+    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 = TH1F_LW::create("trk_pT_pos_eca","pT distribution for positive tracks (Endcap A)",50,0,100);
+    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 = TH1F_LW::create("trk_phi0_neg_ecc","Phi distribution for negative tracks (Endcap C)",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_phi0_pos_ecc","Phi distribution for positive tracks (Endcap C)",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_pT_neg_ecc","pT distribution for negative tracks (Endcap C)",50,0,100);
+    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 = TH1F_LW::create("trk_pT_pos_ecc","pT distribution for positive tracks (Endcap C)",50,0,100);
+    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 = TH1F_LW::create("trk_phi0_asym_barrel","Track Charge Asymmetry versus phi (Barrel) ",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_phi0_asym_eca","Track Charge Asymmetry versus phi (Endcap A) ",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_phi0_asym_ecc","Track Charge Asymmetry versus phi (Endcap C) ",20,0,2*m_Pi);
+    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 = TH1F_LW::create("trk_pT_asym_barrel","Track Charge Asymmetry versus pT (Barrel) ",50,0,100);
+    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 = TH1F_LW::create("trk_pT_asym_eca","Track Charge Asymmetry versus pT (Endcap A) ",50,0,100);
+    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 = TH1F_LW::create("trk_pT_asym_ecc","Track Charge Asymmetry versus pT (Endcap C) ",50,0,100);
+    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);
     
     
+    // 
+    // histogram of track Pt vs track eta
+    int etaBins = 40;
+    int ptBins = 40;
+    m_trk_pT_vs_eta = new TH2F("trk_pT_vs_eta", "pT vs eta;#eta;p_{T} [GeV] ", 
+			       etaBins, -m_etaRange, m_etaRange,  ptBins, 0., m_pTRange);
+    RegisterHisto(al_mon, m_trk_pT_vs_eta);
+
+    // histograms of number of intractions per event vs track pt and vs track eta
+    m_eventMu_vs_TrkPt  = new TH2F("h_eventMuVsTrkPt", "Event #mu vs track p_{T};#mu;p_{T} [GeV]", 
+				   m_nBinsMuRange, m_muRangeMin, m_muRangeMax,  ptBins, 0., m_pTRange);
+    RegisterHisto(al_mon, m_eventMu_vs_TrkPt); 
+
+    m_eventMu_vs_TrkEta = new TH2F("h_eventMuVsTrkEta", "Event #mu vs track #eta;#mu; #eta",        
+				   m_nBinsMuRange, m_muRangeMin, m_muRangeMax,  etaBins, -m_etaRange, m_etaRange);
+    RegisterHisto(al_mon, m_eventMu_vs_TrkEta); 
+
+    // number of interactions
+    m_mu_perEvent = new TH1F("mu_perEvent","#mu per event", m_nBinsMuRange, m_muRangeMin, m_muRangeMax);
+    RegisterHisto(al_mon,m_mu_perEvent);
+    m_mu_perEvent->GetXaxis()->SetTitle("#mu");
+    m_mu_perEvent->GetYaxis()->SetTitle("Events");
     
-
     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.
+      // histo for self beam spot calculation (using the data of the whole run... so nothing to do with the beam spot by Lumiblock).
       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.);
+      m_trk_d0_vs_phi_vs_eta         = new TH3F("trk_d0_vs_phi_vs_eta"       , "d0 vs phi vs eta", 
+						etaBins, -m_etaRange, m_etaRange,  40, 0, 2*m_Pi,  100, -m_d0Range, m_d0Range); 
+      m_trk_d0_vs_phi_vs_eta_barrel  = new TH3F("trk_d0_vs_phi_vs_eta_barrel", "d0 vs phi vs eta (Barrel)", 
+						etaBins, -m_etaRange, m_etaRange,  40, 0, 2*m_Pi,  100, -m_d0Range, m_d0Range);
+      m_trk_d0_vs_phi_vs_eta_ecc     = new TH3F("trk_d0_vs_phi_vs_eta_ecc"   , "d0 vs phi vs eta (Endcap C)", 
+						etaBins, -m_etaRange, m_etaRange,  40, 0, 2*m_Pi,  100, -m_d0Range, m_d0Range);
+      m_trk_d0_vs_phi_vs_eta_eca     = new TH3F("trk_d0_vs_phi_vs_eta_eca"   , "d0 vs phi vs eta (Endcap A)", 
+						etaBins, -m_etaRange, m_etaRange,  40, 0, 2*m_Pi,  100, -m_d0Range, m_d0Range);
+      m_trk_pT_vs_eta_barrel         = new TH2F("trk_pT_vs_eta_barrel"       , "pT vs eta barrel;#eta;p_{T} [GeV]", 
+						etaBins, -m_etaRange, m_etaRange, ptBins, 0., m_pTRange);
+      m_trk_pT_vs_eta_eca            = new TH2F("trk_pT_vs_eta_eca"          , "pT vs eta eca;#eta;p_{T} [GeV]", 
+						etaBins, -m_etaRange, m_etaRange, ptBins, 0., m_pTRange);
+      m_trk_pT_vs_eta_ecc            = new TH2F("trk_pT_vs_eta_ecc"          , "pT vs eta ecc;#eta;p_{T} [GeV]", 
+						etaBins, -m_etaRange, m_etaRange, ptBins, 0., m_pTRange);
       
       
       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    );
@@ -794,15 +884,15 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       RegisterHisto(al_mon, m_trk_d0_vs_phi_vs_eta_eca    );
       RegisterHisto(al_mon, m_trk_pT_vs_eta_eca     );
 
-      m_trk_d0_barrel  = TH1F_LW::create("trk_d0_barrel","Impact parameter: all tracks (Barrel); d_{0} [mm]",100, -m_d0Range, m_d0Range);
-      m_trk_d0c_barrel = TH1F_LW::create("trk_d0c_barrel","Impact parameter (corrected for vertex): all tracks (Barrel)",100, -5, 5);  
-      m_trk_z0_barrel  = TH1F_LW::create("trk_z0_barrel","Track z0: all tracks (Barrel)",100, -m_z0Range, m_z0Range);
-      m_trk_d0_eca     = TH1F_LW::create("trk_d0_eca","Impact parameter: all tracks (Endcap A)",100, -m_d0Range, m_d0Range);
-      m_trk_d0c_eca    = TH1F_LW::create("trk_d0c_eca","Impact parameter (corrected for vertex): all tracks  (Endcap A)",100, -m_d0Range, m_d0Range);  
-      m_trk_z0_eca     = TH1F_LW::create("trk_z0_eca","Track z0: all tracks (Endcap A)",100, -m_z0Range, m_z0Range);
-      m_trk_d0_ecc     = TH1F_LW::create("trk_d0_ecc","Impact parameter: all tracks (Endcap C)",100, -m_d0Range, m_d0Range);
-      m_trk_d0c_ecc    = TH1F_LW::create("trk_d0c_ecc","Impact parameter (corrected for vertex): all tracks  (Endcap C)",100, -m_d0Range, m_d0Range);  
-      m_trk_z0_ecc     = TH1F_LW::create("trk_z0_ecc","Track z0: all tracks (Endcap C)",100, -m_z0Range, m_z0Range);
+      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, -5, 5);  
+      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);
@@ -826,12 +916,12 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
 
       
       //Detailed IP Plots. All the PV Corrected are broken and need to be fixed.
-      m_trk_d0_barrel_zoomin = TH1F_LW::create("trk_d0_barrel_zoomin","Impact parameter: all tracks (Barrel)",100,-5,5);
-      m_trk_z0_barrel_zoomin = TH1F_LW::create("trk_z0_barrel_zoomin","Track z0: all tracks (Barrel)",100,-300,300);  
-      m_trk_d0_eca_zoomin = TH1F_LW::create("trk_d0_eca_zoomin","Impact parameter: all tracks (Endcap A)",100,-5,5);
-      m_trk_z0_eca_zoomin = TH1F_LW::create("trk_z0_eca_zoomin","Track z0: all tracks (Endcap A)",100,-300,300);
-      m_trk_d0_ecc_zoomin = TH1F_LW::create("trk_d0_ecc_zoomin","Impact parameter: all tracks (Endcap C)",100,-5,5);
-      m_trk_z0_ecc_zoomin = TH1F_LW::create("trk_z0_ecc_zoomin","Track z0: all tracks (Endcap C)",100,-300,300);
+      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) ; 
@@ -845,69 +935,69 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       //############### 
       double z0cRange=5;
       double d0cRange=0.1;
-      m_trk_d0c_neg= TH1F_LW::create("trk_d0c_neg","Impact parameter: all negative charged tracks" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_pos","Impact parameter: all positive charged tracks" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_neg_barrel","Impact parameter: all negative charged tracks (Barrel)" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_pos_barrel","Impact parameter: all positive charged tracks (Barrel)" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_neg_eca","Impact parameter: all negative charged tracks (Endcap A)" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_pos_eca","Impact parameter: all positive charged tracks (Endcap A)" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_neg_ecc","Impact parameter: all negative charged tracks (Endcap C)" ,50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_d0c_pos_ecc","Impact parameter: all positive charged tracks (Endcap C)" ,50,-d0cRange,d0cRange);
+      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=TH1F_LW::create("trk_d0c_asym","Track Charge Asymmetry versus d0 (corrected for vertex)",50,-d0cRange,d0cRange);
+      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=TH1F_LW::create("trk_d0c_asym_barrel","Track Charge Asymmetry versus d0 (Barrel, corrected for vertex)",50,-d0cRange,d0cRange);
+      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=TH1F_LW::create("trk_d0c_asym_eca","Track Charge Asymmetry versus d0(Endcap A, corrected for vertex)",50,-d0cRange,d0cRange);
+      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=TH1F_LW::create("trk_d0c_asym_ecc","Track Charge Asymmetry versus d0(Endcap C, corrected for vertex)",50,-d0cRange,d0cRange);
+      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= TH1F_LW::create("trk_z0c_neg","z0: all negative charged tracks" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_pos","z0: all positive charged tracks" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_neg_barrel",":z0 all negative charged tracks (Barrel)" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_pos_barrel","z0: all positive charged tracks (Barrel)" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_neg_eca","z0: all negative charged tracks (Endcap A)" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_pos_eca","z0: all positive charged tracks (Endcap A)" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_neg_ecc","z0: all negative charged tracks (Endcap C)" ,50,-z0cRange,z0cRange);
+      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= TH1F_LW::create("trk_z0c_pos_ecc","z0: all positive charged tracks (Endcap C)" ,50,-z0cRange,z0cRange);
+      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=TH1F_LW::create("trk_z0c_asym","Track Charge Asymmetry versus z0 (corrected for vertex)",50,-z0cRange,z0cRange);
+      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=TH1F_LW::create("trk_z0c_asym_barrel","Track Charge Asymmetry versus z0 (Barrel, corrected for vertex)",50,-z0cRange,z0cRange);
+      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=TH1F_LW::create("trk_z0c_asym_eca","Track Charge Asymmetry versus z0(Endcap A, corrected for vertex)",50,-z0cRange,z0cRange);
+      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=TH1F_LW::create("trk_z0c_asym_ecc","Track Charge Asymmetry versus z0(Endcap C, corrected for vertex)",50,-z0cRange,z0cRange);
+      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 = TH1F_LW::create("d0_pvcorr","d0 (corrected for primVtx); [mm]",400,-m_d0Range,m_d0Range);  
+      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 = TH1F_LW::create("z0_pvcorr","z0 (corrected for primVtx);[mm]",100,-m_z0Range,m_z0Range);  
+      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 = TH1F_LW::create("z0sintheta_pvcorr","z*sintheta (corrected for primVtx); [mm]",100,-m_z0Range,m_z0Range);  
+      m_z0sintheta_pvcorr = new TH1F("z0sintheta_pvcorr","z*sintheta (corrected for primVtx); [mm]",100,-m_z0Range,m_z0Range);  
       RegisterHisto(al_mon,m_z0sintheta_pvcorr) ;  
       
       
@@ -948,12 +1038,12 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_trk_chi2oDoF_P->GetXaxis()->SetTitle("P (GeV)"); 
       m_trk_chi2oDoF_P->GetYaxis()->SetTitle("Chi2"); 
       
-      m_trk_chi2ProbDist = TH1F_LW::create("trk_chi2ProbDist","chi2Prob distribution",50,0,1);  
+      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 = TH1F_LW::create("errCotTheta","Error of CotTheta",50,0,0.02);
+      m_errCotTheta = new TH1F("errCotTheta","Error of CotTheta",50,0,0.02);
       RegisterHisto(al_mon,m_errCotTheta);  
       m_errCotTheta->GetXaxis()->SetTitle("Track #Delta(cot(#theta))"); 
       m_errCotTheta->GetYaxis()->SetTitle("Number of Tracks"); 
@@ -983,7 +1073,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_errCotThetaVsEta->GetXaxis()->SetTitle("#eta"); 
       m_errCotThetaVsEta->GetYaxis()->SetTitle("Track #Delta(cot(#theta))"); 
       
-      m_errTheta = TH1F_LW::create("errTheta","Error of Theta",50,0,0.02);
+      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"); 
@@ -1013,7 +1103,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_errThetaVsEta->GetXaxis()->SetTitle("#eta"); 
       m_errThetaVsEta->GetYaxis()->SetTitle("Track #delta(#theta)"); 
       
-      m_errD0 = TH1F_LW::create("errD0", "Error of d0", 60,0,0.30);
+      m_errD0 = new TH1F("errD0", "Error of d0", 60,0,0.30);
       RegisterHisto(al_mon,m_errD0);
       m_errD0->GetXaxis()->SetTitle("d0 error (mm)"); 
       
@@ -1057,7 +1147,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_errD0VsEta->GetXaxis()->SetTitle("#eta"); 
       m_errD0VsEta->GetYaxis()->SetTitle("d0 error (mm)");         
       
-      m_errPhi0 = TH1F_LW::create("errPhi0", "Error of Phi0", 50,0,0.010);
+      m_errPhi0 = new TH1F("errPhi0", "Error of Phi0", 50,0,0.010);
       RegisterHisto(al_mon,m_errPhi0);
       m_errPhi0->GetXaxis()->SetTitle("#phi0 error (rad)"); 
 
@@ -1086,7 +1176,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_errPhi0VsEta->GetXaxis()->SetTitle("#eta"); 
       m_errPhi0VsEta->GetYaxis()->SetTitle("#phi0 error (rad)");  
         
-      m_errZ0 = TH1F_LW::create("errZ0", "Error of Z0", 50,0,0.3);
+      m_errZ0 = new TH1F("errZ0", "Error of Z0", 50,0,0.3);
       RegisterHisto(al_mon,m_errZ0);
       m_errZ0->GetXaxis()->SetTitle("z0 error (mm)"); 
       
@@ -1115,7 +1205,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_errZ0VsEta->GetXaxis()->SetTitle("#eta"); 
       m_errZ0VsEta->GetYaxis()->SetTitle("z0 error (mm)");  
         
-      m_errPt = TH1F_LW::create("errPt", "Error of Pt", 50 ,0., 1.);
+      m_errPt = new TH1F("errPt", "Error of Pt", 50 ,0., 1.);
       RegisterHisto(al_mon,m_errPt);
       m_errPt->GetXaxis()->SetTitle("Pt err (GeV/c)");
         
@@ -1154,39 +1244,39 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_errPtVsEta->GetXaxis()->SetTitle("#eta"); 
       m_errPtVsEta->GetYaxis()->SetTitle("Pt error (GeV/c)");       
         
-      m_errPt_Pt2 = TH1F_LW::create("errPt_Pt2", "Error of Pt/Pt^{2}", 50 ,0., 0.015);
+      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_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_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_errPt_Pt2VsPhi0->GetYaxis()->SetTitle("#sigma(Pt)/Pt^{2} [GeV/c]^{-1}");
   
       m_D0VsPhi0 = new TH2F("D0VsPhi0", "d0 Vs #phi0 ", 100, 0, 2*m_Pi, 400, -m_d0Range, m_d0Range);
       RegisterHisto(al_mon,m_D0VsPhi0);
-      m_D0VsPhi0->GetXaxis()->SetTitle("#phi0 (rad)"); 
-      m_D0VsPhi0->GetYaxis()->SetTitle("d0 (mm)"); 
+      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_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_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);
@@ -1251,7 +1341,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       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);
@@ -1269,26 +1359,26 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_XBs_vs_ZBs->GetYaxis()->SetTitle("x coordinate (mm)");
       
       
-      m_XBs = TH1F_LW::create("XBs","BeamSpot Position: x",100,-1,0.);
+      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= TH1F_LW::create("YBs","BeamSpot Position: y",100,-1,0.);
+      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 = TH1F_LW::create("ZBs","BeamSpot Position: z",100,-50,50);
+      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 = TH1F_LW::create("TiltX_Bs","Beam spot tile angle: x-z plane",100,-1e3,1e3);
+      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 = TH1F_LW::create("TiltY_Bs","Beam spot tile angle: y-z plane",100,-1e3,1e3);
+      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)");
       
@@ -1319,116 +1409,115 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       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 = TH1F_LW::create("d0_pvcorr_est","d0 (corrected for primVtx v2); [mm]",400,-0.2,0.2);  
+    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 = TH1F_LW::create("z0_pvcorr_est","z0 (corrected for primVtx v2); [mm]",100,-1,1);  
+    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 = TH1F_LW::create("phi_barrel_pos_2_5GeV","phi_barrel_pos_2_5GeV",100,0,2*m_Pi);  m_phi_barrel_pos_2_5GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_pos_5_10GeV","phi_barrel_pos_5_10GeV",100,0,2*m_Pi);  m_phi_barrel_pos_5_10GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_pos_10_20GeV","phi_barrel_pos_10_20GeV",100,0,2*m_Pi);  m_phi_barrel_pos_10_20GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_pos_20plusGeV","phi_barrel_pos_20plusGeV",100,0,2*m_Pi);  m_phi_barrel_pos_20plusGeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_neg_2_5GeV","phi_barrel_neg_2_5GeV",100,0,2*m_Pi);  m_phi_barrel_neg_2_5GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_neg_5_10GeV","phi_barrel_neg_5_10GeV",100,0,2*m_Pi);  m_phi_barrel_neg_5_10GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_neg_10_20GeV","phi_barrel_neg_10_20GeV",100,0,2*m_Pi);  m_phi_barrel_neg_10_20GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_barrel_neg_20plusGeV","phi_barrel_neg_20plusGeV",100,0,2*m_Pi);  m_phi_barrel_neg_20plusGeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_pos_2_5GeV","phi_eca_pos_2_5GeV",100,0,2*m_Pi);  m_phi_eca_pos_2_5GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_pos_5_10GeV","phi_eca_pos_5_10GeV",100,0,2*m_Pi);  m_phi_eca_pos_5_10GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_pos_10_20GeV","phi_eca_pos_10_20GeV",100,0,2*m_Pi);  m_phi_eca_pos_10_20GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_pos_20plusGeV","phi_eca_pos_20plusGeV",100,0,2*m_Pi);  m_phi_eca_pos_20plusGeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_neg_2_5GeV","phi_eca_neg_2_5GeV",100,0,2*m_Pi);  m_phi_eca_neg_2_5GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_neg_5_10GeV","phi_eca_neg_5_10GeV",100,0,2*m_Pi);  m_phi_eca_neg_5_10GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_neg_10_20GeV","phi_eca_neg_10_20GeV",100,0,2*m_Pi);  m_phi_eca_neg_10_20GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca_neg_20plusGeV","phi_eca_neg_20plusGeV",100,0,2*m_Pi);  m_phi_eca_neg_20plusGeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_pos_2_5GeV","phi_ecc_pos_2_5GeV",100,0,2*m_Pi);  m_phi_ecc_pos_2_5GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_pos_5_10GeV","phi_ecc_pos_5_10GeV",100,0,2*m_Pi);  m_phi_ecc_pos_5_10GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_pos_10_20GeV","phi_ecc_pos_10_20GeV",100,0,2*m_Pi);  m_phi_ecc_pos_10_20GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_pos_20plusGeV","phi_ecc_pos_20plusGeV",100,0,2*m_Pi);  m_phi_ecc_pos_20plusGeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_neg_2_5GeV","phi_ecc_neg_2_5GeV",100,0,2*m_Pi);  m_phi_ecc_neg_2_5GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_neg_5_10GeV","phi_ecc_neg_5_10GeV",100,0,2*m_Pi);  m_phi_ecc_neg_5_10GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_neg_10_20GeV","phi_ecc_neg_10_20GeV",100,0,2*m_Pi);  m_phi_ecc_neg_10_20GeV->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc_neg_20plusGeV","phi_ecc_neg_20plusGeV",100,0,2*m_Pi);  m_phi_ecc_neg_20plusGeV->SetMinimum(0);
+    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");    
@@ -1467,57 +1556,63 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     m_eta_phi_neg_20plusGeV->GetXaxis()->SetTitle("Track #eta"); 
     m_eta_phi_neg_20plusGeV->GetYaxis()->SetTitle("Track #phi");
 
-    m_chi2oDoF_barrel = TH1F_LW::create("chi2oDoF_barrel","chi2oDoF (Barrel)",100,0,10);  
+    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 = TH1F_LW::create("chi2oDoF_eca","chi2oDoF (Eca)",100,0,10);  
+    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 = TH1F_LW::create("chi2oDoF_ecc","chi2oDoF (Ecc)",100,0,10);  
+    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 = TH1F_LW::create("phi_barrel","phi (Barrel)",100,0,2*m_Pi); m_phi_barrel->SetMinimum(0);
+    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 = TH1F_LW::create("phi_eca","phi (Eca)",100,0,2*m_Pi); m_phi_eca->SetMinimum(0);
+    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 = TH1F_LW::create("phi_ecc","phi (Ecc)",100,0,2*m_Pi); m_phi_ecc->SetMinimum(0);
+    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 = TH1F_LW::create("pT","pT",200,-m_pTRange,m_pTRange);  
-    RegisterHisto(al_mon_ls,m_pT) ;   
-    m_pT->GetXaxis()->SetTitle("Signed Track pT [GeV]"); 
+    m_pT = new TH1F("pT","signed track p_{T}",200,-m_pTRange,m_pTRange);  
+    RegisterHisto(al_mon,   m_pT);   
+    m_pT->GetXaxis()->SetTitle("Signed track p_{T} [GeV]"); 
     m_pT->GetYaxis()->SetTitle("Number of Tracks");   
-    m_pTRes = TH1F_LW::create("pTRes","pTRes",100,0,1.0);  
+
+    m_pTabs = new TH1F("pTabs","Track p_{T}",100, 0., m_pTRange);  
+    RegisterHisto(al_mon,   m_pTabs) ;   
+    m_pTabs->GetXaxis()->SetTitle("Track p_{T} [GeV]"); 
+    m_pTabs->GetYaxis()->SetTitle("Number of Tracks");   
+
+    m_pTRes = new TH1F("pTRes","pTRes",100,0,1.0);  
     RegisterHisto(al_mon,m_pTRes) ;  
-    m_pTResOverP = TH1F_LW::create("pTResOverP","Momentum resolution / Momentum",100,0,0.05);  
+    m_pTResOverP = new TH1F("pTResOverP","Momentum resolution / Momentum",100,0,0.05);  
     RegisterHisto(al_mon,m_pTResOverP) ;  
 
-    m_P = TH1F_LW::create("P","Track Momentum P",200,-m_pTRange,m_pTRange);  
+    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 = TH1F_LW::create("Zmumu","Zmumu Inv. Mass",60,60,120);  
+    m_Zmumu = new TH1F("Zmumu","Zmumu Inv. Mass",60,60,120);  
     RegisterHisto(al_mon,m_Zmumu) ;  
-    m_Zmumu_barrel = TH1F_LW::create("Zmumu_barrel","Zmumu Both Legs Barrel",60,60,120);  
+    m_Zmumu_barrel = new TH1F("Zmumu_barrel","Zmumu Both Legs Barrel",60,60,120);  
     RegisterHisto(al_mon,m_Zmumu_barrel) ;  
-    m_Zmumu_eca = TH1F_LW::create("Zmumu_eca","Zmumu Both Legs ECA",60,60,120);  
+    m_Zmumu_eca = new TH1F("Zmumu_eca","Zmumu Both Legs ECA",60,60,120);  
     RegisterHisto(al_mon,m_Zmumu_eca) ;  
-    m_Zmumu_ecc = TH1F_LW::create("Zmumu_ecc","Zmumu Both Legs ECC",60,60,120);  
+    m_Zmumu_ecc = new TH1F("Zmumu_ecc","Zmumu Both Legs ECC",60,60,120);  
     RegisterHisto(al_mon,m_Zmumu_ecc) ;  
-    m_Zmumu_barrel_eca = TH1F_LW::create("Zmumu_barrel_eca","Zmumu One Barrel One ECA",60,60,120);  
+    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 = TH1F_LW::create("Zmumu_barrel_ecc","Zmumu One Barrel One ECC",60,60,120);  
+    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);  
@@ -1542,6 +1637,9 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     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_barrel_zoom = new TH2F("hitMap_barrel_zoom","Hit Map for Barrel",125,-150.,150., 125,-150.,150.);
+    RegisterHisto(al_mon,m_hitMap_barrel_zoom);
+
     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);
     
@@ -1549,79 +1647,84 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     RegisterHisto(al_mon,m_hitMap_endcapC);
 
     //charge asymmetry vs.eta
-    m_eta_neg = TH1F_LW::create("eta_neg","eta for negative tracks; #eta(-)",25,-m_etaRange,m_etaRange);   
+    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 = TH1F_LW::create("eta_pos","eta for positive tracks; #eta(+)",25,-m_etaRange,m_etaRange);   
+    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 = TH1F_LW::create("eta_asym","Track Charge Asymmetry versus eta",25, -m_etaRange,m_etaRange);
+    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 " <<endreq;
+    // msg(MSG::INFO) << "lumiblock histos done " <<endmsg;
 
  
 
 
     
     // lumiblock histos 
-    m_LumiBlock = TH1F_LW::create("LumiBlock","Lumi block",1024,-0.5,1023.5); 
+    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 = TH1F_LW::create("TracksPerLumiBlock","Tracks per Lumi block",1024,-0.5,1023.5); 
+    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 = TH1F_LW::create("NPixPerLumiBlock","N pixel hits per Lumi block",1024,-0.5,1023.5); 
+    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 = TH1F_LW::create("NSCTPerLumiBlock","N SCT hits per Lumi block",1024,-0.5,1023.5); 
+    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 = TH1F_LW::create("NTRTPerLumiBlock","N TRT hits per Lumi block",1024,-0.5,1023.5); 
+    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");   
 
+    // track weight histo
+    int theNbins = 50;
+    float theLowRange = 0.;
+    float theUppRange = 5.;
+    float theBinWidth= (theUppRange-theLowRange)/theNbins;
+    m_hTrackWeight = new TH1F("hUsedWeight","Weight per track", theNbins+1, theLowRange-theBinWidth/2, theUppRange+theBinWidth/2); 
+    RegisterHisto(al_mon, m_hTrackWeight) ;
+    m_hTrackWeight->GetXaxis()->SetTitle("weight"); 
+    m_hTrackWeight->GetYaxis()->SetTitle("# tracks");   
+    //
     m_histosBooked++;
   }
-  return StatusCode::SUCCESS;
-  
-}
 
-void IDAlignMonGenericTracks::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
+  if (msgLvl(MSG::INFO)) msg(MSG::INFO) << " ** IDAlignMonGenericTracks::bookHistograms() ** COMPLETED ** track collection: " << m_tracksName 
+					<< "  trigchain: " << m_triggerChainName 
+					<< "  m_histosBooked : " << m_histosBooked << std::endl;
   
-  //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:" << endreq;
-  }
+  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:" << endreq;
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
   }
 }
 
@@ -1629,7 +1732,7 @@ 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:" << endreq;
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
   }
 }
 
@@ -1638,22 +1741,37 @@ 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:" << endreq;
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
   }
 }
 
-
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 StatusCode IDAlignMonGenericTracks::fillHistograms()
 {
   m_events++;
  
+  // Get EventInfo
+  const DataHandle<xAOD::EventInfo> eventInfo;
+  if (StatusCode::SUCCESS != evtStore()->retrieve( eventInfo ) ){
+    msg(MSG::ERROR) << "Cannot get event info." << endmsg;
+    return StatusCode::FAILURE;
+  }
+  //EventID* eventID = eventInfo->event_ID();
+
   //if (!evtStore()->contains<TrackCollection>(m_tracksName)) {
   if (!evtStore()->contains<TrackCollection>(m_tracksName)) {
-    if(m_events == 1) {if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_tracksName << " TrackCollection" << endreq;}
-    else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_tracksName << " TrackCollection" << endreq;
+    if(m_events == 1) {if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_tracksName << " TrackCollection" << endmsg;}
+    else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_tracksName << " TrackCollection" << endmsg;
     return StatusCode::SUCCESS;
   }
 
+  // Code is able to get a weight from an external file and appy it to all histograms
+  double TrkWeight = 1.;
+  // NB the weight is a "per track" weight, so histograms such as BS info are never weighted
+  
+  // interactions per event
+  m_mu = eventInfo->averageInteractionsPerCrossing();
+  if(m_mu_perEvent) m_mu_perEvent->Fill(m_mu);
   
   //get tracks
   DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
@@ -1669,10 +1787,10 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
   if (evtStore()->contains<xAOD::VertexContainer>(m_VxPrimContainerName)) {
     StatusCode scv = evtStore()->retrieve(m_vertices,m_VxPrimContainerName);
     if (scv.isFailure()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No Collection with name  "<<m_VxPrimContainerName<<" found in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No Collection with name  "<<m_VxPrimContainerName<<" found in StoreGate" << endmsg;
       return StatusCode::SUCCESS;
     } else {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name  "<<m_VxPrimContainerName<< " with size " << m_vertices->size() <<" found  in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name  "<<m_VxPrimContainerName<< " with size " << m_vertices->size() <<" found  in StoreGate" << endmsg;
   
       xAOD::VertexContainer::const_iterator vxItr  = m_vertices->begin();
       xAOD::VertexContainer::const_iterator vxItrE = m_vertices->end();    
@@ -1692,17 +1810,14 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
       }
     }
     //std::cout << "xv, yv, zv: " << xv << ", " << yv << ", " << zv << std::endl;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "StoreGate does not contain VxPrimaryCandidate Container" << endreq;
+  } 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"<<endreq;
+    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
  
   if (m_doIP) fillVertexInformation();
 
@@ -1720,45 +1835,38 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
     beamTiltY = m_beamCondSvc->beamTilt(1);
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Beamspot from " << m_beamCondSvc << ": x0 = " << beamSpotX << ", y0 = " << beamSpotY
           << ", z0 = " << beamSpotZ << ", tiltX = " << beamTiltX
-          << ", tiltY = " << beamTiltY <<endreq;
-
-
-    
+          << ", tiltY = " << beamTiltY <<endmsg;
   }
   
-  // Get EventInfo
-  const DataHandle<xAOD::EventInfo> eventInfo;
-  if (StatusCode::SUCCESS != evtStore()->retrieve( eventInfo ) ){
-    msg(MSG::ERROR) << "Cannot get event info." << endreq;
-    delete trks;
-    return StatusCode::FAILURE;
-  }
-  //EventID* eventID = eventInfo->event_ID();
+  // extract lumiblock
   unsigned int LumiBlock = eventInfo->lumiBlock();
 
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LumiBlock = " <<  LumiBlock << endreq;
-  m_LumiBlock->Fill(float(LumiBlock), hweight);
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LumiBlock = " <<  LumiBlock << endmsg;
+  m_LumiBlock->Fill(float(LumiBlock), TrkWeight);
   
-  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(float(LumiBlock),beamSpotX, hweight);
-	m_YBs_vs_LumiBlock->Fill(float(LumiBlock),beamSpotY, hweight);
-	m_ZBs_vs_LumiBlock->Fill(float(LumiBlock),beamSpotZ, hweight);
-	m_BeamSpotTiltX_vs_LumiBlock->Fill(float(LumiBlock),1e3*beamTiltX, hweight);
-	m_BeamSpotTiltY_vs_LumiBlock->Fill(float(LumiBlock),1e3*beamTiltY, hweight);
-      }
+  if (m_extendedPlots) { // warning: these histograms are filled once per event, not for every track --> TrkWeight = 1;
+    
+    //Fill BeamSpot Position histos
+    
+
+
+    m_YBs_vs_XBs->Fill(beamSpotX,beamSpotY, TrkWeight);
+    m_YBs_vs_ZBs->Fill(beamSpotZ,beamSpotY, TrkWeight);
+    m_XBs_vs_ZBs->Fill(beamSpotZ,beamSpotX, TrkWeight);
+    
+    m_XBs->Fill(beamSpotX, TrkWeight);
+    m_YBs->Fill(beamSpotY, TrkWeight);
+    m_ZBs->Fill(beamSpotZ, TrkWeight);
+    m_TiltX_Bs->Fill(1e6*beamTiltX, TrkWeight);
+    m_TiltY_Bs->Fill(1e6*beamTiltY, TrkWeight);
+    
+    //Fill BeamSpot Position versus lumiblock histos
+    m_XBs_vs_LumiBlock->Fill(float(LumiBlock),beamSpotX, TrkWeight);
+    m_YBs_vs_LumiBlock->Fill(float(LumiBlock),beamSpotY, TrkWeight);
+    m_ZBs_vs_LumiBlock->Fill(float(LumiBlock),beamSpotZ, TrkWeight);
+    m_BeamSpotTiltX_vs_LumiBlock->Fill(float(LumiBlock),1e3*beamTiltX, TrkWeight);
+    m_BeamSpotTiltY_vs_LumiBlock->Fill(float(LumiBlock),1e3*beamTiltY, TrkWeight);
+  } // end of m_extendedPlots
   
 
   int nHits=0;
@@ -1777,30 +1885,29 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
   //DataVector<xAOD::TrackParticle>::const_iterator trkPsItr  = trkPs->begin();
   //DataVector<xAOD::TrackParticle>::const_iterator trkPsItrE = trkPs->end();
   
-  if (m_doIP)
-    {
-      const xAOD::VertexContainer* vxContainer(0);
-      StatusCode sc = evtStore()->retrieve(vxContainer, m_VxPrimContainerName);
-      if (sc.isFailure()) {
-	ATH_MSG_DEBUG("Could not retrieve primary vertex info: " << m_VxPrimContainerName);
-	return false;
-      }
-      if(vxContainer) {
-	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);
-	  }
+  if (m_doIP) {
+    const xAOD::VertexContainer* vxContainer(0);
+    StatusCode sc = evtStore()->retrieve(vxContainer, m_VxPrimContainerName);
+    if (sc.isFailure()) {
+      ATH_MSG_DEBUG("Could not retrieve primary vertex info: " << m_VxPrimContainerName);
+      return false;
+    }
+    if(vxContainer) {
+      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);
 	}
       }
     }
+  } // end m_doIP
   
   
   for (; trksItr != trksItrE; ++trksItr) {
@@ -1852,7 +1959,7 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
     } 
     
     if (covariance == NULL) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq; 
+      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg; 
     }
     else{  
       AmgVector(5) perigeeParams = measPer->parameters(); 
@@ -1887,15 +1994,36 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
       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 ( m_applyHistWeight ){
+	TrkWeight = 1.; // default
+	int binNumber = 0;
+	// different weights can be considered
+	switch (m_userInputWeigthMethod) {
+	case IDAlignMonGenericTracks::TRKETA_TRKPT : // map of trk pt vs eta
+	  binNumber = m_hInputTrackWeight->FindBin(trketa, trkpt);
+	  TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	  break;
+	case IDAlignMonGenericTracks::EVENTMU_TRKPT : // map of event mu vs eta
+	  binNumber = m_hInputTrackWeight->FindBin(m_mu, trkpt);
+	  TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	  break;
+	case IDAlignMonGenericTracks::EVENTMU_TRKETA : // map of event mu vs eta
+	  binNumber = m_hInputTrackWeight->FindBin(m_mu, trketa);
+	  TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	  break;
+	default:
+	  // map of trk pt vs eta
+	  binNumber = m_hInputTrackWeight->FindBin(trketa, trkpt);
+	  TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	} // end switch for trk weight calculation
+
+	m_hTrackWeight->Fill(TrkWeight);   
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Track weight calculation method " << m_userInputWeigthMethod << " TrkWeight: " << TrkWeight << endmsg;
+      } // end of track weight
+    } // end of else (covariance == NULL)  
 
     if (fitQual==0) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No fit quality assigned to the track" << endreq; 
+      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No fit quality assigned to the track" << endmsg; 
       chi2Prob = -1e12; // return big value
     }
     else {
@@ -1912,24 +2040,25 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
     if (trkphi<0) trkphi+=2*m_Pi;
     
     ngTracks++;    
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << nTracks << " is a good track!" << endreq;  
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << nTracks << " is a good track!" << endmsg;  
 
    
+    // variables for number of hits
+    int nhpixB=0, nhibl=0, nhpixECA=0, nhpixECC=0, nhsctB=0, nhsctECA=0, nhsctECC=0, nhtrtB=0, nhtrtECA=0, nhtrtECC=0;
 
-    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 DataVector<const Trk::TrackStateOnSurface>* TSOS;
     TSOS = (*trksItr)->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"<<endreq;
+    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" << endreq;
+        if (msgLvl(MSG::DEBUG)) msg() << "hit skipped because no associated track parameters" << endmsg;
         continue;
       }
       
@@ -1948,16 +2077,16 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
         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..." << endreq;
+            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==NULL) {
-              if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit failed quality cuts and is rejected." << endreq;
+              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" << endreq;
+            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." << endreq;
+          else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit quality cuts NOT APPLIED to Silicon hit." << endmsg;
         }
       
         const Trk::Surface& hitSurface  = mesb->associatedSurface();
@@ -1970,7 +2099,12 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
         if (m_idHelper->is_pixel(surfaceID)){
           if(m_pixelID->barrel_ec(surfaceID)      ==  0){
             nhpixB++;
-            m_hitMap_barrel   -> Fill( hitSurfaceX,  hitSurfaceY, hweight );
+            m_hitMap_barrel   -> Fill( hitSurfaceX,  hitSurfaceY, TrkWeight );
+            m_hitMap_barrel_zoom-> Fill( hitSurfaceX,  hitSurfaceY, TrkWeight );
+
+	    if (m_pixelID->layer_disk(surfaceID)      ==  0){
+	      nhibl++;
+	    }
           }
           else if(m_pixelID->barrel_ec(surfaceID) ==  2)  nhpixECA++;
           else if(m_pixelID->barrel_ec(surfaceID) == -2) nhpixECC++;
@@ -1979,7 +2113,7 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
         else if (m_idHelper->is_sct(surfaceID)){
           if(m_sctID->barrel_ec(surfaceID)      ==  0){
             nhsctB++;
-            m_hitMap_barrel   -> Fill( hitSurfaceX,  hitSurfaceY, hweight );
+            m_hitMap_barrel   -> Fill( hitSurfaceX,  hitSurfaceY, TrkWeight );
           }
           else if(m_sctID->barrel_ec(surfaceID) ==  2) nhsctECA++;
           else if(m_sctID->barrel_ec(surfaceID) == -2) nhsctECC++;
@@ -1989,54 +2123,57 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
           int m_barrel_ec      = m_trtID->barrel_ec(surfaceID);
           if(m_barrel_ec == 1 || m_barrel_ec == -1 ) {
             nhtrtB++;
-            m_hitMap_barrel  -> Fill( hitSurfaceX,   hitSurfaceY, hweight );
+            m_hitMap_barrel  -> Fill( hitSurfaceX,   hitSurfaceY, TrkWeight );
           }
           else if(m_barrel_ec ==  2){
             nhtrtECA++;
-            m_hitMap_endcapA -> Fill( float(gp.z()), float(gp.phi()), hweight );
+            m_hitMap_endcapA -> Fill( float(gp.z()), float(gp.phi()), TrkWeight );
           }else if(m_barrel_ec == -2){
             nhtrtECC++;
-            m_hitMap_endcapC -> Fill( float(gp.z()), float(gp.phi()), hweight );
+            m_hitMap_endcapC -> Fill( float(gp.z()), float(gp.phi()), TrkWeight );
           }
         }
       }
     }
+
     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);
+    m_nhits_per_track -> Fill(nhits, TrkWeight);
+    m_nsilhits_per_track -> Fill(nhpix+nhsct);
+    m_niblhits_per_track -> Fill(nhibl, TrkWeight);
+    m_npixhits_per_track -> Fill(nhpix, TrkWeight); // including IBL and old_Pixels
+    m_nscthits_per_track -> Fill(nhsct, TrkWeight);
+    m_ntrthits_per_track -> Fill(nhtrt, TrkWeight);
     // 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);
+    m_npixhits_per_track_barrel -> Fill(nhpixB, TrkWeight);
+    m_nscthits_per_track_barrel -> Fill(nhsctB, TrkWeight);
+    m_ntrthits_per_track_barrel -> Fill(nhtrtB, TrkWeight);
     // 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);
+    m_npixhits_per_track_eca -> Fill(nhpixECA, TrkWeight);
+    m_nscthits_per_track_eca -> Fill(nhsctECA, TrkWeight);
+    m_ntrthits_per_track_eca -> Fill(nhtrtECA, TrkWeight);
     // 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);
+    m_npixhits_per_track_ecc -> Fill(nhpixECC, TrkWeight);
+    m_nscthits_per_track_ecc -> Fill(nhsctECC, TrkWeight);
+    m_ntrthits_per_track_ecc -> Fill(nhtrtECC, TrkWeight);
+
+    if (nhibl   >= 1) m_summary -> Fill(0., TrkWeight);
+    if (nhpix   >= 3) m_summary -> Fill(1., TrkWeight); 
+    if (nhsct   >= 8) m_summary -> Fill(2., TrkWeight);
+    if (nhtrt   >=20) m_summary -> Fill(3., TrkWeight);
+    if (nhpixB  >= 3) m_summary -> Fill(4., TrkWeight);
+    if (nhsctB  >= 8) m_summary -> Fill(5., TrkWeight);
+    if (nhtrtB  >=20) m_summary -> Fill(6., TrkWeight);
+    if (nhpixECA>= 2) m_summary -> Fill(7., TrkWeight);
+    if (nhsctECA>= 2) m_summary -> Fill(8., TrkWeight);
+    if (nhtrtECA>=15) m_summary -> Fill(9., TrkWeight);
+    if (nhpixECC>= 2) m_summary -> Fill(10., TrkWeight);
+    if (nhsctECC>= 2) m_summary -> Fill(11., TrkWeight);
+    if (nhtrtECC>=15) m_summary -> Fill(12., TrkWeight);
 
     bool hasECAhits = false;
     if(nhpixECA+nhsctECA+nhtrtECA > 0) hasECAhits = true;
@@ -2045,316 +2182,325 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
 
     
     if (!hasECAhits && !hasECChits) { //filling barrel histograms
-      m_chi2oDoF_barrel             -> Fill(chi2oDoF, hweight);
-      m_phi_barrel                  -> Fill(trkphi  , hweight);
+      m_chi2oDoF_barrel             -> Fill(chi2oDoF, TrkWeight);
+      m_phi_barrel                  -> Fill(trkphi  , TrkWeight);
             
 
       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);
+        m_trk_d0_wrtPV_vs_phi_vs_eta_barrel->Fill(trketa, trkphi, myIPandSigma->IPd0, TrkWeight);
+        m_trk_z0_wrtPV_vs_phi_vs_eta_barrel->Fill(trketa, trkphi, myIPandSigma->IPz0, TrkWeight);
       }
 
 
       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);
+        if(trkpt> 2. && trkpt< 5.)     m_phi_barrel_pos_2_5GeV   -> Fill(trkphi, TrkWeight);
+        else if(trkpt> 5. && trkpt<10.)m_phi_barrel_pos_5_10GeV  -> Fill(trkphi, TrkWeight);
+        else if(trkpt>10. && trkpt<20.)m_phi_barrel_pos_10_20GeV -> Fill(trkphi, TrkWeight);
+        else if(trkpt>20.)             m_phi_barrel_pos_20plusGeV-> Fill(trkphi, TrkWeight);
       } 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);
+        if(trkpt> 2. && trkpt< 5.)     m_phi_barrel_neg_2_5GeV   -> Fill(trkphi, TrkWeight);
+        else if(trkpt> 5. && trkpt<10.)m_phi_barrel_neg_5_10GeV  -> Fill(trkphi, TrkWeight);
+        else if(trkpt>10. && trkpt<20.)m_phi_barrel_neg_10_20GeV -> Fill(trkphi, TrkWeight);
+        else if(trkpt>20.)             m_phi_barrel_neg_20plusGeV-> Fill(trkphi, TrkWeight);
       }
     }
     else if (hasECAhits) {//filling endcap A histograms
-      m_chi2oDoF_eca -> Fill(chi2oDoF, hweight);
-      m_phi_eca      -> Fill(trkphi  , hweight);  
+      m_chi2oDoF_eca -> Fill(chi2oDoF, TrkWeight);
+      m_phi_eca      -> Fill(trkphi  , TrkWeight);  
       
       
       
       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);
+        m_trk_d0_wrtPV_vs_phi_vs_eta_eca -> Fill(trketa, trkphi, myIPandSigma->IPd0, TrkWeight);
+        m_trk_z0_wrtPV_vs_phi_vs_eta_eca -> Fill(trketa, trkphi, myIPandSigma->IPz0, TrkWeight);
       }
 
       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);
+        if(trkpt> 2. && trkpt< 5.)     m_phi_eca_pos_2_5GeV   -> Fill(trkphi, TrkWeight);
+        else if(trkpt> 5. && trkpt<10.)m_phi_eca_pos_5_10GeV  -> Fill(trkphi, TrkWeight);
+        else if(trkpt>10. && trkpt<20.)m_phi_eca_pos_10_20GeV -> Fill(trkphi, TrkWeight);
+        else if(trkpt>20.)             m_phi_eca_pos_20plusGeV-> Fill(trkphi, TrkWeight);
       } 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);
+        if(trkpt> 2. && trkpt< 5.)     m_phi_eca_neg_2_5GeV   -> Fill(trkphi, TrkWeight);
+        else if(trkpt> 5. && trkpt<10.)m_phi_eca_neg_5_10GeV  -> Fill(trkphi, TrkWeight);
+        else if(trkpt>10. && trkpt<20.)m_phi_eca_neg_10_20GeV -> Fill(trkphi, TrkWeight);
+        else if(trkpt>20.)             m_phi_eca_neg_20plusGeV-> Fill(trkphi, TrkWeight);
       }
     }
     else if (hasECChits) {//filling endcap C histograms
-      m_chi2oDoF_ecc -> Fill(chi2oDoF, hweight);
-      m_phi_ecc      -> Fill(trkphi  , hweight);
+      m_chi2oDoF_ecc -> Fill(chi2oDoF, TrkWeight);
+      m_phi_ecc      -> Fill(trkphi  , TrkWeight);
       
 
       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);
+        m_trk_d0_wrtPV_vs_phi_vs_eta_ecc -> Fill(trketa, trkphi, myIPandSigma->IPd0, TrkWeight);
+        m_trk_z0_wrtPV_vs_phi_vs_eta_ecc -> Fill(trketa, trkphi, myIPandSigma->IPz0, TrkWeight);
       }
 
 
       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);
+        if(trkpt> 2. && trkpt< 5.)     m_phi_ecc_pos_2_5GeV   -> Fill(trkphi, TrkWeight);
+        else if(trkpt> 5. && trkpt<10.)m_phi_ecc_pos_5_10GeV  -> Fill(trkphi, TrkWeight);
+        else if(trkpt>10. && trkpt<20.)m_phi_ecc_pos_10_20GeV -> Fill(trkphi, TrkWeight);
+        else if(trkpt>20.)             m_phi_ecc_pos_20plusGeV-> Fill(trkphi, TrkWeight);
       } 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);
+        if(trkpt> 2. && trkpt< 5.)     m_phi_ecc_neg_2_5GeV   -> Fill(trkphi, TrkWeight);
+        else if(trkpt> 5. && trkpt<10.)m_phi_ecc_neg_5_10GeV  -> Fill(trkphi, TrkWeight);
+        else if(trkpt>10. && trkpt<20.)m_phi_ecc_neg_10_20GeV -> Fill(trkphi, TrkWeight);
+        else if(trkpt>20.)             m_phi_ecc_neg_20plusGeV-> Fill(trkphi, TrkWeight);
       }
     }
   
-    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);
+    m_chi2oDoF -> Fill(chi2oDoF, TrkWeight);
+    m_eta      -> Fill(trketa  , TrkWeight);
+    if (charge>0) m_eta_pos -> Fill (trketa, TrkWeight);
+    else          m_eta_neg -> Fill (trketa, TrkWeight);
+    m_phi -> Fill(trkphi, TrkWeight);
     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);
+      if(trkpt> 2. && trkpt< 5.)     m_eta_phi_pos_2_5GeV   -> Fill(trketa,trkphi, TrkWeight);
+      else if(trkpt> 5. && trkpt<10.)m_eta_phi_pos_5_10GeV  -> Fill(trketa,trkphi, TrkWeight);
+      else if(trkpt>10. && trkpt<20.)m_eta_phi_pos_10_20GeV -> Fill(trketa,trkphi, TrkWeight);
+      else if(trkpt>20.)             m_eta_phi_pos_20plusGeV-> Fill(trketa,trkphi, TrkWeight);
     } 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);
+      if(trkpt> 2. && trkpt< 5.)     m_eta_phi_neg_2_5GeV   -> Fill(trketa,trkphi, TrkWeight);
+      else if(trkpt> 5. && trkpt<10.)m_eta_phi_neg_5_10GeV  -> Fill(trketa,trkphi, TrkWeight);
+      else if(trkpt>10. && trkpt<20.)m_eta_phi_neg_10_20GeV -> Fill(trketa,trkphi, TrkWeight);
+      else if(trkpt>20.)             m_eta_phi_neg_20plusGeV-> Fill(trketa,trkphi, TrkWeight);
     }
-    m_z0 -> Fill(trkz0, hweight);
-    m_z0sintheta -> Fill(trkz0*(sin(trktheta)), hweight);
-    m_d0        -> Fill(trkd0, hweight);
-    m_d0_bscorr -> Fill(d0bscorr    , hweight);
+    m_z0 -> Fill(trkz0, TrkWeight);
+    m_z0sintheta -> Fill(trkz0*(sin(trktheta)), TrkWeight);
+    m_d0        -> Fill(trkd0, TrkWeight);
+    m_d0_bscorr -> Fill(d0bscorr    , TrkWeight);
     
     if(m_doIP && myIPandSigma){
-      m_trk_d0_wrtPV -> Fill(myIPandSigma->IPd0, hweight);
-      m_trk_z0_wrtPV -> Fill(myIPandSigma->IPz0, hweight);
+      m_trk_d0_wrtPV -> Fill(myIPandSigma->IPd0, TrkWeight);
+      m_trk_z0_wrtPV -> Fill(myIPandSigma->IPz0, TrkWeight);
       }
-    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_pT        -> Fill(charge*trkpt, TrkWeight);
+    m_pTabs     -> Fill(trkpt, TrkWeight);
+    m_P         -> Fill(trkP        , TrkWeight);
+    if(charge>0) m_pT_p -> Fill(trkpt, TrkWeight);
+    if(charge<0) m_pT_n -> Fill(trkpt, TrkWeight);
     
-    m_pTRes      -> Fill(fabs(Err_qOverP/qOverP)       , hweight);
-    m_pTResOverP -> Fill(fabs(Err_qOverP/qOverP*qOverP), hweight);
+    m_pTRes      -> Fill(fabs(Err_qOverP/qOverP)       , TrkWeight);
+    m_pTResOverP -> Fill(fabs(Err_qOverP/qOverP*qOverP), TrkWeight);
 
     
 
-    m_Tracks_per_LumiBlock->Fill(float(LumiBlock), hweight);
-    m_NPIX_per_LumiBlock->Fill(float(LumiBlock), nhpix*hweight);
-    m_NSCT_per_LumiBlock->Fill(float(LumiBlock), nhsct*hweight);
-    m_NTRT_per_LumiBlock->Fill(float(LumiBlock), nhtrt*hweight);
+    m_Tracks_per_LumiBlock->Fill(float(LumiBlock), TrkWeight);
+    m_NPIX_per_LumiBlock->Fill(float(LumiBlock), nhpix*TrkWeight);
+    m_NSCT_per_LumiBlock->Fill(float(LumiBlock), nhsct*TrkWeight);
+    m_NTRT_per_LumiBlock->Fill(float(LumiBlock), nhtrt*TrkWeight);
 
     
-
     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);
+      m_trk_d0_wrtPV_vs_phi_vs_eta-> Fill(trketa, trkphi, myIPandSigma->IPd0, TrkWeight);
+      m_trk_z0_wrtPV_vs_phi_vs_eta-> Fill(trketa, trkphi, myIPandSigma->IPz0, TrkWeight);
     }
 
 
     if(m_extendedPlots){
-      m_d0_pvcorr -> Fill(trkd0c      , hweight);
-      m_z0_pvcorr  -> Fill(trkz0c, hweight);
+      m_d0_pvcorr -> Fill(trkd0c      , TrkWeight);
+      m_z0_pvcorr  -> Fill(trkz0c, TrkWeight);
       
       if(charge>0) {
-	m_trk_d0c_pos -> Fill(trkd0c, hweight);
-	m_trk_z0c_pos -> Fill(trkz0c, hweight);
+	m_trk_d0c_pos -> Fill(trkd0c, TrkWeight);
+	m_trk_z0c_pos -> Fill(trkz0c, TrkWeight);
       }
       if(charge<0) {
-	m_trk_d0c_neg -> Fill(trkd0c, hweight);
-	m_trk_z0c_neg -> Fill(trkz0c, hweight);
+	m_trk_d0c_neg -> Fill(trkd0c, TrkWeight);
+	m_trk_z0c_neg -> Fill(trkz0c, TrkWeight);
       }
       
       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*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( fabs(trkpt)      , Err_cottheta, hweight);
-      m_errCotThetaVsP   -> Fill( 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( fabs(trkpt)      , Err_theta, hweight);
-      m_errThetaVsP      -> Fill( 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( fabs(trkpt)      , Err_d0   , hweight);
-      m_errD0VsP         -> Fill( 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( fabs(trkpt)      , Err_phi  , hweight);
-      m_errPhi0VsP       -> Fill( 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( fabs(trkpt)      , Err_z0   , hweight);
-      m_errZ0VsP         -> Fill( 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( 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);
+      m_z0sintheta_pvcorr -> Fill(trkz0c*(sin(trktheta)), TrkWeight);
+      m_trk_chi2oDoF -> Fill(trketa,chi2oDoF, TrkWeight);
+      m_trk_chi2Prob -> Fill(trketa,chi2Prob, TrkWeight);
+      m_trk_d0_vs_phi_vs_eta -> Fill(trketa, trkphi, trkd0c, TrkWeight);
+
+      m_trk_PIXvSCTHits  -> Fill( nhsct            , nhpix   , TrkWeight);
+      m_trk_PIXHitsvEta  -> Fill( trketa           , nhpix   , TrkWeight);    
+      m_trk_SCTHitsvEta  -> Fill( trketa           , nhsct   , TrkWeight);
+      m_trk_TRTHitsvEta  -> Fill( trketa           , nhtrt   , TrkWeight);
+      m_trk_chi2oDoF_Phi -> Fill( trkphi           , chi2oDoF, TrkWeight);
+      m_trk_chi2oDoF_Pt  -> Fill( charge*trkpt     , chi2oDoF, TrkWeight);
+      m_trk_chi2oDoF_P   -> Fill( charge*fabs(trkP), chi2oDoF, TrkWeight);
+      m_trk_chi2ProbDist -> Fill( chi2Prob                   , TrkWeight);
+      m_errCotTheta      -> Fill( Err_cottheta               , TrkWeight);
+      m_errCotThetaVsD0BS-> Fill( d0bscorr         , Err_cottheta, TrkWeight);
+      m_errCotThetaVsPt  -> Fill( fabs(trkpt)      , Err_cottheta, TrkWeight);
+      m_errCotThetaVsP   -> Fill( fabs(trkP)       , Err_cottheta, TrkWeight);
+      m_errCotThetaVsPhi -> Fill( trkphi           , Err_cottheta, TrkWeight);
+      m_errCotThetaVsEta -> Fill( trketa           , Err_cottheta, TrkWeight);
+      m_errTheta         -> Fill( Err_theta                   , TrkWeight); 
+      m_errThetaVsD0BS   -> Fill( d0bscorr         , Err_theta, TrkWeight);
+      m_errThetaVsPt     -> Fill( fabs(trkpt)      , Err_theta, TrkWeight);
+      m_errThetaVsP      -> Fill( fabs(trkP)       , Err_theta, TrkWeight);
+      m_errThetaVsPhi    -> Fill( trkphi           , Err_theta, TrkWeight);
+      m_errThetaVsEta    -> Fill( trketa           , Err_theta, TrkWeight);
+      m_errD0            -> Fill( Err_d0                      , TrkWeight);
+      m_errD0VsD0BS      -> Fill( d0bscorr         , Err_d0   , TrkWeight);
+      m_errD0VsPt        -> Fill( fabs(trkpt)      , Err_d0   , TrkWeight);
+      m_errD0VsP         -> Fill( fabs(trkP)       , Err_d0   , TrkWeight);
+      m_errD0VsPhi       -> Fill( trkphi           , Err_d0   , TrkWeight);
+      m_errD0VsEta       -> Fill( trketa           , Err_d0   , TrkWeight);
+      m_errPhi0          -> Fill( Err_phi                     , TrkWeight);
+      m_errPhi0VsD0BS    -> Fill( d0bscorr         , Err_phi  , TrkWeight);
+      m_errPhi0VsPt      -> Fill( fabs(trkpt)      , Err_phi  , TrkWeight);
+      m_errPhi0VsP       -> Fill( fabs(trkP)       , Err_phi  , TrkWeight);
+      m_errPhi0VsPhi0    -> Fill( trkphi           , Err_phi  , TrkWeight);
+      m_errPhi0VsEta     -> Fill( trketa           , Err_phi  , TrkWeight);
+      m_errZ0            -> Fill( Err_z0                      , TrkWeight);
+      //m_errZ0VsD0BS      -> Fill( d0bscorr         , Err_z0   , TrkWeight);
+      m_errZ0VsPt        -> Fill( fabs(trkpt)      , Err_z0   , TrkWeight);
+      m_errZ0VsP         -> Fill( fabs(trkP)       , Err_z0   , TrkWeight);
+      m_errZ0VsPhi0      -> Fill( trkphi           , Err_z0   , TrkWeight);
+      m_errZ0VsEta       -> Fill( trketa           , Err_z0   , TrkWeight);
+      m_errPt            -> Fill( Err_Pt                      , TrkWeight);
+      m_errPtVsD0BS      -> Fill( d0bscorr         , Err_Pt   , TrkWeight);
+      m_errPtVsPt        -> Fill( trkpt            , Err_Pt   , TrkWeight);
+      m_errPtVsP         -> Fill( fabs(trkP)       , Err_Pt   , TrkWeight);
+      m_errPt_Pt2        -> Fill( Err_Pt/(trkpt*trkpt)        , TrkWeight);
+      m_errPt_Pt2VsPt    -> Fill( trkpt , Err_Pt/(trkpt*trkpt), TrkWeight);
+      m_errPt_Pt2VsEta   -> Fill( trketa, Err_Pt/(trkpt*trkpt), TrkWeight);
+      m_errPt_Pt2VsPhi0  -> Fill( trkphi, Err_Pt/(trkpt*trkpt), TrkWeight);
+      m_errPtVsPhi0      -> Fill( trkphi, Err_Pt              , TrkWeight);
+      m_errPtVsEta       -> Fill( trketa, Err_Pt              , TrkWeight);
+      m_D0VsPhi0         -> Fill( trkphi, trkd0               , TrkWeight);
+      m_Z0VsEta          -> Fill( trketa, trkz0               , TrkWeight);
+      m_QoverPtVsPhi0    -> Fill( trkphi, qOverPt             , TrkWeight);
+      m_QoverPtVsEta     -> Fill( trketa, qOverPt             , TrkWeight);
+      m_QPtVsPhi0        -> Fill( trkphi, charge*trkpt        , TrkWeight);
+      m_QPtVsEta         -> Fill( trketa, charge*trkpt        , TrkWeight);
+      // interaction per event histograms
+      m_eventMu_vs_TrkPt -> Fill( m_mu, trkpt, TrkWeight);
+      m_eventMu_vs_TrkEta-> Fill( m_mu, trketa, TrkWeight); 
+
+      // pt vs eta
+      m_trk_pT_vs_eta        -> Fill(trketa, trkpt         , TrkWeight);
+      
+
       //bs plots
-      m_D0bsVsPhi0 -> Fill( trkphi      , d0bscorr, hweight);
-      m_D0bsVsEta  -> Fill( trketa      , d0bscorr, hweight);
-      m_D0bsVsPt   -> Fill( charge*trkpt, d0bscorr, hweight);
+      m_D0bsVsPhi0 -> Fill( trkphi      , d0bscorr, TrkWeight);
+      m_D0bsVsEta  -> Fill( trketa      , d0bscorr, TrkWeight);
+      m_D0bsVsPt   -> Fill( charge*trkpt, d0bscorr, TrkWeight);
       
       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);
+        m_errD0VsPhiBarrel -> Fill(trkphi      , Err_d0  , TrkWeight);
+        m_D0bsVsPhi0Barrel -> Fill(trkphi      , d0bscorr, TrkWeight);
+        m_D0bsVsPtBarrel   -> Fill(charge*trkpt, d0bscorr, TrkWeight);
+	m_trk_d0_vs_phi_vs_eta_barrel -> Fill(trketa, trkphi, trkd0c, TrkWeight); 
+	m_trk_pT_vs_eta_barrel        -> Fill(trketa, trkpt         , TrkWeight);
+	m_trk_d0_barrel  -> Fill(trkd0 , TrkWeight); 
+	m_trk_d0_barrel_zoomin -> Fill(trkd0, TrkWeight);
+	m_trk_d0c_barrel -> Fill(trkd0c, TrkWeight);            
+	m_trk_z0_barrel  -> Fill(trkz0 , TrkWeight); 
+	m_trk_z0_barrel_zoomin -> Fill(trkz0, TrkWeight);
 	
 	if (charge <0)
 	  {
-	    m_trk_d0c_neg_barrel  -> Fill( trkd0c , hweight);
-	    m_trk_z0c_neg_barrel  -> Fill( trkz0c , hweight);
+	    m_trk_d0c_neg_barrel  -> Fill( trkd0c , TrkWeight);
+	    m_trk_z0c_neg_barrel  -> Fill( trkz0c , TrkWeight);
 	  }
 	else
 	  {
-	    m_trk_d0c_pos_barrel  -> Fill(trkd0c, hweight);
-	    m_trk_z0c_pos_barrel  -> Fill(trkz0c, hweight);
+	    m_trk_d0c_pos_barrel  -> Fill(trkd0c, TrkWeight);
+	    m_trk_z0c_pos_barrel  -> Fill(trkz0c, TrkWeight);
 	  }
       
 	
       }
       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);
+        m_errD0VsPhiECA -> Fill(trkphi      , Err_d0  , TrkWeight);
+        m_D0bsVsPhi0ECA -> Fill(trkphi      , d0bscorr, TrkWeight);
+        m_D0bsVsPtECA   -> Fill(charge*trkpt, d0bscorr, TrkWeight);
+	m_trk_d0_vs_phi_vs_eta_eca -> Fill(trketa, trkphi, trkd0c, TrkWeight);
+	m_trk_pT_vs_eta_eca        -> Fill(trketa, trkpt         , TrkWeight);
+	m_trk_d0_eca  -> Fill(trkd0 , TrkWeight); m_trk_d0_eca_zoomin -> Fill(trkd0, TrkWeight);
+	m_trk_d0c_eca -> Fill(trkd0c, TrkWeight);              
+	m_trk_z0_eca  -> Fill(trkz0 , TrkWeight); m_trk_z0_eca_zoomin -> Fill(trkz0, TrkWeight);
 	
 	if (charge<0)
 	  {
-	    m_trk_d0c_neg_eca  -> Fill(trkd0c, hweight);
-	    m_trk_z0c_neg_eca  -> Fill(trkz0c, hweight);
+	    m_trk_d0c_neg_eca  -> Fill(trkd0c, TrkWeight);
+	    m_trk_z0c_neg_eca  -> Fill(trkz0c, TrkWeight);
 	  }
 	else
 	  {
-	    m_trk_d0c_pos_eca  -> Fill(trkd0c, hweight);
-	    m_trk_z0c_pos_eca  -> Fill(trkz0c, hweight);
+	    m_trk_d0c_pos_eca  -> Fill(trkd0c, TrkWeight);
+	    m_trk_z0c_pos_eca  -> Fill(trkz0c, TrkWeight);
 	  }
 	  
 
       }
       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);
+        m_errD0VsPhiECC -> Fill(trkphi      , Err_d0  , TrkWeight);
+        m_D0bsVsPhi0ECC -> Fill(trkphi      , d0bscorr, TrkWeight);
+        m_D0bsVsPtECC   -> Fill(charge*trkpt, d0bscorr, TrkWeight);
+	m_trk_d0_vs_phi_vs_eta_ecc -> Fill(trketa, trkphi, trkd0c, TrkWeight);
+	m_trk_pT_vs_eta_ecc        -> Fill(trketa, trkpt         , TrkWeight);
+	m_trk_d0_ecc  -> Fill(trkd0 , TrkWeight); m_trk_d0_ecc_zoomin -> Fill(trkd0, TrkWeight);
+	m_trk_d0c_ecc -> Fill(trkd0c, TrkWeight);              
+	m_trk_z0_ecc  -> Fill(trkz0 , TrkWeight); m_trk_z0_ecc_zoomin -> Fill(trkz0, TrkWeight);
 	
 	if (charge <0)
 	  {
-	    m_trk_d0c_neg_ecc  -> Fill(trkd0c, hweight);
-	    m_trk_z0c_neg_ecc  -> Fill(trkz0c, hweight);
+	    m_trk_d0c_neg_ecc  -> Fill(trkd0c, TrkWeight);
+	    m_trk_z0c_neg_ecc  -> Fill(trkz0c, TrkWeight);
 	  }
 	else
 	  {
-	    m_trk_d0c_pos_ecc  -> Fill(trkd0c, hweight);
-	    m_trk_z0c_pos_ecc  -> Fill(trkz0c, hweight);
+	    m_trk_d0c_pos_ecc  -> Fill(trkd0c, TrkWeight);
+	    m_trk_z0c_pos_ecc  -> Fill(trkz0c, TrkWeight);
 	  }
 	  
 	
       }
       if(charge>0)
-        m_PtVsPhi0Pos->Fill(trkphi, trkpt, hweight);
+        m_PtVsPhi0Pos->Fill(trkphi, trkpt, TrkWeight);
       else
-        m_PtVsPhi0Neg->Fill(trkphi, trkpt, hweight);
+        m_PtVsPhi0Neg->Fill(trkphi, trkpt, TrkWeight);
     }//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);
+      m_trk_qopT_vs_phi_barrel -> Fill(trkphi, qOverPt, TrkWeight);
+      m_trk_d0_vs_phi_barrel   -> Fill(trkphi, trkd0  , TrkWeight);
+      m_trk_d0bs_vs_phi_barrel -> Fill(trkphi, d0bscorr, TrkWeight); 
+      m_trk_d0_vs_z0_barrel    -> Fill(trkz0 , trkd0  , TrkWeight);
       if (charge<0) {
-        m_trk_phi0_neg_barrel -> Fill( trkphi , hweight);
-        m_trk_pT_neg_barrel   -> Fill( trkpt  , hweight);
+        m_trk_phi0_neg_barrel -> Fill( trkphi , TrkWeight);
+        m_trk_pT_neg_barrel   -> Fill( trkpt  , TrkWeight);
         
       }
       else {
-        m_trk_phi0_pos_barrel -> Fill(trkphi, hweight);
-        m_trk_pT_pos_barrel   -> Fill(trkpt , hweight);
+        m_trk_phi0_pos_barrel -> Fill(trkphi, TrkWeight);
+        m_trk_pT_pos_barrel   -> Fill(trkpt , TrkWeight);
         
       }
     } 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);
+      m_trk_qopT_vs_phi_eca -> Fill(trkphi,qOverPt, TrkWeight);
+      m_trk_d0_vs_phi_eca   -> Fill(trkphi,trkd0  , TrkWeight);
+      m_trk_d0_vs_z0_eca    -> Fill(trkz0 ,trkd0  , TrkWeight);
       if (charge<0) {
-        m_trk_phi0_neg_eca -> Fill(trkphi, hweight);
-        m_trk_pT_neg_eca   -> Fill(trkpt , hweight);
+        m_trk_phi0_neg_eca -> Fill(trkphi, TrkWeight);
+        m_trk_pT_neg_eca   -> Fill(trkpt , TrkWeight);
       }
       else {
-        m_trk_phi0_pos_eca -> Fill(trkphi, hweight);
-        m_trk_pT_pos_eca   -> Fill(trkpt , hweight);
+        m_trk_phi0_pos_eca -> Fill(trkphi, TrkWeight);
+        m_trk_pT_pos_eca   -> Fill(trkpt , TrkWeight);
       }
     } 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);
+      m_trk_qopT_vs_phi_ecc -> Fill(trkphi, qOverPt, TrkWeight);
+      m_trk_d0_vs_phi_ecc   -> Fill(trkphi, trkd0  , TrkWeight);
+      m_trk_d0_vs_z0_ecc    -> Fill(trkz0 , trkd0  , TrkWeight);
       if (charge<0) {
-        m_trk_phi0_neg_ecc -> Fill(trkphi, hweight);
-        m_trk_pT_neg_ecc   -> Fill(trkpt , hweight);
+        m_trk_phi0_neg_ecc -> Fill(trkphi, TrkWeight);
+        m_trk_pT_neg_ecc   -> Fill(trkpt , TrkWeight);
       }
       else {
-        m_trk_phi0_pos_ecc -> Fill(trkphi, hweight);
-        m_trk_pT_pos_ecc   -> Fill(trkpt , hweight);
+        m_trk_phi0_pos_ecc -> Fill(trkphi, TrkWeight);
+        m_trk_pT_pos_ecc   -> Fill(trkpt , TrkWeight);
         
       }
     } 
@@ -2376,11 +2522,11 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
 
   } // end of loop on trks
 
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of good tracks from TrackCollection: "<< ngTracks<< endreq;
+  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);
+  m_nhits_per_event -> Fill(nHits   , TrkWeight);
+  m_ntrk            -> Fill(nTracks , TrkWeight);
+  m_ngtrk           -> Fill(ngTracks, TrkWeight);
 
   float ptfirst = ptlast;
   ptlast = 0;
@@ -2403,7 +2549,7 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
     const AmgSymMatrix(5)* covariance = measPer ? measPer->covariance() : NULL;
     
     if (covariance == 0) {
-      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track or no covariance matrix associated to the perigee" << endreq; 
+      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(); 
@@ -2437,27 +2583,26 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
       M = sqrt(M);
     
 
-    m_Zmumu -> Fill(M, hweight);
+    m_Zmumu -> Fill(M, TrkWeight);
 
     if(z_pT[0] > 0){
-      m_ZpT_p -> Fill(z_pT[0] , hweight);
-      m_ZpT_n -> Fill(-z_pT[1], hweight);
+      m_ZpT_p -> Fill(z_pT[0] , TrkWeight);
+      m_ZpT_n -> Fill(-z_pT[1], TrkWeight);
     } else {
-      m_ZpT_p -> Fill(z_pT[1] , hweight);
-      m_ZpT_n -> Fill(-z_pT[0], hweight);
+      m_ZpT_p -> Fill(z_pT[1] , TrkWeight);
+      m_ZpT_n -> Fill(-z_pT[0], TrkWeight);
     }
 
-    if(fabs(z_eta[0]) < m_barrelEta && 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(fabs(z_eta[0]) < m_barrelEta && fabs(z_eta[1]) < m_barrelEta) m_Zmumu_barrel-> Fill(M, TrkWeight);
+    if(z_eta[0] >=  m_barrelEta && z_eta[1] >=  m_barrelEta)         m_Zmumu_eca   -> Fill(M, TrkWeight);
+    if(z_eta[0] <= -m_barrelEta && z_eta[1] <= -m_barrelEta)         m_Zmumu_ecc   -> Fill(M, TrkWeight);
     
     if((fabs(z_eta[0]) < m_barrelEta && z_eta[1] >= m_barrelEta) ||
-       (z_eta[0] >= m_barrelEta && fabs(z_eta[1]) < m_barrelEta))    m_Zmumu_barrel_eca -> Fill(M, hweight);
+       (z_eta[0] >= m_barrelEta && fabs(z_eta[1]) < m_barrelEta))    m_Zmumu_barrel_eca -> Fill(M, TrkWeight);
 
     if((fabs(z_eta[0]) < m_barrelEta && z_eta[1] <= -m_barrelEta) ||
-       (z_eta[0] <= -m_barrelEta && fabs(z_eta[1]) < m_barrelEta))   m_Zmumu_barrel_ecc -> Fill(M, hweight);
-
-  }
+       (z_eta[0] <= -m_barrelEta && fabs(z_eta[1]) < m_barrelEta))   m_Zmumu_barrel_ecc -> Fill(M, TrkWeight);
+  } 
 
   delete trks;
 
@@ -2467,11 +2612,11 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
 
 StatusCode IDAlignMonGenericTracks::procHistograms()
 {
-  if( endOfLowStat ) {
+  if( endOfLowStatFlag() ) {
   }
-  if( endOfLumiBlock ) {
+  if( endOfLumiBlockFlag() ) {
   }
-  if( endOfRun ) {
+  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);
@@ -2479,30 +2624,29 @@ StatusCode IDAlignMonGenericTracks::procHistograms()
     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);
-      }
+    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* m_neg, TH1F* m_pos, TH1F* m_asym) 
 {
   if (m_neg->GetNbinsX()==m_pos->GetNbinsX()&& m_neg->GetNbinsX()==m_asym->GetNbinsX()) {
@@ -2518,29 +2662,7 @@ void IDAlignMonGenericTracks::ProcessAsymHistograms(TH1F* m_neg, TH1F* m_pos, TH
                               << "  npos=" << npos
                               << "  nneg=" << nneg
                               << "  asym=" << asym
-                              << endreq;
-    }
-  }
-
-}
-
-
-void IDAlignMonGenericTracks::ProcessAsymHistograms(TH1F_LW* m_neg, TH1F_LW* m_pos, TH1F_LW* m_asym) 
-{
-  if (m_neg->GetNbinsX()==m_pos->GetNbinsX()&& m_neg->GetNbinsX()==m_asym->GetNbinsX()) {
-    for (unsigned int i=1;i<=m_neg->GetNbinsX();i++) {
-      float nneg=m_neg->GetBinContent(i);
-      float npos=m_pos->GetBinContent(i);
-      float asym=0;
-      if (nneg+npos>0) asym=(npos-nneg)/(nneg+npos);
-      m_asym->SetBinContent(i,asym);
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) 
-                              << ">>ProcessAsymHistograms>> " << m_asym->GetTitle() 
-                              << "  bin: " << i 
-                              << "  npos=" << npos
-                              << "  nneg=" << nneg
-                              << "  asym=" << asym
-                              << endreq;
+                              << endmsg;
     }
   }
 
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
index 03f448042ab1ebe49598ed3f859e02bc5d35f1a1..cb36371dd4148d93f27c8edea6e2b8ab189f2316 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDAlignMonGenericTracks_H
 #define IDAlignMonGenericTracks_H
@@ -67,18 +67,17 @@ public:
   virtual StatusCode procHistograms();
   
   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 ProcessAsymHistograms(TH1F* m_neg, TH1F* m_pos, TH1F* m_asym); 
-  void ProcessAsymHistograms(TH1F_LW* m_neg, TH1F_LW* m_pos, TH1F_LW* m_asym); 
   void InitializeHistograms();
 
 protected:
 
-    bool m_hasBeamCondSvc;
-  TH1F_LW* m_summary;
+  bool m_hasBeamCondSvc;
+  TH1F* m_summary;
+
 
   TProfile* m_trk_chi2oDoF;
   TProfile* m_trk_chi2Prob;
@@ -89,26 +88,28 @@ protected:
   TH3F* m_trk_d0_vs_phi0_z0;
 
   // barrel
-  TH1F_LW* m_trk_d0_barrel;
-  TH1F_LW* m_trk_d0_barrel_zoomin;
-  TH1F_LW* m_trk_d0c_barrel;
-  TH1F_LW* m_trk_z0_barrel;
-  TH1F_LW* m_trk_z0_barrel_zoomin;
+  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_d0bs_vs_phi_barrel;
   TProfile* m_trk_d0_vs_z0_barrel;
-  TH1F_LW* m_trk_phi0_neg_barrel;
-  TH1F_LW* m_trk_phi0_pos_barrel;
-  TH1F_LW* m_trk_phi0_asym_barrel;
-  TH1F_LW* m_trk_pT_neg_barrel;
-  TH1F_LW* m_trk_pT_pos_barrel;
-  TH1F_LW* m_trk_pT_asym_barrel;
-  TH1F_LW* m_npixhits_per_track_barrel;
-  TH1F_LW* m_nscthits_per_track_barrel;
-  TH1F_LW* m_ntrthits_per_track_barrel;
-  TH1F_LW* m_chi2oDoF_barrel;
-  TH1F_LW* m_phi_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_barrel_zoom;
   TH2F* m_hitMap_endcapA;
   TH2F* m_hitMap_endcapC;
 
@@ -118,25 +119,25 @@ protected:
   TH3F* m_trk_z0_wrtPV_vs_phi_vs_eta_barrel;
 
   // endcap A
-  TH1F_LW* m_trk_d0_eca; 
-  TH1F_LW* m_trk_d0_eca_zoomin; 
-  TH1F_LW* m_trk_d0c_eca;
-  TH1F_LW* m_trk_z0_eca;
-  TH1F_LW* m_trk_z0_eca_zoomin;
+  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_LW* m_trk_phi0_neg_eca;
-  TH1F_LW* m_trk_phi0_pos_eca;
-  TH1F_LW* m_trk_phi0_asym_eca;
-  TH1F_LW* m_trk_pT_neg_eca;
-  TH1F_LW* m_trk_pT_pos_eca;
-  TH1F_LW* m_trk_pT_asym_eca;
-  TH1F_LW* m_npixhits_per_track_eca;
-  TH1F_LW* m_nscthits_per_track_eca;
-  TH1F_LW* m_ntrthits_per_track_eca;
-  TH1F_LW* m_chi2oDoF_eca;
-  TH1F_LW* m_phi_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;
@@ -145,25 +146,25 @@ protected:
 
 
   // endcap C
-  TH1F_LW* m_trk_d0_ecc;
-  TH1F_LW* m_trk_d0_ecc_zoomin;
-  TH1F_LW* m_trk_d0c_ecc;
-  TH1F_LW* m_trk_z0_ecc;
-  TH1F_LW* m_trk_z0_ecc_zoomin;
+  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_LW* m_trk_phi0_neg_ecc;
-  TH1F_LW* m_trk_phi0_pos_ecc;
-  TH1F_LW* m_trk_phi0_asym_ecc;
-  TH1F_LW* m_trk_pT_neg_ecc;
-  TH1F_LW* m_trk_pT_pos_ecc;
-  TH1F_LW* m_trk_pT_asym_ecc;
-  TH1F_LW* m_npixhits_per_track_ecc;
-  TH1F_LW* m_nscthits_per_track_ecc;
-  TH1F_LW* m_ntrthits_per_track_ecc;
-  TH1F_LW* m_chi2oDoF_ecc;
-  TH1F_LW* m_phi_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;
@@ -174,30 +175,33 @@ protected:
   // Whole detector
 
 
-  TH1F_LW* m_nhits_per_event;
-  TH1F_LW* m_nhits_per_track;
-  TH1F_LW* m_ntrk;
-  TH1F_LW* m_ngtrk;
-  TH1F_LW* m_npixhits_per_track;
-  TH1F_LW* m_nscthits_per_track;
-  TH1F_LW* m_ntrthits_per_track;
-  TH1F_LW* m_chi2oDoF;
-  TH1F_LW* m_eta;
-  TH1F_LW* m_phi;
-  TH1F_LW* m_z0;
-  TH1F_LW* m_z0sintheta;
-  TH1F_LW* m_z0_pvcorr;
-  TH1F_LW* m_z0sintheta_pvcorr;
-  TH1F_LW* m_d0;
-  TH1F_LW* m_d0_pvcorr;
-  TH1F_LW* m_d0_bscorr;
-  TH1F_LW* m_trk_d0_wrtPV;
-  TH1F_LW* m_trk_z0_wrtPV;
-  TH1F_LW* m_pT;
-  TH1F_LW* m_pTRes;
-  TH1F_LW* m_pTResOverP;
-  TH1F_LW* m_P;
-  
+  TH1F* m_nhits_per_event;
+  TH1F* m_nhits_per_track;
+  TH1F* m_ntrk;
+  TH1F* m_ngtrk;
+  TH1F* m_nsilhits_per_track;
+  TH1F* m_niblhits_per_track;
+  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;
+  TH1F* m_pTabs;
+
   TH3F* m_trk_d0_vs_phi_vs_eta;
   TH2F* m_trk_pT_vs_eta;
   
@@ -213,20 +217,20 @@ protected:
   TH2F* m_trk_chi2oDoF_Phi;
   TH2F* m_trk_chi2oDoF_Pt;
   TH2F* m_trk_chi2oDoF_P;
-  TH1F_LW* m_trk_chi2ProbDist;
-  TH1F_LW* m_errCotTheta;
+  TH1F* m_trk_chi2ProbDist;
+  TH1F* m_errCotTheta;
   TH2F* m_errCotThetaVsD0BS;
   TH2F* m_errCotThetaVsPt;
   TH2F* m_errCotThetaVsP;
   TH2F* m_errCotThetaVsPhi;
   TH2F* m_errCotThetaVsEta;
-  TH1F_LW* m_errTheta;
+  TH1F* m_errTheta;
   TH2F* m_errThetaVsD0BS;
   TH2F* m_errThetaVsPt;
   TH2F* m_errThetaVsP;
   TH2F* m_errThetaVsPhi;
   TH2F* m_errThetaVsEta;
-  TH1F_LW* m_errD0;
+  TH1F* m_errD0;
   TH2F* m_errD0VsD0BS;
   TH2F* m_errD0VsPt;
   TH2F* m_errD0VsP;
@@ -235,25 +239,25 @@ protected:
   TH2F* m_errD0VsPhiECA;
   TH2F* m_errD0VsPhiECC;
   TH2F* m_errD0VsEta;
-  TH1F_LW* m_errPhi0;
+  TH1F* m_errPhi0;
   TH2F* m_errPhi0VsD0BS;
   TH2F* m_errPhi0VsPt;
   TH2F* m_errPhi0VsP;
   TH2F* m_errPhi0VsPhi0;
   TH2F* m_errPhi0VsEta;
-  TH1F_LW* m_errZ0;
+  TH1F* m_errZ0;
   TH2F* m_errZ0VsD0BS;
   TH2F* m_errZ0VsPt;
   TH2F* m_errZ0VsP;
   TH2F* m_errZ0VsPhi0;
   TH2F* m_errZ0VsEta;
-  TH1F_LW* m_errPt;
+  TH1F* m_errPt;
   TH2F* m_PtVsPhi0Pos;
   TH2F* m_PtVsPhi0Neg;
   TH2F* m_errPtVsD0BS;
   TH2F* m_errPtVsPt;
   TH2F* m_errPtVsP;
-  TH1F_LW* m_errPt_Pt2;
+  TH1F* m_errPt_Pt2;
   TH2F* m_errPt_Pt2VsPt;
   TH2F* m_errPt_Pt2VsPhi0;
   TH2F* m_errPt_Pt2VsEta;
@@ -279,6 +283,13 @@ protected:
   TH2F* m_D0bsVsPtECA;
   TH2F* m_D0bsVsPtBarrel;
 
+  // mu: number of interactions per event
+  TH1F* m_mu_perEvent;
+  // histograms of number of interactions vs track pt and vs track eta
+  TH2F* m_eventMu_vs_TrkPt;
+  TH2F* m_eventMu_vs_TrkEta;
+
+
 
   //BeamSpot Position Plots
 
@@ -286,11 +297,11 @@ protected:
   TH2F* m_YBs_vs_ZBs;
   TH2F* m_XBs_vs_ZBs;
 
-  TH1F_LW* m_XBs;
-  TH1F_LW* m_YBs;
-  TH1F_LW* m_ZBs;
-  TH1F_LW* m_TiltX_Bs;
-  TH1F_LW* m_TiltY_Bs;
+  TH1F* m_XBs;
+  TH1F* m_YBs;
+  TH1F* m_ZBs;
+  TH1F* m_TiltX_Bs;
+  TH1F* m_TiltY_Bs;
 
   //versus lumiblock
   TProfile* m_XBs_vs_LumiBlock;
@@ -305,32 +316,32 @@ protected:
 
   // End of extended plots
   
-  TH1F_LW* m_phi_barrel_pos_2_5GeV;
-  TH1F_LW* m_phi_barrel_pos_5_10GeV;
-  TH1F_LW* m_phi_barrel_pos_10_20GeV;
-  TH1F_LW* m_phi_barrel_pos_20plusGeV;
-  TH1F_LW* m_phi_barrel_neg_2_5GeV;
-  TH1F_LW* m_phi_barrel_neg_5_10GeV;
-  TH1F_LW* m_phi_barrel_neg_10_20GeV;
-  TH1F_LW* m_phi_barrel_neg_20plusGeV;
-
-  TH1F_LW* m_phi_eca_pos_2_5GeV;
-  TH1F_LW* m_phi_eca_pos_5_10GeV;
-  TH1F_LW* m_phi_eca_pos_10_20GeV;
-  TH1F_LW* m_phi_eca_pos_20plusGeV;
-  TH1F_LW* m_phi_eca_neg_2_5GeV;
-  TH1F_LW* m_phi_eca_neg_5_10GeV;
-  TH1F_LW* m_phi_eca_neg_10_20GeV;
-  TH1F_LW* m_phi_eca_neg_20plusGeV;
-
-  TH1F_LW* m_phi_ecc_pos_2_5GeV;
-  TH1F_LW* m_phi_ecc_pos_5_10GeV;
-  TH1F_LW* m_phi_ecc_pos_10_20GeV;
-  TH1F_LW* m_phi_ecc_pos_20plusGeV;
-  TH1F_LW* m_phi_ecc_neg_2_5GeV;
-  TH1F_LW* m_phi_ecc_neg_5_10GeV;
-  TH1F_LW* m_phi_ecc_neg_10_20GeV;
-  TH1F_LW* m_phi_ecc_neg_20plusGeV;
+  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;
@@ -341,12 +352,12 @@ protected:
   TH2F* m_eta_phi_neg_10_20GeV;
   TH2F* m_eta_phi_neg_20plusGeV;
 
-  TH1F_LW* m_Zmumu;
-  TH1F_LW* m_Zmumu_barrel;
-  TH1F_LW* m_Zmumu_eca;
-  TH1F_LW* m_Zmumu_ecc;
-  TH1F_LW* m_Zmumu_barrel_eca;
-  TH1F_LW* m_Zmumu_barrel_ecc;
+  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;
@@ -356,45 +367,47 @@ protected:
   TH1F* m_pT_diff;
   TH1F* m_trk_pT_asym;
 
-  TH1F_LW* m_eta_neg;
-  TH1F_LW* m_eta_pos;
-  TH1F_LW* m_eta_asym;
-
-  TH1F_LW* m_LumiBlock;
-  TH1F_LW* m_Tracks_per_LumiBlock;
-  TH1F_LW* m_NPIX_per_LumiBlock;
-  TH1F_LW* m_NSCT_per_LumiBlock;
-  TH1F_LW* m_NTRT_per_LumiBlock;
-
-  TH1F_LW* m_trk_d0c_pos;
-  TH1F_LW* m_trk_d0c_neg;
-  TH1F_LW* m_trk_d0c_pos_barrel;
-  TH1F_LW* m_trk_d0c_neg_barrel;
-  TH1F_LW* m_trk_d0c_pos_eca;
-  TH1F_LW* m_trk_d0c_neg_eca;
-  TH1F_LW* m_trk_d0c_pos_ecc;
-  TH1F_LW* m_trk_d0c_neg_ecc;
-  TH1F_LW* m_trk_d0c_asym;
-  TH1F_LW* m_trk_d0c_asym_barrel;
-  TH1F_LW* m_trk_d0c_asym_eca;
-  TH1F_LW* m_trk_d0c_asym_ecc;
-
-  TH1F_LW* m_trk_z0c_pos;
-  TH1F_LW* m_trk_z0c_neg;
-  TH1F_LW* m_trk_z0c_pos_barrel;
-  TH1F_LW* m_trk_z0c_neg_barrel;
-  TH1F_LW* m_trk_z0c_pos_eca;
-  TH1F_LW* m_trk_z0c_neg_eca;
-  TH1F_LW* m_trk_z0c_pos_ecc;
-  TH1F_LW* m_trk_z0c_neg_ecc;
-  TH1F_LW* m_trk_z0c_asym;
-  TH1F_LW* m_trk_z0c_asym_barrel;
-  TH1F_LW* m_trk_z0c_asym_eca;
-  TH1F_LW* m_trk_z0c_asym_ecc;
-
+  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;
+
+  TH1F* m_hTrackWeight;
 
  private:
- 
+
+  StatusCode SetupTools();
   bool fillVertexInformation() const;
   const Trk::Track*        getTrkTrack(const Trk::VxTrackAtVertex*)const;
   //const Trk::VxCandidate*  findAssociatedVertex(const Trk::Track *) const;
@@ -423,11 +436,16 @@ protected:
   bool m_extendedPlots;
   float m_d0Range;
   float m_d0BsRange;
-  float m_pTRange;
   float m_z0Range;
+  float m_pTRange;
   float m_etaRange;
   int   m_NTracksRange;
-
+  // mu histogram
+  int m_nBinsMuRange;
+  float m_muRangeMin;
+  float m_muRangeMax;
+  float  m_mu; // value per event
+  //
   bool m_doIP;
 
   
@@ -446,9 +464,13 @@ protected:
   bool m_applyHistWeight;
   std::string m_hWeightInFileName;
   TFile* m_hWeightInFile;
-  TH2F*  m_etapTWeight;
+  TH2F*  m_hInputTrackWeight;
   std::string m_hWeightHistName;
-  
+  int    m_userInputWeigthMethod;
+  bool   m_useLowStat;
+
+  // enumerate for trk weight methods
+  enum {TRKETA_TRKPT, EVENTMU_TRKPT, EVENTMU_TRKETA};
 };
 
 #endif
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
index 747e0c878733df90edc8f3ea9f676d5a2085dd5d..2846b32b5f5f33ca9490717189d93c4396111cac 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
@@ -93,19 +93,19 @@ IDAlignMonNtuple::~IDAlignMonNtuple() { }
 
 StatusCode IDAlignMonNtuple::initialize()
 {
-  
+
   //initialize tools and services
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endreq;
+  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!" << endreq;
+    msg(MSG::FATAL) << "Failed to initialize tools/services!" << endmsg;
     return StatusCode::FAILURE;
-  } 
-  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endreq;
+  }
+  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;
 
-  if(m_unbiasedSCT) msg(MSG::INFO) << "Using Truly unbiased SCT residuals" << endreq;
-  if(m_usePRD) msg(MSG::INFO) << "Using PrepRawData for hits information" << endreq;   
-     
   return StatusCode::SUCCESS;
 }
 
@@ -114,37 +114,37 @@ StatusCode IDAlignMonNtuple::bookHistograms()
 {
   StatusCode sc;
 
-  if ( newLowStatFlag() ) {  
+  if ( newLowStatFlag() ) {
   }
-  if ( newLumiBlockFlag() ) {  
+  if ( newLumiBlockFlag() ) {
   }
   if ( newRunFlag() ) {  }
-  
+
   std::string directoryStructure = "/NTUPLES/ALIGNMONITOR";
   //std::string fullNtuplePath = "/NTUPLES/ALIGNMONITOR/Alignment/tree";
   std::string fullNtuplePath = "/NTUPLES/ALIGNMONITOR/" + m_tracksName + "/tree";
   //NTupleFilePtr file( m_ntupleSvc, directoryStructure );
   NTuplePtr nt(m_ntupleSvc, fullNtuplePath );
-  
+
   //booking ntuple
   if (!nt)    {    // Check if already booked
-    
+
     nt = m_ntupleSvc->book(fullNtuplePath, CLID_ColumnWiseTuple,"tree" );
     if(nt) {
-      
+
       ntuple=nt;
-      msg(MSG::INFO) << "Alignment monitoring ntuple booked." << endreq;
-      
+      msg(MSG::INFO) << "Alignment monitoring ntuple booked." << endmsg;
+
       //information per event
-      sc = ntuple->addItem("event_ntracks",m_nt_ntrks,0,s_n_maxTracks);		
+      sc = ntuple->addItem("event_ntracks",m_nt_ntrks,0,s_n_maxTracks);
       sc = ntuple->addItem("event_nhits",m_nt_nhits,0,s_n_maxEventHits);
-      sc = ntuple->addItem("event_nvtx",m_nt_nvtx,0,1000);	
-      sc = ntuple->addItem("event_goodvtxfound",m_nt_goodvtx,0,1000);	
-      sc = ntuple->addItem("event_vtxntrks",m_nt_vtxntrks,0,s_n_maxTracks);	
-      sc = ntuple->addItem("event_vtxX",m_nt_vtxX,-1000,1000);	
-      sc = ntuple->addItem("event_vtxY",m_nt_vtxY,-1000,1000);	
-      sc = ntuple->addItem("event_vtxZ",m_nt_vtxZ,-1000,1000);	
-	
+      sc = ntuple->addItem("event_nvtx",m_nt_nvtx,0,1000);
+      sc = ntuple->addItem("event_goodvtxfound",m_nt_goodvtx,0,1000);
+      sc = ntuple->addItem("event_vtxntrks",m_nt_vtxntrks,0,s_n_maxTracks);
+      sc = ntuple->addItem("event_vtxX",m_nt_vtxX,-1000,1000);
+      sc = ntuple->addItem("event_vtxY",m_nt_vtxY,-1000,1000);
+      sc = ntuple->addItem("event_vtxZ",m_nt_vtxZ,-1000,1000);
+
       //information per track
       sc = ntuple->addIndexedItem("track_nhits",m_nt_ntrks,m_nt_trknhits);
       sc = ntuple->addIndexedItem("track_qoverpt",m_nt_ntrks,m_nt_trkqoverpt);
@@ -165,7 +165,7 @@ StatusCode IDAlignMonNtuple::bookHistograms()
       sc = ntuple->addIndexedItem("track_truthphi",m_nt_ntrks,m_nt_trktruthphi);
       sc = ntuple->addIndexedItem("track_trutheta",m_nt_ntrks,m_nt_trktrutheta);
       sc = ntuple->addIndexedItem("track_truthpdg",m_nt_ntrks,m_nt_trktruthpdg);
-      
+
       sc = ntuple->addIndexedItem("track_truthphi0",m_nt_ntrks,m_nt_trktruthphi0);
       sc = ntuple->addIndexedItem("track_truthd0",m_nt_ntrks,m_nt_trktruthd0);
       sc = ntuple->addIndexedItem("track_truthz0",m_nt_ntrks,m_nt_trktruthz0);
@@ -180,27 +180,27 @@ StatusCode IDAlignMonNtuple::bookHistograms()
       //int max_hits = 5000;//do not make this smaller!
 
       //information per hit per track
-      sc = ntuple->addItem("hit_dettype",m_nt_ntrks,m_nt_dettype,s_n_maxHits);		
-      sc = ntuple->addItem("hit_isbarrel",m_nt_ntrks,m_nt_isbarrel,s_n_maxHits);		
-      sc = ntuple->addItem("hit_layer",m_nt_ntrks,m_nt_layer,s_n_maxHits);		
-      sc = ntuple->addItem("hit_modphi",m_nt_ntrks,m_nt_hitmodphi,s_n_maxHits);		
-      sc = ntuple->addItem("hit_modeta",m_nt_ntrks,m_nt_hitmodeta,s_n_maxHits);		
-      sc = ntuple->addItem("hit_hitx",m_nt_ntrks,m_nt_hitx,s_n_maxHits);		
-      sc = ntuple->addItem("hit_hity",m_nt_ntrks,m_nt_hity,s_n_maxHits);		
-      sc = ntuple->addItem("hit_residualx",m_nt_ntrks,m_nt_residualx,s_n_maxHits);		
-      sc = ntuple->addItem("hit_residualy",m_nt_ntrks,m_nt_residualy,s_n_maxHits);		
-      sc = ntuple->addItem("hit_biasedresidualx",m_nt_ntrks,m_nt_biasedresidualx,s_n_maxHits);		
-      sc = ntuple->addItem("hit_biasedresidualy",m_nt_ntrks,m_nt_biasedresidualy,s_n_maxHits);	
-      sc = ntuple->addItem("hit_hittype",m_nt_ntrks,m_nt_hittype,s_n_maxHits);		
-      sc = ntuple->addItem("hit_errorx",m_nt_ntrks,m_nt_errorx,s_n_maxHits);		
-      sc = ntuple->addItem("hit_errory",m_nt_ntrks,m_nt_errory,s_n_maxHits);		
-      sc = ntuple->addItem("hit_hitxwidth",m_nt_ntrks,m_nt_hitxwidth,s_n_maxHits);		
-      sc = ntuple->addItem("hit_hitywidth",m_nt_ntrks,m_nt_hitywidth,s_n_maxHits);	
+      sc = ntuple->addItem("hit_dettype",m_nt_ntrks,m_nt_dettype,s_n_maxHits);
+      sc = ntuple->addItem("hit_isbarrel",m_nt_ntrks,m_nt_isbarrel,s_n_maxHits);
+      sc = ntuple->addItem("hit_layer",m_nt_ntrks,m_nt_layer,s_n_maxHits);
+      sc = ntuple->addItem("hit_modphi",m_nt_ntrks,m_nt_hitmodphi,s_n_maxHits);
+      sc = ntuple->addItem("hit_modeta",m_nt_ntrks,m_nt_hitmodeta,s_n_maxHits);
+      sc = ntuple->addItem("hit_hitx",m_nt_ntrks,m_nt_hitx,s_n_maxHits);
+      sc = ntuple->addItem("hit_hity",m_nt_ntrks,m_nt_hity,s_n_maxHits);
+      sc = ntuple->addItem("hit_residualx",m_nt_ntrks,m_nt_residualx,s_n_maxHits);
+      sc = ntuple->addItem("hit_residualy",m_nt_ntrks,m_nt_residualy,s_n_maxHits);
+      sc = ntuple->addItem("hit_biasedresidualx",m_nt_ntrks,m_nt_biasedresidualx,s_n_maxHits);
+      sc = ntuple->addItem("hit_biasedresidualy",m_nt_ntrks,m_nt_biasedresidualy,s_n_maxHits);
+      sc = ntuple->addItem("hit_hittype",m_nt_ntrks,m_nt_hittype,s_n_maxHits);
+      sc = ntuple->addItem("hit_errorx",m_nt_ntrks,m_nt_errorx,s_n_maxHits);
+      sc = ntuple->addItem("hit_errory",m_nt_ntrks,m_nt_errory,s_n_maxHits);
+      sc = ntuple->addItem("hit_hitxwidth",m_nt_ntrks,m_nt_hitxwidth,s_n_maxHits);
+      sc = ntuple->addItem("hit_hitywidth",m_nt_ntrks,m_nt_hitywidth,s_n_maxHits);
       sc = ntuple->addItem("hit_hitolegwidth",m_nt_ntrks,m_nt_hitolegwidth,s_n_maxHits);
       sc = ntuple->addItem("hit_incidangle",m_nt_ntrks,m_nt_hitincidangle,s_n_maxHits);
 
-    } else { 
-      msg(MSG::ERROR) << "Failed to book Alignment monitoring ntuple." << endreq;
+    } else {
+      msg(MSG::ERROR) << "Failed to book Alignment monitoring ntuple." << endmsg;
     }
   }
 
@@ -211,7 +211,7 @@ StatusCode IDAlignMonNtuple::bookHistograms()
 
 StatusCode IDAlignMonNtuple::fillHistograms()
 {
-  
+
   //-------------------------------------------------------------
   //looking at vertex reconstruction
 
@@ -222,17 +222,17 @@ StatusCode IDAlignMonNtuple::fillHistograms()
   const VxContainer* vertices;
   int ntrkMax=0;
   int nVtx = 0;
-  
+
   if (evtStore()->contains<VxContainer>(m_VxPrimContainerName)) {
     StatusCode scv = evtStore()->retrieve (vertices,m_VxPrimContainerName);
     if (scv.isFailure()) {
-      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No Collection with name  "<<m_VxPrimContainerName<<" found in StoreGate" << endreq;
+      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No Collection with name  "<<m_VxPrimContainerName<<" found in StoreGate" << endmsg;
       return StatusCode::SUCCESS;
     } else {
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name  "<<m_VxPrimContainerName<< " with size " << vertices->size() <<" found  in StoreGate" << endreq;
-  
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name  "<<m_VxPrimContainerName<< " with size " << vertices->size() <<" found  in StoreGate" << endmsg;
+
       VxContainer::const_iterator vxItr  = vertices->begin();
-      VxContainer::const_iterator vxItrE = vertices->end();    
+      VxContainer::const_iterator vxItrE = vertices->end();
       nVtx = vertices->size();
       for (; vxItr != vxItrE; ++vxItr) {
 	int numTracksPerVertex = (*vxItr)->vxTrackAtVertex()->size();
@@ -244,15 +244,15 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	}
       }
     }
-  } else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "StoreGate does not contain VxPrimaryCandidate Container" << endreq;
-  
+  } 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"<<endreq;
+    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 << endreq;
+  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;
@@ -269,31 +269,31 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 
   //-------------------------------------------------------------
 
-  if (m_tracksName.empty()) msg(MSG::ERROR) << " no track collection given"<<endreq;
+  if (m_tracksName.empty()) msg(MSG::ERROR) << " no track collection given"<<endmsg;
 
   //const Rec::TrackParticleContainer* tracks        = new Rec::TrackParticleContainer;
   const TrackCollection* tracks;//        = new TrackCollection;
-  
+
   StatusCode sc = evtStore()->retrieve(tracks,m_tracksName);
   if (sc.isFailure()) {
-    msg(MSG::ERROR) << "No TrackCollection with name "<<m_tracksName<<" found in StoreGate" << endreq;
+    msg(MSG::ERROR) << "No TrackCollection with name "<<m_tracksName<<" found in StoreGate" << endmsg;
     return sc;
   } else {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_tracksName<<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_tracksName<<" found in StoreGate" << endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
   }
 
   const TrackTruthCollection  * truthMap  = NULL;
 
   sc = evtStore()->retrieve(truthMap, m_tracksTruthName);
   if (sc.isFailure()) {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackTruthCollection with name "<< m_tracksTruthName <<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Truth information will not be filled in the AlignMonNtuple" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackTruthCollection with name "<< m_tracksTruthName <<" 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 <<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< truthMap->size() <<" truth tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name "<< m_tracksTruthName <<" 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;
@@ -304,14 +304,14 @@ StatusCode IDAlignMonNtuple::fillHistograms()
   //Rec::TrackParticleContainer::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 == NULL){
-      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracks << endreq;
+      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracks << endmsg;
       continue;
     }
 
@@ -319,10 +319,10 @@ StatusCode IDAlignMonNtuple::fillHistograms()
     //variables will be overwritten later if can be defined
     setTrackErrorValues(nTracks);
 
-    //trackStateOnSurfaces is a vector of Trk::TrackStateOnSurface objects which contain information 
+    //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 << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found " << track->trackStateOnSurfaces()->size() << " TrkSurfaces " << endreq;
+    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;
 
@@ -333,86 +333,86 @@ StatusCode IDAlignMonNtuple::fillHistograms()
       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; 
+      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 << endreq;       
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TSOS (hit) = " << nHits << endmsg;
 
       if ((*iter_tsos) == NULL) continue;
 
       //determining type of TSOS object - can represent many different track elements
       if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Measurement" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Measurement" << endmsg;
 	hitType = 0;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::InertMaterial)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::InertMaterial" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::InertMaterial" << endmsg;
 	hitType = 1;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::BremPoint)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::BremPoint" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::BremPoint" << endmsg;
 	hitType = 2;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Scatterer)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Scatterer" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Scatterer" << endmsg;
 	hitType = 3;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Perigee)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Perigee" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Perigee" << endmsg;
 	hitType = 4;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Outlier)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Outlier" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Outlier" << endmsg;
 	hitType = 5;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Hole)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Hole" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Hole" << endmsg;
 	hitType = 6;
       }
       else if ((*iter_tsos)->type(Trk::TrackStateOnSurface::Unknown)) {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Trk::TrackStateOnSurface::Unknown" << endreq;
+	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" << endreq;
+      else if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unrecognised Trk::TrackStateOnSurface Type" << endmsg;
 
 
       const Trk::MeasurementBase* mesh =(*iter_tsos)->measurementOnTrack();
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit MeasurementBase " << endreq;
-         
+      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== NULL) { 
+      if (hit== NULL) {
 	//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 << endreq; 
+	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 = NULL;}
- 
+
       const Identifier & hitId = hit->identify();
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit Identifier " << endreq;
+      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" << endreq;
+	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" << endreq;
+	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" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "This is a TRT Hit" << endmsg;
       }
-      
+
       //finding local error on hit
       if(m_usePRD && hitPRD != NULL){
 	errorX = Amg::error(hitPRD->localCovariance(),Trk::locX);
@@ -422,10 +422,10 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	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 << endreq;
+	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);
@@ -438,15 +438,15 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	  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 << endreq;
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Pixel hit z cluster width = " << zWidth << endreq;
+	  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 << endreq;
+
+      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);
@@ -458,29 +458,29 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	if ( pCluster != NULL ){
 	  InDet::SiWidth width = pCluster->width();
 	  phiWidth = int(width.colRow().x());
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "SCT hit phi cluster width = " << phiWidth << endreq;
+	  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... " << endreq;
+
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is pixel or SCT, finding residuals... " << endmsg;
 
 	const Trk::TrackParameters* trackParameter = (*iter_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 << endreq ;
+	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" << endreq;	 
+	  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 != NULL ){
 	    Amg::Vector3D trkDir       = trackParameter->momentum() ;
 	    Amg::Vector3D detElePhi    = detEle->phiAxis() ; //!< local x axis in global frame
@@ -500,35 +500,35 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 
 	  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,*iter_tsos,true,unbiasedResXY);
 	  if (sc.isFailure()) {
-	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiased residuals! Hit is skipped." << endreq;
+	    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" << endreq;
+	  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,*iter_tsos,false,biasedResXY);
 	  if (sc.isFailure()) {
-	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining biased residuals! Hit is skipped." << endreq;
+	    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" << endreq;
+	  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 << endreq; 
+	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackParameters associated with TrkSurface "<< nHits << ", hit type = " << hitType << endmsg;
       }
 
       //filling ntuple
@@ -551,23 +551,23 @@ StatusCode IDAlignMonNtuple::fillHistograms()
       m_nt_hitolegwidth[nTracks][nHits] = olegWidth;
       m_nt_hitincidangle[nTracks][nHits] = trkIncidAngle;
 
-      nHits++; 
+      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!" << endreq;
-      msg(MSG::ERROR) << "Set max hits per track = " <<  s_n_maxHits << ", current track has " << nHits << " or more hits!" << endreq;
+      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; 
-    
+
+    m_nt_trknhits[nTracks] = nHits;
+
     //filling ntuple with some track parameters
     const Trk::Perigee* startPerigee = track->perigeeParameters();
-    float theta = startPerigee->parameters()[Trk::theta];  
+    float theta = startPerigee->parameters()[Trk::theta];
     float d0 = startPerigee->parameters()[Trk::d0];
     float phi0 = startPerigee->parameters()[Trk::phi0];
     m_nt_trktheta[nTracks] = theta;
@@ -577,7 +577,7 @@ StatusCode IDAlignMonNtuple::fillHistograms()
     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
@@ -591,21 +591,21 @@ StatusCode IDAlignMonNtuple::fillHistograms()
     int DoF = (fit) ? fit->numberDoF() : -1;
     m_nt_trkchi2[nTracks] = chiSquared;
     m_nt_trkdof[nTracks] = DoF;
-            
+
 
     //tracktruth stuff (put in separate method)
     if (truthMap) {
-	  
+
       //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(const_cast<Trk::Track*>(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
@@ -613,9 +613,9 @@ StatusCode IDAlignMonNtuple::fillHistograms()
       	HepMcParticleLink HMPL = trkTruth.particleLink();
 
 	if ( HMPL.isValid()) {
-	  const HepMC::GenParticle *genParticle = HMPL.cptr(); 
-	  
-	  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()<<endreq;
+	  const HepMC::GenParticle *genParticle = HMPL.cptr();
+
+	  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();
@@ -627,17 +627,17 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	  m_nt_trktruthphi[nTracks] = genParticle->momentum().phi();
 
 
-	  if(genParticle->pdg_id()==0) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Particle with PDG 0!" << endreq;}
-	  else if(!genParticle->production_vertex()) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No GenVertex (generator level) production vertex found!" << endreq;}
+	  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!" << endreq;
-	    
+	    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];
@@ -646,8 +646,8 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	      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 << endreq;
+
+	      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;
@@ -659,8 +659,8 @@ StatusCode IDAlignMonNtuple::fillHistograms()
 	      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; 
+
+	      delete  generatedTrackPerigee;
 	    }
 	  }
 	}
@@ -668,31 +668,31 @@ StatusCode IDAlignMonNtuple::fillHistograms()
     }
 
     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 ntuple tracks matrix!" << endreq;
-    msg(MSG::ERROR) << "Set max tracks per event = " <<  s_n_maxTracks << ", current event has " << nTracks << " or more tracks!" << endreq;
+    msg(MSG::ERROR) << "WATCH OUT: There are more TRACKS in this events than fit in the 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 << endreq;
-  
+
+  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!" << endreq;
-    msg(MSG::ERROR) << "Set max hits per event = " <<  s_n_maxEventHits << ", current event has " << nHitsEvent << " or more hits!" << endreq;
+    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 ntuple record 
+
+  //write the ntuple record
   if (!(m_ntupleSvc->writeRecord(ntuple)).isSuccess()) {
-    msg(MSG::ERROR) << "problems writing ntuple record" << endreq;
+    msg(MSG::ERROR) << "problems writing ntuple record" << endmsg;
   }
 
 
@@ -709,7 +709,7 @@ StatusCode IDAlignMonNtuple::procHistograms()
   if( endOfLumiBlockFlag() ) {
   }
   if( endOfRunFlag() ) {}
-  
+
   return StatusCode::SUCCESS;
 }
 
@@ -724,15 +724,15 @@ StatusCode  IDAlignMonNtuple::getSiResiduals(const Trk::Track* track, const Trk:
   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 = NULL;
   if(unBias) trackParameterUnbiased = getUnbiasedTrackParameters(track,tsos);
-   
+
   //updator can fail in defining unbiased parameters, in which case we use biased
   const Trk::TrackParameters* trackParameterForResiduals = NULL;
   if(trackParameterUnbiased) trackParameterForResiduals = trackParameterUnbiased;
@@ -742,45 +742,45 @@ StatusCode  IDAlignMonNtuple::getSiResiduals(const Trk::Track* track, const Trk:
   }
 
   if (!m_residualPullCalculator.empty() && !m_residualPullCalculator.retrieve().isFailure()) {
-    
+
     if (hit && trackParameterForResiduals) {
-      
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<" got hit and track parameters " << endreq;
+
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<" got hit and track parameters " << endmsg;
 
       //const Trk::ResidualPull* residualPull = m_residualPullCalculator->residualPull(hit, trackParameterForResiduals, unBias);
       const Trk::ResidualPull* residualPull = NULL;
       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 " << endreq;
+      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 " << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " got residual pull " << 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!!!" << endreq;
+	  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" << endreq;
+	  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 << endreq; 
+	  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!!!" << endreq;
+	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds invalid Y Pull!!!" << endmsg;
 	    sc = StatusCode::FAILURE;
 	  }
 	}
-	
+
 	delete residualPull;
 
       }
       else {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator failed!" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator failed!" << endmsg;
 	sc = StatusCode::FAILURE;
       }
     }
@@ -790,28 +790,28 @@ StatusCode  IDAlignMonNtuple::getSiResiduals(const Trk::Track* track, const Trk:
   // for each of the SCT sides; residualPull->dimension()==1 always.
 
   //std::pair <double, double> result(residualX, residualY);
-  results[0] = residualX; 
+  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!!!" << endreq;
+    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(0);
   const Trk::TrackParameters* PropagatedTrackParams(0);
@@ -821,15 +821,15 @@ const Trk::TrackParameters* IDAlignMonNtuple::getUnbiasedTrackParameters(const T
   bool trueUnbiased = true;
 
   Identifier surfaceID;
-  
 
-  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "original track parameters: " << *(tsos->trackParameters()) <<endreq;
 
-  
-  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Trying to unbias track parameters." << endreq;
+  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "original track parameters: " << *(tsos->trackParameters()) <<endmsg;
+
+
+  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Trying to unbias track parameters." << endmsg;
 
   const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
-  
+
   if (hitOnTrack == NULL)
     return NULL;
 
@@ -837,18 +837,18 @@ const Trk::TrackParameters* IDAlignMonNtuple::getUnbiasedTrackParameters(const T
   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)
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Entering True Unbiased loop." << endreq;
+    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Entering True Unbiased loop." << endmsg;
     // check if other module side was also hit and try to remove other hit as well
     const Trk::TrackStateOnSurface* OtherModuleSideHit(0);
     const Identifier& OtherModuleSideID = m_SCT_Mgr->getDetectorElement(surfaceID)->otherSide()->identify();
-      
+
     for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator TempTsos=trkPnt->trackStateOnSurfaces()->begin();TempTsos!=trkPnt->trackStateOnSurfaces()->end(); ++TempTsos) {
-        
+
       const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>((*TempTsos)->measurementOnTrack());
       if (hitOnTrack != 0) {
 	const Identifier& trkID = hitOnTrack->identify();
 	if (m_sctID->wafer_id(trkID) == OtherModuleSideID) {
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(OtherModuleSideID,0,'/') << endreq;
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(OtherModuleSideID,0,'/') << endmsg;
 	  OtherModuleSideHit = *TempTsos;
 	}
       }
@@ -856,73 +856,73 @@ const Trk::TrackParameters* IDAlignMonNtuple::getUnbiasedTrackParameters(const T
 
     if (OtherModuleSideHit) {
 
-      
+
       const Trk::TrackParameters* OMSHmeasuredTrackParameter = OtherModuleSideHit->trackParameters();
-      
+
       // 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) {
-      
 
-	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "OtherSideTrackParameters: " << *(OtherModuleSideHit->trackParameters()) << endreq;
+
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "OtherSideTrackParameters: " << *(OtherModuleSideHit->trackParameters()) << endmsg;
 	OtherSideUnbiasedTrackParams = m_iUpdator->removeFromState(*(OtherModuleSideHit->trackParameters()),
 								   OtherModuleSideHit->measurementOnTrack()->localParameters(),
 								   OtherModuleSideHit->measurementOnTrack()->localCovariance());
 
 	if (OtherSideUnbiasedTrackParams) {
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased OtherSideTrackParameters: " << *OtherSideUnbiasedTrackParams << endreq;
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased OtherSideTrackParameters: " << *OtherSideUnbiasedTrackParams << endmsg;
 
 
 	  const Trk::Surface& TempSurface = OtherModuleSideHit->measurementOnTrack()->associatedSurface();
 
 	  const Trk::MagneticFieldProperties* TempField = 0;
-	  
-          
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After OtherSide surface call. Surface exists" << endreq;
+
+
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After OtherSide surface call. Surface exists" << endmsg;
 	  if (TempSurface.associatedLayer())
 	    {
-	      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() exists" << endreq;
+	      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() exists" << endmsg;
 	      if(TempSurface.associatedLayer()->enclosingTrackingVolume())
 		{
-		  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume exists" << endreq;
-		  
+		  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume exists" << endmsg;
+
 		  TempField = dynamic_cast <const Trk::MagneticFieldProperties*>(TempSurface.associatedLayer()->enclosingTrackingVolume());
-		  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After MagneticFieldProperties cast" << endreq;
-		  
+		  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After MagneticFieldProperties cast" << endmsg;
+
 		} else {
-		if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume does not exist" << endreq;
+		if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume does not exist" << endmsg;
 	      }
 	    } else {
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() does not exist" << endreq;
+	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() does not exist" << endmsg;
 	  }
-	  
-	  
-	  
-	  
-	  
-	  
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Before other side unbiased propagation" << endreq;
+
+
+
+
+
+
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Before other side unbiased propagation" << endmsg;
 	  if (TempSurface.associatedLayer() && TempField) PropagatedTrackParams = m_propagator->propagate(*OtherSideUnbiasedTrackParams,
 													  tsos->measurementOnTrack()->associatedSurface(),
 													  Trk::anyDirection, false,
 													  *TempField,
 													  Trk::nonInteracting);
-	  
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After other side unbiased propagation" << endreq;
+
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After other side unbiased propagation" << endmsg;
 	  delete OtherSideUnbiasedTrackParams;
 	  if (PropagatedTrackParams) {
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Propagated Track Parameters: " << *PropagatedTrackParams << endreq;
+	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Propagated Track Parameters: " << *PropagatedTrackParams << endmsg;
 	  } else {
-	    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Propagation of unbiased OtherSideParameters failed" << endreq;
+	    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Propagation of unbiased OtherSideParameters failed" << endmsg;
 	  }
 	} else {
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RemoveFromState did not work for OtherSideParameters" << endreq;
+	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RemoveFromState did not work for OtherSideParameters" << endmsg;
 	}
       } else {
-	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit Measured Track Parameters found. Covariance Null" << endreq;
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit Measured Track Parameters found. Covariance Null" << endmsg;
       }
     } else {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit found" << endreq;
+      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit found" << endmsg;
     }
   }
 
@@ -931,118 +931,118 @@ const Trk::TrackParameters* IDAlignMonNtuple::getUnbiasedTrackParameters(const T
     PropagatedTrackParams = tsos->trackParameters()->clone();
   }
 
-    
+
   UnbiasedTrackParams = m_iUpdator->removeFromState(*PropagatedTrackParams, tsos->measurementOnTrack()->localParameters(), tsos->measurementOnTrack()->localCovariance());
 
   delete PropagatedTrackParams;
 
   if (UnbiasedTrackParams) {
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased residual. Removing original Hit " << m_idHelper->show_to_string(surfaceID,0,'/') << endreq;
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased Trackparameters: " << *UnbiasedTrackParams << endreq;
+    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased residual. Removing original Hit " << m_idHelper->show_to_string(surfaceID,0,'/') << endmsg;
+    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased Trackparameters: " << *UnbiasedTrackParams << endmsg;
 
     TrackParams = UnbiasedTrackParams->clone();
 
   } else { // Unbiasing went awry.
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "RemoveFromState did not work, using original TrackParameters" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "RemoveFromState did not work, using original TrackParameters" << endmsg;
     TrackParams = tsos->trackParameters()->clone();
   }
-  
 
-  delete UnbiasedTrackParams;  
+
+  delete UnbiasedTrackParams;
   return TrackParams;
-  
+
 }
- 
- 
+
+
 //---------------------------------------------------------------------------------------
 
 StatusCode IDAlignMonNtuple::setupTools()
 {
   //initializing tools
 
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In initialize()" << endreq;
+  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" << endreq;
+    msg(MSG::FATAL) << "Cannot retrieve the NTuple service... Exiting" << endmsg;
     return StatusCode::FAILURE;
-  }  
+  }
 
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined detector service" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTIDHelper" << endmsg;
 
   // Get the SCT manager from the detector store
   sc = detStore()->retrieve(m_SCT_Mgr, "SCT");
   if (sc.isFailure()) {
-    msg(MSG::ERROR) << "Could not get SCT_Manager !" << endreq;
+    msg(MSG::ERROR) << "Could not get SCT_Manager !" << endmsg;
     return sc;
   }
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTManager" << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initialized SCTManager" << endmsg;
 
   //ID Helper
   sc = detStore()->retrieve(m_idHelper, "AtlasID" );
   if (sc.isFailure()) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get AtlasDetectorID !" << endreq;
+    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" << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found AtlasDetectorID" << endmsg;
   }
-  
+
 
   if (m_iUpdator.retrieve().isFailure() ) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_iUpdator << endreq;
+    msg(MSG::FATAL) << "Failed to retrieve tool " << m_iUpdator << endmsg;
     return StatusCode::FAILURE;
   } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_iUpdator << endreq;
+    msg(MSG::INFO) << "Retrieved tool " << m_iUpdator << endmsg;
   }
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved IUpdator" << endreq;
+  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() << endreq;
+	<< m_propagator.typeAndName() << endmsg;
     return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_propagator.typeAndName() << endreq;
+  } else msg(MSG::INFO) << "Retrieved tool " << m_propagator.typeAndName() << endmsg;
 
   if (m_truthToTrack.retrieve().isFailure() ) {
-     msg(MSG::FATAL) << "Failed to retrieve tool " << m_truthToTrack << endreq;
+     msg(MSG::FATAL) << "Failed to retrieve tool " << m_truthToTrack << endmsg;
      return StatusCode::FAILURE;
    } else {
-     msg(MSG::INFO) << "Retrieved tool " << m_truthToTrack << endreq;
+     msg(MSG::INFO) << "Retrieved tool " << m_truthToTrack << endmsg;
    }
 
   if (m_residualPullCalculator.empty()) {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << 
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
       "No residual/pull calculator for general hit residuals configured."
-	<< endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << 
+	<< endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<
       "It is recommended to give R/P calculators to the det-specific tool"
-	<< " handle lists then." << endreq;
+	<< " 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) "<< endreq;
+    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) 
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)
 	<< "Generic hit residuals&pulls will be calculated in one or both "
-	<< "available local coordinates" << endreq;
+	<< "available local coordinates" << endmsg;
     m_doPulls = true;
   }
 
@@ -1055,11 +1055,11 @@ StatusCode IDAlignMonNtuple::setupTools()
 void IDAlignMonNtuple::setTrackErrorValues(int nTracks)
 {
 
-  //for each track ensures that the variable is set to 
+  //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;
@@ -1077,7 +1077,7 @@ void IDAlignMonNtuple::setTrackErrorValues(int nTracks)
   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;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h
index 938286755d3c02e4d19896247ca1221c6ffe56ae..33a3ef8ef8f5006b9e66e7bf7110b8858a835bb1 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonNtuple.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonNtuple_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
index cfaa67208fdc635483241e46013e5ab6482e2b9a..8734a818961fdd5655de66332c3d67653fb503ef 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
index 31b57c96b24fb4131281ae586f3148779519e3a0..08d049ad917ed28341c9f1aee9ce000a39438ae2 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonPVBiases_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
index 4ada0f012148c9d4e1ead7d8e2a2ecaef99c8092..e549929495c612696a2723037ebe4aa17be1b93d 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 // ***************************************************************************************
 // IDAlignMonResiduals.cxx
@@ -290,7 +290,8 @@ IDAlignMonResiduals::IDAlignMonResiduals( const std::string & type, const std::s
   m_comTimeObjectName("ComTime"),
   m_trtcaldbSvc("TRT_CalDbSvc",name),
   m_hWeightInFile(0),
-  m_etapTWeight(0)
+  m_hInputTrackWeight(0),
+  m_userInputWeigthMethod(IDAlignMonResiduals::TRKETA_TRKPT)	
   
 {
 	m_iUpdator               = ToolHandle<Trk::IUpdator>("Trk::KalmanUpdator");
@@ -313,18 +314,18 @@ IDAlignMonResiduals::IDAlignMonResiduals( const std::string & type, const std::s
 	m_maxSiResWidthWindow  = 0.3;  
 	m_minSiPullWidthWindow = 0.0;   
 	m_maxSiPullWidthWindow = 2.0;
-	m_minSiResFillRange    = -0.5;   
-	m_maxSiResFillRange    = 0.5;
+	m_minSiResFillRange    = -0.08;   
+	m_maxSiResFillRange    = 0.08;
 	m_maxPIXResXFillRange  = 0.;  // if 0, it will use the m_maxSiResFillRange value
 	m_minPIXResXFillRange  = 0.;  // if 0, it will use the m_minSiResFillRange value
-	m_maxPIXResYFillRange  = 0.;
-	m_minPIXResYFillRange  = 0.;
+	m_maxPIXResYFillRange  = 0.4;
+	m_minPIXResYFillRange  = 0.4;
 	m_maxSCTResFillRange   = 0.;
 	m_minSCTResFillRange   = 0.;
 	m_ClusterSizeRange     = 10.;
 	m_IncidentThetaRange   = 2;
 	m_IncidentPhiRange     = 0.8;
-	m_RangeOfPullHistos    = 10.; 
+	m_RangeOfPullHistos    = 6.; 
 	m_PtRange              = 20.;
 	m_nBinsMuRange         = 100.;
 	m_muRangeMin           = 0.;
@@ -340,7 +341,7 @@ IDAlignMonResiduals::IDAlignMonResiduals( const std::string & type, const std::s
 	m_LBRangeMax            = 2599.5; // 1199.5
 	m_nBinsLB               = 52; // 24
 	m_gap_pix = 4;
-	m_gap_sct = 4;
+	m_gap_sct = 10;  
 	m_mu = 0.;
 	m_nBinsMuRange         = 100.;
 	m_muRangeMin           = 0.;
@@ -352,8 +353,8 @@ IDAlignMonResiduals::IDAlignMonResiduals( const std::string & type, const std::s
 	m_useGausFit           = false;
 	m_maxPtEC              = 10.;
 
-	InitializeHistograms();
-	
+
+	InitializeHistograms();	
 	
 	declareProperty("tracksName"                , m_tracksName);
 	declareProperty("CheckRate"                 , m_checkrate=1000);
@@ -395,6 +396,7 @@ IDAlignMonResiduals::IDAlignMonResiduals( const std::string & type, const std::s
 	declareProperty("useGausFit"                , m_useGausFit);
 	declareProperty("lowPtCut"                  , m_maxPtEC);
 
+	return;
 }
 
 //---------------------------------------------------------------------------------------
@@ -649,82 +651,105 @@ void IDAlignMonResiduals::InitializeHistograms()
   m_pix_ecc_pully_pt =0;
 }
 
-
+//////////////////////////////////////////////////////
 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
+  PixelBarrelXSize = 16.44;  // mm
+  PixelBarrelYSize = 60.2;  // mm 
+  SCTBarrelXSize = 61.54;  // mm
+  SCTBarrelYSize = 128.;  // mm  
+  
+  if(msgLvl(MSG::VERBOSE)) msg() << ">> Range of histograms: m_minSiResFillRange= "<< m_minSCTResFillRange  << endmsg;
+  if(msgLvl(MSG::VERBOSE)) msg() << ">> Range of histograms: m_maxSiResFillRange= "<< m_maxSCTResFillRange  << endmsg;
+  if(msgLvl(MSG::VERBOSE)) msg() << ">> Range of histograms: m_RangeOfPullHistos= "<< m_RangeOfPullHistos  << endmsg;
+  
+  //initialize tools and services
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endmsg;
+  StatusCode sc = setupTools();
+  if (sc.isFailure()) {
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize tools/services!" << endmsg;
+    return StatusCode::SUCCESS;
+  } 
+  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endmsg;                                   
+  
+  sc = ManagedMonitorToolBase::initialize();
+  if (sc.isFailure()) {
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize ManagedMonitorToolBase!" << endmsg;
+    return StatusCode::SUCCESS;
+  } 
+  
+  /** Get TRTCalDbTool */
+  if (m_trtcaldbSvc.name() == ""){
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "TRT_CalDbSvc not given."<<endmsg;
+  } else {  
+    if(m_trtcaldbSvc.retrieve().isFailure()){
+      msg(MSG::ERROR) << "Cannot get TRTCalDBSvc !"<<endmsg;
+    }
+  }
+  
+  // Get the weight histogram
+  if(m_applyHistWeight){
+    m_hWeightInFile =  new TFile( m_hWeightInFileName.c_str() ,"read");
     
-	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
-	PixelBarrelXSize = 16.44;  // mm
-	PixelBarrelYSize = 60.2;  // mm 
-	SCTBarrelXSize = 61.54;  // mm
-	SCTBarrelYSize = 128.;  // mm  
-	
-	if(msgLvl(MSG::VERBOSE)) msg() << ">> Range of histograms: m_minSiResFillRange= "<< m_minSCTResFillRange  << endreq;
-	if(msgLvl(MSG::VERBOSE)) msg() << ">> Range of histograms: m_maxSiResFillRange= "<< m_maxSCTResFillRange  << endreq;
-	if(msgLvl(MSG::VERBOSE)) msg() << ">> Range of histograms: m_RangeOfPullHistos= "<< m_RangeOfPullHistos  << endreq;
-	
-	//initialize tools and services
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endreq;
-	StatusCode sc = setupTools();
-	if (sc.isFailure()) {
-		if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize tools/services!" << endreq;
-		return StatusCode::SUCCESS;
-	} 
-	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endreq;                                   
-	
-	sc = ManagedMonitorToolBase::initialize();
-	if (sc.isFailure()) {
-		if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to initialize ManagedMonitorToolBase!" << endreq;
-		return StatusCode::SUCCESS;
-	} 
-	
-	/** Get TRTCalDbTool */
-	if (m_trtcaldbSvc.name() == ""){
-		if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "TRT_CalDbSvc not given."<<endreq;
-	} else {  
-		if(m_trtcaldbSvc.retrieve().isFailure()){
-			msg(MSG::ERROR) << "Cannot get TRTCalDBSvc !"<<endreq;
-		}
-	}
-	
-	// 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;
-	  }
-	}
-
-	return StatusCode::SUCCESS;
+    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 track weight " << m_hWeightInFileName);
+    
+    m_hInputTrackWeight = (TH2F*) m_hWeightInFile -> Get( m_hWeightHistName.c_str() );
+    if( !m_hInputTrackWeight ){
+      ATH_MSG_FATAL( " Problem getting track weight histogtam. Name " << m_hWeightHistName );
+      m_hWeightInFile -> Close();
+      delete m_hWeightInFile;
+      return StatusCode::FAILURE;
+    }
+    if( m_hInputTrackWeight ){
+      // the input histogram exists. Now, make sure the code knows how to deal with it
+      if (m_hWeightHistName.compare("trk_pT_vs_eta")    == 0) m_userInputWeigthMethod = IDAlignMonResiduals::TRKETA_TRKPT;
+      if (m_hWeightHistName.compare("h_eventMuVsTrkPt") == 0) m_userInputWeigthMethod = IDAlignMonResiduals::EVENTMU_TRKPT;
+      if (m_hWeightHistName.compare("h_eventMuVsTrkEta")== 0) m_userInputWeigthMethod = IDAlignMonResiduals::EVENTMU_TRKETA;
+    }
+    ATH_MSG_INFO( "Track weights histogram is " << m_hWeightHistName << "  m_userInputWeightMethod= " << m_userInputWeigthMethod);
+  }
+  
+  // max number of SCT modules in a disk/wheel ring (this is 52, it can be hardcoded, but let's find out...)
+  int numDisks = m_SCT_Mgr->numerology().numDisks();
+  m_maxModulesInASCTEndCapRing = 0;
+  m_maxRingsInASCTEndCapDisk = 0;
+  
+  for (int iWheel=0; iWheel < numDisks; ++iWheel) {
+    int numRings =m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
+    if (m_maxRingsInASCTEndCapDisk < numRings) m_maxRingsInASCTEndCapDisk = numRings;
+    
+    for (int iEta = 0; iEta < numRings; ++iEta) {
+      int modulesInThisRing = m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel,iEta);
+      if (m_maxModulesInASCTEndCapRing < modulesInThisRing) m_maxModulesInASCTEndCapRing = modulesInThisRing; 
+    }
+  }
+  
+  //
+  return StatusCode::SUCCESS;
 }
 
 StatusCode IDAlignMonResiduals::bookHistograms()
@@ -736,9 +761,12 @@ StatusCode IDAlignMonResiduals::bookHistograms()
   if ( AthenaMonManager::dataType() == AthenaMonManager::cosmics ) {
     // book histograms that are only relevant for cosmics data...
   }
+
+  std::cout << " ** IDAlignMonResiduals::bookHistograms() ** START ** track collection: " << m_tracksName << " trigchain: " << m_triggerChainName << std::endl;
+  if (msgLvl(MSG::INFO))msg(MSG::INFO) << "** IDAlignMonResiduals::bookHistograms() ** START ** track collection: " << m_tracksName 
+				       << " trigchain: " << m_triggerChainName << "!!!" << endmsg;
   
   std::string outputDirName = "IDAlignMon/" + m_tracksName + "_" + m_triggerChainName + "/Residuals";
-  //std::cout << " -- SALVA -- histos for track collection: " <<  m_tracksName << "_" << m_triggerChainName << std::endl;
 
   MonGroup al_mon ( this, outputDirName, run );
 	
@@ -944,14 +972,13 @@ StatusCode IDAlignMonResiduals::bookHistograms()
     RegisterHisto(al_mon,m_sct_bec_Oyresx_rms);
 	
     //Special histograms
-    if (m_extendedPlots)
-      {
-	m_totalEvents  = new TH1F("TotalEvents","TotalEvents",2,0,2);
-	RegisterHisto(al_mon,m_totalEvents);
+    if (m_extendedPlots) {
+      m_totalEvents  = new TH1F("TotalEvents","TotalEvents",2,0,2);
+      RegisterHisto(al_mon,m_totalEvents);
       
-	m_mu_perEvent = new TH1F("mu_perEvent","<#mu> per event",m_nBinsMuRange,m_muRangeMin,m_muRangeMax);
-	RegisterHisto(al_mon,m_mu_perEvent);
-      }
+      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 
@@ -1026,22 +1053,22 @@ StatusCode IDAlignMonResiduals::bookHistograms()
     
     //mag + base as function of lb
     
-    m_mag_vs_LB = new TH1D("mag_vs_LB","IBL 2pi averaged bowing magnitude vs LumiBlock;LumiBlock;Magnitude [mm]",m_nBinsLB, m_LBRangeMin,m_LBRangeMax);
+    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 TH1D("base_vs_LB","IBL 2pi averaged bowing baseline vs LumiBlock;LumiBlock;Baseline [mm]",m_nBinsLB, m_LBRangeMin,m_LBRangeMax);
+    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 TH1D("mag_vs_LB_planars","IBL 2pi averaged bowing magnitude vs LumiBlock;LumiBlock;Magnitude [mm]",m_nBinsLB, m_LBRangeMin,m_LBRangeMax);
+    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 TH1D("base_vs_LB_planars","IBL 2pi averaged bowing baseline vs LumiBlock;LumiBlock;Baseline [mm]",m_nBinsLB, m_LBRangeMin,m_LBRangeMax);
+    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);
 
 
-    std::cout<<"INITIALIZED GENERALHISTOS FOR RESIDUALS"<<std::endl;
-    
+    //std::cout<<"INITIALIZED GENERALHISTOS FOR RESIDUALS"<<std::endl;
+    if(msgLvl(MSG::VERBOSE)) msg() << " INITIALIZED GENERALHISTOS FOR RESIDUALS "<< endmsg;
     //PrintIBLGeometry();
     MakePIXBarrelHistograms (al_mon);
     MakePIXEndCapsHistograms(al_mon);  
@@ -1052,7 +1079,8 @@ StatusCode IDAlignMonResiduals::bookHistograms()
     MakeTRTHistograms(al_mon);
 	
     MakeSiliconHistograms(al_mon);
-    std::cout<<"INITIALIZED GENERALHISTOS FOR RESIDUALS 2"<<std::endl;
+    //std::cout<<"INITIALIZED GENERALHISTOS FOR RESIDUALS 2"<<std::endl;
+    if(msgLvl(MSG::VERBOSE)) msg() << " INITIALIZED GENERALHISTOS FOR RESIDUALS "<< endmsg;
     ++m_histosBooked;
   }
 	
@@ -1103,14 +1131,14 @@ TProfile* IDAlignMonResiduals::MakeProfile(const std::string& name, const std::s
 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:" << endreq;
+    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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH3 Histogram:" << endmsg;
   }
 }
 
@@ -1121,7 +1149,7 @@ void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TH1* histo) {
   histo->SetOption("e");
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1 Histogram:" << endmsg;
   }
 }
 
@@ -1131,7 +1159,7 @@ void IDAlignMonResiduals::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
   //histo->SetOption("e");
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1F_LW Histogram:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH1F_LW Histogram:" << endmsg;
   }
 }
 
@@ -1139,7 +1167,7 @@ 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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TProfile Histogram:" << endmsg;
   }
 }
 
@@ -1148,7 +1176,7 @@ 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:" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot book TH2 Histogram:" << endmsg;
   }
 }
 
@@ -1164,7 +1192,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 
   const DataHandle<xAOD::EventInfo> eventInfo;
   if (StatusCode::SUCCESS != evtStore()->retrieve( eventInfo ) ){
-    msg(MSG::ERROR) << "Cannot get event info." << endreq;
+    msg(MSG::ERROR) << "Cannot get event info." << endmsg;
   }
   
   
@@ -1189,11 +1217,11 @@ StatusCode IDAlignMonResiduals::fillHistograms()
   
   if (evtStore()->contains<ComTime>(m_comTimeObjectName)){
     if(evtStore()->retrieve(theComTime, m_comTimeObjectName).isFailure() ){
-      if (msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "ComTime object not found with name " << m_comTimeObjectName << "!!!" << endreq;
+      if (msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "ComTime object not found with name " << m_comTimeObjectName << "!!!" << endmsg;
       //return StatusCode::FAILURE;
     }
     else{
-      if (msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "ComTime object found successfully " << endreq;
+      if (msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "ComTime object found successfully " << endmsg;
     }
   }
 	
@@ -1201,22 +1229,29 @@ StatusCode IDAlignMonResiduals::fillHistograms()
   if(theComTime){
     timeCor = theComTime->getTime();
   }
-  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " ** IDAlignMonResiduals::fillHistograms() ** going to fill histos for " << m_tracksName << " tracks" << endreq;
+  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " ** IDAlignMonResiduals::fillHistograms() ** going to fill histos for " << m_tracksName << " tracks" << endmsg;
+
   if (!evtStore()->contains<TrackCollection>(m_tracksName)) {
-    if(m_events == 1) {if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Unable to get " << m_tracksName << " tracks from TrackCollection" << endreq;}
-    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " ** IDAlignMonResiduals::fillHistograms() ** Unable to get " << m_tracksName << " tracks from TrackCollection " << endreq;
+    if(m_events == 1) {
+      if (m_histosBooked!=0){ 
+	if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Unable to get " << m_tracksName << " tracks from TrackCollection" << endmsg;
+      }
+    }
+    else {
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " ** IDAlignMonResiduals::fillHistograms() ** Unable to get " << m_tracksName << " tracks from TrackCollection " << endmsg;
+    }
     return StatusCode::SUCCESS;
   }
 
   // Code is able to get a weight from an external file and appy it to all histograms
-  double hweight = 1.;
+  double TrkWeight = 1.;
   // NB the weight is a "per track" weight, so histograms such as BS info are never weighted
 
 	
   DataVector<Trk::Track>* tracks = m_trackSelection->selectTracks(m_tracksName);
   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "IDAlignMonResiduals::fillHistograms() -- event: " << m_events
 					 << " with Track collection " << m_tracksName << " has size =" << tracks->size()
-					 << endreq;
+					 << endmsg;
   
   int nTracks = 0;
   int nHitsEvent = 0;
@@ -1229,7 +1264,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     //this has the hit information
     const Trk::Track* track = *trackItr;
     if(track == NULL){
-      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracks << endreq;
+      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracks << endmsg;
       continue;
     }
 		
@@ -1237,36 +1272,56 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     
     if(msgLvl(MSG::DEBUG)){
       if(trackRequiresRefit(track)){
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not all TSOS contain track parameters - will be missing residuals/pulls " << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not all TSOS contain track parameters - will be missing residuals/pulls " << endmsg;
       }
-      else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "All TSOS contain track parameters - Good! " << endreq;
+      else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "All TSOS contain track parameters - Good! " << endmsg;
     }
 		
     //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 << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "******************* Track Pointer = " << track << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found " << track->trackStateOnSurfaces()->size() << " TrkSurfaces " << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "******************* Track = " << nTracks << endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "******************* Track Pointer = " << track << endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found " << track->trackStateOnSurfaces()->size() << " TrkSurfaces " << endmsg;
 		
     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;
+    float trketa     = -999;
     
     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();
+    trkpt  = (track->perigeeParameters()->charge())*(track->perigeeParameters()->pT())/1000.; // signed and in GeV?
+    trketa =  track->perigeeParameters()->eta();
 
     // per track weight, if required
-    if ( m_applyHistWeight ){ 
-      int binNumber = m_etapTWeight->FindBin( trketa_w, trkpt );
-      hweight       = m_etapTWeight->GetBinContent( binNumber );
-    }
+    if ( m_applyHistWeight ){
+      TrkWeight = 1.; // default
+      int binNumber = 0;
+      // different weights can be considered
+      switch (m_userInputWeigthMethod) {
+      case IDAlignMonResiduals::TRKETA_TRKPT : // map of trk pt vs eta
+	binNumber = m_hInputTrackWeight->FindBin(trketa, trkpt);
+	TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	break;
+      case IDAlignMonResiduals::EVENTMU_TRKPT : // map of event mu vs eta
+	binNumber = m_hInputTrackWeight->FindBin(m_mu, trkpt);
+	TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	break;
+      case IDAlignMonResiduals::EVENTMU_TRKETA : // map of event mu vs eta
+	binNumber = m_hInputTrackWeight->FindBin(m_mu, trketa);
+	TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+	break;
+      default:
+	// map of trk pt vs eta
+	binNumber = m_hInputTrackWeight->FindBin(trketa, trkpt);
+	TrkWeight = m_hInputTrackWeight->GetBinContent(binNumber);
+      } // end switch for trk weight calculation
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Track weight calculation method " << m_userInputWeigthMethod << " TrkWeight: " << TrkWeight << endmsg;
+    } // end of track weight calculation
 
     //looping over the hits
     for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator iter_tsos=(track->trackStateOnSurfaces()->begin());
@@ -1274,30 +1329,30 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 					
       ++nTSOS;
 			
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "***************** TSOS (hit) = " << nTSOS << endreq;       
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "***************** TSOS (hit) = " << nTSOS << endmsg;       
 			
       if ((*iter_tsos) == NULL) continue;
 			
       //skipping outliers
       if(!(*iter_tsos)->type(Trk::TrackStateOnSurface::Measurement)) {
-      	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because it is an outlier (or the first TSOS on the track)" << endreq;
+      	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because it is an outlier (or the first TSOS on the track)" << endmsg;
       continue;
       }		
       const Trk::MeasurementBase* mesh =(*iter_tsos)->measurementOnTrack();
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined hit MeasurementBase " << endreq;
+      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== NULL) { 
 	//for some reason the first tsos has no associated hit - maybe because this contains the defining parameters?
-	if (nHits > 0 && msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No hit associated with TSOS "<< nTSOS << endreq; 
+	if (nHits > 0 && msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No hit associated with TSOS "<< nTSOS << endmsg; 
 	continue;
       }
 			
       const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
       if(trackParameter==NULL) {
 	//if no TrackParameters for TSOS we cannot define residuals
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because does not have TrackParameters" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because does not have TrackParameters" << endmsg;
 	continue;
       }
       
@@ -1326,7 +1381,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       if(TrackParCovariance==NULL) {
 	//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)
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because does not have MeasuredTrackParameters" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because does not have MeasuredTrackParameters" << endmsg;
 	continue;
       }
 
@@ -1368,13 +1423,18 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       int ClusSize    = -999;
       			
       const Identifier & hitId = hit->identify();
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit Identifier " << endreq;
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit Identifier " << endmsg;
+      // Salva (Feb 2017): problem observed with a hit not being pixel -> make sure hits are from an ID part     
+
+      // Salva: new code
+      detType = -1; // unknown
       if (m_idHelper->is_trt(hitId)) detType = 2;
-      else if (m_idHelper->is_sct(hitId)) detType = 1;
-      else  detType = 0;
+      if (m_idHelper->is_sct(hitId)) detType = 1;
+      if (m_idHelper->is_pixel(hitId)) detType = 0;
+
       if(detType==2){
 	//have identified a TRT hit
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is from the TRT, finding residuals... " << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is from the TRT, finding residuals... " << endmsg;
 	bool isTubeHit = (mesh->localCovariance()(Trk::locX,Trk::locX) > 1.0) ? 1 : 0;			
 	const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
 	float hitR = hit->localParameters()[Trk::driftRadius];
@@ -1389,19 +1449,19 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 
 	//finding residuals
 	if(!trackParameter){
-	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No TrackParameters associated with TRT TrkSurface "<<nTSOS<< endreq;
+	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No TrackParameters associated with TRT TrkSurface "<<nTSOS<< endmsg;
 	  continue;
 	}
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found Trk::TrackParameters" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found Trk::TrackParameters" << endmsg;
 	
 	//getting unbiased track parameters by removing the hit from the track and refitting
 	const Trk::TrackParameters* trackParameterUnbiased = getUnbiasedTrackParameters(track,*iter_tsos);
 	
 	if(!trackParameterUnbiased){//updator can fail
-	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot define unbiased parameters for hit, skipping it." << endreq;
+	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot define unbiased parameters for hit, skipping it." << endmsg;
 	  continue;
 	}
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found UnBiased TrackParameters" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found UnBiased TrackParameters" << endmsg;
 	
 	float perdictR = trackParameterUnbiased->parameters()[Trk::locR];
 				
@@ -1419,7 +1479,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  pullR = residualPull->pull()[Trk::locR];
 	}
 	else {
-	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " no covariance of the track parameters given, can not calc pull!" << endreq;
+	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " no covariance of the track parameters given, can not calc pull!" << endmsg;
 	}
 				
 	delete trackParameterUnbiased;
@@ -1496,25 +1556,25 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 			    ,t0
 			    ,isTubeHit
 			    ,trketa
-			    ,trkpt, hweight);
+			    ,trkpt, TrkWeight);
 	}
       }//if detType ==2
       
       //if (detType==0 || detType==1) 
       else {//have identified pixel or SCT hit
 	
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is pixel or SCT, finding residuals... " << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is pixel or SCT, finding residuals... " << endmsg;
 	if(m_doHitQuality) {
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to Silicon hit..." << endreq;
+	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to Silicon hit..." << endmsg;
 	  
 	  hit = m_hitQualityTool->getGoodHit(*iter_tsos);
 	  if(hit==NULL) {
-	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit failed quality cuts and is rejected." << endreq;
+	    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" << endreq;
+	  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." << endreq;
+	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);
@@ -1560,7 +1620,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  modPhi    = m_sctID->phi_module(id);
 	  sctSide   = m_sctID->side(id);
 	  const InDetDD::SiDetectorElement *siDet = dynamic_cast<const InDetDD::SiDetectorElement*>(hit->detectorElement());
-	  isStereo = siDet->isStereo();
+	  isStereo = siDet ? siDet->isStereo() : false;
 	  const InDet::SCT_Cluster *clus = dynamic_cast<const InDet::SCT_Cluster*>(hit->prepRawData());
 	  if(clus){
 	    const InDet::SiWidth cw = clus->width();
@@ -1574,7 +1634,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	//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 << endreq;	  
+	  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};
@@ -1583,11 +1643,11 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  StatusCode sc;
 	  sc = getSiResiduals(track,*iter_tsos,true,unbiasedResXY);
 	  if (sc.isFailure()) {
-	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiased residuals! Hit is skipped." << endreq;
-	    m_sirescalcfailure -> Fill(detType, hweight);
+	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining unbiased residuals! Hit is skipped." << endmsg;
+	    m_sirescalcfailure -> Fill(detType, TrkWeight);
 	    continue;
 	  }
-	  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "unbiased residuals found ok" << endreq;
+	  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];
@@ -1596,10 +1656,10 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  //finding biased single residuals (for interest)
 	  sc = getSiResiduals(track,*iter_tsos,false,biasedResXY);
 	  if (sc.isFailure()) {
-	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Problem in determining biased residuals! Hit is skipped." << endreq;
+	    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" << endreq;
+	  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];
@@ -1610,7 +1670,12 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	    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)));
+	    if (mesh->localCovariance().rows()>1) { // attempt to avoid crashes in following line
+	      hitErrorY = (float)sqrt(fabs(mesh->localCovariance()(Trk::loc2,Trk::loc2)));
+	    }
+	    else {
+	      hitErrorY = 1.;
+	    }
 	    //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
@@ -1643,7 +1708,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 					
 	  //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..." << endreq;
+	  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
@@ -1658,10 +1723,10 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	    //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." << endreq;
+	      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" << endreq;
+	    } else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "unbiasedOverlapRes found ok" << endmsg;
 	    /*
 	    overlapXResX = (float)unbiasedOverlapRes[0];
 	    overlapXResY = (float)unbiasedOverlapRes[1];
@@ -1684,16 +1749,16 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	    //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." << endreq;
+	      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" << endreq;
+	    } 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" << endreq; 
+	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackParameters associated with Si TrkSurface "<< nTSOS << " - Hit is probably an outlier" << endmsg; 
       }
 	
       //--------------------------------------------
@@ -1704,210 +1769,220 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       
    
       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" << endreq;
+	m_si_residualx -> Fill(residualX, TrkWeight);
+	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)
 	    nIBLHitsPerLB++;
 
-	  m_si_b_residualx -> Fill(residualX, hweight);
+	  m_si_b_residualx -> Fill(residualX, TrkWeight);
 	  int m_layerModEtaShift[4] = {10,30,48,65};       //HARDCODED!
 	  int m_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);
+	  m_si_barrel_pullX -> Fill(layerDisk,pullX   , TrkWeight);
+	  m_si_barrel_pullY -> Fill(layerDisk,pullY   , TrkWeight);					
+	  m_si_barrel_resX -> Fill(layerDisk,residualX, TrkWeight);
+	  m_si_barrel_resY -> Fill(layerDisk,residualY, TrkWeight);					
+	  m_pix_b_residualx      -> Fill(residualX      , TrkWeight);
+	  m_pix_b_biased_residualx-> Fill(biasedResidualX, TrkWeight);
+	  m_pix_b_residualy      -> Fill(residualY      , TrkWeight);
+	  m_pix_b_biased_residualy-> Fill(biasedResidualY, TrkWeight);
+	  m_pix_b_residualsx[layerDisk]-> Fill(residualX, TrkWeight); 
+	  m_pix_b_residualsy[layerDisk]-> Fill(residualY, TrkWeight); 
+	  m_pix_b_pullsx[layerDisk]    -> Fill(pullX    , TrkWeight); 
+	  m_pix_b_pullsy[layerDisk]    -> Fill(pullY    , TrkWeight); 
+
+
+	  m_pix_b_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta, modPhi, residualX, TrkWeight);
+	  m_pix_b_yresvsmodetaphi_3ds[layerDisk] -> Fill(modEta, modPhi, residualY, TrkWeight);
 
 	  if (layerDisk == 0) {
-	    m_pix_b0_resXvsetaLumiBlock->Fill(float(lumiblock), modEta, residualX, hweight);
+	    m_pix_b0_resXvsetaLumiBlock->Fill(float(lumiblock), modEta, residualX, TrkWeight);
 
 	    if (modEta<=6 && modEta>=-6)
-	      m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(lumiblock),modEta,residualX,hweight);
+	      m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(lumiblock),modEta,residualX,TrkWeight);
 	    
 	    if (m_doIBLLBPlots)
 	      {
-		m_pix_b0_resXvsetaLumiBlock_3d->Fill(float(lumiblock), modEta, residualX, hweight);
-		if (modEta<=6 && modEta>=-6) m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==0) m_pix_b0_resXvsetaLumiBlock_stave0->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==1) m_pix_b0_resXvsetaLumiBlock_stave1->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==2) m_pix_b0_resXvsetaLumiBlock_stave2->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==3) m_pix_b0_resXvsetaLumiBlock_stave3->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==4) m_pix_b0_resXvsetaLumiBlock_stave4->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==5) m_pix_b0_resXvsetaLumiBlock_stave5->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==6) m_pix_b0_resXvsetaLumiBlock_stave6->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==7) m_pix_b0_resXvsetaLumiBlock_stave7->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==8) m_pix_b0_resXvsetaLumiBlock_stave8->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==9) m_pix_b0_resXvsetaLumiBlock_stave9->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==10) m_pix_b0_resXvsetaLumiBlock_stave10->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==11) m_pix_b0_resXvsetaLumiBlock_stave11->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==12) m_pix_b0_resXvsetaLumiBlock_stave12->Fill(float(lumiblock),modEta,residualX,hweight);
-		if (modPhi==13) m_pix_b0_resXvsetaLumiBlock_stave13->Fill(float(lumiblock),modEta,residualX,hweight);
+		m_pix_b0_resXvsetaLumiBlock_3d->Fill(float(lumiblock), modEta, residualX, TrkWeight);
+		if (modEta<=6 && modEta>=-6) m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==0) m_pix_b0_resXvsetaLumiBlock_stave0->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==1) m_pix_b0_resXvsetaLumiBlock_stave1->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==2) m_pix_b0_resXvsetaLumiBlock_stave2->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==3) m_pix_b0_resXvsetaLumiBlock_stave3->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==4) m_pix_b0_resXvsetaLumiBlock_stave4->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==5) m_pix_b0_resXvsetaLumiBlock_stave5->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==6) m_pix_b0_resXvsetaLumiBlock_stave6->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==7) m_pix_b0_resXvsetaLumiBlock_stave7->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==8) m_pix_b0_resXvsetaLumiBlock_stave8->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==9) m_pix_b0_resXvsetaLumiBlock_stave9->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==10) m_pix_b0_resXvsetaLumiBlock_stave10->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==11) m_pix_b0_resXvsetaLumiBlock_stave11->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==12) m_pix_b0_resXvsetaLumiBlock_stave12->Fill(float(lumiblock),modEta,residualX,TrkWeight);
+		if (modPhi==13) m_pix_b0_resXvsetaLumiBlock_stave13->Fill(float(lumiblock),modEta,residualX,TrkWeight);
 	      }
 	  }
 
 	  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+m_layerModEtaShift[layerDisk],overlapXResidualX,     hweight);
-	    m_pix_b_Oxresxvsmodphi-> Fill(modPhi+m_layerModPhiShift[layerDisk],overlapXResidualX, hweight);
+	    m_pix_bec_Oxresx_mean -> Fill(layerDisk+1.1,overlapXResidualX, TrkWeight);
+	    m_pix_bec_Oxresy_mean -> Fill(layerDisk+1.1,overlapXResidualY, TrkWeight);
+	    m_pix_b_Oxresxvsmodeta-> Fill(modEta+m_layerModEtaShift[layerDisk],overlapXResidualX,     TrkWeight);
+	    m_pix_b_Oxresxvsmodphi-> Fill(modPhi+m_layerModPhiShift[layerDisk],overlapXResidualX, TrkWeight);
 	    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);
+	      m_pix_b_Oxresxvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapXResidualX, TrkWeight);
+	      m_pix_b_Oxresyvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapXResidualY, TrkWeight);
 	    }
 	  }//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+m_layerModEtaShift[layerDisk],overlapYResidualY,     hweight);
-	    m_pix_b_Oyresyvsmodphi-> Fill(modPhi+m_layerModPhiShift[layerDisk],overlapYResidualY,     hweight);
+	    m_pix_bec_Oyresx_mean -> Fill(layerDisk+1.1,overlapYResidualX, TrkWeight);
+	    m_pix_bec_Oyresy_mean -> Fill(layerDisk+1.1,overlapYResidualY, TrkWeight);
+	    m_pix_b_Oyresyvsmodeta-> Fill(modEta+m_layerModEtaShift[layerDisk],overlapYResidualY,     TrkWeight);
+	    m_pix_b_Oyresyvsmodphi-> Fill(modPhi+m_layerModPhiShift[layerDisk],overlapYResidualY,     TrkWeight);
 	    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);
+	      m_pix_b_Oyresxvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapYResidualX, TrkWeight);
+	      m_pix_b_Oyresyvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapYResidualY, TrkWeight);
 	    }
 	  }//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);
+	  m_si_eca_pullX-> Fill(layerDisk,pullX    , TrkWeight);
+	  m_si_eca_pullY-> Fill(layerDisk,pullY    , TrkWeight);
+	  m_si_eca_resX -> Fill(layerDisk,residualX, TrkWeight);
+	  m_si_eca_resY -> Fill(layerDisk,residualY, TrkWeight);
+	  m_pix_eca_residualx     -> Fill(residualX, TrkWeight);
+	  m_pix_eca_residualy     -> Fill(residualY, TrkWeight);
+	  m_pix_eca_pullx         -> Fill(pullX    , TrkWeight);
+	  m_pix_eca_pully         -> Fill(pullY    , TrkWeight);
 	  
 	  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);
+	    m_pix_bec_Oxresx_mean -> Fill(disk+5.0,overlapXResidualX, TrkWeight);
+	    m_pix_bec_Oxresy_mean -> Fill(disk+5.0,overlapXResidualY, TrkWeight);
+	    m_pix_eca_Oxresxvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],overlapXResidualX, TrkWeight);
 	  }
 					
 	  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_bec_Oyresx_mean -> Fill(disk+5.0,overlapYResidualX, TrkWeight);
+	    m_pix_bec_Oyresy_mean -> Fill(disk+5.0,overlapYResidualY, TrkWeight);
+	    m_pix_eca_Oyresyvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],overlapYResidualY, TrkWeight);
 	  }
 
-	  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);
-	  //m_pix_eca_unbiased_xresvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],residualX,hweight);
-	  //m_pix_eca_unbiased_yresvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],residualY,hweight);
+	  m_pix_eca_xresvsmodphi_2d -> Fill(modPhi+ModPhiShift[layerDisk],residualX, TrkWeight);
+	  m_pix_eca_yresvsmodphi_2d -> Fill(modPhi+ModPhiShift[layerDisk],residualY, TrkWeight);
+
+	  if (0 <= layerDisk && layerDisk <= m_PIX_Mgr->numerology().numDisks()-1) { // protection
+	    msg(MSG::DEBUG) << " filling histos pixel ECA disk " << layerDisk << " for track " << nTracks << " of collection "<<  m_tracksName << endmsg;
+	    if (m_pix_eca_unbiased_xresvsmodphi_disks[layerDisk] != NULL) // protection
+	      m_pix_eca_unbiased_xresvsmodphi_disks[layerDisk] -> Fill(modPhi,residualX, TrkWeight);
+	    if (m_pix_eca_unbiased_yresvsmodphi_disks[layerDisk] != NULL)
+	      m_pix_eca_unbiased_yresvsmodphi_disks[layerDisk] -> Fill(modPhi,residualY, TrkWeight);
+	  }
+	  else {
+	    msg(MSG::INFO) << " bad number for pixel ECA disk " << layerDisk << " of track " << nTracks << " of collection "<<  m_tracksName << endmsg;
+	    msg(MSG::INFO) << " dumping hit: -- start --" << endmsg;
+	    hit->dump(msg(MSG::INFO));
+	    msg(MSG::INFO) << " dumping hit: -- completed --" << endmsg;
+	  }
 	  
 	}
 	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);
+	  m_si_ecc_pullX-> Fill(layerDisk,pullX    , TrkWeight);
+	  m_si_ecc_pullY-> Fill(layerDisk,pullY    , TrkWeight);
+	  m_si_ecc_resX -> Fill(layerDisk,residualX, TrkWeight);
+	  m_si_ecc_resY -> Fill(layerDisk,residualY, TrkWeight);
 					
 	  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);					
+	  m_pix_ecc_residualx     -> Fill(residualX, TrkWeight);
+	  m_pix_ecc_residualy     -> Fill(residualY, TrkWeight);
+	  m_pix_ecc_pullx         -> Fill(pullX    , TrkWeight);
+	  m_pix_ecc_pully         -> Fill(pullY    , TrkWeight);					
 	  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);
+	    m_pix_bec_Oxresx_mean -> Fill(disk,overlapXResidualX, TrkWeight);
+	    m_pix_bec_Oxresy_mean -> Fill(disk,overlapXResidualY, TrkWeight);
+	    m_pix_ecc_Oxresxvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],overlapXResidualX, TrkWeight);
 	  }					
 	  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_bec_Oyresx_mean -> Fill(disk,overlapYResidualX, TrkWeight);
+	    m_pix_bec_Oyresy_mean -> Fill(disk,overlapYResidualY, TrkWeight);
+	    m_pix_ecc_Oyresyvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],overlapYResidualY, TrkWeight);
 	  }
-	  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);	  
+	  m_pix_ecc_xresvsmodphi_2d -> Fill(modPhi+ModPhiShift[layerDisk],residualX, TrkWeight);
+	  m_pix_ecc_yresvsmodphi_2d -> Fill(modPhi+ModPhiShift[layerDisk],residualY, TrkWeight);
+	  //m_pix_ecc_unbiased_xresvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],residualX,TrkWeight);
+	  //m_pix_ecc_unbiased_yresvsmodphi -> Fill(modPhi+ModPhiShift[layerDisk],residualY,TrkWeight);	
+	  m_pix_ecc_unbiased_xresvsmodphi_disks[layerDisk] -> Fill(modPhi,residualX, TrkWeight);
+	  m_pix_ecc_unbiased_yresvsmodphi_disks[layerDisk] -> Fill(modPhi,residualY, TrkWeight);	  
 	  
 	}
 	  
       }
       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" << endreq;
+	m_si_residualx -> Fill(residualX, TrkWeight);			
+	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);
+	  m_si_b_residualx -> Fill(residualX, TrkWeight);
 	  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_pullX->Fill(m_NPixLayers + 2*(layerDisk) + sctSide, pullX, TrkWeight);
 	  //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_resX->Fill(m_NPixLayers + 2*(layerDisk) + sctSide, residualX, TrkWeight);
 	  //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);
+	  m_sct_b_residualx      -> Fill(residualX      , TrkWeight);
+	  m_sct_b_biasedresidualx-> Fill(biasedResidualX, TrkWeight);
 	  
-	  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);
+	  if(foundXOverlap) m_sct_bec_Oxresx_mean -> Fill(layerDisk+1.1,overlapXResidualX, TrkWeight);
+	  if(foundYOverlap) m_sct_bec_Oyresx_mean -> Fill(layerDisk+1.1,overlapYResidualX, TrkWeight);
 	  
-	  m_sct_b_residualsx[layerDisk]-> Fill(residualX, hweight); 
-	  m_sct_b_pullsx[layerDisk]    -> Fill(pullX    , hweight); 
+	  m_sct_b_residualsx[layerDisk]-> Fill(residualX, TrkWeight); 
+	  m_sct_b_pullsx[layerDisk]    -> Fill(pullX    , TrkWeight); 
 	  
-	  m_sct_b_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,residualX, hweight);
+	  m_sct_b_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,residualX, TrkWeight);
 	  
 	  	  
 	  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);
+	    m_sct_b_xoverlapresidualsx[layerDisk]-> Fill(overlapXResidualX         , TrkWeight); 
+	    m_sct_b_Oxresxvsmodeta    -> Fill(modEta+ModEtaShift[layerDisk],overlapXResidualX, TrkWeight);
+	    m_sct_b_Oxresxvsmodphi    -> Fill(modPhi+ModPhiShift[layerDisk],overlapXResidualX  , TrkWeight);
 	    if (m_do3DOverlapHistos)
-	      m_sct_b_Oxresxvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapXResidualX, hweight);
+	      m_sct_b_Oxresxvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapXResidualX, TrkWeight);
 	  }								  
 	  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);
+	    m_sct_b_yoverlapresidualsx[layerDisk]-> Fill(overlapYResidualX         , TrkWeight); 
+	    m_sct_b_Oyresxvsmodeta    -> Fill(modEta+ModEtaShift[layerDisk],overlapYResidualX, TrkWeight);
+	    m_sct_b_Oyresxvsmodphi    -> Fill(modPhi+ModPhiShift[layerDisk],overlapYResidualX  , TrkWeight);
 	    if(m_do3DOverlapHistos)
-	      m_sct_b_Oyresxvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapYResidualX, hweight);
+	      m_sct_b_Oyresxvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,overlapYResidualX, TrkWeight);
 	  }
-	  // if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unexpected SCT layer number "<< layerDisk << endreq; 
+	  // 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_pullX->Fill(3 + 2*(layerDisk) + sctSide, pullX, TrkWeight);
 	  //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_resX->Fill(3 + 2*(layerDisk) + sctSide, residualX, TrkWeight);
 	  //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_residualx     -> Fill(residualX, TrkWeight);
+	  m_sct_eca_pullx         -> Fill(pullX    , TrkWeight);
 	  
-	  m_sct_eca_xresvsmodphi_2d -> Fill(modPhi+(layerDisk - 1)* (m_gap_sct + Nmods),residualX, hweight);
+	  m_sct_eca_xresvsmodphi_2d -> Fill(modPhi + (layerDisk) * (m_gap_sct + Nmods), residualX, TrkWeight);
 	  					
 	  if(foundXOverlap) {
 	    m_sct_bec_Oxresx_mean->Fill(disk+6.0,overlapXResidualX);						
-	    m_sct_eca_Oxresxvsmodphi -> Fill(modPhi+ (layerDisk - 1)* (m_gap_sct + Nmods),overlapXResidualX,hweight);
-	    //                               modPhi+ ModPhiShift[layerDisk],overlapXResidualX    , hweight);
+	    m_sct_eca_Oxresxvsmodphi -> Fill(modPhi+ (layerDisk) * (m_gap_sct + Nmods),overlapXResidualX,TrkWeight);
+	    //                               modPhi+ ModPhiShift[layerDisk],overlapXResidualX    , TrkWeight);
 	  }
 					
 	}
@@ -1915,20 +1990,20 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	
 	else if(barrelEC==-2){
 	  int Nmods = 52;
-	  m_si_ecc_pullX->Fill(3 + 2*(layerDisk) + sctSide, pullX, hweight);
+	  m_si_ecc_pullX->Fill(3 + 2*(layerDisk) + sctSide, pullX, TrkWeight);
 	  //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_resX->Fill(3 + 2*(layerDisk) + sctSide, residualX, TrkWeight);
 	  //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_residualx     ->Fill(residualX, TrkWeight);
+	  m_sct_ecc_pullx         ->Fill(pullX    , TrkWeight);
 	  
-	  m_sct_ecc_xresvsmodphi_2d -> Fill(modPhi+(layerDisk - 1)* (m_gap_sct + Nmods)    ,residualX, hweight);	  					
+	  m_sct_ecc_xresvsmodphi_2d -> Fill(modPhi + (layerDisk)* (m_gap_sct + Nmods)    ,residualX, TrkWeight);	  					
 	  if(foundXOverlap) {
 	    m_sct_bec_Oxresx_mean->Fill(disk,overlapXResidualX);
-	    m_sct_ecc_Oxresxvsmodphi -> Fill(modPhi+(layerDisk - 1)* (m_gap_sct + Nmods)    ,overlapXResidualX, hweight);
+	    m_sct_ecc_Oxresxvsmodphi -> Fill(modPhi + (layerDisk)* (m_gap_sct + Nmods)    ,overlapXResidualX, TrkWeight);
 	  }
 	}
       }
@@ -1939,29 +2014,29 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  if(barrelEC==0){ // barrel
 	    static int m_phiIdentifier_min[3]    = {0,-1 ,22};
 	    static int m_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);
+	    m_pix_b_biased_residualx_pt-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_pix_b_biased_residualy_pt-> Fill(trkpt, biasedResidualY, TrkWeight);
+	    m_pix_b_residualx_pt       -> Fill(trkpt, residualX, TrkWeight);
+	    m_pix_b_residualy_pt       -> Fill(trkpt, residualY, TrkWeight);
+	    m_pix_b_pullx_pt           -> Fill(trkpt, pullX, TrkWeight);
+	    m_pix_b_pully_pt           -> Fill(trkpt, pullY, TrkWeight);
+	    m_pix_b_residualx_fine -> Fill(residualX      , TrkWeight);
+	    m_pix_b_residualy_fine -> Fill(residualY      , TrkWeight);
+	    m_pix_b_measured_localx-> Fill(mlocalX     , TrkWeight);
+	    m_pix_b_measured_localy-> Fill(mlocalY     , TrkWeight);
+	    m_pix_b_extrapolated_localx-> Fill(elocalX     , TrkWeight);
+	    m_pix_b_extrapolated_localy-> Fill(elocalY     , TrkWeight);
 	    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);
+	      m_hiterror_x_pix_b         -> Fill(hitErrorX   , TrkWeight); 	    
+	      m_hiterror_x_pix_b_WideRange-> Fill(hitErrorX   , TrkWeight);
+	      m_hiterror_y_pix_b         -> Fill(hitErrorY   , TrkWeight);	    
+	      m_hiterror_y_pix_b_WideRange-> Fill(hitErrorY   , TrkWeight);
 	    }
 	    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);
+	      m_hiterror_x_ibl_b      ->Fill(hitErrorX,TrkWeight);
+	      m_hiterror_y_ibl_b      ->Fill(hitErrorX,TrkWeight);
+	      m_hiterror_x_ibl_b_WideRange      ->Fill(hitErrorX,TrkWeight);
+	      m_hiterror_y_ibl_b_WideRange      ->Fill(hitErrorX,TrkWeight);
 	    }
 	    
 	    if(mlocalY >  PixelBarrelYSize / 2.05 )	mlocalY =  PixelBarrelYSize/2.05;
@@ -1969,30 +2044,30 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	    if(mlocalX >  PixelBarrelXSize / 2.05 )	mlocalX =  PixelBarrelXSize/2.05;
 	    if(mlocalX < -PixelBarrelXSize / 2.05 )	mlocalX = -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);
+	    m_pix_b_residualsx_incitheta[layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+	    m_pix_b_residualsy_incitheta[layerDisk] ->Fill(incidenceTheta,residualY,TrkWeight);
+	    m_pix_b_residualsx_inciphi[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
+	    m_pix_b_residualsy_inciphi[layerDisk] ->Fill(incidencePhi,residualY,TrkWeight);
+	    m_pix_b_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
+	    m_pix_b_residualsy_pt[layerDisk]       -> Fill(trkpt, residualY      , TrkWeight);
+	    m_pix_b_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, residualX      , TrkWeight);
+	    m_pix_b_residualsy_qoverp2[layerDisk]-> Fill(trkqoverp2, residualY      , TrkWeight);
+	    m_pix_b_biased_residualsx[layerDisk]   -> Fill(biasedResidualX       , TrkWeight);
+	    m_pix_b_biased_residualsy[layerDisk]   -> Fill(biasedResidualY       , TrkWeight);
+	    m_pix_b_biased_residualsx_pt[layerDisk]-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_pix_b_biased_residualsy_pt[layerDisk]-> Fill(trkpt, biasedResidualY, TrkWeight);
+	    m_pix_b_biased_residualsx_qoverp2[layerDisk]  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_pix_b_biased_residualsy_qoverp2[layerDisk]  -> Fill(trkqoverp2, biasedResidualY, TrkWeight);
+	    m_pix_b_pullsx_pt[layerDisk]          -> Fill(trkpt, pullX          , TrkWeight);
+	    m_pix_b_pullsy_pt[layerDisk]           -> Fill(trkpt, pullY          , TrkWeight);
 	    if(foundXOverlap) {
-	      m_pix_b_xoverlapresidualsx[layerDisk]-> Fill(overlapXResidualX          , hweight); 
-	      m_pix_b_xoverlapresidualsy[layerDisk]-> Fill(overlapXResidualY          , hweight); 
+	      m_pix_b_xoverlapresidualsx[layerDisk]-> Fill(overlapXResidualX          , TrkWeight); 
+	      m_pix_b_xoverlapresidualsy[layerDisk]-> Fill(overlapXResidualY          , TrkWeight); 
 	    }
 	    
 	    if(foundYOverlap) {
-	      m_pix_b_yoverlapresidualsx[layerDisk]-> Fill(overlapYResidualX          , hweight); 
-	      m_pix_b_yoverlapresidualsy[layerDisk]-> Fill(overlapYResidualY          , hweight); 
+	      m_pix_b_yoverlapresidualsx[layerDisk]-> Fill(overlapYResidualX          , TrkWeight); 
+	      m_pix_b_yoverlapresidualsy[layerDisk]-> Fill(overlapYResidualY          , TrkWeight); 
 	    }
 	    // int modoffset = 6.5;       // default for old pixel layers
 	    PixelBarrelXSize = 16.44;  // mm
@@ -2011,23 +2086,9 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	    float xValueForHist = modEta +  mlocalY / PixelBarrelYSize; 
 	    float yValueForHist = modPhi +  mlocalX / PixelBarrelXSize;
 
-	    if (false) {
-	      std::cout << " -- SALVA -- filling detailed pixel maps -- layer = " << layerDisk 
-			<< "  eta: " << modEta 
-			<< "  phi " << modPhi
-			<< "  local (" << mlocalX << " / " << PixelBarrelXSize 
-			<< ", "        << mlocalY << " / " << PixelBarrelYSize << ") "
-			<< "  normalized (" << mlocalY/PixelBarrelYSize * m_mapSplit << ", " << mlocalX/PixelBarrelXSize * m_mapSplit << ") "
-			<< std::endl;
-	      std::cout << "                                                      " 
-			<< " fill (" << xValueForHist << ", " << yValueForHist << ") "
-			<< std::endl;
-	    }
 	    // 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);
+	    m_pix_b_detailed_xresvsmodetaphi_3ds[layerDisk] -> Fill( xValueForHist, yValueForHist, residualX, TrkWeight);
+	    m_pix_b_detailed_yresvsmodetaphi_3ds[layerDisk] -> Fill( xValueForHist, yValueForHist, residualY, TrkWeight);
 	    
 	    // pixel B-layer halfshell phi identifier association
 		// Layer 0                  Layer 1                     Layer 2
@@ -2035,195 +2096,206 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 		// bottom: 11-21 and 0      20-37                       23-48
 	    if (layerDisk != 2) // Necessary because the logic changes
 	      if(modPhi>m_phiIdentifier_min[layerDisk] && modPhi<m_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); 
+		m_pix_b_top_residualsx[layerDisk] -> Fill(residualX, TrkWeight); 
+		m_pix_b_top_residualsy[layerDisk] -> Fill(residualY, TrkWeight);
+		m_pix_b_top_biased_residualsx[layerDisk] -> Fill(biasedResidualX, TrkWeight);
+		m_pix_b_top_biased_residualsy[layerDisk] -> Fill(biasedResidualY, TrkWeight); 
 	      }
 	      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); 
+		m_pix_b_btm_residualsx[layerDisk] -> Fill(residualX, TrkWeight); 
+		m_pix_b_btm_residualsy[layerDisk] -> Fill(residualY, TrkWeight);
+		m_pix_b_btm_biased_residualsx[layerDisk] -> Fill(biasedResidualX, TrkWeight); 
+		m_pix_b_btm_biased_residualsy[layerDisk] -> Fill(biasedResidualY, TrkWeight); 
 	      }
 		else 
 		  if(modPhi>m_phiIdentifier_min[layerDisk] && modPhi<m_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); 
+		    m_pix_b_btm_residualsx[layerDisk] -> Fill(residualX, TrkWeight); 
+		    m_pix_b_btm_residualsy[layerDisk] -> Fill(residualY, TrkWeight);
+		    m_pix_b_btm_biased_residualsx[layerDisk] -> Fill(biasedResidualX, TrkWeight);
+		    m_pix_b_btm_biased_residualsy[layerDisk] -> Fill(biasedResidualY, TrkWeight); 
 		  }
 		  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); 
+		    m_pix_b_top_residualsx[layerDisk] -> Fill(residualX, TrkWeight); 
+		    m_pix_b_top_residualsy[layerDisk] -> Fill(residualY, TrkWeight);
+		    m_pix_b_top_biased_residualsx[layerDisk] -> Fill(biasedResidualX, TrkWeight); 
+		    m_pix_b_top_biased_residualsy[layerDisk] -> Fill(biasedResidualY, TrkWeight); 
 		  }
 	    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);
+		m_pix_b_clustersize[layerDisk] -> Fill(ClusSize,TrkWeight);
+		m_pix_b_clustersizePhi[layerDisk] -> Fill(ClusSizePhi,TrkWeight);
+		m_pix_b_clustersizeZ[layerDisk] -> Fill(ClusSizeZ,TrkWeight);
+		m_pix_b_residualsx_clustersize[layerDisk]->Fill(ClusSize,residualX,TrkWeight);
+		m_pix_b_residualsy_clustersize[layerDisk]->Fill(ClusSize,residualY,TrkWeight);
+		m_pix_b_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi,residualX,TrkWeight);
+		m_pix_b_residualsy_clustersizePhi[layerDisk]->Fill(ClusSizePhi,residualY,TrkWeight);
+		m_pix_b_residualsx_clustersizeZ[layerDisk]->Fill(ClusSizeZ,residualX,TrkWeight);
+		m_pix_b_residualsy_clustersizeZ[layerDisk]->Fill(ClusSizeZ,residualY,TrkWeight);
+		m_pix_b_residualsx_clustersizeP[layerDisk]->Fill(ClusSize,residualX,TrkWeight);
+		m_pix_b_residualsy_clustersizeP[layerDisk]->Fill(ClusSize,residualY,TrkWeight);
+		m_pix_b_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi,residualX,TrkWeight);
+		m_pix_b_residualsy_clustersizePhiP[layerDisk]->Fill(ClusSizePhi,residualY,TrkWeight);
+		m_pix_b_residualsx_clustersizeZP[layerDisk]->Fill(ClusSizeZ,residualX,TrkWeight);
+		m_pix_b_residualsy_clustersizeZP[layerDisk]->Fill(ClusSizeZ,residualY,TrkWeight);
+		m_pix_b_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSizePhi,TrkWeight);
+		m_pix_b_clustersizeZ_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSizeZ,TrkWeight);
+		m_pix_b_clustersize_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSize,TrkWeight);
+		m_pix_b_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSizePhi,TrkWeight);
+		m_pix_b_clustersizeZ_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSizeZ,TrkWeight);
+		m_pix_b_clustersize_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSize,TrkWeight);
 	      }
 	  }
 	  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_x_pix_ec_WideRange-> Fill(hitErrorX       , hweight);
-	    m_hiterror_y_pix_ec   -> Fill(hitErrorY       , 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);
-		
-	      }
+	    m_pix_eca_xresvsmodphidisk_3d->Fill(layerDisk,modPhi,residualX,TrkWeight);
+	    m_pix_eca_yresvsmodphidisk_3d->Fill(layerDisk,modPhi,residualY,TrkWeight);
+	    m_pix_eca_biased_residualx->Fill(biasedResidualX,TrkWeight);
+	    m_pix_eca_biased_residualy->Fill(biasedResidualY,TrkWeight);
+	    m_pix_eca_residualx_fine-> Fill(residualX, TrkWeight);
+	    m_pix_eca_residualy_fine-> Fill(residualY, TrkWeight);
+	    m_pix_eca_biased_residualx_pt-> Fill(trkpt,biasedResidualX, TrkWeight);
+	    m_pix_eca_biased_residualy_pt-> Fill(trkpt,biasedResidualY, TrkWeight);
+	    m_pix_eca_residualx_pt-> Fill(trkpt, residualX, TrkWeight);
+	    m_pix_eca_residualy_pt-> Fill(trkpt, residualY, TrkWeight);
+	    m_pix_eca_pullx_pt    -> Fill(trkpt, pullX    , TrkWeight);
+	    m_pix_eca_pully_pt    -> Fill(trkpt, pullY    , TrkWeight);
+
+	    m_hiterror_x_pix_ec   -> Fill(hitErrorX       , TrkWeight); 	    m_hiterror_x_pix_ec_WideRange-> Fill(hitErrorX       , TrkWeight);
+	    m_hiterror_y_pix_ec   -> Fill(hitErrorY       , TrkWeight);       m_hiterror_y_pix_ec_WideRange-> Fill(hitErrorY       , TrkWeight);    
+
+	    if (0 <= layerDisk && layerDisk <= m_PIX_Mgr->numerology().numDisks()-1) { // protection
+	      msg(MSG::DEBUG) << " filling biased histos pixel ECA disk " << layerDisk << " for track " << nTracks << " of collection "<<  m_tracksName << endmsg;
+	      m_pix_eca_biased_residualsx[layerDisk]   -> Fill(biasedResidualX      , TrkWeight);
+	      m_pix_eca_biased_residualsy[layerDisk]   -> Fill(biasedResidualY      , TrkWeight);
+	      m_pix_eca_biased_residualsx_pt[layerDisk]-> Fill(trkpt,biasedResidualX, TrkWeight);
+	      m_pix_eca_biased_residualsy_pt[layerDisk]-> Fill(trkpt,biasedResidualY, TrkWeight);
+	      m_pix_eca_residualsx_pt[layerDisk]-> Fill(trkpt,residualX, TrkWeight);
+	      m_pix_eca_residualsy_pt[layerDisk]-> Fill(trkpt,residualY, TrkWeight);
+	      m_pix_eca_pullsx_pt[layerDisk]    -> Fill(trkpt,pullX    , TrkWeight);
+	      m_pix_eca_pullsy_pt[layerDisk]     -> Fill(trkpt,pullY    , TrkWeight);
+	      m_pix_eca_biased_residualsx_qoverp2[layerDisk]   -> Fill(trkqoverp2,biasedResidualX, TrkWeight);
+	      m_pix_eca_biased_residualsy_qoverp2[layerDisk]   -> Fill(trkqoverp2,biasedResidualY, TrkWeight);
+	      m_pix_eca_residualsx_qoverp2[layerDisk] -> Fill(trkqoverp2,residualX      , TrkWeight);
+	      m_pix_eca_residualsy_qoverp2[layerDisk] -> Fill(trkqoverp2,residualY      , TrkWeight);
+	      m_pix_eca_biased_xresvsmodphi_2ds[layerDisk]  -> Fill(modPhi,biasedResidualX, TrkWeight);
+	      m_pix_eca_biased_yresvsmodphi_2ds[layerDisk]  -> Fill(modPhi,biasedResidualY, TrkWeight);
 	    
-	    }
+	      if (m_doClusterSizeHistos) {
+		  m_pix_eca_clustersize[layerDisk] -> Fill(ClusSize,TrkWeight);
+		  m_pix_eca_clustersizePhi[layerDisk] -> Fill(ClusSizePhi,TrkWeight);
+		  m_pix_eca_clustersizeZ[layerDisk] -> Fill(ClusSizeZ,TrkWeight);
+		  m_pix_eca_residualsx_clustersize[layerDisk]->Fill(ClusSize,residualX,TrkWeight);
+		  m_pix_eca_residualsy_clustersize[layerDisk]->Fill(ClusSize,residualY,TrkWeight);
+		  m_pix_eca_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi,residualX,TrkWeight);
+		  m_pix_eca_residualsy_clustersizePhi[layerDisk]->Fill(ClusSizePhi,residualY,TrkWeight);
+		  m_pix_eca_residualsx_clustersizeZ[layerDisk]->Fill(ClusSizeZ,residualX,TrkWeight);
+		  m_pix_eca_residualsy_clustersizeZ[layerDisk]->Fill(ClusSizeZ,residualY,TrkWeight);
+		  m_pix_eca_residualsx_clustersizeP[layerDisk]->Fill(ClusSize,residualX,TrkWeight);
+		  m_pix_eca_residualsy_clustersizeP[layerDisk]->Fill(ClusSize,residualY,TrkWeight);
+		  m_pix_eca_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi,residualX,TrkWeight);
+		  m_pix_eca_residualsy_clustersizePhiP[layerDisk]->Fill(ClusSizePhi,residualY,TrkWeight);
+		  m_pix_eca_residualsx_clustersizeZP[layerDisk]->Fill(ClusSizeZ,residualX,TrkWeight);
+		  m_pix_eca_residualsy_clustersizeZP[layerDisk]->Fill(ClusSizeZ,residualY,TrkWeight);
+		  m_pix_eca_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSizePhi,TrkWeight);
+		  m_pix_eca_clustersizeZ_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSizeZ,TrkWeight);
+		  m_pix_eca_clustersize_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSize,TrkWeight);
+		  m_pix_eca_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSizePhi,TrkWeight);
+		  m_pix_eca_clustersizeZ_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSizeZ,TrkWeight);
+		  m_pix_eca_clustersize_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSize,TrkWeight);
+	      } // m_doClusterSizeHistos
+	    } // good layerDisk
+	    else{
+	      msg(MSG::INFO) << " bad number for pixel ECA disk " << layerDisk << " of track " << nTracks << " of collection "<<  m_tracksName << endmsg;
+	    } // fail good layerDisk                                                             
+	  }
 	  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_x_pix_ec_WideRange-> Fill(hitErrorX       , hweight); 
-	    m_hiterror_y_pix_ec   -> Fill(hitErrorY       , hweight);  m_hiterror_y_pix_ec_WideRange-> Fill(hitErrorY       , hweight);
+	    m_pix_ecc_xresvsmodphidisk_3d->Fill(layerDisk,modPhi,residualX,TrkWeight);
+	    m_pix_ecc_yresvsmodphidisk_3d->Fill(layerDisk,modPhi,residualY,TrkWeight);
+	    m_pix_ecc_biased_residualx->Fill(biasedResidualX,TrkWeight);
+	    m_pix_ecc_biased_residualy->Fill(biasedResidualY,TrkWeight);
+	    m_pix_ecc_residualx_fine-> Fill(residualX, TrkWeight);
+	    m_pix_ecc_residualy_fine-> Fill(residualY, TrkWeight);
+	    m_pix_ecc_biased_residualx_pt-> Fill(trkpt,biasedResidualX, TrkWeight);
+	    m_pix_ecc_biased_residualy_pt-> Fill(trkpt,biasedResidualY, TrkWeight);
+	    m_pix_ecc_residualx_pt-> Fill(trkpt, residualX, TrkWeight);
+	    m_pix_ecc_residualy_pt-> Fill(trkpt, residualY, TrkWeight);
+	    m_pix_ecc_pullx_pt    -> Fill(trkpt, pullX    , TrkWeight);
+	    m_pix_ecc_pully_pt    -> Fill(trkpt, pullY    , TrkWeight);
+	    m_hiterror_x_pix_ec   -> Fill(hitErrorX       , TrkWeight);  m_hiterror_x_pix_ec_WideRange-> Fill(hitErrorX       , TrkWeight); 
+	    m_hiterror_y_pix_ec   -> Fill(hitErrorY       , TrkWeight);  m_hiterror_y_pix_ec_WideRange-> Fill(hitErrorY       , TrkWeight);
 	   
-	    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 (0 <= layerDisk && layerDisk <= m_PIX_Mgr->numerology().numDisks()-1) { // protection
+	      msg(MSG::DEBUG) << " filling biased histos pixel ECA disk " << layerDisk << " for track " << nTracks << " of collection "<<  m_tracksName << endmsg;
+	      
+	      m_pix_ecc_biased_residualsx[layerDisk]   -> Fill(biasedResidualX      , TrkWeight);
+	      m_pix_ecc_biased_residualsy[layerDisk]   -> Fill(biasedResidualY      , TrkWeight);
+	      m_pix_ecc_biased_residualsx_pt[layerDisk]-> Fill(trkpt,biasedResidualX, TrkWeight);
+	      m_pix_ecc_biased_residualsy_pt[layerDisk]-> Fill(trkpt,biasedResidualY, TrkWeight);
+	      m_pix_ecc_residualsx_pt[layerDisk]-> Fill(trkpt,residualX, TrkWeight);
+	      m_pix_ecc_residualsy_pt[layerDisk]-> Fill(trkpt,residualY, TrkWeight);
+	      m_pix_ecc_pullsx_pt[layerDisk]    -> Fill(trkpt,pullX    , TrkWeight);
+	      m_pix_ecc_pullsy_pt[layerDisk]     -> Fill(trkpt,pullY    , TrkWeight);
+	      m_pix_ecc_biased_residualsx_qoverp2[layerDisk]   -> Fill(trkqoverp2,biasedResidualX, TrkWeight);
+	      m_pix_ecc_biased_residualsy_qoverp2[layerDisk]   -> Fill(trkqoverp2,biasedResidualY, TrkWeight);
+	      m_pix_ecc_residualsx_qoverp2[layerDisk] -> Fill(trkqoverp2,residualX      , TrkWeight);
+	      m_pix_ecc_residualsy_qoverp2[layerDisk] -> Fill(trkqoverp2,residualY      , TrkWeight);
+	      m_pix_ecc_biased_xresvsmodphi_2ds[layerDisk]  -> Fill(modPhi,biasedResidualX, TrkWeight);
+	      m_pix_ecc_biased_yresvsmodphi_2ds[layerDisk]  -> Fill(modPhi,biasedResidualY, TrkWeight);
 	    
-	    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);
+	      if (m_doClusterSizeHistos) {
+		  m_pix_ecc_clustersize[layerDisk] -> Fill(ClusSize,TrkWeight);
+		  m_pix_ecc_clustersizePhi[layerDisk] -> Fill(ClusSizePhi,TrkWeight);
+		  m_pix_ecc_clustersizeZ[layerDisk] -> Fill(ClusSizeZ,TrkWeight);
+		  m_pix_ecc_residualsx_clustersize[layerDisk]->Fill(ClusSize,residualX,TrkWeight);
+		  m_pix_ecc_residualsy_clustersize[layerDisk]->Fill(ClusSize,residualY,TrkWeight);
+		  m_pix_ecc_residualsx_clustersizePhi[layerDisk]->Fill(ClusSizePhi,residualX,TrkWeight);
+		  m_pix_ecc_residualsy_clustersizePhi[layerDisk]->Fill(ClusSizePhi,residualY,TrkWeight);
+		  m_pix_ecc_residualsx_clustersizeZ[layerDisk]->Fill(ClusSizeZ,residualX,TrkWeight);
+		  m_pix_ecc_residualsy_clustersizeZ[layerDisk]->Fill(ClusSizeZ,residualY,TrkWeight);
+		  m_pix_ecc_residualsx_clustersizeP[layerDisk]->Fill(ClusSize,residualX,TrkWeight);
+		  m_pix_ecc_residualsy_clustersizeP[layerDisk]->Fill(ClusSize,residualY,TrkWeight);
+		  m_pix_ecc_residualsx_clustersizePhiP[layerDisk]->Fill(ClusSizePhi,residualX,TrkWeight);
+		  m_pix_ecc_residualsy_clustersizePhiP[layerDisk]->Fill(ClusSizePhi,residualY,TrkWeight);
+		  m_pix_ecc_residualsx_clustersizeZP[layerDisk]->Fill(ClusSizeZ,residualX,TrkWeight);
+		  m_pix_ecc_residualsy_clustersizeZP[layerDisk]->Fill(ClusSizeZ,residualY,TrkWeight);
+		  m_pix_ecc_clustersizePhi_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSizePhi,TrkWeight);
+		  m_pix_ecc_clustersizeZ_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSizeZ,TrkWeight);
+		  m_pix_ecc_clustersize_incidentAngle[layerDisk]->Fill(incidenceTheta,ClusSize,TrkWeight);
+		  m_pix_ecc_clustersizePhi_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSizePhi,TrkWeight);
+		  m_pix_ecc_clustersizeZ_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSizeZ,TrkWeight);
+		  m_pix_ecc_clustersize_incidentAnglePhi[layerDisk]->Fill(incidencePhi,ClusSize,TrkWeight);
 	      }
-	  }
-	}
+	    } // good layer disk
+	    else {
+	      msg(MSG::INFO) << " bad number for pixel ECA disk " << layerDisk << " of track " << nTracks << " of collection "<<  m_tracksName << endmsg;
+	    } // fail good layerDisk                                                             
+	  }  // ECC - barrelEC==-2
+	} // pixel 
+
+	// SCT histos
 	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_sct_b_residualx_fine -> Fill(residualX      , TrkWeight);
+	    m_sct_b_biased_residualx_pt     -> Fill(trkpt, biasedResidualX     , TrkWeight);
+	    m_sct_b_residualx_pt            -> Fill(trkpt, residualX           , TrkWeight);
+	    m_sct_b_pullx_pt                -> Fill(trkpt, pullX               , TrkWeight);
+	    m_sct_b_biased_residualx_qoverp2-> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_sct_b_unbiased_residualx_qoverp2-> Fill(trkqoverp2, residualX, TrkWeight);
+	    //m_sct_b_residualx_qoverp2 -> Fill(trkqoverp2, residualX   , TrkWeight); !! Not in the original
 	   
-	    m_hiterror_sct_b                   -> Fill(hitErrorX               , hweight);
-	    m_hiterror_sct_b_WideRange         -> Fill(hitErrorX               , hweight);
+	    m_hiterror_sct_b                   -> Fill(hitErrorX               , TrkWeight);
+	    m_hiterror_sct_b_WideRange         -> Fill(hitErrorX               , TrkWeight);
 
 	    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);
+	      m_sct_b_extrapolated_st_localx-> Fill(elocalX, TrkWeight);
+	      m_sct_b_extrapolated_st_localy-> Fill(elocalY, TrkWeight);
+	      m_sct_b_measured_st_localx    -> Fill(mlocalX, TrkWeight);
+	      m_sct_b_measured_st_localy    -> Fill(mlocalY, TrkWeight);
 	    }
 	    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);
+	      m_sct_b_extrapolated_nst_localx-> Fill(elocalX, TrkWeight);
+	      m_sct_b_extrapolated_nst_localy-> Fill(elocalY, TrkWeight);
+	      m_sct_b_measured_nst_localx    -> Fill(mlocalX, TrkWeight);
+	      m_sct_b_measured_nst_localy    -> Fill(mlocalY, TrkWeight);
 	    }
 	    
 	    if(fabs(elocalY)>SCTBarrelYSize/2.){
@@ -2239,30 +2311,30 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	    if(mlocalX >  SCTBarrelXSize/2.05)	      mlocalX =  SCTBarrelXSize/2.05;
 	    if(mlocalX < -SCTBarrelXSize/2.05)	      mlocalX = -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);
+	    m_sct_b_biased_residualsx[layerDisk]   -> Fill(biasedResidualX       , TrkWeight);
+	    m_sct_b_biased_residualsx_pt[layerDisk]-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_sct_b_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
+	    m_sct_b_pullsx_pt[layerDisk]           -> Fill(trkpt, pullX          , TrkWeight);
+	    m_sct_b_biased_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_sct_b_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, residualX      , TrkWeight);
+	    m_sct_b_biased_pullsx[layerDisk]       -> Fill(biasedPullX                , TrkWeight);
 	    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);
+		m_sct_b_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,TrkWeight);
+		m_sct_b_residualsx_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,residualX,TrkWeight);
+		m_sct_b_residualsx_clustersizePhiP[layerDisk] ->Fill(ClusSizePhi,residualX,TrkWeight);
 		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);
+		  m_sct_b_residualsx_incidentAngle_s0 [layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+		  m_sct_b_residualsx_incidentAnglePhi_s0[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
+		  m_sct_b_clustersizePhivsmodetaphi_3ds_s0[layerDisk] -> Fill(modEta,modPhi,ClusSizePhi, TrkWeight);
 		}
 		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_residualsx_incidentAngle_s1 [layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+		  m_sct_b_residualsx_incidentAnglePhi_s1[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
+		  m_sct_b_clustersizePhivsmodetaphi_3ds_s1[layerDisk] -> Fill(modEta,modPhi,ClusSizePhi, TrkWeight);
 		}
-		m_sct_b_clustersizePhi_incidentAngle[layerDisk] ->Fill(incidenceTheta,ClusSizePhi,hweight);
-		m_sct_b_clustersizePhi_incidentAnglePhi[layerDisk] ->Fill(incidencePhi,ClusSizePhi,hweight);
+		m_sct_b_clustersizePhi_incidentAngle[layerDisk] ->Fill(incidenceTheta,ClusSizePhi,TrkWeight);
+		m_sct_b_clustersizePhi_incidentAnglePhi[layerDisk] ->Fill(incidencePhi,ClusSizePhi,TrkWeight);
 	      }
 	    Float_t corrEta;							    
 	    if(modEta>0)  corrEta = modEta+5.5;
@@ -2273,119 +2345,116 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	      + (modPhi+0.5)*SCTBarrelXSize;
 	    if(sctSide==0)
 	      {
-		// SALVA (13/May/2015) temporary fix.. used the biased histogram to store the unbiased residuals when modules divides in a Nsplit x Nsplit grid
-		// SALVA m_sct_b_s0_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(ModCenterPosX+elocalY, ModCenterPosY+mlocalX,biasedResidualX, hweight);
-		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);
+		m_sct_b_s0_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(ModCenterPosX+elocalY, ModCenterPosY+mlocalX, residualX, TrkWeight);
+		m_sct_b_s0_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta, modPhi, residualX, TrkWeight);
 	      }
 	    else
 	      {
-		// SALVA m_sct_b_s1_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(ModCenterPosX+elocalY, ModCenterPosY+mlocalX,biasedResidualX, hweight);		   
-		// SALVA (13/May/2015) temporary fix.. used the biased histogram to store the unbiased residuals when modules divides in a Nsplit x Nsplit grid
-		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);
+		m_sct_b_s1_biased_xresvsmodetaphi_3ds[layerDisk]->Fill(ModCenterPosX+elocalY, ModCenterPosY+mlocalX, residualX, TrkWeight);
+		m_sct_b_s1_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta, modPhi, residualX, TrkWeight);
 	      }
 	  }
 	 
 	  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);
-	   
+	    m_sct_eca_residualx_fine-> Fill(residualX, TrkWeight);
+	    m_sct_eca_biased_residualx   -> Fill(biasedResidualX       , TrkWeight);
+	    m_sct_eca_biased_residualx_pt-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_sct_eca_residualx_pt       -> Fill(trkpt, residualX      , TrkWeight);
+	    m_sct_eca_pullx_pt           -> Fill(trkpt, pullX          , TrkWeight);
+	    m_sct_eca_biased_residualx_qoverp2  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_sct_eca_unbiased_residualx_qoverp2-> Fill(trkqoverp2, residualX      , TrkWeight);
+	    m_hiterror_sct_ec                   -> Fill(hitErrorX                  , TrkWeight);
+	    m_hiterror_sct_ec_WideRange         -> Fill(hitErrorX                  , TrkWeight);
+
+	    m_sct_eca_biased_residualsx[layerDisk]   -> Fill(biasedResidualX       , TrkWeight);
+	    m_sct_eca_biased_residualsx_pt[layerDisk]-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_sct_eca_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
+	    m_sct_eca_pullsx_pt[layerDisk]           -> Fill(trkpt, pullX          , TrkWeight);
+	    m_sct_eca_biased_residualsx_qoverp2[layerDisk]  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_sct_eca_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, residualX      , TrkWeight);
+
+	    float theBin = modPhi + ( m_maxRingsInASCTEndCapDisk - modEta-1) * m_maxModulesInASCTEndCapRing; 
+	    m_sct_eca_xresvsmodphi_disks[layerDisk]           -> Fill(theBin, residualX, TrkWeight);  // 
+	    m_sct_eca_biased_xresvsmodphi_disks[layerDisk]    -> Fill(theBin, biasedResidualX, TrkWeight);
+	    
 	    if (m_doClusterSizeHistos)
 	      {
-		m_sct_eca_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,hweight);
+		m_sct_eca_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,TrkWeight);
 		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);
+		    m_sct_eca_residualsx_incidentAngle_s0 [layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+		    m_sct_eca_residualsx_incidentAnglePhi_s0[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
 		  }
 		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_incidentAngle_s1 [layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+		    m_sct_eca_residualsx_incidentAnglePhi_s1[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
 		  }
 		
-		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);
+		m_sct_eca_residualsx_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,residualX,TrkWeight);
+		m_sct_eca_residualsx_clustersizePhiP[layerDisk] ->Fill(ClusSizePhi,residualX,TrkWeight);
+		m_sct_eca_clustersizePhi_incidentAngle[layerDisk] ->Fill(incidenceTheta,ClusSizePhi,TrkWeight);
+		m_sct_eca_clustersizePhi_incidentAnglePhi[layerDisk] ->Fill(incidencePhi,ClusSizePhi,TrkWeight);
 	      }
 	    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);
+	      m_sct_eca_s0_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,residualX, TrkWeight);
+	      m_sct_eca_s0_biased_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,biasedResidualX, TrkWeight);
 	    }
 	    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);
+	      m_sct_eca_s1_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,residualX, TrkWeight);
+	      m_sct_eca_s1_biased_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,biasedResidualX, TrkWeight);
 	    }
 	  }
 	   
 	  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);
+	    m_sct_ecc_residualx_fine-> Fill(residualX, TrkWeight);
+	    m_sct_ecc_biased_residualx   -> Fill(biasedResidualX       , TrkWeight);
+	    m_sct_ecc_biased_residualx_pt-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_sct_ecc_residualx_pt       -> Fill(trkpt, residualX      , TrkWeight);
+	    m_sct_ecc_pullx_pt           -> Fill(trkpt, pullX          , TrkWeight);
+	    m_sct_ecc_biased_residualx_qoverp2  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_sct_ecc_unbiased_residualx_qoverp2-> Fill(trkqoverp2, residualX      , TrkWeight);
+	    m_hiterror_sct_ec                   -> Fill(hitErrorX                  , TrkWeight);
+	    m_hiterror_sct_ec_WideRange         -> Fill(hitErrorX                  , TrkWeight);
+
+	    m_sct_ecc_biased_residualsx[layerDisk]   -> Fill(biasedResidualX       , TrkWeight);
+	    m_sct_ecc_biased_residualsx_pt[layerDisk]-> Fill(trkpt, biasedResidualX, TrkWeight);
+	    m_sct_ecc_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
+	    m_sct_ecc_pullsx_pt[layerDisk]          -> Fill(trkpt, pullX          , TrkWeight);
+	    m_sct_ecc_biased_residualsx_qoverp2[layerDisk]  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
+	    m_sct_ecc_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, residualX      , TrkWeight);
+
+	    float theBin = modPhi + ( m_maxRingsInASCTEndCapDisk - modEta-1) * m_maxModulesInASCTEndCapRing; 
+	    m_sct_ecc_xresvsmodphi_disks[layerDisk]       ->Fill(theBin, residualX      , TrkWeight);
+	    m_sct_ecc_biased_xresvsmodphi_disks[layerDisk]->Fill(theBin, biasedResidualX, TrkWeight);
+
 	    if (m_doClusterSizeHistos){
-	      m_sct_ecc_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,hweight);
+	      m_sct_ecc_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,TrkWeight);
 	      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);
+		    m_sct_ecc_residualsx_incidentAngle_s0 [layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+		    m_sct_ecc_residualsx_incidentAnglePhi_s0[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
 		  }
 		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_incidentAngle_s1 [layerDisk] ->Fill(incidenceTheta,residualX,TrkWeight);
+		    m_sct_ecc_residualsx_incidentAnglePhi_s1[layerDisk] ->Fill(incidencePhi,residualX,TrkWeight);
 		  }
 	     
-	      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);
+	      m_sct_ecc_residualsx_clustersizePhi[layerDisk] ->Fill(ClusSizePhi,residualX,TrkWeight);
+	      m_sct_ecc_residualsx_clustersizePhiP[layerDisk] ->Fill(ClusSizePhi,residualX,TrkWeight);
+	      m_sct_ecc_clustersizePhi_incidentAngle[layerDisk] ->Fill(incidenceTheta,ClusSizePhi,TrkWeight);
+	      m_sct_ecc_clustersizePhi_incidentAnglePhi[layerDisk] ->Fill(incidencePhi,ClusSizePhi,TrkWeight);
 	      
 	    }
 	      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);
+	      m_sct_ecc_s0_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,residualX, TrkWeight);
+	      m_sct_ecc_s0_biased_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,biasedResidualX, TrkWeight);
 	    }
 	    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);
+		m_sct_ecc_s1_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,residualX, TrkWeight);
+		m_sct_ecc_s1_biased_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta,modPhi,biasedResidualX, TrkWeight);
 	      }
 	  }
 	 
@@ -2414,7 +2483,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       
       if ( nIBLHitsPerLB > m_minIBLhits )
 	{
-	  TH1D* projection_lumiblock = m_pix_b0_resXvsetaLumiBlock->ProjectionY(("iblBowingProjection_lumiblock_"+intToString(lumibin-1)).c_str(),lumibin,lumibin);
+	  TH1F* projection_lumiblock = (TH1F*) m_pix_b0_resXvsetaLumiBlock->ProjectionY(("iblBowingProjection_lumiblock_"+intToString(lumibin-1)).c_str(),lumibin,lumibin);
 	  //if (projection_lumiblock->GetEntries() > min_entries)
 	  //{
 	  MakeStaveShapeFit(mag,mag_er,base,base_er,projection_lumiblock);
@@ -2422,7 +2491,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  m_mag_vs_LB->SetBinError(lumibin,mag_er);
 	  m_base_vs_LB->SetBinContent(lumibin,base);
 	  m_base_vs_LB->SetBinError(lumibin,base_er);
-	  TH1D* projection_lumiblock_planars = m_pix_b0_resXvsetaLumiBlock_planars->ProjectionY(("planars_iblBowingProjection_lumiblock_"+intToString(lumibin-1)).c_str(),lumibin,lumibin);
+	  TH1F* projection_lumiblock_planars = (TH1F*) m_pix_b0_resXvsetaLumiBlock_planars->ProjectionY(("planars_iblBowingProjection_lumiblock_"+intToString(lumibin-1)).c_str(),lumibin,lumibin);
 	  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);
@@ -2430,13 +2499,13 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  m_base_vs_LB_planars->SetBinError(lumibin,base_er);
 	  //}
 	  //else
-	  //  if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Fit IBL Shape for LumiBlock : "<< lumiblock<<" disabled because of too few entries!  "<<projection_lumiblock->GetEntries() <<endreq;
+	  //  if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Fit IBL Shape for LumiBlock : "<< lumiblock<<" disabled because of too few entries!  "<<projection_lumiblock->GetEntries() <<endmsg;
 	  
 	  delete projection_lumiblock;
 	}
       else
 	if(msgLvl(MSG::WARNING)) 
-	  msg(MSG::WARNING) << "Fit IBL Shape for LumiBlock : "<< lumiblock<<" disabled. Too Few hits"<<endreq; 
+	  msg(MSG::WARNING) << "Fit IBL Shape for LumiBlock : "<< lumiblock<<" disabled. Too Few hits"<<endmsg; 
   
       
 
@@ -2444,7 +2513,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     }// End of lumiblock
     
   delete tracks;	
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of tracks : "<< nTracks << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of tracks : "<< nTracks << endmsg;
   
   
   
@@ -2562,33 +2631,33 @@ StatusCode  IDAlignMonResiduals::getSiResiduals(const Trk::Track* track, const T
 		
     if (hit && trackParameterForResiduals) {
 			
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<" got hit and track parameters " << endreq;
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<" got hit and track parameters " << endmsg;
 			
       //const Trk::ResidualPull* residualPull = m_residualPullCalculator->residualPull(hit, trackParameterForResiduals, unBias);
       const Trk::ResidualPull* residualPull = NULL;
       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 " << endreq;
+      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" << endreq;
+	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!!!" << endreq;
+	  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" << endreq;
+	  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 << endreq; 
+	  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!!!" << endreq;
+	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds invalid Y Pull!!!" << endmsg;
 	    sc = StatusCode::FAILURE;
 	  }
 	}
@@ -2597,7 +2666,7 @@ StatusCode  IDAlignMonResiduals::getSiResiduals(const Trk::Track* track, const T
 				
       }
       else {
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator failed!" << endreq;
+	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator failed!" << endmsg;
 	sc = StatusCode::FAILURE;
       }
     }
@@ -2613,7 +2682,7 @@ StatusCode  IDAlignMonResiduals::getSiResiduals(const Trk::Track* track, const T
   results[3] = pullY;
 	
   if(pullX!=pullX || pullY!=pullY){
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds Pull=NAN!!!" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ResidualPullCalculator finds Pull=NAN!!!" << endmsg;
     sc = StatusCode::FAILURE;
   }
 	
@@ -2624,6 +2693,58 @@ StatusCode  IDAlignMonResiduals::getSiResiduals(const Trk::Track* track, const T
 	
 }
 
+//_______________________
+
+
+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)
 {
@@ -2642,7 +2763,13 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
   
   const Trk::TrackStateOnSurface* xOverlap = NULL;
   const Trk::TrackStateOnSurface* yOverlap = NULL;
-     
+  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;
@@ -2670,7 +2797,7 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
       }
       if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "******** looking for overlaps for new hit detType = " << detType 
 					   << ", modEta = " << modEta << ", modPhi = " << modPhi << " , layerDisk= "<<layerDisk
-					   << ", barrelEC= "<<barrelEC<< endreq;
+					   << ", barrelEC= "<<barrelEC<< endmsg;
       
       int nHits = 0;
       for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsos2=trk->trackStateOnSurfaces()->begin();tsos2!=trk->trackStateOnSurfaces()->end(); ++tsos2) {
@@ -2710,44 +2837,52 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	  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)<<endreq;
+	  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<< endreq;
+					   << ", 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" << endreq;
+	  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" << endreq;
+	  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" << endreq;
+	  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" << endreq;
+	  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)" << endreq;
+	  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();
+	  bool stereo = siDet ? siDet->isStereo() : false;
 	  const InDetDD::SiDetectorElement *siDet2 = dynamic_cast<const InDetDD::SiDetectorElement*>(hit2->detectorElement());
-	  bool stereo2 = siDet2->isStereo();
+	  bool stereo2 = siDet2 ? siDet2->isStereo() : false;
 	  if(stereo!=stereo2){
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "SCT overlap rejected because the modules are not both stereo/radial modules" << endreq;
+	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "SCT overlap rejected because the modules are not both stereo/radial modules" << endmsg;
 	    continue;
 	  }
 	}
@@ -2757,23 +2892,23 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	const AmgSymMatrix(5)* MeasTrackParCovariance = measuredTrackParameter ? measuredTrackParameter->covariance() : NULL;
 	if(MeasTrackParCovariance==NULL) {
 				
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because overlap hit does not have associated measuredTrackParameters" << endreq;
+	  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..." << endreq;
+	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "applying hit quality cuts to overlap hit..." << endmsg;
 					
 	    hit2 = m_hitQualityTool->getGoodHit(*tsos2);
 	    if(hit2==NULL) {
-	      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "overlap rejected because failed hit quality cuts." << endreq;
+	      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" << endreq;
+	    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." << endreq;
+	  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "hit quality cuts NOT APPLIED to overlap hit." << endmsg;
 	}
 			
 	bool close = false; //added by LT
@@ -2816,25 +2951,25 @@ std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> IDAl
 	    close = true;
 	  }
 	  if(close){  //end add by TG
-	    //	if(msgLvl(MSG::DEBUG)) msg() <<  "original module radius = " << radius << endreq;
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<  "***** identified local X overlap in the IBL" << endreq;
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<  "original module phi, eta,layerDisk,barrelEC  = " << modEta <<", "<<modPhi<<",  "<< layerDisk <<" , "<< barrelEC  << endreq;
-	    //if(msgLvl(MSG::DEBUG)) msg() <<  "overlap module radius = " << radius2 << endreq;
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<  "second module phi, eta,layerDisk,barrelEC  = " << modEta2 <<", "<<modPhi2<<layerDisk<<barrelEC<< endreq;
+	    //	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" << endreq;
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "modEta2 = " << modEta2 << endreq;
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "modPhi2 = " << modPhi2 << endreq;
-	  //if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "original module radius = " << radius << endreq;
-	  //if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<  "overlap module radius = " << radius2 << endreq;
+	  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);
 }
@@ -2854,10 +2989,10 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
   Identifier surfaceID;
 	
 	
-  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "original track parameters: " << *(tsos->trackParameters()) <<endreq;
+  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "original track parameters: " << *(tsos->trackParameters()) <<endmsg;
 	
 	
-  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Trying to unbias track parameters." << endreq;
+  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Trying to unbias track parameters." << endmsg;
 	
   const Trk::RIO_OnTrack* hitOnTrack = dynamic_cast <const Trk::RIO_OnTrack*>(tsos->measurementOnTrack());
 	
@@ -2867,7 +3002,7 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
 
   // 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)
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Entering True Unbiased loop." << endreq;
+    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Entering True Unbiased loop." << endmsg;
     // check if other module side was also hit and try to remove other hit as well
     const Trk::TrackStateOnSurface* OtherModuleSideHit(0);
     const Identifier& OtherModuleSideID = m_SCT_Mgr->getDetectorElement(surfaceID)->otherSide()->identify();
@@ -2879,7 +3014,7 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
 	//const Identifier& trkID = TempHitOnTrack->identify();
 	//if (m_sctID->wafer_id(trkID) == OtherModuleSideID) {
 	if (m_sctID->wafer_id(TempHitOnTrack->identify()) == OtherModuleSideID) {
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(OtherModuleSideID,0,'/') << endreq;
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "True unbiased residual. Removing OtherModuleSide Hit " << m_idHelper->show_to_string(OtherModuleSideID,0,'/') << endmsg;
 	  OtherModuleSideHit = *TempTsos;
 	}
       }
@@ -2893,13 +3028,13 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
       // check that the hit on the other module side has measuredtrackparameters, otherwise it cannot be removed from the track
       if (OMSHmeasuredTrackParameterCov) {
 				
-	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "OtherSideTrackParameters: " << *(OtherModuleSideHit->trackParameters()) << endreq;
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "OtherSideTrackParameters: " << *(OtherModuleSideHit->trackParameters()) << endmsg;
 	OtherSideUnbiasedTrackParams = m_iUpdator->removeFromState(*(OtherModuleSideHit->trackParameters()),
 								   OtherModuleSideHit->measurementOnTrack()->localParameters(),
 								   OtherModuleSideHit->measurementOnTrack()->localCovariance());
 				
 	if (OtherSideUnbiasedTrackParams) {
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased OtherSideTrackParameters: " << *OtherSideUnbiasedTrackParams << endreq;
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased OtherSideTrackParameters: " << *OtherSideUnbiasedTrackParams << endmsg;
 					
 					
 	  const Trk::Surface* TempSurface = &(OtherModuleSideHit->measurementOnTrack()->associatedSurface());
@@ -2907,18 +3042,18 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
 	  const Trk::MagneticFieldProperties* TempField = 0;
 	  if (TempSurface)
 	    {
-	      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After OtherSide surface call. Surface exists" << endreq;
+	      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After OtherSide surface call. Surface exists" << endmsg;
 	      if (TempSurface->associatedLayer())
 		{
-		  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() exists" << endreq;
+		  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() exists" << endmsg;
 		  if(TempSurface->associatedLayer()->enclosingTrackingVolume())
 		    {
-		      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume exists" << endreq;
+		      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume exists" << endmsg;
 								
 		      TempField = dynamic_cast <const Trk::MagneticFieldProperties*>(TempSurface->associatedLayer()->enclosingTrackingVolume());
-		      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After MagneticFieldProperties cast" << endreq;
+		      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After MagneticFieldProperties cast" << endmsg;
 		      
-		      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Before other side unbiased propagation" << endreq;
+		      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Before other side unbiased propagation" << endmsg;
 		      if (TempSurface->associatedLayer() && TempField) PropagatedTrackParams = m_propagator->propagate(*OtherSideUnbiasedTrackParams,
 														       tsos->measurementOnTrack()->associatedSurface(),
 														       Trk::anyDirection, false,
@@ -2927,32 +3062,32 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
 	
 							
 		    } else {
-		    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume does not exist" << endreq;
+		    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer()->enclosingTrackingVolume does not exist" << endmsg;
 		  }
 		} else {
-		if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() does not exist" << endreq;
+		if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TempSurface->associatedLayer() does not exist" << endmsg;
 	      }
 	    } else {
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After OtherSide surface call. Surface does not exist" << endreq;
+	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After OtherSide surface call. Surface does not exist" << endmsg;
 	  }
 					
 					
 	  				
-	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After other side unbiased propagation" << endreq;
+	  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "After other side unbiased propagation" << endmsg;
 	  delete OtherSideUnbiasedTrackParams;
 	  if (PropagatedTrackParams) {
-	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Propagated Track Parameters: " << *PropagatedTrackParams << endreq;
+	    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Propagated Track Parameters: " << *PropagatedTrackParams << endmsg;
 	  } else {
-	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Propagation of unbiased OtherSideParameters failed" << endreq;
+	    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Propagation of unbiased OtherSideParameters failed" << endmsg;
 	  }
 	} else {
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RemoveFromState did not work for OtherSideParameters" << endreq;
+	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "RemoveFromState did not work for OtherSideParameters" << endmsg;
 	}
       } else {
-	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit Measured Track Parameters found" << endreq;
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit Measured Track Parameters found" << endmsg;
       }
     } else {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit found" << endreq;
+      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "No OtherModuleSideHit found" << endmsg;
     }
   }
 	
@@ -2967,13 +3102,13 @@ const Trk::TrackParameters* IDAlignMonResiduals::getUnbiasedTrackParameters(cons
   delete PropagatedTrackParams;
 	
   if (UnbiasedTrackParams) {
-    if(msgLvl(MSG::VERBOSE) && surfaceID.is_valid()) msg(MSG::VERBOSE) << "Unbiased residual. Removing original Hit " << m_idHelper->show_to_string(surfaceID,0,'/') << endreq;
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased Trackparameters: " << *UnbiasedTrackParams << endreq;
+    if(msgLvl(MSG::VERBOSE) && surfaceID.is_valid()) msg(MSG::VERBOSE) << "Unbiased residual. Removing original Hit " << m_idHelper->show_to_string(surfaceID,0,'/') << endmsg;
+    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Unbiased Trackparameters: " << *UnbiasedTrackParams << endmsg;
 		
     TrackParams = UnbiasedTrackParams->clone();
 		
   } else { // Unbiasing went awry.
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "RemoveFromState did not work, using original TrackParameters" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "RemoveFromState did not work, using original TrackParameters" << endmsg;
     TrackParams = tsos->trackParameters()->clone();
   }
 	
@@ -2989,109 +3124,109 @@ StatusCode IDAlignMonResiduals::setupTools()
 {
   //initializing tools
 	
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endreq;
+  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 !" << endreq;
+    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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+  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 !" << endreq;
+    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" << endreq;
+    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 << endreq;
+    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 << endreq;
+    msg(MSG::INFO) << "Retrieved tool " << m_iUpdator << endmsg;
   }
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved IUpdator" << endreq;
+  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() << endreq;
+					       << m_propagator.typeAndName() << endmsg;
     return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_propagator.typeAndName() << endreq;
+  } 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() << endreq;
+					       << m_trackSelection.typeAndName() << endmsg;
     return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_trackSelection.typeAndName() << endreq;
+  } 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."
-					   << endreq;
+					   << endmsg;
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << 
 			     "It is recommended to give R/P calculators to the det-specific tool"
-					   << " handle lists then." << endreq;
+					   << " 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) "<< endreq;
+					       <<" (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" << endreq;
+			     << "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"
-					   << endreq;
+					   << 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) "<< endreq;
+					       <<" (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" << endreq;
+			     << "- hit quality cuts will be applied to Si hits" << endmsg;
     m_doHitQuality = true;
   }
 	
@@ -3113,7 +3248,7 @@ bool IDAlignMonResiduals::trackRequiresRefit(const Trk::Track* track)
   int nHits = 0;
   int nHitsNoParams = 0;
 	
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Testing track to see if requires refit..." << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Testing track to see if requires refit..." << endmsg;
 	
   for (std::vector<const Trk::TrackStateOnSurface*>::const_iterator iter_tsos=(track->trackStateOnSurfaces()->begin());
        iter_tsos!=track->trackStateOnSurfaces()->end(); ++iter_tsos) {//looping over hits
@@ -3135,11 +3270,11 @@ bool IDAlignMonResiduals::trackRequiresRefit(const Trk::Track* track)
 		
   }
 	
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Total nhits on track (excluding outliers) = " << nHits << ", nhits without trackparameters = " << nHitsNoParams << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Total nhits on track (excluding outliers) = " << nHits << ", nhits without trackparameters = " << nHitsNoParams << endmsg;
 	
   if(nHitsNoParams>0) {
     refitTrack = true;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Track Requires refit to get residuals!!!" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Track Requires refit to get residuals!!!" << endmsg;
   }
 	
   return refitTrack;
@@ -3156,7 +3291,7 @@ void IDAlignMonResiduals::meanRMSProjections(TH2F* h2d, TH1F* h,int meanrms)
   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" << endreq;
+  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 
@@ -3182,7 +3317,7 @@ void IDAlignMonResiduals::meanRMSProjections(TH2F* h2d, TH1F* h,int meanrms)
       h->SetBinContent(i,hproj->GetRMS());
       h->SetBinError(i,hproj->GetRMSError());
     }
-    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjectionsBarrel()" << endreq;
+    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjectionsBarrel()" << endmsg;
 		
     delete hproj;
   }
@@ -3201,8 +3336,8 @@ void IDAlignMonResiduals::meanRMSProjection2D(TH3F* h3d, TH2F* h2d,int meanrms,b
   int nbins_x_2d = h2d->GetNbinsX();
   int nbins_y_2d = h2d->GetNbinsY();
 	
-  if(nbins_x_3d!=nbins_x_2d) if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Mean/RMS Histograms not set up correctly - nbins mismatch" << endreq;
-  if(nbins_y_3d!=nbins_y_2d) if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Mean/RMS Histograms not set up correctly - nbins mismatch" << endreq;
+  if(nbins_x_3d!=nbins_x_2d) if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Mean/RMS Histograms not set up correctly - nbins mismatch" << endmsg;
+  if(nbins_y_3d!=nbins_y_2d) if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Mean/RMS Histograms not set up correctly - nbins mismatch" << endmsg;
 	
 	
   for(int i = 1; i!=nbins_x_2d+1; ++i){
@@ -3232,7 +3367,7 @@ void IDAlignMonResiduals::meanRMSProjection2D(TH3F* h3d, TH2F* h2d,int meanrms,b
 	  h2d->SetBinContent(i,j,sigma);
 	  h2d->SetBinError(i,j,sigmaerr);
 	}
-	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjections2D()" << endreq;
+	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjections2D()" << endmsg;
       }
       else {// !fitGaus
 	if(meanrms==0){
@@ -3244,7 +3379,7 @@ void IDAlignMonResiduals::meanRMSProjection2D(TH3F* h3d, TH2F* h2d,int meanrms,b
 	  h2d->SetBinContent(i,j,hproj->GetRMS());
 	  h2d->SetBinError(i,j,hproj->GetRMSError());
 	}
-	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjections2D()" << endreq;
+	else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in MeanRMSProjections2D()" << endmsg;
       }
       delete hproj;
     }
@@ -3306,7 +3441,7 @@ void IDAlignMonResiduals::fillGaussianMeanOrWidth(TH2F* h2d, TH1F* h, float fitM
   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" << endreq;
+  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){
 		
@@ -3334,7 +3469,7 @@ void IDAlignMonResiduals::fillGaussianMeanOrWidth(TH2F* h2d, TH1F* h, float fitM
       h->SetBinContent(i,width);
       h->SetBinError(i,widthErr);
     }
-    else  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in fillGaussianMeanOrWidth" << endreq;
+    else  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Incorrect switch in fillGaussianMeanOrWidth" << endmsg;
 		
     delete hproj;
     delete fit;
@@ -3392,7 +3527,7 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
   for (int iLayer=0; iLayer < totalLayers;++iLayer) 
     {
       if (!m_PIX_Mgr->numerology().useLayer(iLayer)){
-	msg(MSG::WARNING) << "Layer "<<iLayer<<" Not in Use"<<endreq;
+	msg(MSG::WARNING) << "Layer "<<iLayer<<" Not in Use"<<endmsg;
 	continue;} 
       m_siliconBarrelLayersLabels.push_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)
@@ -3409,25 +3544,43 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
  
       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));
+      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));
+      if (iLayer == 0) m_pix_b_residualsx[iLayer]->SetTitle("IBL: Unbiased X residual");
+      m_pix_b_residualsx[iLayer]->GetXaxis()->SetTitle("Local x residual [mm]");
       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));
+
+      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));
+      if (iLayer == 0) m_pix_b_residualsy[iLayer]->SetTitle("IBL: Unbiased Y residual");
+      m_pix_b_residualsy[iLayer]->GetXaxis()->SetTitle("Local y residual [mm]");
       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));
+
+      m_pix_b_pullsx.push_back(     new TH1F(("pix_b"+intToString(iLayer)+"_pullx").c_str(),("Unbiased X residual pull Pixel Barrel "+intToString(iLayer)).c_str(),
+					     100*m_FinerBinningFactor,-m_RangeOfPullHistos, m_RangeOfPullHistos));
+      if (iLayer == 0) m_pix_b_pullsx[iLayer]->SetTitle("IBL: Unbiased X residual Pull");
       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));
+
+      m_pix_b_pullsy.push_back(     new TH1F(("pix_b"+intToString(iLayer)+"_pully").c_str(),("Unbiased Y residual pull Pixel Barrel "+intToString(iLayer)).c_str(),
+					     100*m_FinerBinningFactor,-m_RangeOfPullHistos, m_RangeOfPullHistos));
       RegisterHisto(al_mon,m_pix_b_pullsy[iLayer]);
+      if (iLayer == 0) m_pix_b_pullsy[iLayer]->SetTitle("IBL: Unbiased Y residual Pull");
+
+
       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]);
-      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " -- SALVA -- build pix 3d histos -- m_minPIXResXFillRange: " << m_minPIXResXFillRange << "       m_maxPIXResXFillRange: " << m_maxPIXResXFillRange << endreq;
+      if (iLayer == 0) m_pix_b_xresvsmodetaphi_3ds[iLayer]->SetTitle("IBL: X Residual Distbn vs Module Eta-Phi-ID Pixel");
+
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " -- build pix 3d histos -- m_minPIXResXFillRange: " << m_minPIXResXFillRange << "       m_maxPIXResXFillRange: " << m_maxPIXResXFillRange << endmsg;
       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 (iLayer == 0) m_pix_b_yresvsmodetaphi_3ds[iLayer]->SetTitle("IBL: Y Residual Distbn vs Module Eta-Phi-ID Pixel");
       
       
       if(m_do3DOverlapHistos) {
@@ -3564,7 +3717,6 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
 	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));
@@ -3661,11 +3813,12 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
       }//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);
+  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);
+  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);  
@@ -3701,7 +3854,6 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
 
   int phibinid = 0;
   for (int ibin=1; ibin <= m_pix_b_xresvsmodphi->GetNbinsX(); ibin++) {
-    // - SALVA - 
     // there is a free bin at the beginning and the end
     // IBL has 14 staves: starts at bin 2 
     if (2 <= ibin && ibin <= 15) {
@@ -3724,9 +3876,9 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
   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);
+    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);
+    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
@@ -3757,6 +3909,7 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
     RegisterHisto(al_mon,m_pix_b_pully_pt);
   }
   
+  return;
 }
 
 
@@ -3787,7 +3940,7 @@ void IDAlignMonResiduals::MakePIXEndCapsHistograms(MonGroup& al_mon){
 	{
 	  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"<<endreq;
+	    msg(MSG::WARNING) << "Wheel "<<iWheel<<" Not in Use"<<endmsg;
 	    continue;}
 	  else
 	    {
@@ -4014,7 +4167,7 @@ void IDAlignMonResiduals::MakePIXEndCapsHistograms(MonGroup& al_mon){
   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);
+  m_pix_ecc_residualy = new TH1F("pix_ecc_residualy","UnBiased Y Residual Pixel EndCap C",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
   RegisterHisto(al_mon,m_pix_ecc_residualy);
 
   //pulls
@@ -4152,13 +4305,14 @@ void IDAlignMonResiduals::MakePIXEndCapsHistograms(MonGroup& al_mon){
       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);
     }
-  }
+  return;
+}
 
 
 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 = m_gap_sct*(totalLayers-1);  //to allow separation between layers for profiles
+  int totalEtaModules = m_gap_sct*(totalLayers+1);  //to allow separation between layers for profiles
+  int totalPhiModules = m_gap_sct*(totalLayers+1);  //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];
@@ -4169,24 +4323,24 @@ void IDAlignMonResiduals::MakeSCTBarrelHistograms(MonGroup& al_mon){
       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"<<endreq;
-	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.push_back("SCTL"+intToString(iLayer)+" S0");
-      m_siliconBarrelLayersLabels.push_back("SCTL"+intToString(iLayer)+" S1");
+  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.push_back("SCTL"+intToString(iLayer)+" S0");
+    m_siliconBarrelLayersLabels.push_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
@@ -4360,7 +4514,7 @@ void IDAlignMonResiduals::MakeSCTBarrelHistograms(MonGroup& al_mon){
       m_hiterror_sct_b_WideRange = new TH1F("m_hiterror_sct_b_WideRange", "SCT Barrel Hit Error;Hit Error[mm];SCT Hits", 80, 0., 2.5);
       RegisterHisto(al_mon,m_hiterror_sct_b_WideRange);
     }
-  
+  return;
 }
 
 
@@ -4382,82 +4536,97 @@ void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon){
 
   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);
+      totalPhiModules = m_gap_sct * (numDisks); //It is resetted to starting value for ECA. Only ECC modules are counted. This avoid double counting
+      totalPhiModulesOuterLayer = 0; // Salva 6/June/2018: was = m_gap_sct * (numDisks);
       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"<<endreq;
-	      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.push_back("SCTL"+intToString(iWheel)+" S0");
-		  m_siliconEndcapLayersLabels.push_back("SCTL"+intToString(iWheel)+" S1");
-		  }
-	    }
+
+      for (int iWheel=0; iWheel < numDisks; ++iWheel) {
+	int 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.push_back("SCTL"+intToString(iWheel)+" S0");
+		m_siliconEndcapLayersLabels.push_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;
-	      //std::cout<< m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel,iEta)<< "  "<<iWheel<<" "<<iEta<<std::endl;
-	      //std::cout<<totalPhiModules<<std::endl;
-	      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]);
+	  for (int iEta = 0; iEta < rings; ++iEta) {   //iEta<m_SCT_Mgr->numerology().numRingsForDisk(iWheel);
+	    // find the maximum number of modules per ring... should be 52, but anyway... this is a way to avoid a hard coded value
+	    ModulesPerRing = m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel,iEta);
+	    if (maxModulesPerRing < ModulesPerRing) maxModulesPerRing = ModulesPerRing;
+	    //std::cout<< m_SCT_Mgr->numerology().numPhiModulesForDiskRing(iWheel,iEta)<< "  "<<iWheel<<" "<<iEta<<std::endl;
+	    //std::cout<<totalPhiModules<<std::endl;
+	    totalPhiModules+=ModulesPerRing;
+	    // maxModulesPerDisk+=ModulesPerRing;
+	  }
+	  totalPhiModulesOuterLayer+=(maxModulesPerRing+m_gap_sct); // Salva add m_gap_sct to allow for separation between disks
 
-		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)
-		  {
+	  // for histos that have all SCT modules in one binning
+	  // # bins (modules) =  the_number_of_rings * modules_in_the bigger_ring
+	  maxModulesPerDisk = m_maxRingsInASCTEndCapDisk * m_maxModulesInASCTEndCapRing;
+
+	  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.5, maxModulesPerDisk-0.5));
+	      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.5, rings-0.5,
+									 maxModulesPerRing, -0.5, maxModulesPerRing-0.5,
+									 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.5, rings-0.5,
+									 maxModulesPerRing, -0.5, maxModulesPerRing-0.5,
+									 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.5, maxModulesPerDisk-0.5));
+	      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]);
@@ -4491,16 +4660,32 @@ void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon){
 	    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));
+		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.5, rings-0.5,
+								    maxModulesPerRing, -0.5, maxModulesPerRing-0.5,
+								    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));
+		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.5, rings-0.5,
+								    maxModulesPerRing, -0.5, maxModulesPerRing-0.5,
+								    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));
+
+		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.5 ,maxModulesPerDisk-0.5));
 		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));
+
+		//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.5, rings-0.5,
+									   maxModulesPerRing, -0.5, maxModulesPerRing-0.5,
+									   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));
+
+		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.5, rings-0.5,
+									   maxModulesPerRing, -0.5, maxModulesPerRing-0.5,
+									   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)); 
@@ -4512,7 +4697,8 @@ void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon){
 		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));
+		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.5, maxModulesPerDisk-0.5));
 		RegisterHisto(al_mon,m_sct_ecc_biased_xresvsmodphi_disks[iWheel]);
 	
 		//biased 
@@ -4571,35 +4757,52 @@ void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon){
   //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);
+  m_sct_eca_xresvsmodphi_2d = new TH2F("sct_eca_xresvsmodphi_2d","X Residual Mean vs (Modified) Module Phi SCT ECA;(Modified) Module Phi Identifier;Mean Residual X",
+				       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);
+  m_sct_ecc_xresvsmodphi_2d = new TH2F("sct_ecc_xresvsmodphi_2d","X Residual Mean vs (Modified) Module Phi SCT ECC;(Modified) Module Phi Identifier;Mean Residual X",
+				       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);
+  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);
+  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
+  m_sct_eca_xresvsmodphi = new TH1F("sct_eca_xresvsmodphi","Residual Mean vs (Modified) Module Phi SCT ECA;(Modified) Module Phi Identifier;Mean Residual X [mm]",
+				    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);
+  m_sct_ecc_xresvsmodphi = new TH1F("sct_ecc_xresvsmodphi","Residual Mean vs (Modified) Module Phi SCT ECC;(Modified) Module Phi Identifier;Mean Residual X [mm]",
+				    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]",2000,-2.0,2.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]",2000,-2.0,2.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 );  
+ 
+  if (m_extendedPlots)  {
+    m_sct_eca_residualx_fine = new TH1F("sct_eca_residualx_fine","UnBiased X Residual SCT Endcap A;Residual [mm]", 800, -0.5, 0.5);
+    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]", 800, -0.5, 0.5);
+    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); 
@@ -4950,7 +5153,7 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
   return;
 }
 
-void IDAlignMonResiduals::fillTRTHistograms(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_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 IDAlignMonResiduals::fillTRTHistograms(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_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 TrkWeight){
 	
   bool LRcorrect = true;
   if( perdictR*hitR < 0)
@@ -4977,7 +5180,7 @@ void IDAlignMonResiduals::fillTRTHistograms(int m_barrel_ec, int m_layer_or_whee
 			    ,t0
 			    ,isTubeHit
 			    ,trketa
-			    ,trkpt, hweight);
+			    ,trkpt, TrkWeight);
   	
   /** Filling EndCapA histograms */
   if(m_barrel_ec==2 || m_barrel_ec==-2)
@@ -4996,13 +5199,13 @@ void IDAlignMonResiduals::fillTRTHistograms(int m_barrel_ec, int m_layer_or_whee
 			    ,t0
 			    ,isTubeHit
 			    ,trketa
-			    ,trkpt, hweight);
+			    ,trkpt, TrkWeight);
   	
   return;
 }
 
 //Filling barrel histograms
-void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_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 IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_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 TrkWeight){
   //Logic to determine Left, Right, Upper, Lower
   bool m_isUpper = (m_phi_module > 4 && m_phi_module < 12 ) ? true : false;
   bool m_isLower = (m_phi_module > 20 && m_phi_module < 28 ) ? true : false;
@@ -5023,33 +5226,33 @@ void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_o
     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->PredictedR[side]-> Fill(perdictR , TrkWeight);
+    m_trt_b_hist->MeasuredR[side] -> Fill(hitR     , TrkWeight);
+    m_trt_b_hist->residualR[side] -> Fill(residualR, TrkWeight);
    
-    m_trt_b_hist->pullR[side]     -> Fill(pullR    , hweight);
+    m_trt_b_hist->pullR[side]     -> Fill(pullR    , TrkWeight);
     if (!isTubeHit) {
-      m_trt_b_hist->pullR_notube[side] -> Fill(pullR, hweight);
-      m_trt_b_hist->residualR_notube[side] -> Fill(residualR,hweight);
+      m_trt_b_hist->pullR_notube[side] -> Fill(pullR, TrkWeight);
+      m_trt_b_hist->residualR_notube[side] -> Fill(residualR,TrkWeight);
     }
     
     		
-    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(LRcorrect  && !isTubeHit)      m_trt_b_hist->lr[side] -> Fill(0.5, TrkWeight);
+    if(LRcorrect  && isTubeHit )      m_trt_b_hist->lr[side] -> Fill(1.5, TrkWeight);
+    if(!LRcorrect && !isTubeHit)      m_trt_b_hist->lr[side] -> Fill(2.5, TrkWeight);
+    if(!LRcorrect && isTubeHit )      m_trt_b_hist->lr[side] -> Fill(3.5, TrkWeight);
         
     
     
     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);
+	m_trt_b_hist->rt[side]->Fill(LE - EP - t0,fabs(perdictR), TrkWeight);
+      m_trt_b_hist->residualR_pt[side]-> Fill(trkpt, residualR, TrkWeight);
+      m_trt_b_hist->pullR_pt[side]    -> Fill(trkpt, pullR    , TrkWeight);
+      if (!isTubeHit) m_trt_b_hist->pullR_notube_pt[side] -> Fill(trkpt,pullR, TrkWeight);
+      m_trt_b_hist->residualR_mu[side]-> Fill(m_mu, residualR, TrkWeight);
+      m_trt_b_hist->pullR_mu[side]    -> Fill(m_mu, pullR    , TrkWeight);
+      if (!isTubeHit) m_trt_b_hist->pullR_notube_mu[side] -> Fill(m_mu,pullR, TrkWeight);
     }
     		
     //There are different number of straw layers in the differnt types of module layers
@@ -5058,16 +5261,16 @@ void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_o
 		
     for(int lay=0; lay<3; ++lay){
       if(lay == m_layer_or_wheel){
-	m_trt_b_hist->lrOverPhiVsStrawLayer[side] -> Fill(numStrawLayers[lay]+m_straw_layer, LRcorrect, hweight);
+	m_trt_b_hist->lrOverPhiVsStrawLayer[side] -> Fill(numStrawLayers[lay]+m_straw_layer, LRcorrect, TrkWeight);
 	if(m_extendedPlots && hitZ!=-999){
-	  m_trt_b_hist->resVsPhiZ[side][lay]->Fill(hitZ,m_phi_module,residualR,hweight);
-	  m_trt_b_hist->resVsPhiEta[side][lay]->Fill(trketa,m_phi_module,residualR,hweight);
+	  m_trt_b_hist->resVsPhiZ[side][lay]->Fill(hitZ,m_phi_module,residualR,TrkWeight);
+	  m_trt_b_hist->resVsPhiEta[side][lay]->Fill(trketa,m_phi_module,residualR,TrkWeight);
 	}
 	if (m_extendedPlots)
 	  {
 	    for(int m_testPhi=0; m_testPhi < 32; ++m_testPhi ){
 	      if(m_phi_module == m_testPhi)
-		m_trt_b_hist->aveResVsStrawLayerStackLevel[side][m_testPhi] -> Fill(numStrawLayers[lay]+m_straw_layer, residualR, hweight);
+		m_trt_b_hist->aveResVsStrawLayerStackLevel[side][m_testPhi] -> Fill(numStrawLayers[lay]+m_straw_layer, residualR, TrkWeight);
 	    }
 	  }
 				
@@ -5087,18 +5290,18 @@ void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_o
 	  if(!doFillPosition)
 	    continue;
 					
-	  m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side] -> Fill(numStrawLayers[lay]+m_straw_layer, residualR, hweight);
+	  m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side] -> Fill(numStrawLayers[lay]+m_straw_layer, residualR, TrkWeight);
 	}
       }
     }//over layers
 		
     for(int lay=0; lay<3; ++lay){//Filling layer lay of barrel 
       if(m_layer_or_wheel == lay){
-	m_trt_b_hist->aveResVsTrackEta_l[side][lay] -> Fill(trketa,residualR, hweight);
+	m_trt_b_hist->aveResVsTrackEta_l[side][lay] -> Fill(trketa,residualR, TrkWeight);
 	for(int phi=0; phi<32; ++phi){  //Filling phimodule phi of barrel 
 	  if(m_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->aveRes_l[side][lay]-> Fill(phi, residualR, TrkWeight);
+	    m_trt_b_hist->lr_l[side][lay]    -> Fill(phi, LRcorrect, TrkWeight);
 	    //m_trt_b_hist->aveResVsStrawLayer[lay][phi]->Fill(m_straw_layer, residualR);
 	  }
 	}
@@ -5109,7 +5312,7 @@ void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_o
   return;
 }//fillTRTBarrelHistograms
 
-void IDAlignMonResiduals::fillTRTEndcapHistograms(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_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){
+void IDAlignMonResiduals::fillTRTEndcapHistograms(int m_barrel_ec, int m_layer_or_wheel, int m_phi_module, int m_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 TrkWeight){
 	
   for(unsigned int endcap=0; endcap<2; ++endcap){
     bool doFill=false;
@@ -5121,54 +5324,54 @@ void IDAlignMonResiduals::fillTRTEndcapHistograms(int m_barrel_ec, int m_layer_o
     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);
+    m_trt_ec_hist->PredictedR[endcap]  -> Fill(perdictR , TrkWeight);
+    m_trt_ec_hist->MeasuredR[endcap]   -> Fill(hitR     , TrkWeight);
+    m_trt_ec_hist->residualR[endcap][0]-> Fill(residualR, TrkWeight);
+    m_trt_ec_hist->pullR[endcap][0]    -> Fill(pullR    , TrkWeight);
     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->pullR_notube[endcap][0]-> Fill(pullR           , TrkWeight); 
+	m_trt_ec_hist->residualR_notube[endcap][0] -> Fill(residualR,TrkWeight);
       }
-    m_trt_ec_hist->aveResVsTrackEta[endcap] -> Fill(trketa,residualR, hweight);
+    m_trt_ec_hist->aveResVsTrackEta[endcap] -> Fill(trketa,residualR, TrkWeight);
 		
     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->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->rt[endcap] -> Fill(LE - EP - t0,fabs(perdictR), TrkWeight);
+      m_trt_ec_hist->residualR_pt[endcap]-> Fill(trkpt, residualR, TrkWeight);
+      m_trt_ec_hist->pullR_pt[endcap]    -> Fill(trkpt, pullR    , TrkWeight);
+      if (!isTubeHit) m_trt_ec_hist->pullR_notube_pt[endcap] -> Fill(trkpt,pullR, TrkWeight);
       
-      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);
+      m_trt_ec_hist->residualR_mu[endcap]-> Fill(m_mu, residualR, TrkWeight);
+      m_trt_ec_hist->pullR_mu[endcap]    -> Fill(m_mu, pullR    , TrkWeight);
+      if (!isTubeHit) m_trt_ec_hist->pullR_notube_mu[endcap] -> Fill(m_mu,pullR, TrkWeight);
     }
     
-    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);
+    if(LRcorrect  && !isTubeHit)      m_trt_ec_hist->lr[endcap] -> Fill(0.5, TrkWeight);
+    if(LRcorrect  && isTubeHit )      m_trt_ec_hist->lr[endcap] -> Fill(1.5, TrkWeight);
+    if(!LRcorrect && !isTubeHit)      m_trt_ec_hist->lr[endcap] -> Fill(2.5, TrkWeight);
+    if(!LRcorrect && isTubeHit )      m_trt_ec_hist->lr[endcap] -> Fill(3.5, TrkWeight);
 		
     for(int phi=0; phi<32; ++phi){ 
       if(m_phi_module == phi){
-	m_trt_ec_hist->aveResVsPhiSec[endcap]-> Fill(phi,residualR, hweight);
-	m_trt_ec_hist->lrVsPhiSec[endcap]    -> Fill(phi,LRcorrect, hweight);
+	m_trt_ec_hist->aveResVsPhiSec[endcap]-> Fill(phi,residualR, TrkWeight);
+	m_trt_ec_hist->lrVsPhiSec[endcap]    -> Fill(phi,LRcorrect, TrkWeight);
       }
     }
 		
     // fill TH3F of ave residual vs phi & wheel
     if(m_extendedPlots){
-      m_trt_ec_hist->resVsPhiWheel[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),m_phi_module,residualR,hweight);
+      m_trt_ec_hist->resVsPhiWheel[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),m_phi_module,residualR,TrkWeight);
       // fill TH3F of ave residual vs wheel & radius vs charge & LOW PT ONLY
       if(fabs(trkpt) < m_maxPtEC){
 	int charge = (trkpt > 0 ? 1 : -1);
 	if (hitGlobalR != -9999)
 	  {
 	    if(charge > 0){
-	      m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,hweight);
+	      m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,TrkWeight);
 	    }
 	    else{
-	      m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,hweight);
+	      m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,TrkWeight);
 	    }
 	  }
       }
@@ -5178,14 +5381,14 @@ void IDAlignMonResiduals::fillTRTEndcapHistograms(int m_barrel_ec, int m_layer_o
 
     for(unsigned int ring=0; ring<totalRings-1; ++ring){
       if(getRing(m_layer_or_wheel,m_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);
+	m_trt_ec_hist->residualR[endcap][ring+1]-> Fill(residualR, TrkWeight);
+	m_trt_ec_hist->pullR[endcap][ring+1]    -> Fill(pullR    , TrkWeight);
 	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->pullR_notube[endcap][ring+1] -> Fill(pullR, TrkWeight); 
+	  m_trt_ec_hist->residualR_notube[endcap][ring+1]-> Fill(residualR, TrkWeight);
 	}
-	m_trt_ec_hist->aveResVsRing[endcap]-> Fill(ring,residualR, hweight);
-	m_trt_ec_hist->lrVsRing[endcap]    -> Fill(ring,LRcorrect, hweight);
+	m_trt_ec_hist->aveResVsRing[endcap]-> Fill(ring,residualR, TrkWeight);
+	m_trt_ec_hist->lrVsRing[endcap]    -> Fill(ring,LRcorrect, TrkWeight);
       }
     }
   }
@@ -5200,9 +5403,15 @@ unsigned int IDAlignMonResiduals::getRing(unsigned int wheel,unsigned int strawl
     return (16*6+8*(wheel-6) + strawlayer) /4;
 }
 
-void IDAlignMonResiduals::MakeStaveShapeFit(float& mag, float& mag_er, float& base, float& base_er, TH1D* projection)
+
+void IDAlignMonResiduals::MakeStaveShapeFit(float& mag, float& mag_er, float& base, float& base_er, TH1F* projection)
 {
   TGraphErrors* g = ConvertHistoInGraph(projection);
+  if (g->GetN() == 0 ) { 
+    delete g;
+    return;
+  }
+    
   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 );
   
@@ -5221,7 +5430,7 @@ void IDAlignMonResiduals::MakeStaveShapeFit(float& mag, float& mag_er, float& ba
   return;
 }
 
-TGraphErrors* IDAlignMonResiduals::ConvertHistoInGraph(TH1D* histo)
+TGraphErrors* IDAlignMonResiduals::ConvertHistoInGraph(TH1F* histo)
 {
   TGraphErrors* graph = new TGraphErrors();
   std::vector<int> filled_bins;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
index 816d455135d54973985f0407c1b6b26fdc44a705..04201af6aaa283caa7b7e87bff87dfae9504284d 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonResiduals_H
@@ -55,10 +55,10 @@ namespace Trk {
   class RIO_OnTrack;
   class Track;
   class TrackStateOnSurface;
-  class IResidualPullCalculator; 
+  class IResidualPullCalculator;
 }
 
-class IInDetAlignHitQualSelTool; 
+class IInDetAlignHitQualSelTool;
 //namespace InDet {
 //  class IInDetTrackSelectionTool;
 //}
@@ -66,10 +66,10 @@ class IInDetAlignHitQualSelTool;
 
 class IDAlignMonResiduals : public ManagedMonitorToolBase
 {
-  
+
  public:
-  
-  IDAlignMonResiduals( const std::string & type, const std::string & name, const IInterface* parent ); 
+
+  IDAlignMonResiduals( const std::string & type, const std::string & name, const IInterface* parent );
 
   virtual ~IDAlignMonResiduals();
 
@@ -83,8 +83,8 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   void MakeSCTEndcapsHistograms (MonGroup& al_mon);
   void MakeSCTBarrelHistograms (MonGroup& al_mon);
 
-  void MakeStaveShapeFit(float& mag, float& mag_er,float& base,float& base_er,TH1D* projection);
-  TGraphErrors* ConvertHistoInGraph(TH1D*);
+  void MakeStaveShapeFit(float& mag, float& mag_er,float& base,float& base_er,TH1F* projection);
+  TGraphErrors* ConvertHistoInGraph(TH1F*);
 
   void MakeTRTHistograms(MonGroup& al_mon);
   void MakeTRTBarrelHistograms(MonGroup& al_mon);
@@ -101,18 +101,18 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   /** Make Histograms */
   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);
   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 */
   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();
 
 
@@ -122,9 +122,11 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   ServiceHandle<ITRT_CalDbSvc> m_trtcaldbSvc ;
  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*);
@@ -135,7 +137,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   bool trackRequiresRefit(const Trk::Track*);
 
   //================================================================
-  // Establishes a minimim window for the histograms 
+  // Establishes a minimim window for the histograms
   //================================================================
   void SetMinWindow(TProfile* hProf, float min, float max);
   void SetMinWindow(TH1* h1, float min, float max);
@@ -146,11 +148,13 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
   int m_NLumiBlocksMon;
+  int m_maxModulesInASCTEndCapRing;
+  int m_maxRingsInASCTEndCapDisk;
 
   float m_minTRTResWindow;
   float m_maxTRTResWindow;
@@ -165,9 +169,9 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   float m_maxSCTResFillRange;
   float m_minSCTResFillRange;
   float m_maxPIXResXFillRange;
-  float m_minPIXResXFillRange;  
+  float m_minPIXResXFillRange;
   float m_maxPIXResYFillRange;
-  float m_minPIXResYFillRange;  
+  float m_minPIXResYFillRange;
   float m_RangeOfPullHistos;
   float m_PtRange;
   float m_ClusterSizeRange;
@@ -192,18 +196,18 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   int  m_oldlumiblock;
   int m_FinerBinningFactor;
   float m_LBGranularity;
-  std::vector<TString> m_siliconBarrelLayersLabels; 
+  std::vector<TString> m_siliconBarrelLayersLabels;
   std::vector<TString> m_siliconEndcapLayersLabels;
   bool m_useGausFit;
   float m_maxPtEC; // threshold for low-pt EC distributions
-  
+
   //tools
   const AtlasDetectorID*                m_idHelper;
-  const InDetDD::PixelDetectorManager*  m_PIX_Mgr; 
+  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; 
+  const SCT_ID*                         m_sctID;
+  const TRT_ID*                         m_trtID;
   ToolHandle<Trk::IUpdator>             m_iUpdator;
   ToolHandle<Trk::IPropagator>          m_propagator;
 
@@ -213,7 +217,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   //ToolHandle<InDet::IInDetTrackSelectionTool>   m_idtrackSelection;
 
   //histograms
-  
+
   TH1F* m_totalEvents;
   TH1F* m_sirescalcfailure;
   std::vector<TH3F*> m_sct_b_Oxresxvsmodetaphi_3ds;
@@ -232,24 +236,24 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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<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;
@@ -265,7 +269,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -278,7 +282,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -299,7 +303,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -313,7 +317,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -342,10 +346,10 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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 
+
+  //SctCluster Size
 
   std::vector<TH1F*> m_sct_b_clustersizePhi;
   std::vector<TH1F*> m_sct_eca_clustersizePhi;
@@ -354,9 +358,9 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -367,7 +371,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
 
 
   //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;
@@ -383,7 +387,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -399,7 +403,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -429,8 +433,8 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   float m_LBRangeMin;
   float m_LBRangeMax;
   int nIBLHitsPerLB;
-  
-  
+
+
   int lumiblock;
 
   TProfile2D*   m_pix_b0_resXvsetaLumiBlock;
@@ -454,37 +458,37 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   TH3F*   m_pix_b0_resXvsetaLumiBlock_stave13;
 
   //IBL fit magnitude and baseline as a function of LumiBlock
-  
-  TH1D* m_mag_vs_LB;
-  TH1D* m_base_vs_LB;
 
-  TH1D* m_mag_vs_LB_planars;
-  TH1D* m_base_vs_LB_planars;
+  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_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;
@@ -539,7 +543,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -555,12 +559,12 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -581,7 +585,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
-  
+
 
 
 
@@ -600,16 +604,16 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -644,7 +648,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   TH2F* m_pix_ecc_biased_residualx_pt;
   TH2F* m_pix_ecc_biased_residualy_pt;
 
- 
+
 
 
 
@@ -680,15 +684,15 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -710,7 +714,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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_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;
@@ -724,13 +728,13 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;
@@ -754,7 +758,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
 
 
   // Extended histograms
- 
+
 
 
   // Pixel unbiased residuals vs pt
@@ -764,65 +768,65 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   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;	
-   
-  
-
-    
-    
+
+
+
+  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; 
-  
+  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_st_localy;
   TH1F* m_sct_b_measured_nst_localx;
-  TH1F* m_sct_b_measured_nst_localy;  
-  
-  
+  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;
@@ -850,7 +854,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
 
   // Pulls vs pt
   // Pixel
-  
+
   TH2F* m_pix_b_pullx_pt;
   TH2F* m_pix_b_pully_pt;
   TH2F* m_pix_eca_pullx_pt;
@@ -858,18 +862,18 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   TH2F* m_pix_ecc_pullx_pt;
   TH2F* m_pix_ecc_pully_pt;
 
- 
+
 
   /**====================================
    //TRT histograms
    //====================================*/
-  
+
   /* Barrel
   //======================= */
   struct TRTBarrelHistograms;
   TRTBarrelHistograms* m_trt_b_hist;
 
-  /** TRT EndCap 
+  /** TRT EndCap
    //======================= */
   struct TRTEndcapHistograms;
   TRTEndcapHistograms* m_trt_ec_hist;
@@ -879,8 +883,13 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   bool m_applyHistWeight;
   std::string m_hWeightInFileName;
   TFile* m_hWeightInFile;
-  TH2F*  m_etapTWeight;
+  TH2F*  m_hInputTrackWeight;
   std::string m_hWeightHistName;
+  int    m_userInputWeigthMethod;
+
+  // enumerate for trk weight methods
+  enum {TRKETA_TRKPT, EVENTMU_TRKPT, EVENTMU_TRKETA};
+
 
   //I don't like an itialisation here.
   float 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};
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
index aa0a4a73cef6adceffdea1a861397ce8ba223c6a..d63eebfa951b8921fd02f4b1c5cf8c5b3e918640 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
@@ -49,14 +49,14 @@ IDAlignMonSivsTRT::IDAlignMonSivsTRT( const std::string & type, const std::strin
   declareProperty("trackSelection"         , m_trackSelection);
   declareProperty("trackSumTool"           , m_trackSumTool);
   declareProperty("MatchdRCut"             , m_matchdRcut = 0.01);
-  
+
 }
 
 //---------------------------------------------------------------------------------------
 
 void IDAlignMonSivsTRT::InitializeHistograms(){
-  
-  
+
+
   m_delta_phi0 = 0 ;
   m_delta_eta0 = 0 ;
   m_delta_R = 0 ;
@@ -67,7 +67,7 @@ void IDAlignMonSivsTRT::InitializeHistograms(){
   m_delta_pt = 0 ;
   m_reldelta_pt = 0 ;
   m_nhitstrt = 0 ;
- 
+
   m_delta_phi0_b = 0 ;
   m_delta_eta0_b = 0 ;
   m_delta_R_b = 0 ;
@@ -77,7 +77,7 @@ void IDAlignMonSivsTRT::InitializeHistograms(){
   m_delta_z0_b = 0 ;
   m_delta_pt_b = 0 ;
   m_reldelta_pt_b = 0 ;
- 
+
   m_alltrks_phi0 = 0 ;
   m_alltrks_phi0_b = 0 ;
   m_alltrks_phi0_eca = 0 ;
@@ -92,7 +92,7 @@ void IDAlignMonSivsTRT::InitializeHistograms(){
   m_trt_eta0 = 0 ;
   m_matched_phi0 = 0 ;
   m_matched_eta0 = 0;
-  
+
   m_sieff_phi0 = 0 ;
   m_sieff_eta0 = 0 ;
   m_trteff_phi0 = 0 ;
@@ -100,7 +100,7 @@ void IDAlignMonSivsTRT::InitializeHistograms(){
   m_trteff_phi0_eca = 0 ;
   m_trteff_phi0_ecc = 0 ;
   m_trteff_eta0 = 0 ;
-  
+
 
 }
 
@@ -118,18 +118,18 @@ StatusCode IDAlignMonSivsTRT::initialize()
   m_events = 0;
   m_histosBooked = 0;
 
-  StatusCode sc;                                      
+  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" << endreq;
+  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!" << endreq;
+    msg(MSG::FATAL) << "Failed to initialize tools/services!" << endmsg;
     return StatusCode::FAILURE;
-  } 
-  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endreq;
+  }
+  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endmsg;
   return sc;
 }
 
@@ -146,102 +146,102 @@ StatusCode IDAlignMonSivsTRT::bookHistograms()
 
   MonGroup al_mon ( this, "IDAlignMon/SivsTRT/" + m_triggerChainName, run );
 
-  if ( newLowStat || newLumiBlock ) {
+  if ( newLowStatFlag() || newLumiBlockFlag() ) {
   }
 
-  if( newRun ) { 
+  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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);    
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
-   
+    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,-3.14,3.14);
-    RegisterHisto(al_mon,m_alltrks_phi0);  
+    RegisterHisto(al_mon,m_alltrks_phi0);
     m_alltrks_phi0_b = new TH1F("alltrks_phi0_b","#phi_{0} all tracks |#eta| < 1.0",10,-3.14,3.14);
-    RegisterHisto(al_mon,m_alltrks_phi0_b);  
+    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,-3.14,3.14);
     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,-3.14,3.14);
     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);  
+    RegisterHisto(al_mon,m_alltrks_eta0);
     m_si_phi0 = new TH1F("si_phi0","#phi_{0} Si-only tracks with no TRT hits",10,-3.14,3.14);
-    RegisterHisto(al_mon,m_si_phi0);  
+    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);  
+    RegisterHisto(al_mon,m_si_eta0);
     m_trt_phi0 = new TH1F("trt_phi0","#phi_{0} tracks with TRT hits #eta < 2.1",10,-3.14,3.14);
     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,-3.14,3.14);
-    RegisterHisto(al_mon,m_trt_phi0_b);  
+    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,-3.14,3.14);
     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,-3.14,3.14);
     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);  
+    RegisterHisto(al_mon,m_trt_eta0);
     m_matched_phi0 = new TH1F("matched_phi0","#phi_{0} tracks with TRT hits that match Sionly",10,-3.14,3.14);
-    RegisterHisto(al_mon,m_matched_phi0);  
+    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);  
-        
+    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);  
+    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,-3.14,3.14,0.0,1.0);
-    RegisterHisto(al_mon,m_sieff_phi0);  
+    RegisterHisto(al_mon,m_sieff_phi0);
     m_trteff_phi0 = new TProfile("eff_trthits_phi0","eff TRT hits association vs #phi_{0}",10,-3.14,3.14,0.0,1.0);
-    RegisterHisto(al_mon,m_trteff_phi0);  
+    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,-3.14,3.14,0.0,1.0);
-    RegisterHisto(al_mon,m_trteff_phi0_b);  
+    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,-3.14,3.14,0.0,1.0);
-    RegisterHisto(al_mon,m_trteff_phi0_eca);  
+    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,-3.14,3.14,0.0,1.0);
-    RegisterHisto(al_mon,m_trteff_phi0_ecc);  
+    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);  
+    RegisterHisto(al_mon,m_trteff_eta0);
 
     m_histosBooked++;
   }
@@ -259,7 +259,7 @@ void IDAlignMonSivsTRT::RegisterHisto(MonGroup& mon, TH1* histo) {
   histo->SetOption("e");
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    msg(MSG::ERROR) << "Cannot book TH1 Histogram:" << endreq;
+    msg(MSG::ERROR) << "Cannot book TH1 Histogram:" << endmsg;
   }
 }
 
@@ -267,16 +267,16 @@ void IDAlignMonSivsTRT::RegisterHisto(MonGroup& mon, TProfile* histo) {
 
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    msg(MSG::ERROR) << "Cannot book TProfile Histogram:" << endreq;
+    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:" << endreq;
+    msg(MSG::ERROR) << "Cannot book TH2 Histogram:" << endmsg;
   }
 }
 
@@ -291,13 +291,13 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
   //checking that we can retrieve the required track collections from SG
   //if not print out warning but only for first event
   if (!evtStore()->contains<TrackCollection>("ResolvedTracks")) {
-    if(m_events == 1) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get ResolvedTracks TrackCollection" << endreq;}
-    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get ResolvedTracks TrackCollection - histograms will not be filled" << endreq;
+    if(m_events == 1) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get ResolvedTracks TrackCollection" << endmsg;}
+    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get ResolvedTracks TrackCollection - histograms will not be filled" << endmsg;
     return StatusCode::SUCCESS;
   }
   if (!evtStore()->contains<TrackCollection>("ExtendedTracks")) {
-    if(m_events == 1) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get ExtendedTracks TrackCollection" << endreq;}
-    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get ExtendedTracks TrackCollection - histograms will not be filled" << endreq;
+    if(m_events == 1) {if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get ExtendedTracks TrackCollection" << endmsg;}
+    else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get ExtendedTracks TrackCollection - histograms will not be filled" << endmsg;
     return StatusCode::SUCCESS;
   }
 
@@ -305,24 +305,24 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
   //tracks that are fitted to Si hits only, before extension to TRT
   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"<< endreq;
+    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" << endreq;
-    if(tracksSi->size()==0) msg(MSG::DEBUG) << "Histograms will not be filled because 0 tracks in ResolvedTracks (track collection probably doesn't exist)" << endreq;
-  } 
-  
+    msg(MSG::DEBUG) << "Retrieved "<< tracksSi->size() <<" ResolvedTracks tracks from StoreGate" << endmsg;
+    if(tracksSi->size()==0) 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
   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"<< endreq;
+    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" << endreq;
-    if(tracksTRT->size()==0) msg(MSG::DEBUG) << "Histograms will not be filled because 0 tracks in ExtendedTracks (track collection probably doesn't exist)" << endreq;
-  } 
+    msg(MSG::DEBUG) << "Retrieved "<< tracksTRT->size() <<" ExtendedTracks tracks from StoreGate" << endmsg;
+    if(tracksTRT->size()==0) msg(MSG::DEBUG) << "Histograms will not be filled because 0 tracks in ExtendedTracks (track collection probably doesn't exist)" << endmsg;
+  }
 
   int nTracksTRT = 0;
 
@@ -330,14 +330,14 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
   DataVector<Trk::Track>::const_iterator trackItrE = tracksTRT->end();
   for (; trackItr != trackItrE; ++trackItr) { //looping over extended tracks
 
-    
+
     const Trk::Track* trackTRT = *trackItr;
     if(trackTRT == NULL){
-      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracksTRT << endreq;
+      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracksTRT << endmsg;
       continue;
     }
 
-    const Trk::TrackSummary* summary = NULL;       
+    const Trk::TrackSummary* summary = NULL;
     summary = m_trackSumTool->createSummary(*trackTRT);
     int nhpix=0, nhsct=0, nhtrt=0;
 
@@ -347,18 +347,18 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
       nhtrt = summary->get(Trk::numberOfTRTHits);
       delete summary;
     }
-    
+
 
     const Trk::Perigee* TRTPerigee =  trackTRT->perigeeParameters();
 
     if (!TRTPerigee)
-      msg(MSG::WARNING) << "TRTPerigee is NULL. Track Information may be missing"<<endreq;
-    
+      msg(MSG::WARNING) << "TRTPerigee is NULL. Track Information may be missing"<<endmsg;
+
 
     const AmgSymMatrix(5)* TRTPerCovariance = TRTPerigee ? TRTPerigee->covariance() : NULL;
-    
-    if ( TRTPerCovariance == 0 )  
-      msg(MSG::WARNING) << " failed dynamic_cast TRT track perigee to measured perigee, some parameters may be missing" << endreq; 
+
+    if ( TRTPerCovariance == 0 )
+      msg(MSG::WARNING) << " failed dynamic_cast TRT track perigee to measured perigee, some parameters may be missing" << endmsg;
 
     double d0 = -999;
     double phi0 = -999;
@@ -377,23 +377,23 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
 	eta0 = TRTPerigee->eta();
 	z0 = TRTPerigee->parameters()[Trk::z0];
 	charge = TRTPerigee->charge();
-	if ( TRTPerCovariance != 0 )  pt = TRTPerigee->pT()/1000.; 
+	if ( TRTPerCovariance != 0 )  pt = TRTPerigee->pT()/1000.;
       }
-    
 
-    //trackStateOnSurfaces is a vector of Trk::TrackStateOnSurface objects which contain information 
+
+    //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 << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRT Track Eta = " << eta0 << ", phi = " << phi0 << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRT Track nhitspix = " << nhpix << ", sct = " << nhsct << ", trt = " << nhtrt << endreq;
+    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 
+    //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" << endreq;
+      if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ExtendedTracks track is outside eta < 2.1 - skipped" << endmsg;
       continue;
     }
 
@@ -404,13 +404,13 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
     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 
+    // 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" << endreq;
-      //filling histos for tracks which do not have TRT hits (fitted with Si only) 
+      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;
@@ -423,7 +423,7 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
     if(eta0 > 1.0) m_trt_phi0_eca->Fill(phi0);
     if(eta0 < -1.0) m_trt_phi0_ecc->Fill(phi0);
 
-    double mindR = 10000; 
+    double mindR = 10000;
     //double Xtheta = -999999;
     double Xd0 = -999999;
     double Xphi0 = -999999;
@@ -441,41 +441,41 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
 
       const Trk::Track* trackSi = *trackItr2;
       if(trackSi == NULL){
-      if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No associated Trk::Track object found for track "<< nTracksSi << endreq;
+      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"<<endreq;
-      
+	msg(MSG::WARNING) << " SiPerigee is NULL. Track information may be missing"<<endmsg;
+
       const AmgSymMatrix(5)* SiPerCovariance = SiPerigee ? SiPerigee->covariance() : NULL;
 
-      if ( SiPerCovariance == 0 )  
-	msg(MSG::WARNING) << " failed dynamic_cast Si track perigee to measured perigee, some parameters may be missing" << endreq; 
-      
+      if ( SiPerCovariance == 0 )
+	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 << endreq;
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Si Track Eta = " << Sieta0 << ", phi = " << Siphi0 << endreq;
+	  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];  
+	    //Xtheta = SiPerigee->parameters()[Trk::theta];
 	    Xd0 = SiPerigee->parameters()[Trk::d0];
 	    Xphi0 = SiPerigee->parameters()[Trk::phi0];
 	    Xqoverp = SiPerigee->parameters()[Trk::qOverP]*1000;
@@ -483,7 +483,7 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
 	    Xz0 = SiPerigee->parameters()[Trk::z0];
 	    Xcharge = SiPerigee->charge();
 	    //Xpt = (1/Xqoverp)*Xcharge*sin(Xtheta);
-	    if ( SiPerCovariance != 0 ) Xpt = SiPerigee->pT()/1000.; 
+	    if ( SiPerCovariance != 0 ) Xpt = SiPerigee->pT()/1000.;
 	    if(dR < m_matchdRcut) matchFound = true;
 	  }
 	}
@@ -500,22 +500,22 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
       m_delta_R_b->Fill(mindR);
     }
 
-    //filling histos for tracks with TRT hits which also match 
+    //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);
@@ -528,12 +528,12 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
     }
 
     nTracksTRT++;
-   
+
   } // end of loop on tracks
-  
+
   delete tracksSi;
   delete tracksTRT;
-  
+
 
   return StatusCode::SUCCESS;
 }
@@ -543,7 +543,7 @@ StatusCode IDAlignMonSivsTRT::fillHistograms()
 StatusCode IDAlignMonSivsTRT::procHistograms()
 {
 
-  if( endOfLowStat || endOfLumiBlock ) {
+  if( endOfLowStatFlag() || endOfLumiBlockFlag() ) {
 
     //StatusCode sc = fillEfficiencyHisto(m_matched_eta0,m_trt_eta0,m_sieff_eta0);
     //if (sc.isFailure()) return StatusCode::SUCCESS;
@@ -561,8 +561,8 @@ StatusCode IDAlignMonSivsTRT::procHistograms()
     //if (sc.isFailure()) return StatusCode::SUCCESS;
   }
 
-  if( endOfRun ) { 
-    
+  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);
@@ -579,7 +579,7 @@ StatusCode IDAlignMonSivsTRT::procHistograms()
     if (sc.isFailure()) return StatusCode::SUCCESS;
 
   }
-  
+
   return StatusCode::SUCCESS;
 }
 
@@ -612,10 +612,10 @@ StatusCode IDAlignMonSivsTRT::fillEfficiencyProfileHisto(TH1* h_num, TH1* h_deno
 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" << endreq;
+    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){
@@ -627,35 +627,35 @@ StatusCode IDAlignMonSivsTRT::fillEfficiencyHisto(TH1* num, TH1* den, TH1* eff){
   return StatusCode::SUCCESS;
 
 }
- 
+
 //---------------------------------------------------------------------------------------
 
 StatusCode IDAlignMonSivsTRT::setupTools()
 {
   //initializing tools
 
-  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endreq;
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endmsg;
 
   if ( evtStore().retrieve().isFailure() ) {
-    msg(MSG::FATAL) << "Failed to retrieve service " << evtStore() << endreq;
+    msg(MSG::FATAL) << "Failed to retrieve service " << evtStore() << endmsg;
     return StatusCode::FAILURE;
-  } else 
-    msg(MSG::INFO) << "Retrieved service " << evtStore() << endreq;
+  } else
+    msg(MSG::INFO) << "Retrieved service " << evtStore() << endmsg;
 
   if (m_trackSelection.retrieve().isFailure()) {
     msg(MSG::FATAL) << "Can not retrieve TrackSelection tool of type "
-	<< m_trackSelection.typeAndName() << endreq;
+	<< m_trackSelection.typeAndName() << endmsg;
     return StatusCode::FAILURE;
-  } else msg(MSG::INFO) << "Retrieved tool " << m_trackSelection.typeAndName() << endreq;
-  
+  } 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 << endreq;
+    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 << endreq;
+    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
index 6a5351f0e1360cb540001d81d427ff9595bcbfbd..445e21f18d5ebc57b19184366c74033bab77093b 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonSivsTRT.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonSivsTRT_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx
index daf0ad51e35bd22a4e75b6b838a615bf35d6531e..5059f05bbbc7db0ef3b45d892a7d0a7c1e4efd1b 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.cxx
@@ -1,10 +1,10 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
 // IDAlignMonTrackSegments.cxx
-// AUTHORS: John Alison (john.alison@cern.ch) johnda 
+// AUTHORS: John Alison (john.alison@cern.ch) johnda
 //          Ben Cooper
 //          Tobias Golling
 // **********************************************************************
@@ -42,7 +42,7 @@ struct IDAlignMonTrackSegments::UpperLowerHistograms{
 };
 
 struct IDAlignMonTrackSegments::DeltaTrackParamHistograms{
-  
+
   // All Tracks, Positive Tracks, Negative Tracks
   TH1F_LW* dTp[3];
   TH1F_LW* dTpPull[3];
@@ -51,9 +51,9 @@ struct IDAlignMonTrackSegments::DeltaTrackParamHistograms{
   TH2F_LW* VsPhi0[3];
   TH2F_LW* VsPt[3];
   TH2F_LW* VsEta[3];
-  
+
   DeltaTrackParamHistograms(){
-    
+
     for(unsigned int charge=0; charge<3; ++charge){
       dTp[charge] = 0;
       dTpPull[charge] = 0;
@@ -63,10 +63,10 @@ struct IDAlignMonTrackSegments::DeltaTrackParamHistograms{
       VsPt[charge] = 0;
       VsEta[charge] = 0;
     }
-    
+
   };
-  
-  
+
+
 };
 
 
@@ -84,12 +84,12 @@ IDAlignMonTrackSegments::IDAlignMonTrackSegments( const std::string & type, cons
    m_deltaPhiRange2D(0.02),
    m_deltaQoverPtRange(0.1),
    m_deltaQoverPtRange2D(0.4),
-   m_deltaPtQoverPtRange(0.5),
-   m_deltaPtQoverPtRange2D(0.5),
+   m_deltaPtoverPtRange(0.5),
+   m_deltaPtoverPtRange2D(0.5),
    m_deltaZ0Range(0.6),
    m_d0Range(150),
    m_upperPhi(0),
-   m_triggerChainName("NoTriggerSelection"),	
+   m_triggerChainName("NoTriggerSelection"),
    m_upper_hist(new UpperLowerHistograms),
    m_lower_hist(new UpperLowerHistograms),
    m_delta_d0(new DeltaTrackParamHistograms),
@@ -125,8 +125,8 @@ IDAlignMonTrackSegments::IDAlignMonTrackSegments( const std::string & type, cons
   declareProperty("DeltaPhiRange2D", m_deltaPhiRange2D);
   declareProperty("DeltaQoverPtRange", m_deltaQoverPtRange);
   declareProperty("DeltaQoverPtRange2D", m_deltaQoverPtRange2D);
-  declareProperty("DeltaQoverPtRange", m_deltaPtQoverPtRange);
-  declareProperty("DeltaQoverPtRange2D", m_deltaPtQoverPtRange2D);
+  declareProperty("DeltaPtoverPtRange", m_deltaPtoverPtRange);
+  declareProperty("DeltaPtoverPtRange2D", m_deltaPtoverPtRange2D);
   declareProperty("DeltaZ0Range", m_deltaZ0Range);
   declareProperty("D0Range", m_d0Range);
   declareProperty("UpperPhi", m_upperPhi);
@@ -152,14 +152,14 @@ IDAlignMonTrackSegments::~IDAlignMonTrackSegments(){
 
 void IDAlignMonTrackSegments::InitializeHistograms()
 {
-  
+
   m_debug_phi0 = 0 ;
   m_debug_eta0 = 0;
-  
-  // pt 
+
+  // pt
   m_delta_pt = 0 ;
   m_reldelta_pt = 0 ;
-  
+
 }
 
 
@@ -169,17 +169,17 @@ void IDAlignMonTrackSegments::InitializeHistograms()
 StatusCode IDAlignMonTrackSegments::bookHistograms()
 {
   m_events=0;
-  
+
   //initialize tools and services
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endreq;
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Calling initialize() to setup tools/services" << endmsg;
   StatusCode sc = setupTools();
   if (sc.isFailure()) {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Failed to initialize tools/services!" << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Failed to initialize tools/services!" << endmsg;
     return StatusCode::SUCCESS;
-  } 
-  else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endreq;
+  }
+  else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully initialized tools/services" << endmsg;
+
 
-  
   if ( AthenaMonManager::environment() == AthenaMonManager::online ) {
     // book histograms that are only made in the online environment...
   }
@@ -193,363 +193,363 @@ StatusCode IDAlignMonTrackSegments::bookHistograms()
     outputDirName = "IDAlignMon/" + m_upperTracksName + "_" + m_lowerTracksName + "_" + m_triggerChainName + "/TrackSegments";
 
   MonGroup al_mon ( this, outputDirName, run );
-  
 
-  if ( newLowStat || newLumiBlock ) {
+
+  if ( newLowStatFlag() || newLumiBlockFlag() ) {
   }
 
-  if( newRun ) { 
-    
+  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 
+    //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);  
+    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);  
+    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);  
+    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);  
+    RegisterHisto(al_mon,m_upper_hist->nhitsSct);
     m_upper_hist->phi0 = TH1F_LW::create("Upper_phi0","#phi_{0}^{Upper}", 60,-3.14,m_upperPhi);
-    RegisterHisto(al_mon,m_upper_hist->phi0);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
+    RegisterHisto(al_mon,m_upper_hist->pt);
 
-    //Lower Tracks 
+    //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);  
+    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);  
+    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);  
+    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);  
+    RegisterHisto(al_mon,m_lower_hist->nhitsSct);
     m_lower_hist->phi0 = TH1F_LW::create("Lower_phi0","#phi_{0}^{Low} ", 60,-3.14,m_upperPhi);
-    RegisterHisto(al_mon,m_lower_hist->phi0);  
+    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);  
+    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);  
+    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);  
+    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);  
+    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);  
-    
-    
-    
+    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]);  
+      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]);  
-      
+      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]);  
+      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]" 
+					    ,"d_{0}^{Low} - d_{0}^{Upper} Vs #phi_{0}^{Upper}"+chargeNames[charge]+"; #phi_{0}^{Upper} [mm]; #Delta d_{0} [mm]"
 					    ,9,-3.14,m_upperPhi,50,-1*m_deltaD0Range2D,m_deltaD0Range2D);
-      RegisterHisto(al_mon,m_delta_d0->VsPhi0[charge]);  
+      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]" 
+					  ,"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]);  
+      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]" 
+					   ,"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]);  
+      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]" 
+					  ,"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]);  
-      
+      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]);  
+					 ,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]);  
+					     ,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]);  
+					  ,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,-3.14,m_upperPhi, 50, -m_deltaZ0Range, m_deltaZ0Range); 
-      RegisterHisto(al_mon,m_delta_z0->VsPhi0[charge]);  
-      
+					    ,9,-3.14,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]);  
+					  ,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]);  
-      
+					   ,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]);  
-      
+					  ,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]);  
+      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]);  
+      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]);  
+      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,-3.14,m_upperPhi,50,-1*m_deltaPhiRange2D,m_deltaPhiRange2D);
-      RegisterHisto(al_mon,m_delta_phi0->VsPhi0[charge]);  
-      
+      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]);  
+      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]);  
+      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]);  
+      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]);  
-      
+      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]);  
+      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]);  
+      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,-3.14,m_upperPhi,50, -0.02, 0.02);
-      RegisterHisto(al_mon,m_delta_eta0->VsPhi0[charge]);  
+      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]);  
+      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]);  
+      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]);  
+      RegisterHisto(al_mon,m_delta_eta0->VsZ0[charge]);
 
-      //======= qOverPt    
+      //======= 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]);  
+      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]);  
+      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]);  
+      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]);  
+      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,-3.14,m_upperPhi,50,-1*m_deltaQoverPtRange2D,m_deltaQoverPtRange2D);
-      RegisterHisto(al_mon,m_delta_qOverPt->VsPhi0[charge]);  
+      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]);  
+      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]);  
+      RegisterHisto(al_mon,m_delta_qOverPt->VsEta[charge]);
 
-      //======= PtqOverPt    
+      //======= 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]);  
+					      ,100,-1*m_deltaPtoverPtRange,m_deltaPtoverPtRange);
+      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]);  
+      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]);  
+					       ,8,-1*m_d0Range,m_d0Range,50,-1*m_deltaPtoverPtRange2D,m_deltaPtoverPtRange2D);
+      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]);  
+					       ,50,-1000,1000,50,-1*m_deltaPtoverPtRange2D,m_deltaPtoverPtRange2D);
+      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,-3.14,m_upperPhi,50,-1*m_deltaPtQoverPtRange2D,m_deltaPtQoverPtRange2D);
-      RegisterHisto(al_mon,m_delta_PtqOverPt->VsPhi0[charge]);  
+						 ,8,-3.14,m_upperPhi,50,-1*m_deltaPtoverPtRange2D,m_deltaPtoverPtRange2D);
+      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]);  
+					       ,50,0,100,50,-1*m_deltaPtoverPtRange2D,m_deltaPtoverPtRange2D);
+      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]);  
+						,50,-2.1,2.1,50,-1*m_deltaPtoverPtRange2D,m_deltaPtoverPtRange2D);
+      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]);  
+      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]);  
+      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,-3.14,m_upperPhi, 61, -30.5, 30.5);
-      RegisterHisto(al_mon,m_delta_nHits->VsPhi0[charge]);  
+      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]);  
+      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]);  
+      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]);  
-      
+      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]);  
-    
+    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]);  
+    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,-3.14,m_upperPhi, 5, -2.5, 2.5);
-    RegisterHisto(al_mon,m_delta_charge->VsPhi0[0]);  
+    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]);  
+    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]);  
+    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]);  
-    
+    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,-3.14,3.14);
-    RegisterHisto(al_mon,m_debug_phi0);  
-    
+    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);  
-    
+    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);        
+    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);  
-    
+    RegisterHisto(al_mon,m_reldelta_pt);
+
     m_histosBooked++;
   }
 
@@ -560,20 +560,20 @@ StatusCode IDAlignMonTrackSegments::bookHistograms()
 // 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:" << endreq;
+    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:" << endreq;
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Cannot book TH2F_LW Histogram:" << endmsg;
   }
 }
 
@@ -583,120 +583,98 @@ void IDAlignMonTrackSegments::RegisterHisto(MonGroup& mon, TH2F_LW* histo) {
 //---------------------------------------------------------------------------------------
 StatusCode IDAlignMonTrackSegments::fillHistograms()
 {
-  
+
   m_events++;
   //Get the track collections
   const DataVector<Trk::Track>* tracksUpper(0);
   const DataVector<Trk::Track>* tracksLower(0);
 
-  //if (false) {
-  //  std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- START -- upper track collection = "<< m_upperTracksName << std::endl
-  //	      << "                                                                 lower track collection = "<< m_lowerTracksName 
-  //	      << std::endl;
-  //}
 
   if(m_useCTBSplitTracks){
-    
+
     if(!evtStore()->contains<TrackCollection>(m_upperTracksName)){
       if(m_events == 1) {
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_upperTracksName << " TrackCollections" << endreq;
-      }else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_upperTracksName << " TrackCollections" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_upperTracksName << " TrackCollections" << endmsg;
+      }else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_upperTracksName << " TrackCollections" << endmsg;
       return StatusCode::SUCCESS;
     }
-    
+
     if (!evtStore()->contains<TrackCollection>(m_lowerTracksName)){
       if(m_events == 1) {
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_lowerTracksName << " TrackCollections" << endreq;
-      }else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_lowerTracksName << " TrackCollections" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_lowerTracksName << " TrackCollections" << endmsg;
+      }else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_lowerTracksName << " TrackCollections" << endmsg;
       return StatusCode::SUCCESS;
     }
-    
+
     tracksUpper = m_trackSelectionUpper->selectTracks(m_upperTracksName);
     if (!tracksUpper) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_upperTracksName<<" is NULL" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_upperTracksName<<" is NULL" << endmsg;
     }
 
     tracksLower = m_trackSelectionLower->selectTracks(m_lowerTracksName);
     if (!tracksLower) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_lowerTracksName<<" is NULL" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_lowerTracksName<<" is NULL" << endmsg;
     }
-    
+
   }else{
-    
+
     //We only need the inputTracks if we're splitting them ourselves
     if (!evtStore()->contains<TrackCollection>(m_inputTracksName)){
-      if(m_events == 1){ 
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_inputTracksName << " TrackCollections" << endreq;
-      }else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_inputTracksName << " TrackCollections" << endreq;
+      if(m_events == 1){
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_inputTracksName << " TrackCollections" << endmsg;
+      }else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Unable to get " << m_inputTracksName << " TrackCollections" << endmsg;
       return StatusCode::SUCCESS;
     }
-    
+
     //Split the tracks.
-    const DataVector<Trk::Track>* tracksIn; 
+    const DataVector<Trk::Track>* tracksIn;
     StatusCode sc = evtStore()->retrieve(tracksIn, m_inputTracksName);
     if (sc.isFailure()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<m_inputTracksName<<" found in StoreGate" << endreq;
-      
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<m_inputTracksName<<" found in StoreGate" << endmsg;
+
     }else{
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracksIn->size() <<" Input Tracks from StoreGate" << endreq;
-      
+      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 
-    //		<< " with size: " <<  tracksIn->size()                                                                 
-    //		<< std::endl;
-    //}
-    //This records the upper and lower track collections to storeGate 
     m_trackSplitter->splitTracks(tracksIn);
-    //if (false) {
-    //std::cout << " -- SALVA -- IDAlignMonTrackSegments::fillHistograms -- track collection: " << m_inputTracksName 
-    //		<< " (size: " <<  tracksIn->size() <<" ) splitting completed "                                                                 
-    //		<< std::endl;
-    //}
+
     //Get the Upper Tracks
     tracksUpper = m_trackSelectionUpper->selectTracks(m_upperTracksName);
     if (!tracksUpper) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_upperTracksName<<" is NULL" << endreq;
-      
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_upperTracksName<<" is NULL" << endmsg;
+
     }
 
     //Get the Lower Tracks
     tracksLower = m_trackSelectionLower->selectTracks(m_lowerTracksName);
     if (!tracksLower) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_lowerTracksName<<" is NULL" << endreq;
-      
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_lowerTracksName<<" is NULL" << endmsg;
+
     }
 
   }
 
-  //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;
-  //}
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracksUpper->size() <<" Upper Tracks." << endmsg;
+  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracksLower->size() <<" Lower Tracks from Track from StoreGate" << endmsg;
 
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracksUpper->size() <<" Upper Tracks." << endreq;
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracksLower->size() <<" Lower Tracks from Track from StoreGate" << endreq;
-  
   //===============================================================
   // 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) { 
+  for (; trackItrUpper != trackItrUpperE; ++trackItrUpper) {
     const Trk::Track* trackUpper = *trackItrUpper;
     if(trackUpper == NULL){
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No associated Trk::Track object found for track "<< nTracksUpper << endreq;
+      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" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Got the "<< nTracksUpper << " Upper Track" << endmsg;
 
-    const Trk::TrackSummary* summary = NULL;       
+    const Trk::TrackSummary* summary = NULL;
     summary = m_trackSumTool->createSummary(*trackUpper);
     unsigned int nHitsPixUp = 0;
     unsigned int nHitsSCTUp=0;
@@ -707,10 +685,10 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
     unsigned int nHitsUp = nHitsPixUp + nHitsSCTUp + nHitsTRTUp;
     delete summary;
 
-    
+
     const Trk::Perigee* measUpperPer = trackUpper->perigeeParameters();
     const AmgSymMatrix(5)* covariance = measUpperPer ? measUpperPer->covariance() : NULL;
-    
+
     float d0Up            = -999.;
     float d0UpErr         = -999.;
     float phi0Up          = -999.;
@@ -727,47 +705,40 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
     float qOverPtUpErr	  = -999.;
     float chargeUp	  = -999.;
     float ptUp 	          = -999.;
-      
+
     //control on the measUpperPer!
     //Get the track parameters
     if ( covariance != NULL ){
       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];  
+
+      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.; 
+      ptUp = measUpperPer->pT()/1000.;
     }
     else
       {
-	if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Measured Upper Perigee not retrieved" << endreq;
+	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" << endreq;
+    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);
@@ -778,14 +749,14 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
     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 
+
+    //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 << endreq;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Upper Track Eta = " << eta0Up << ", phi = " << phi0Up << endreq;
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Upper Track Pix = " << nHitsPixUp << ", SCT = " << nHitsSCTUp << ", TRT = " << nHitsTRTUp << endreq;
+    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 mindR = 10000;
     float Matched_Low_d0 = -99;
     float Matched_Low_d0_Err = -99;
     float Matched_Low_phi0 = -99;
@@ -800,19 +771,19 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
     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 == NULL){
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No associated Trk::Track object found for track "<< nTracksLower << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No associated Trk::Track object found for track "<< nTracksLower << endmsg;
 	continue;
       }
 
-      const Trk::TrackSummary* summary = NULL;       
+      const Trk::TrackSummary* summary = NULL;
       summary = m_trackSumTool->createSummary(*trackLower);
       unsigned int nHitsPixLow = 0;
       unsigned int nHitsSCTLow = 0;
@@ -823,7 +794,7 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
       nHitsLow = nHitsPixLow + nHitsSCTLow + nHitsTRTLow;
       delete summary;
 
-      
+
       const Trk::Perigee* measLowerPer = trackLower->perigeeParameters();
       const AmgSymMatrix(5)* covariance = measLowerPer ? measLowerPer->covariance() : NULL;
 
@@ -845,55 +816,55 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
       float ptLow          = -999.;
 
       if ( covariance != NULL ){
-	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.;                                                               
+	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" << endreq;
+	  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Measured Lower Perigee not retrieved" << endmsg;
 	}
 
 
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Lower Track = " << nTracksLower << endreq;
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Lower Track Eta = " << eta0Low << ", phi = " << phi0Low << endreq;
-      
+      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;
@@ -910,21 +881,21 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
 	Matched_Low_charge = chargeLow;
 	Matched_Low_pt = ptLow;
 
-	if(dR < m_matchedRcut) 
+	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 " <<endreq;
-      
+
+      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
@@ -934,7 +905,7 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
 	//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));
@@ -943,7 +914,7 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
 	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));
@@ -997,9 +968,9 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
 	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);
@@ -1007,25 +978,20 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
       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;
 }
 
@@ -1035,38 +1001,38 @@ StatusCode IDAlignMonTrackSegments::fillHistograms()
 //---------------------------------------------------------------------------------------
 StatusCode IDAlignMonTrackSegments::setupTools()
 {
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "In setupTools()" << endreq;
-  
+  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"<< endreq;
+    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() << endreq; 
-  } else 
-    if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Retrieved tool " << m_trackSplitter.typeAndName() << endreq;
-      
+    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 << endreq;
+    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 << endreq;
+    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() << endreq;
+	<< m_trackSelectionUpper.typeAndName() << endmsg;
     return StatusCode::SUCCESS;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelectionUpper.typeAndName() << endreq;
-  
+  } 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() << endreq;
+	<< m_trackSelectionLower.typeAndName() << endmsg;
     return StatusCode::SUCCESS;
-  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelectionLower.typeAndName() << endreq;
+  } else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSelectionLower.typeAndName() << endmsg;
+
 
-  
   return StatusCode::SUCCESS;
 }
 
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
index 2d80db4b29b7be25ac0e53454269f89caa1ee200..9e42e7a1443487961d3416390b4dc98c4c3e279b 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTrackSegments.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonTrackSegments_H
@@ -100,8 +100,8 @@ class IDAlignMonTrackSegments : public ManagedMonitorToolBase
   float m_deltaPhiRange2D;
   float m_deltaQoverPtRange;
   float m_deltaQoverPtRange2D;
-  float m_deltaPtQoverPtRange;
-  float m_deltaPtQoverPtRange2D;
+  float m_deltaPtoverPtRange;
+  float m_deltaPtoverPtRange2D;
   float m_deltaZ0Range;
   float m_d0Range;
   float m_upperPhi;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
index 488508ac9d0824a8295a656a777d87d74c105dd0..4b9821a8a4819aacf974a8cf8e8ce84460739e6f 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
@@ -68,9 +68,9 @@ IDAlignMonTruthComparison::IDAlignMonTruthComparison( const std::string & type,
 {
   m_trackSelection = ToolHandle< InDetAlignMon::TrackSelectionTool >("InDetAlignMon::TrackSelectionTool");
   m_truthToTrack = ToolHandle<Trk::ITruthToTrack>("Trk::TruthToTrack/InDetTruthToTrack");
-  
+
   declareProperty("tracksName"              , m_tracksName);
-  declareProperty("tracksTruthName"         , m_tracksTruthName);  
+  declareProperty("tracksTruthName"         , m_tracksTruthName);
   declareProperty("CheckRate"               , m_checkrate=1000);
   declareProperty("TruthToTrackTool"        , m_truthToTrack);
   declareProperty("trackSelection"          , m_trackSelection);
@@ -82,25 +82,25 @@ IDAlignMonTruthComparison::~IDAlignMonTruthComparison() { }
 
 StatusCode IDAlignMonTruthComparison::initialize()
 {
-  StatusCode sc;                                      
+  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 << endreq;
+    msg(MSG::FATAL) << "Failed to retrieve tool " << m_truthToTrack << endmsg;
     return StatusCode::FAILURE;
   } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_truthToTrack << endreq;
+    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 << endreq;
+    msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSelection << endmsg;
     return StatusCode::FAILURE;
   } else {
-    msg(MSG::INFO) << "Retrieved tool " << m_trackSelection << endreq;
+    msg(MSG::INFO) << "Retrieved tool " << m_trackSelection << endmsg;
   }
 
   return sc;
@@ -120,208 +120,208 @@ StatusCode IDAlignMonTruthComparison::bookHistograms()
   std::string outputDirName = "IDAlignMon/" + m_tracksName + "_NoTriggerSelection/TruthComparison";
   MonGroup al_mon ( this, outputDirName, run );
 
-  if ( newLowStat ) {  
+  if ( newLowStatFlag() ) {
   }
-  if ( newLumiBlock ) {  
+  if ( newLumiBlockFlag() ) {
   }
-  if( newRun ) { 
-    
+  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);   
+      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_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);   
+
+    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_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) ;  
+    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_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_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) ;  
+    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) ; 
+    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) ; 
+    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) ; 
+    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) ; 
+    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);  
+    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) ;   
+    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) ;
 
 
   }
@@ -334,7 +334,7 @@ void IDAlignMonTruthComparison::RegisterHisto(MonGroup& mon, TH1* histo) {
   histo->Sumw2();
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    msg(MSG::ERROR) << "Cannot book TH1 Histogram:" << endreq;
+    msg(MSG::ERROR) << "Cannot book TH1 Histogram:" << endmsg;
   }
 }
 
@@ -342,16 +342,16 @@ void IDAlignMonTruthComparison::RegisterHisto(MonGroup& mon, TProfile* histo) {
 
   StatusCode sc = mon.regHist(histo);
   if (sc.isFailure() ) {
-    msg(MSG::ERROR) << "Cannot book TProfile Histogram:" << endreq;
+    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:" << endreq;
+    msg(MSG::ERROR) << "Cannot book TH2 Histogram:" << endmsg;
   }
 }
 
@@ -361,37 +361,37 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 
   //get TrackCollection using TrackSelectionTool
   DataVector<Trk::Track>* trks = m_trackSelection->selectTracks(m_tracksName);
-  
+
   //although we select tracks using the TrackSelectionTool, we still need to get a complete TrackCollection
   //from StoreGate for use in the track-truth map, otherwise the track-truth matching is screwed up
   const TrackCollection       * RecCollection = NULL;
   StatusCode sc = StatusCode :: SUCCESS;
-  sc = evtStore()->retrieve(RecCollection, m_tracksName);  
+  sc = evtStore()->retrieve(RecCollection, m_tracksName);
   if (sc.isFailure()) {
-    if (msgLvl(MSG::VERBOSE)) msg() <<"Track collection \"" << m_tracksName << "\" not found." << endreq;
+    if (msgLvl(MSG::VERBOSE)) msg() <<"Track collection \"" << m_tracksName << "\" not found." << endmsg;
     return StatusCode::SUCCESS;
   }
-  if (RecCollection)  
+  if (RecCollection)
     {
-      if (msgLvl(MSG::VERBOSE)) 
-	msg() << "Retrieved " << m_tracksName << " with size " << RecCollection->size() << " reconstructed tracks from storegate" << endreq;
+      if (msgLvl(MSG::VERBOSE))
+	msg() << "Retrieved " << m_tracksName << " with size " << RecCollection->size() << " reconstructed tracks from storegate" << endmsg;
     }
-  else 
+  else
     {
-      if (msgLvl(MSG::VERBOSE)) msg()<<"Problem in retrieving " << m_tracksName << endreq;
+      if (msgLvl(MSG::VERBOSE)) msg()<<"Problem in retrieving " << m_tracksName << endmsg;
       return StatusCode::SUCCESS;
     }
 
   // get TrackTruthCollection
   const TrackTruthCollection  * TruthMap  = NULL;
   if (StatusCode::SUCCESS!=evtStore()->retrieve(TruthMap,m_tracksTruthName)) {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Cannot find " << m_tracksTruthName  << endreq;
+    if (msgLvl(MSG::VERBOSE)) msg() << "Cannot find " << m_tracksTruthName  << endmsg;
     return StatusCode::SUCCESS;
   } else {
-    if (msgLvl(MSG::VERBOSE)) msg() << "Track Truth Collection with name " << m_tracksTruthName << " with size " << TruthMap->size() <<" found in StoreGate" << endreq;
+    if (msgLvl(MSG::VERBOSE)) msg() << "Track Truth Collection with name " << m_tracksTruthName << " 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.};
@@ -399,12 +399,12 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
   float ptlast = 0;
   int chargefirst = 0;
 
-  int nTracks=0;  
+  int nTracks=0;
   DataVector<Trk::Track>::const_iterator trksItr  = trks->begin();
   DataVector<Trk::Track>::const_iterator trksItrE = trks->end();
   for (; trksItr != trksItrE; ++trksItr) {
-    nTracks++;  
-    
+    nTracks++;
+
     float trkd0          = -999;
     float trkz0          = -999;
     float trkphi         = -999;
@@ -413,74 +413,74 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
     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() : NULL;
-    
+
     if (covariance==0) {
-      msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq; 
+      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];  
+    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.;  
+      trketa   = measPer->eta();
+      qOverPt  = perigeeParams[Trk::qOverP]*1000./sin(trktheta);
+      trkpt    = measPer->pT()/1000.;
       if (qOverPt<0) charge=-1;
-      else 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 << endreq; 
-    
-    if (TruthMap) {	
+    if (msgLvl(MSG::VERBOSE)) msg() << "Found good track with phi, PT = " << trkphi << ", " << trkpt << endmsg;
+
+    if (TruthMap) {
 
       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;
 	  HepMcParticleLink HMPL = trtruth.particleLink();
-          
-	  if ( HMPL.isValid()) 
+
+	  if ( HMPL.isValid())
 	    {
-	      const HepMC::GenParticle *genparptr = HMPL.cptr(); 
+	      const HepMC::GenParticle *genparptr = HMPL.cptr();
 
 	      if (genparptr) {
-		if (genparptr->production_vertex()) { 
-		  
+		if (genparptr->production_vertex()) {
+
 		  if(genparptr->pdg_id() == 0){
-		    msg(MSG::WARNING) <<" Particle with PDG ID = 0! Status "<<endreq; 
+		    msg(MSG::WARNING) <<" Particle with PDG ID = 0! Status "<<endmsg;
 		    //msg(MSG::WARNING) <<" Particle with PDG ID = 0! Status "<<genparptr->status()<<" mass "<< genparptr->momentum().m() <<" pt "<<genparptr->momentum().et()<<" eta "
 		    // <<genparptr->momentum().eta()<<" phi "<<genparptr->momentum().phi()<<" Gen Vertex barcode "<<genparptr->production_vertex()->barcode()<<"Gen Vertex Position x"
-		    // <<genparptr->production_vertex()->position().x()<< " y "<<genparptr->production_vertex()->position().y()<<" z "<<genparptr->production_vertex()->position().z()<<endreq;                    
+		    // <<genparptr->production_vertex()->position().x()<< " y "<<genparptr->production_vertex()->position().y()<<" z "<<genparptr->production_vertex()->position().z()<<endmsg;
 		  }else{
-		    
+
 		    const Trk::TrackParameters* generatedTrackPerigee = m_truthToTrack->makePerigeeParameters(genparptr);
-		    if (!generatedTrackPerigee)   msg(MSG::WARNING) <<  "Unable to extrapolate genparticle to perigee!" << endreq;
-		    
+		    if (!generatedTrackPerigee)   msg(MSG::WARNING) <<  "Unable to extrapolate genparticle to perigee!" << endmsg;
+
 		    if ( generatedTrackPerigee) {
 		      float m_track_truth_qoverpt      = 1000. * generatedTrackPerigee->parameters()[Trk::qOverP]/sin(generatedTrackPerigee->parameters()[Trk::theta]);
-		      float m_track_truth_phi          = generatedTrackPerigee->parameters()[Trk::phi0];       
+		      float m_track_truth_phi          = generatedTrackPerigee->parameters()[Trk::phi0];
 		      float m_track_truth_d0           = generatedTrackPerigee->parameters()[Trk::d0];
 		      float m_track_truth_z0           = generatedTrackPerigee->parameters()[Trk::z0];
 		      float m_track_truth_theta        = generatedTrackPerigee->parameters()[Trk::theta];
 		      float m_track_truth_eta          = generatedTrackPerigee->eta();
-		      delete  generatedTrackPerigee; 		      
-		      float m_track_truth_pt           = 1./fabs(m_track_truth_qoverpt);  
-		      float m_track_truth_charge       = 1; 
+		      delete  generatedTrackPerigee;
+		      float m_track_truth_pt           = 1./fabs(m_track_truth_qoverpt);
+		      float m_track_truth_charge       = 1;
 		      if(m_track_truth_qoverpt<0) m_track_truth_charge = -1;
 		      if (m_track_truth_phi<0) m_track_truth_phi+=2*m_Pi;
-		      if (msgLvl(MSG::VERBOSE)) msg() << "Found matched truth track with phi, PT = " << m_track_truth_phi << ", " << m_track_truth_pt << endreq; 
+		      if (msgLvl(MSG::VERBOSE)) msg() << "Found matched truth track with phi, PT = " << m_track_truth_phi << ", " << m_track_truth_pt << endmsg;
 
 		      m_truthpT->Fill(m_track_truth_pt);
 		      m_truthphi->Fill(m_track_truth_phi);
@@ -499,12 +499,12 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 			ptlast = trkpt;
 			chargefirst = (int)charge;
 		      }
-		      
+
 		      // Fill hitos
 		      m_Deta_vs_eta -> Fill(m_track_truth_eta, trketa-m_track_truth_eta);
 		      m_dphi_vs_eta -> Fill(m_track_truth_eta,trkphi-m_track_truth_phi);
 
-		      float eta_barrel = 1.;		      
+		      float eta_barrel = 1.;
 		      if (fabs(m_track_truth_eta) < eta_barrel) {
 			m_dpt_vs_truthpt_barrel -> Fill(m_track_truth_charge*m_track_truth_pt,trkpt/m_track_truth_pt);
 			m_Dqopt_vs_pt_barrel -> Fill(m_track_truth_charge*m_track_truth_pt, qOverPt-m_track_truth_qoverpt);
@@ -535,7 +535,7 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 		      float highpt = 10.;
 		      if(m_track_truth_pt > highpt) {
 			m_Dqopt_vs_eta_highpt -> Fill(m_track_truth_eta, qOverPt-m_track_truth_qoverpt);
-		      
+
 			// vs phi
 			if (fabs(m_track_truth_eta) < eta_barrel) {
 			  m_Dqopt_vs_phi_highpt_barrel -> Fill(m_track_truth_phi, qOverPt-m_track_truth_qoverpt);
@@ -547,7 +547,7 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 
 		      } else {
 			m_Dqopt_vs_eta_lowpt -> Fill(m_track_truth_eta, qOverPt-m_track_truth_qoverpt);
-		      
+
 			// vs phi
 			if (fabs(m_track_truth_eta) < eta_barrel) {
 			  m_Dqopt_vs_phi_lowpt_barrel -> Fill(m_track_truth_phi, qOverPt-m_track_truth_qoverpt);
@@ -561,81 +561,81 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 
 		    }
 		  }
-		} else msg(MSG::WARNING) << " no genparptr->production_vertex() " << endreq; 
-	      } else msg(MSG::WARNING) << " no genparptr found " << endreq; 
-	    } else msg(MSG::WARNING) << " HMPL not Valid " << endreq; 
+		} 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 " << endreq; 
+    } else msg(MSG::WARNING) << " No TruthMap found " << endmsg;
   }
-  
+
   float ptfirst = ptlast;
   ptlast = 0;
   trksItr  = trks->begin();
-  for (; trksItr != trksItrE; ++trksItr) {     
+  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() : NULL;
-    
+
     if (covariance==0) {
-      msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq; 
+      msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endmsg;
     }
-    else{  
-      AmgVector(5) perigeeParams = measPer->parameters(); 
-      trkphi   = perigeeParams[Trk::phi0];  
+    else{
+      AmgVector(5) perigeeParams = measPer->parameters();
+      trkphi   = perigeeParams[Trk::phi0];
       trktheta = perigeeParams[Trk::theta];
-      trkpt    = measPer->pT()/1000.;  
-      trketa   = measPer->eta(); 
+      trkpt    = measPer->pT()/1000.;
+      trketa   = measPer->eta();
       qOverP   = perigeeParams[Trk::qOverP]*1000.;
       if (qOverP<0) charge=-1;
-      else charge=+1; 
-    }  
-    
+      else charge=+1;
+    }
+
     if (TruthMap) {
-           
+
 
       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;
 	  HepMcParticleLink HMPL = trtruth.particleLink();
-          
-	  if ( HMPL.isValid()) 
+
+	  if ( HMPL.isValid())
 	    {
-	      const HepMC::GenParticle *genparptr = HMPL.cptr(); 
-	      
+	      const HepMC::GenParticle *genparptr = HMPL.cptr();
+
 	      if (genparptr) {
-		if (genparptr->production_vertex()) { 
-		  
+		if (genparptr->production_vertex()) {
+
 		  if(genparptr->pdg_id() == 0){
-		    msg(MSG::WARNING) <<" Particle with PDG ID = 0! Status "<<endreq;              
+		    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!" << endreq;
-		    
+		    if (!generatedTrackPerigee)   msg(MSG::WARNING) <<  "Unable to extrapolate genparticle to perigee!" << endmsg;
+
 		    if ( generatedTrackPerigee) {
 		      float m_track_truth_qoverpt      = 1000. * generatedTrackPerigee->parameters()[Trk::qOverP]/sin(generatedTrackPerigee->parameters()[Trk::theta]);
-		      float m_track_truth_phi          = generatedTrackPerigee->parameters()[Trk::phi0];  
+		      float m_track_truth_phi          = generatedTrackPerigee->parameters()[Trk::phi0];
 		      float m_track_truth_theta        = generatedTrackPerigee->parameters()[Trk::theta];
-		      delete  generatedTrackPerigee; 		      
-		      float m_track_truth_pt           = 1./fabs(m_track_truth_qoverpt);  
-		      //float m_track_truth_charge       = 1; 
+		      delete  generatedTrackPerigee;
+		      float m_track_truth_pt           = 1./fabs(m_track_truth_qoverpt);
+		      //float m_track_truth_charge       = 1;
 		      //if(m_track_truth_qoverpt<0) m_track_truth_charge = -1;
 		      if (m_track_truth_phi<0) m_track_truth_phi+=2*m_Pi;
-		      if (msgLvl(MSG::VERBOSE)) msg() << "Found matched truth track with phi, PT = " << m_track_truth_phi << ", " << m_track_truth_pt << endreq; 
+		      if (msgLvl(MSG::VERBOSE)) msg() << "Found matched truth track with phi, PT = " << m_track_truth_phi << ", " << m_track_truth_pt << endmsg;
 
 
 		      if(trkpt > ptlast && trkpt < ptfirst && chargefirst*charge < 0 && trkpt > 15){
@@ -650,7 +650,7 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 			zMC_py[1] = m_track_truth_pt * cos(m_track_truth_phi);
 			ptlast = trkpt;
 			z_true = true;
-		      } 
+		      }
 		    }
 		  }
 		}
@@ -672,14 +672,14 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
     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;
 }
@@ -687,11 +687,11 @@ StatusCode IDAlignMonTruthComparison::fillHistograms()
 
 StatusCode IDAlignMonTruthComparison::procHistograms()
 {
-  if( endOfLowStat ) {
+  if( endOfLowStatFlag() ) {
   }
-  if( endOfLumiBlock ) {
+  if( endOfLumiBlockFlag() ) {
   }
-  if( endOfRun ) {
+  if( endOfRunFlag() ) {
 
     // deta vs eta
     m_Deta_vs_eta->FitSlicesY(0,1,0,10);
@@ -797,7 +797,7 @@ StatusCode IDAlignMonTruthComparison::procHistograms()
       tmp=m_Dqopt_vs_pt_ecc_chi2->GetBinContent(i);
       m_dqopt_vs_pt_ecc_chi2->SetBinContent(i,tmp);
     }
-    
+
     // vs eta
     for (int i=1;i<=m_Dqopt_vs_eta_highpt_1->GetNbinsX();i++){
       double tmp=m_Dqopt_vs_eta_highpt_1->GetBinContent(i);
@@ -866,7 +866,7 @@ StatusCode IDAlignMonTruthComparison::procHistograms()
       m_dqopt_vs_phi_lowpt_ecc_1->SetBinError(i,tmp);
       tmp=m_Dqopt_vs_phi_lowpt_ecc_chi2->GetBinContent(i);
       m_dqopt_vs_phi_lowpt_ecc_chi2->SetBinContent(i,tmp);
-    } 
+    }
 
     TH1F* m_Deta_vs_eta_0 = (TH1F*)gDirectory->Get("Deta_vs_eta_0");
     delete m_Deta_vs_eta_0;
@@ -946,7 +946,7 @@ StatusCode IDAlignMonTruthComparison::procHistograms()
     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
index c10c3749d8d704c23ca5950334a02204c8fa908a..8f741d7f389c6a8f4e0bd616bb2755ddc4f572a8 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonTruthComparison.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonTruthComparison_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
index 2e6b6a6cfa6d72d3823eb59501947e748dab94ab..7e7a731db0583402e174548ed811178b86a0ce99 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // $Id: InDetAlignMonBeamSpot.cxx,v 1.6 2009-02-05 20:55:08 beringer Exp $
@@ -95,10 +95,10 @@ StatusCode InDetAlignMonBeamSpot::initialize() {
   }
 
   if ( m_beamCondSvc.retrieve().isFailure() ) {
-    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve beamspot service " << m_beamCondSvc << " - will use nominal beamspot at (0,0,0)" << endreq;
+    if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve beamspot service " << m_beamCondSvc << " - will use nominal beamspot at (0,0,0)" << endmsg;
   } else {
     m_hasBeamCondSvc = true;
-    msg(MSG::INFO) << "Retrieved service " << m_beamCondSvc << endreq;
+    msg(MSG::INFO) << "Retrieved service " << m_beamCondSvc << endmsg;
   }
 
   return StatusCode::SUCCESS;
@@ -118,10 +118,10 @@ StatusCode InDetAlignMonBeamSpot::bookHistograms() {
     // book histograms that are only relevant for cosmics data...
   }
 
-  if ( newLowStat || newLumiBlock ) {
+  if ( newLowStatFlag() || newLumiBlockFlag() ) {
   }
 
-  if( newRun ) {
+  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);
@@ -201,7 +201,7 @@ StatusCode InDetAlignMonBeamSpot::fillHistograms() {
     m_hBsTiltY->Fill(1e6*beamTiltY);
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Beamspot from " << m_beamCondSvc << ": x0 = " << beamSpotX << ", y0 = " << beamSpotY
 				  << ", z0 = " << beamSpotZ << ", tiltX = " << beamTiltX
-				  << ", tiltY = " << beamTiltY <<endreq;
+				  << ", tiltY = " << beamTiltY <<endmsg;
   }
 
   const xAOD::TrackParticleContainer* trackCollection = evtStore()->tryConstRetrieve<xAOD::TrackParticleContainer>(m_trackContainerName);
@@ -220,12 +220,12 @@ StatusCode InDetAlignMonBeamSpot::fillHistograms() {
 
     const xAOD::TrackParticle* tpb = *trkItr;
     if (!tpb) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Null pointer to TrackParticleBase" << endreq;
+      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" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Null pointer to track perigee" << endmsg;
       continue;
     }
 
@@ -357,9 +357,9 @@ StatusCode InDetAlignMonBeamSpot::procHistograms()
 {
 
 
-  if( endOfLowStat || endOfLumiBlock ) { }
+  if( endOfLowStatFlag() || endOfLumiBlockFlag() ) { }
 
-  if( endOfRun ) { }
+  if( endOfRunFlag() ) { }
 
   return StatusCode::SUCCESS;
 }
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h
index 655110f39d450612cc2e7887437c01bbf906f73f..468aefeebe676a2e7f2c27af7a0b27b8d9d79cc0 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/InDetAlignMonBeamSpot.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // ********************************************************************************
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
index 979e0b52c326511789769479756746c6ede726b6..40302a3c62fffe7ff99d75c08d4f4cc8146d5a79 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
@@ -54,13 +54,13 @@ StatusCode TrackSelectionAlg::initialize()
 
   // get TrackSummaryTool
   if ( m_trackSumTool.retrieve().isFailure() ) {
-    msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSumTool << endreq;
+    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 << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved tool " << m_trackSumTool << endmsg;
   }
 
-  msg(MSG::INFO) << "TrackSelectionAlg initialized" << endreq;
+  msg(MSG::INFO) << "TrackSelectionAlg initialized" << endmsg;
 
   return StatusCode::SUCCESS;
 
@@ -89,24 +89,24 @@ StatusCode TrackSelectionAlg::execute()
   //retrieving input track collection from Storegate
   StatusCode sc = evtStore()->retrieve(tracks,m_inputTrackCol);
   if (sc.isFailure()) {
-    msg(MSG::ERROR) << "No TrackCollection with name "<<m_inputTrackCol<<" found in StoreGate" << endreq;
+    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<<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_inputTrackCol<<" 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
   const VxContainer* vertices;// = new VxContainer; // commented out by Priscilla bug CID30178
   StatusCode scv = evtStore()->retrieve(vertices,"VxPrimaryCandidate");
   if (scv.isFailure()) {
-    msg(MSG::ERROR) << "No Collection with name " << "VxPrimaryCandidate" <<" found in StoreGate" << endreq;
-  } 
-  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name " << "VxPrimaryCandidate" << " with size " << vertices->size() <<" found in StoreGate" << endreq;
-  
-  
+    msg(MSG::ERROR) << "No Collection with name " << "VxPrimaryCandidate" <<" found in StoreGate" << endmsg;
+  }
+  else if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Collection with name " << "VxPrimaryCandidate" << " 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; 
+  float zVtx = -999.0;
   VxContainer::const_iterator vxItr  = vertices->begin();
   VxContainer::const_iterator vxItrE = vertices->end();
   int ntrkMax=0;
@@ -114,7 +114,7 @@ StatusCode TrackSelectionAlg::execute()
 
     int numTracksPerVertex = (*vxItr)->vxTrackAtVertex()->size();
     if (numTracksPerVertex > ntrkMax) {
-  
+
       ntrkMax = numTracksPerVertex;
       //xVtx=(*vxItr)->recVertex().position()[0];
       //yVtx=(*vxItr)->recVertex().position()[1];
@@ -124,11 +124,11 @@ StatusCode TrackSelectionAlg::execute()
 
   //if there is no primary vertex set to zero
   if(vertices->size() < 1){
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No vertex found => setting it to 0.0"<<endreq;
+    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
   TrackCollection* selectedTracks = new TrackCollection( SG::VIEW_ELEMENTS );
 
@@ -136,10 +136,10 @@ StatusCode TrackSelectionAlg::execute()
   TrackCollection::const_iterator trksItr  = tracks->begin();
   TrackCollection::const_iterator trksItrE = tracks->end();
   for (; trksItr != trksItrE; ++trksItr) {
-    
+
     Trk::Track* track = *trksItr;
     bool trackPassed = makeTrackCuts(track, zVtx);
-    if(trackPassed) selectedTracks->push_back(track);    
+    if(trackPassed) selectedTracks->push_back(track);
   }
 
   evtStore()->record(selectedTracks,m_outputTrackCol);
@@ -154,8 +154,8 @@ bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
   bool trackPassed = true;
 
   const Trk::Perigee* startPerigee = track->perigeeParameters();
-  
-  float theta = startPerigee->parameters()[Trk::theta];  
+
+  float theta = startPerigee->parameters()[Trk::theta];
   float qOverPt = startPerigee->parameters()[Trk::qOverP]/sin(theta);
   float charge = startPerigee->charge();
   float eta = startPerigee->eta();
@@ -164,7 +164,7 @@ bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
   float pT = (1/qOverPt)*(charge)/1000;
 
   float z0zVtx = (fabs(z0 - zVtx))*sin(theta);
-  
+
   //making kinematic cuts on tracks
   if(pT < m_trackMinPt) trackPassed = false;
   if(fabs(eta) > m_trackMaxEta) trackPassed = false;
@@ -172,9 +172,9 @@ bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
   if(z0zVtx > m_trackMaxVtxZ0) trackPassed = false;
   if(fabs(d0) > m_trackMaxD0) trackPassed = false;
 
-  const Trk::TrackSummary* summary = NULL;       
+  const Trk::TrackSummary* summary = NULL;
   summary = m_trackSumTool->createSummary(*track);
-  
+
   int nhtrt = 0;
   int nhtrtHT = 0;
   int nhpix = 0;
@@ -182,7 +182,7 @@ bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
   int nhblay = 0;
 
   if(summary==0){
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not create TrackSummary  - Track will likely fail hits requirements" << endreq;}  
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not create TrackSummary  - Track will likely fail hits requirements" << endmsg;}
   else{
 
     nhpix = summary->get(Trk::numberOfPixelHits);
@@ -191,7 +191,7 @@ bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
     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;
@@ -199,8 +199,8 @@ bool TrackSelectionAlg::makeTrackCuts(Trk::Track* track, float zVtx)
   if(nhtrt < m_minTRTHits) trackPassed = false;
   if(nhtrtHT < m_minTRTHitsHT) trackPassed = false;
 
-    
+
   delete summary;
-  
+
   return trackPassed;
 }
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
index 9c989e7b3d04824d3d8ffcd95dfa25614be17619..640781f43c30006d2ac178b6410495e41c6b44a3 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionAlg.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRACKSELECTIONALG_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
index 78678faab240a3e550ab9f869e30802c175c86cd..f7c75f40300aa92546400e4e042983e92f766027 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 // **********************************************************************
@@ -57,19 +57,19 @@ StatusCode InDetAlignMon::TrackSelectionTool::initialize()
   if ( ! m_useIDTrackSelectionTool )
     {
       if ( m_trackSelectorTool.retrieve().isFailure() ) {
-	msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackSelectorTool << endreq;
+	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 << endreq;
+	if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_trackSelectorTool << endmsg;
       }
     }
   else
     {
       if (   m_idtrackSelectionTool.retrieve().isFailure() ) {
-	msg(MSG::FATAL) << "Failed to retrieve tool " << m_idtrackSelectionTool << endreq;
+	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 << endreq;
+	if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_idtrackSelectionTool << endmsg;
       }
     }
   
@@ -112,10 +112,10 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
     const xAOD::VertexContainer* vxContainer = NULL;
     StatusCode sc = evtStore()->retrieve (vxContainer,m_VtxContainerName);
     if (sc.isFailure()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endmsg;
       return return_tracks; //return empty track collection (but not NULL)
     } else {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endmsg;
     }
 
     //loop over vertices and look for good primary vertex
@@ -131,7 +131,7 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
       
       if ((*vxIter)->nTrackParticles()==0 || (*vxIter)->nTrackParticles() < m_minTracksPerVtx) continue;
 
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a primary vertex built with " << (*vxIter)->nTrackParticles() << " tracks" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a primary vertex built with " << (*vxIter)->nTrackParticles() << " tracks" << endmsg;
       pVtx = *vxIter;//set pointer to identified primary vertex
       break;//best pvtx is the first one, so can quit loop once find it
     }
@@ -141,11 +141,11 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
   //if track collection cannot be found an empty track collection is returned
   StatusCode sc = evtStore()->retrieve(tracks,trackColName);
   if (sc.isFailure()) {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
     return return_tracks; //return empty track collection (but not NULL)
   } else {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
   }
     
   //TrackCollection::const_iterator trksItr  = tracks->begin();
@@ -160,16 +160,16 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
     
 
     if(m_passAllTracks) {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track automatically passes TrackSelectionTool since passAllTracks=True" << endreq;
+      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 
       return_tracks->push_back(const_cast<xAOD::TrackParticle*> (track) );
     }
     else {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Testing track using trackSelectorTool..." << endreq;
+      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" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Using primary vertex in track selection" << endmsg;
 
 	
 	if (m_useIDTrackSelectionTool)
@@ -181,7 +181,7 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
 	  trackPassed = m_trackSelectorTool->decision(*track,pVtx);
       }
       else {
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endmsg;
 
 	
 	if (m_useIDTrackSelectionTool)
@@ -200,7 +200,7 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
 	ComTime* theComTime(0);
 	StatusCode sc = evtStore()->retrieve(theComTime, m_commTimeName);
 	if(sc.isFailure()){
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endreq;
+	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endmsg;
 	  trackPassed = false;
 	}
 	
@@ -209,7 +209,7 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
 	  eventPhase = theComTime->getTime();
 	}
 	
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Event phase is " << eventPhase << endreq;
+	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) {
@@ -221,9 +221,9 @@ DataVector<xAOD::TrackParticle>* InDetAlignMon::TrackSelectionTool::selectTracks
       if(trackPassed) {
 	//selected_tracks->push_back(track);//allow only tracks that pass decision into the new collection
 	return_tracks->push_back(const_cast<xAOD::TrackParticle*> (track));
-	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track passed trackSelectorTool" << endreq;
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track passed trackSelectorTool" << endmsg;
       }
-      else if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endreq;
+      else if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endmsg;
     }
   }
 
@@ -247,10 +247,10 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
     const VxContainer* vxContainer = 0;
     StatusCode sc = evtStore()->retrieve (vxContainer,m_VtxContainerName);
     if (sc.isFailure()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endmsg;
       return selected_tracks; //return empty track collection (but not NULL)
     } else {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endmsg;
     }
 
     //loop over vertices and look for good primary vertex
@@ -261,7 +261,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
       if ((*vxIter)->recVertex().fitQuality().numberDoF() <= 0) continue;
       std::vector<Trk::VxTrackAtVertex*>* vxTrackAtVertex = (*vxIter)->vxTrackAtVertex();
       if (vxTrackAtVertex==0 || vxTrackAtVertex->size() < m_minTracksPerVtx) continue;
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a primary vertex built with " << vxTrackAtVertex->size() << " tracks" << endreq;
+      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
     }
@@ -271,11 +271,11 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
   //if track collection cannot be found an empty track collection is returned
   StatusCode sc = evtStore()->retrieve(tracks,trackColName);
   if (sc.isFailure()) {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
     return selected_tracks; //return empty track collection (but not NULL)
   } else {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
   }
     
   TrackCollection::const_iterator trksItr  = tracks->begin();
@@ -285,15 +285,15 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
     Trk::Track* track = *trksItr;
 
     if(m_passAllTracks) {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track automatically passes TrackSelectionTool since passAllTracks=True" << endreq;
+      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..." << endreq;
+      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" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Using primary vertex in track selection" << endmsg;
 
 	
 	if (m_useIDTrackSelectionTool)
@@ -305,7 +305,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
 	  trackPassed = m_trackSelectorTool->decision(*track,pVtx);
       }
       else {
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endmsg;
 
 	
 	if (m_useIDTrackSelectionTool)
@@ -324,7 +324,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
 	ComTime* theComTime(0);
 	StatusCode sc = evtStore()->retrieve(theComTime, m_commTimeName);
 	if(sc.isFailure()){
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endreq;
+	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endmsg;
 	  trackPassed = false;
 	}
 	
@@ -333,7 +333,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
 	  eventPhase = theComTime->getTime();
 	}
 	
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Event phase is " << eventPhase << endreq;
+	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) {
@@ -344,9 +344,9 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks(const st
       
       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" << endreq;
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track passed trackSelectorTool" << endmsg;
       }
-      else if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endreq;
+      else if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endmsg;
     }
   }
 
@@ -375,10 +375,10 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
     const xAOD::VertexContainer* vxContainer = NULL;
     StatusCode sc = evtStore()->retrieve (vxContainer,m_VtxContainerName);
     if (sc.isFailure()) {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No PrimVtxCollection with name  "<<m_VtxContainerName<<" found in StoreGate" << endmsg;
       return return_tracks; //return empty track collection (but not NULL)
     } else {
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "PrimVtxCollection with name  "<<m_VtxContainerName<< " with nvertices =  " << vxContainer->size() <<" found  in StoreGate" << endmsg;
     }
 
     //loop over vertices and look for good primary vertex
@@ -394,7 +394,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
 
       if ((*vxIter)->nTrackParticles()==0 || (*vxIter)->nTrackParticles() < m_minTracksPerVtx) continue;
 
-      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a primary vertex built with " << (*vxIter)->nTrackParticles() << " tracks" << endreq;
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found a primary vertex built with " << (*vxIter)->nTrackParticles() << " tracks" << endmsg;
       pVtx = *vxIter;//set pointer to identified primary vertex
       break;//best pvtx is the first one, so can quit loop once find it
     }
@@ -407,11 +407,11 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
   StatusCode sc = evtStore()->retrieve(tracks,"InDetTrackParticles");
 
   if (sc.isFailure()) {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
     return return_tracks; //return empty track collection (but not NULL)
   } else {
-    if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "TrackCollection with name "<<trackColName<<" found in StoreGate" << endmsg;
+    if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
   }
     
   //TrackCollection::const_iterator trksItr  = tracks->begin();
@@ -429,22 +429,22 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
    
     if (!trk_p)
       {
-	msg(MSG::DEBUG)<<" IDAlignMon::TrackSelectorTool  ---NULL TRACK POINTER--- skipping track"<<endreq;
+	msg(MSG::DEBUG)<<" IDAlignMon::TrackSelectorTool  ---NULL TRACK POINTER--- skipping track"<<endmsg;
 	continue;
       }
 
         
     if(m_passAllTracks) {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track automatically passes TrackSelectionTool since passAllTracks=True" << endreq;
+      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 
       return_tracks->push_back(trk_p);
     }
     else {
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Testing track using trackSelectorTool..." << endreq;
+      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" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Using primary vertex in track selection" << endmsg;
 
 	
 	if (m_useIDTrackSelectionTool)
@@ -456,7 +456,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
 	  trackPassed = m_trackSelectorTool->decision(*track,pVtx);
       }
       else {
-	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endreq;
+	if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Not using primary vertex in track selection" << endmsg;
 
 	
 	if (m_useIDTrackSelectionTool)
@@ -475,7 +475,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
 	ComTime* theComTime(0);
 	StatusCode sc = evtStore()->retrieve(theComTime, m_commTimeName);
 	if(sc.isFailure()){
-	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endreq;
+	  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ComTime object not found with name TRT_Phase !!!" << endmsg;
 	  trackPassed = false;
 	}
 	
@@ -484,7 +484,7 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
 	  eventPhase = theComTime->getTime();
 	}
 	
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Event phase is " << eventPhase << endreq;
+	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) {
@@ -496,9 +496,9 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracksNew(const
       if(trackPassed) {
 	//selected_tracks->push_back(track);//allow only tracks that pass decision into the new collection
 	return_tracks->push_back(trk_p);
-	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track passed trackSelectorTool" << endreq;
+	if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track passed trackSelectorTool" << endmsg;
       }
-      else if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endreq;
+      else if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Track failed trackSelectorTool" << endmsg;
     }
   }
 
@@ -522,11 +522,11 @@ DataVector<Trk::Track>* InDetAlignMon::TrackSelectionTool::selectTracks()
 
   StatusCode sc = evtStore()->retrieve(tracks,m_trackColName);
   if (sc.isFailure()) {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<m_trackColName<<" found in StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrackCollection with name "<<m_trackColName<<" found in StoreGate" << endmsg;
     return selected_tracks; //return empty track collection (but not NULL)
   } else {
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_trackColName<<" found in StoreGate" << endreq;
-    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endreq;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TrackCollection with name "<<m_trackColName<<" found in StoreGate" << endmsg;
+    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieved "<< tracks->size() <<" reconstructed tracks from StoreGate" << endmsg;
   }
 
   TrackCollection::const_iterator trksItr  = tracks->begin();
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
index df8d64b9c041795a1598df4ae1d43128e98aa61d..3ba4312adadea0b268f49a9d33ec612d89017ef5 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRACKSELECTIONTOOL_H
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.C b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/BeamSpotCalculator.C
deleted file mode 100644
index b73dc4e8a2afe22e291f8d26118a02210c26850d..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());
-
-  _hd0phi0z0_prof = _hd0phi0z0->Project3DProfile("yx");
-
-  if (_hd0phi0z0 == NULL) {
-    cout << " ** BeamSpotCalculator::Initialize ** ERROR ** histogram " << hisname.c_str() << " ** Not found ** " << endl;
-    exit(-1); // leave program
-  }
-  else 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 b3eccac126a33d924679749a9576c38cfd6b3f9e..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(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(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 383c899793cd10299a95eed95936504c257614f2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h
+++ /dev/null
@@ -1,165 +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 3
-#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 = false;
-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_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 = 12.; //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::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); 
-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_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 4a0c9dfb360c2724cb76a84fd063806587484e22..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 += 3.14159265;
-    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 ef18a281b57bdc411d76b56c27978adc0ac5972e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/AtlasUtils.C
+++ /dev/null
@@ -1,341 +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"); 
-
-
-  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;
-
- 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 f038c07e7c0cb8f2a964d3f6921ae5b8c5da8006..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelRes.cc
+++ /dev/null
@@ -1,87 +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) {
-	TH1F *hSCTBarrelRes[3];
-	TH1F *hSCTBarrelRes_2[3];
-	
-	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<4; 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 8fe1e4a441e3e72f64502777ec34fcb9d7e8f27f..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/macros/sctBarrelResVsPt.cc
+++ /dev/null
@@ -1,92 +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) {
-	TProfile *hSCTBarrelResVsPt[3];
-	TProfile *hSCTBarrelResVsPt_2[3];
-	
-	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<4; 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 ead1ff86172956eb218ded9e9223337568ecb384..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/reweight.C
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TFile.h"
-#include<string.h>
-#include<stdio.h>
-#include "TCanvas.h"
-#include "TString.h"
-#include "TProfile2D.h"
-#include <iostream>
-
-using namespace std;
-
-
-
-void reweight(string  mcname, string  dtname)
-{
-
-  TFile *mcfile = new TFile(mcname.c_str());
-  TFile *dtfile = new TFile(dtname.c_str());
-
-  string histoName("trk_pT_vs_eta");
-  string path("IDAlignMon/ExtendedTracks_noTrigSel_15GeV/GenericTracks/");
-  string hh = path + histoName;
-  cout << "name " << hh << endl;
-
-  TH2F * mchisto = (TH2F*) mcfile->GetObjectUnchecked( hh.c_str() );
-  TH2F * dthisto = (TH2F*) dtfile->GetObjectUnchecked( hh.c_str() );
-
-  // mchisto->Scale(1./mchisto->Integral());
-  // dthisto->Scale(1./dthisto->Integral());
-
-  //  
-  // 
-  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/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py
new file mode 100644
index 0000000000000000000000000000000000000000..84c7eac41ae7a1462a02e7db29249309567de53c
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py
@@ -0,0 +1,498 @@
+#!/usr/bin/env python                                                                                                                                                                    
+m_year = 2017
+m_storingFolder = ""
+m_recordsFileName = ""
+m_athenaVersion = ""
+m_testArea = ""
+m_theUser = ""
+m_scriptName = "runzmumu_UserConstants.py"
+m_savingFile = "acZmumu_commands.txt"
+
+# options
+m_minEvents = 10000
+m_submitExec = False
+m_firstRun = 0
+m_lastRun = 999999
+m_userLabel = ""
+m_userRun = 0
+m_dataType = "DESDM_MCP"
+m_dataProject = "data17_13TeV"
+m_userFiles = 0 # this means all the files
+m_amitag = "%"
+
+###################################################################################################
+def findListOfDataSets():
+    import os
+
+    listOfDataSets = []
+    #ami list datasets data18_13TeV.%.physics_Main.merge.DESDM_ZMUMU%
+    theAMIsearchCommand = "ami list datasets %s.%%.physics_Main.merge.%s.%s --order run_number --fields events,nfiles"  %(m_dataProject, m_dataType, m_amitag)
+    #theAMIsearchCommand = "ami list datasets %s.%%.physics_Main.merge.%s.%%"  %(m_dataProject, m_dataType)
+    print (" <acZmumu> AMI data set search command: \n  -->  %s" %(theAMIsearchCommand))
+
+    amiReturn = os.popen(theAMIsearchCommand).readlines()
+
+    for theLine in amiReturn:
+        #if m_dataProject in theLine:
+        lineWithContent = True
+        if ("----------" in theLine): 
+            lineWithContent = False # this way add the main line and the trailing lines. Remove the splitting lines
+        if ("events" in theLine):
+            lineWithContent = False # remove the header
+
+        if (lineWithContent):
+            theLine.rstrip() # remove trailing blank spaces
+            listOfDataSets.append(theLine) # add this data set
+    
+    return listOfDataSets
+
+###################################################################################################
+def checkOnFolder (folderName):
+    import os
+    folderReady = True
+
+    # first check if folders exist
+    if (os.path.exists(folderName)):
+        print (" <acZmumu> reports folder already exists: %s " %(folderName))
+        # check if folder is writeable                                                                                                                                                   
+        if (not os.access(folderName, os.W_OK)):
+            print (" <acZmumu> ** ERROR ** Folder %s is not writeable STOP execution. " %(folderName)) 
+            folderReady = False
+        # end of folder not writeable
+            
+    else: 
+        # if folder does not exist, then make a new folder
+        try:
+            os.mkdir(folderName)
+            print (" <acZmumu> New folder %s created successfully" %(folderName))
+        except:
+            print (" <acZmumu> problems creating folder %s. STOP execution. \n " %(folderName))
+            folderReady = False
+                   
+    return folderReady
+                   
+###################################################################################################
+def getYear ():
+    theYear = m_year
+    
+    if ('data18' in m_dataProject):
+        theYear = 2018
+
+    return theYear
+
+###################################################################################################
+def preliminaries ():
+    import os
+    global m_storingFolder
+    global m_athenaVersion
+    global m_testArea
+    global m_theUser
+
+    m_athenaVersion, m_testArea, m_theUser = getAthenaBasics () 
+    m_year = getYear ()
+
+    # reports folder
+    folderName = "ReportsFolder"
+    folderReady = checkOnFolder (folderName)
+    if (not folderReady): exit()
+ 
+    # folder of the current year
+    folderName = "%s/%s" %(folderName, m_year)              
+    folderReady = checkOnFolder (folderName)
+    if (not folderReady): exit()
+
+    # folder of the data project
+    folderName = "%s/%s" %(folderName, m_dataProject)              
+    folderReady = checkOnFolder (folderName)
+    if (not folderReady): exit()
+
+    m_storingFolder = folderName
+    print (" <acZmumu> Storing output in folder: %s" %(m_storingFolder))
+
+    return
+
+###################################################################################################
+def extractRunsAndProperties (listOfDataSets):
+
+    # the list of data sets can contain dummy lines
+    infoFromAMI = {}
+
+    if (len(listOfDataSets)>0):
+        print (" <acZmumu> #data sets= %d" %(len(listOfDataSets)))
+        # extract data set name
+        # first is the data project
+        for theLine in listOfDataSets: 
+            # lines with the main data (warning: there could be lines with left over content
+            # Warning: there could be some dataset name left over in the next line
+            if(m_dataProject in theLine):
+                # usual procedure on each line as new data set is found
+                tempString = theLine[1:] # already remove the first "|"
+                theDataSet = tempString[1:tempString.find("|")] # start from character 1 to avoid blank space
+                theDataSet.rstrip()
+                print " Data set: ", theDataSet
+                # remove the data project and the point behind
+                tempString = tempString[tempString.find(m_dataProject) + len(m_dataProject) +1:]
+                theRunNumber = int(tempString[:tempString.find(".")])
+                print " Run number: ", theRunNumber
+                # finding number events
+                tempString = tempString[tempString.find("|")+1:]
+                theNumberOfEvents = int(tempString[:tempString.find("|")])
+                print " Number of events: ", theNumberOfEvents
+                # finding number of files
+                tempString = tempString[tempString.find("|")+1:]
+                theNumberOfFiles = int(tempString[:tempString.find("|")])
+                print " Number of files: ", theNumberOfFiles
+                print ("")
+                infoFromAMI[theRunNumber] = {}
+                infoFromAMI[theRunNumber]["dataset"] = theDataSet[:len(theDataSet)-1] # trick to remove a trailing blank space
+                infoFromAMI[theRunNumber]["events"] = theNumberOfEvents
+                infoFromAMI[theRunNumber]["nfiles"] = theNumberOfFiles
+                if (m_userFiles > 0): infoFromAMI[theRunNumber]["nfiles"] = m_userFiles
+
+            if (m_dataProject not in theLine):
+                # this means this line has leftover content
+                tempString = theLine[1:] # already remove the first "|"
+                theDataSet = tempString[1:tempString.find("|")] # start from character 1 to avoid blank space
+                theDataSet = theDataSet[:theDataSet.find(" ")] # remove trailing blanks
+                infoFromAMI[theRunNumber]["dataset"] = "%s%s" %(infoFromAMI[theRunNumber]["dataset"],theDataSet)
+                continue
+    else:
+        print (" <acZmumu> ERROR ** list of data sets is empty. Stop Execution")
+        exit ()
+
+    return infoFromAMI
+
+###################################################################################################                                                                                
+def extractInfoFromFile ():
+    import os
+    import datetime
+    global m_recordsFileName
+
+    # current time and date
+    now = datetime.datetime.now()
+
+    # check if recordsfile exist
+    
+    recordsFileName = "%s/%s.log" %(m_storingFolder, "Zmumu_reports")
+    if (os.path.isfile(recordsFileName)):
+        print (" <acZmumu> Reading %s" %(recordsFileName))
+    else:
+        # create file
+        recordsFile = open(recordsFileName, "w")
+        recordsFile.write("# Zmumu records file for %s #  File created: %s " %(m_dataProject, now.strftime("%Y-%m-%d %H:%M")))
+        recordsFile.close()
+
+    # store it in the global variable
+    m_recordsFileName = recordsFileName
+
+    # init tuple
+    infoFromRecordsFile = {}
+    
+    # redfile and dump into a list of lines
+    linesInRecordsFile = open(recordsFileName,"r").readlines()
+
+    runCount = 0
+    for theLine in linesInRecordsFile:
+        wordsInLine = theLine.split(":");
+        print (" next line: %s" %(theLine))
+        if ("#" in wordsInLine[0]): # comment line -> skip
+            continue
+        runNumber = int(wordsInLine[0])
+        if m_dataProject in theLine:
+            runCount += 1
+            infoFromRecordsFile[runNumber] = theLine
+            
+    print (" <acZmumu> %d runs found in %s" %(runCount, recordsFileName))  
+
+    return infoFromRecordsFile
+
+###################################################################################################                                                                                
+def crossCheckInfo(infoFromAMI, infoFromRecordsFile):
+    # check if the runs from AMI are already known (stored in the infoFromRecordsFile).
+    # If not --> flag them as new
+    listOfNewRuns = []
+    listOfPendingRuns = []
+
+    if (len(infoFromAMI)>0):
+        for runInAMI in infoFromAMI:
+            runFound = False
+            if (len(infoFromRecordsFile)>0):
+                for runInFile in infoFromRecordsFile:
+                    print (" <acZmumu> crosscheckInfo: ami run %d vs file run %d" %(runInAMI, runInFile))
+                    if (runInAMI == runInFile):
+                        runFound = True
+            print (" <acZmumu> crosscheckInfo: ami run %d found in file list? %r" %(runInAMI,runFound))
+            if (not runFound or runToAdd):
+                listOfNewRuns.append(runInAMI)
+            else:
+                # maybe run is found but the analysis is not completed
+                # the logics must be formulated
+                if ("NEW" in infoFromRecordsFile[runInFile]["status"]):
+                    # this run is pending
+                    listOfPendingRuns.append(runInAMI)
+
+    print (" <acZmumu> List of new runs has: %d items " %len(listOfNewRuns)) 
+
+    return (listOfNewRuns, listOfPendingRuns)
+
+###################################################################################################                                                                                
+def submitGridJobs (infoFromAMI, listOfNewRuns, listOfPendingRuns):
+    import os
+
+    listOfSubmittedRuns = []
+    # lets merge both list: new and pending
+    listOfRunsToSubmit = [] 
+    for runNumber in listOfNewRuns:
+        listOfRunsToSubmit.append(runNumber)
+    for runNumber in listOfPendingRuns:
+        listOfRunsToSubmit.append(runNumber)
+
+    for runNumber in listOfRunsToSubmit:
+        print (" <acZmumu> dealing with new run: %d" %(runNumber))
+        readyForSubmission = True
+        theRunProperties = infoFromAMI[runNumber]
+        runEvents = int(theRunProperties["events"])
+        runEvents = int(infoFromAMI[runNumber]["events"])
+        # check stats
+        if (runEvents < m_minEvents):
+            readyForSubmission = False
+            infoFromAMI[runNumber]["status"] = "LOW_STATS"
+            infoFromAMI[runNumber]["attempt"] = 0
+
+        # check if run number within range
+        if (runNumber < m_firstRun):
+            readyForSubmission = False
+            infoFromAMI[runNumber]["status"] = "NOT_SELECTED"
+            infoFromAMI[runNumber]["attempt"] = 0
+
+        # check if run number within range
+        if (runNumber > m_lastRun):
+            readyForSubmission = False
+            infoFromAMI[runNumber]["status"] = "NOT_SELECTED"
+            infoFromAMI[runNumber]["attempt"] = 0
+
+        # if ready for submission -> get command
+        if (readyForSubmission):
+            print ("\n <acZmumu> runNumber %d has %d events.  Is ready for submission? %r" %(runNumber, runEvents, readyForSubmission))
+            infoFromAMI[runNumber]["status"] = "NEW"
+            infoFromAMI[runNumber]["attempt"] = 0
+            infoFromAMI[runNumber]["jeditaskid"] = 0
+            theCommand = getGridSubmissionCommand(runNumber, infoFromAMI)
+            print  (" <acZmumu> GRID submission command: \n %s" %(theCommand))
+            listOfSubmittedRuns.append(runNumber)
+            if (m_submitExec): 
+                print (" <acZmumu> m_submitExec = True --> jobs would be submmited");
+                # move to the submission folder
+                submissionPath = "%s/run" %(m_testArea) 
+                os.chdir(submissionPath)
+                print (" <acZmumu> path: %s" %(submissionPath))
+                os.system(theCommand)
+                infoFromAMI[runNumber]["status"] = "SUBMITTED"
+                infoFromAMI[runNumber]["jeditaskid"] = 1
+                infoFromAMI[runNumber]["attempt"] = infoFromAMI[runNumber]["attempt"] + 1
+
+    return listOfSubmittedRuns
+
+###################################################################################################                                                                                
+def getAthenaBasics ():
+    import os
+
+    testArea = ""
+    try:
+        testArea = os.getenv("TestArea","")
+    except:
+        print (" <acZmumu> ERROR ** no Athena TestArea defined --> job submission is not possible. STOP execution")
+        exit()
+
+    theUser = ""
+    try:
+        theUser = os.getenv("USER","")
+    except:
+        print (" <acZmumu> ERROR ** no USER defined --> job submission is not possible. STOP execution")
+        exit()
+
+    athenaVersion = ""
+    try:
+        athenaVersion = os.getenv("AthenaExternals_VERSION","")
+    except:
+        print (" <acZmumu> ERROR ** no Athena TestArea defined --> job submission is not possible. STOP execution")
+        exit()
+
+    # voms proxy must be initiated
+    goodVoms = True
+    vomsInfoReturn = os.popen("voms-proxy-info").readlines()
+    if (len(vomsInfoReturn)>0):
+        lineCount = 0
+        for theLine in vomsInfoReturn:
+            lineCount += 1
+            if ("Proxy not found" in theLine):
+                goodVoms = False
+    else: 
+        goodVoms = False
+        
+    if (not goodVoms):
+        print (" <acZmumu> ERROR ** no voms initiated --> It is not possible to consult AMI. Stop execution")
+        exit()
+
+    return (athenaVersion, testArea, theUser)
+
+###################################################################################################                                                                                
+def getGridSubmissionCommand(runNumber, infoFromAMI):
+    import os
+    # build the command for submission
+
+    #theScript = "%s/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_run2paper.py" %(m_testArea)
+    theScript = "%s/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/%s" %(m_testArea, m_scriptName)
+    theInput = "--inDS=%s" %(infoFromAMI[runNumber]["dataset"])
+    theOutput = "--outDS=user.%s.%s_%s_%d_Zmumu_%s_%d " %(m_theUser, m_athenaVersion, m_dataProject, runNumber, m_userLabel, infoFromAMI[runNumber]["attempt"])
+    #theOptions = "--nfiles %d --useShortLivedReplicas  --forceStaged --nFilesPerJob %d" %(infoFromAMI[runNumber]["nfiles"], 20)
+    theOptions = "--nfiles %d --useShortLivedReplicas  --forceStaged" %(infoFromAMI[runNumber]["nfiles"])
+    
+    theCommand = "pathena %s %s %s %s" %(theScript, theInput, theOutput, theOptions)
+
+    return theCommand
+
+###################################################################################################                                                                                
+def updateRecordsFile(listOfSubmittedRuns, infoFromAMI):
+
+    print (" <acZmumu> updateRecordsFile --> %s " %(m_recordsFileName))
+    fileToUpdate = open(m_recordsFileName, "a");
+    fileToUpdate.write("\n")
+    for runNumber in listOfSubmittedRuns:
+        fileToUpdate.write("%d:%s\n" %(runNumber, infoFromAMI[runNumber]))
+    
+    fileToUpdate.close()
+
+    return
+
+###################################################################################################                                                                                
+def welcomeBanner ():
+    
+    print ("\n \n")
+    print ("        **************************")
+    print ("        *  Automated Zmumu check *")
+    print ("        **************************")
+    print ("\n")
+    print ("  config:")
+    print ("  ** Exec: %r" %m_submitExec)
+    print ("  ** data project: %s " %m_dataProject)
+    print ("  ** min events: %d"  %m_minEvents)
+    print ("  ** min Run: %d"  %m_firstRun)
+    print ("  ** max Run: %d"  %m_lastRun)
+    print ("  ** data type: %s"  %m_dataType)
+    if (m_userFiles == 0):
+        print ("  ** use all available files ")
+    if (m_userFiles > 0):
+        print ("  ** user requested files: %d" %m_userFiles)
+    print ("  ** AMI tag: %s" %m_amitag) 
+    print ("\n")
+
+    return
+###################################################################################################                                                                                
+def endBanner ():
+    
+    print ("\n")
+    print ("   GAME OVER. INSERT COIN \n")
+
+    return
+###################################################################################################
+def optParsing():
+    from optparse import OptionParser
+
+    p_submitExec = False
+    p_minEvents = m_minEvents
+    p_firstRun = m_firstRun
+    p_lastRun = m_lastRun
+    p_userLabel = m_userLabel
+    p_userRun = m_userRun
+    p_dataType = m_dataType 
+    p_userFiles = m_userFiles
+    p_amitag = m_amitag
+    p_dataProject = m_dataProject
+
+    parser = OptionParser()
+    parser.add_option("--amiTag", dest="p_amitag", help="Name of the requested AMI tag (example: r10258_r10258_p3399). Wild card is also possible. Default %s" %(p_amitag), default = p_amitag)
+    parser.add_option("--dataProject", dest="p_dataProject", help="data project of the data sets (examples: data17_13TeV). Default %s" %(p_dataProject), default = p_dataProject)
+    parser.add_option("--dataType", dest="p_dataType", help="User defined data type (examples: DAOD_ZMUMU, DESDM_MCP). Default %s" %(p_dataType), default = p_dataType)
+    parser.add_option("--EXEC", dest="p_submitExec", help="Submit the Grid jobs. Default: no submission", action="store_true", default = False)
+    parser.add_option("--firstRun", dest="p_firstRun", help="First run number (inclusive). Default %s" %(p_firstRun), default = p_firstRun)    
+    parser.add_option("--lastRun", dest="p_lastRun", help="Last run number (inclusive). Default %s" %(p_lastRun), default = p_lastRun)
+    parser.add_option("--minEvents", dest="p_minEvents", help="Minimum number of events. Default %s" %(p_minEvents), default = p_minEvents)
+    parser.add_option("--run", dest="p_userRun", help="Run number in case of targetting a single run. Default %s" %(p_userRun), default = p_userRun)
+    parser.add_option("--nFiles", dest="p_userFiles", help="User defined number of files. Default %s = all the available files" %(p_userFiles), default = p_userFiles)
+    parser.add_option("--userLabel", dest="p_userLabel", help="User defined label. Default %s" %(p_userLabel), default = p_userLabel)
+
+    (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:])
+
+    return config
+
+###################################################################################################                                                                                
+def saveCommandLine (theCommandLine):
+    import os
+    import datetime
+    global m_savingFile
+
+    # current time and date
+    now = datetime.datetime.now()
+    fileReady = False
+
+    # first check if file exist                                                                                                                                                  
+    if (os.path.exists(m_savingFile)):
+        fileReady = True
+    
+    # file already exists
+    if (fileReady):
+        theOutputFile = open(m_savingFile,"a")
+    else:
+        theOutputFile = open(m_savingFile,"w")
+
+    # write
+    theOutputFile.write("%s => python %s\n" %(now.strftime("%Y-%m-%d %H:%M:%S"),theCommandLine))
+    # close
+    theOutputFile.close()    
+
+    return
+
+##########################################################                                                                                                                        
+#             Main code                                  #                                                                                                                         
+##########################################################                                                                                                                              
+if __name__ == '__main__':
+    import sys
+
+    saveCommandLine (' '.join(sys.argv))
+    config = optParsing()
+    m_dataType = config.p_dataType
+    m_submitExec = config.p_submitExec
+    m_minEvents = int(config.p_minEvents)
+    m_firstRun = int(config.p_firstRun)
+    m_lastRun = int(config.p_lastRun)
+    m_userLabel = config.p_userLabel
+    m_userRun = int(config.p_userRun)
+    if (m_userRun > 0): # user provides a useful run number
+        m_firstRun = m_userRun
+        m_lastRun = m_userRun
+    m_userFiles = int(config.p_userFiles)
+    m_amitag = config.p_amitag
+    m_dataProject = config.p_dataProject
+
+    welcomeBanner ()
+    preliminaries ()
+    # extract info from AMI
+    listOfDataSets = findListOfDataSets ()
+    infoFromAMI = extractRunsAndProperties (listOfDataSets)
+    #
+    infoFromRecordsFile = extractInfoFromFile ()
+
+    # now: crosschek the info from AMI and the records file flag new runs
+    (listOfNewRuns, listOfPendingRuns) = crossCheckInfo(infoFromAMI, infoFromRecordsFile)
+
+    # submit the necessary jobs
+    listOfSubmitedRuns = submitGridJobs (infoFromAMI, listOfNewRuns, listOfPendingRuns)
+
+    # store new status
+    updateRecordsFile(listOfSubmitedRuns, infoFromAMI)
+
+    endBanner ()
+#
+    
+
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt
index 2eb83e06150f47626332b13f2ce42eb7d371d7bd..de35af63df0f362e3ec2afe88f218911dfce4f9c 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/CMakeLists.txt
@@ -22,6 +22,8 @@ atlas_depends_on_subdirs( PUBLIC
                           Generators/GeneratorObjects
                           InnerDetector/InDetDetDescr/InDetReadoutGeometry
                           InnerDetector/InDetRecEvent/InDetRIO_OnTrack
+			  InnerDetector/InDetConditions/InDetBeamSpotService	
+			  InnerDetector/InDetRecTools/TrackVertexAssociationTool
                           PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools
                           Reconstruction/Jet/JetInterface
                           Reconstruction/RecoTools/ITrackToVertex
@@ -36,11 +38,13 @@ atlas_depends_on_subdirs( PUBLIC
                           Event/EventPrimitives
                           InnerDetector/InDetDetDescr/InDetIdentifier
                           InnerDetector/InDetRecEvent/InDetPrepRawData
+			  InnerDetector/InDetRecTools/InDetTrackSelectionTool
                           Reconstruction/egamma/egammaInterfaces
                           Tracking/TrkEvent/TrkEventPrimitives
                           Tracking/TrkEvent/TrkTrackSummary
                           Tracking/TrkEvent/TrkTruthData
                           Tracking/TrkEvent/TrkV0Vertex
+			  Tracking/TrkVertexFitter/TrkVertexFitterInterfaces
                           Tracking/TrkVertexFitter/TrkVertexAnalysisUtils
                           Trigger/TrigAnalysis/TrigDecisionTool )
 
@@ -56,13 +60,13 @@ atlas_add_library( InDetPerformanceMonitoringLib
                    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
                    DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry InDetRIO_OnTrack JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack AthenaMonitoringLib StoreGateLib SGtests ElectronPhotonSelectorToolsLib TrkVertexAnalysisUtilsLib TrigDecisionToolLib
+                   LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry InDetRIO_OnTrack InDetTrackSelectionTool JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack AthenaMonitoringLib StoreGateLib SGtests ElectronPhotonSelectorToolsLib TrkVertexAnalysisUtilsLib TrigDecisionToolLib TrackVertexAssociationTool
                    PRIVATE_LINK_LIBRARIES ${HEPMC_LIBRARIES} IdDictDetDescr EventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex )
 
 atlas_add_component( InDetPerformanceMonitoring
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib StoreGateLib SGtests xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry InDetRIO_OnTrack ElectronPhotonSelectorToolsLib JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack IdDictDetDescr EventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex TrkVertexAnalysisUtilsLib TrigDecisionToolLib InDetPerformanceMonitoringLib )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib StoreGateLib SGtests xAODCaloEvent xAODEgamma xAODJet xAODMissingET xAODMuon xAODTracking xAODTruth GaudiKernel GeneratorObjects InDetReadoutGeometry InDetRIO_OnTrack ElectronPhotonSelectorToolsLib JetInterface ITrackToVertex egammaEvent LWHists TrkParameters TrkParticleBase TrkTrack IdDictDetDescr EventInfo EventPrimitives InDetIdentifier InDetPrepRawData TrkEventPrimitives TrkTrackSummary TrkTruthData TrkV0Vertex TrkVertexAnalysisUtilsLib TrigDecisionToolLib InDetPerformanceMonitoringLib TrackVertexAssociationTool )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/EventAnalysis.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/EventAnalysis.h
index 38ccc56f6f5706df3ed51e777ff00a7defe6c858..693612f5514576b692926e7f36ebb4dab3e1124b 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/EventAnalysis.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/EventAnalysis.h
@@ -1,7 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 // Bit of an abstract class ( not in the C++ sense )
 // designed to apply a bunch of cuts & chop up the data
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonEoverP.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonEoverP.h
index 699aa70527c6c4447b76a2410b4977930bd5af4d..9f16ab27df5b918f69909e3b1873219ca658308c 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonEoverP.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonEoverP.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPerfMonEoverP_H
 #define IDPerfMonEoverP_H
@@ -94,7 +94,7 @@ class IDPerfMonEoverP : public AthAlgorithm
  private:
   /** @brief addToValidationNutple*/
   void addToValidationNtuple(const Trk::Perigee*, const xAOD::CaloCluster*,  int isOrginal);
-
+  void addToValidationNtuplexAOD(const xAOD::Electron *eg) const;
   void clearValidationNtuple();
 
   void validationAction() const;
@@ -212,6 +212,9 @@ class IDPerfMonEoverP : public AthAlgorithm
   mutable int                     m_nTRT[NOS_ELECTRONS];
   mutable int                     m_nSCT[NOS_ELECTRONS];
   mutable int                     m_nBLayer[NOS_ELECTRONS];
+  mutable int                     m_nBLayerOutlier[NOS_ELECTRONS];
+  mutable int                     m_nexpectBLayer[NOS_ELECTRONS];
+  mutable int                     m_nBLayerHitPlusOutlier[NOS_ELECTRONS];
   mutable int                     m_nPIX[NOS_ELECTRONS];
   mutable int                     m_nTRTout[NOS_ELECTRONS];
   mutable int                     m_nSCTout[NOS_ELECTRONS];
@@ -292,6 +295,7 @@ class IDPerfMonEoverP : public AthAlgorithm
   TH2F *  m_WenuTightElectron_PTEtaPos;
   TH2F *  m_WenuTightElectron_PTEtaNeg;
 
+  TH1F *  m_LHResult; // result of electron likelihood for each electron (debug purposes)
 
   //!< validation tree name - to be acessed by this from root
   std::string                     m_smallValidationTreeName;
@@ -302,6 +306,8 @@ class IDPerfMonEoverP : public AthAlgorithm
   //!< Root Validation Tree
   TTree*                          m_smallValidationTree;
 
+  // Flag for xAOD
+  bool                            m_isxAOD;
 
   double m_small_QoverP;
   double m_small1_QoverP;
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonJpsimumu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonJpsimumu.h
new file mode 100644
index 0000000000000000000000000000000000000000..75197db1bb0fe399caef223e829d3ca8af74b18a
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonJpsimumu.h
@@ -0,0 +1,140 @@
+#ifndef IDPERFMON_ZMUMU_H
+#define IDPERFMON_ZMUMU_H
+
+//==============================================================================
+// Include files...
+//==============================================================================
+#include "AthenaMonitoring/ManagedMonitorToolBase.h"
+#include "InDetPerformanceMonitoring/JpsimumuEvent.h"
+#include "InDetPerformanceMonitoring/EventAnalysis.h"
+
+//#include "TrkFitterInterfaces/ITrackFitter.h"
+#include "xAODTruth/TruthVertex.h"
+#include "xAODTruth/TruthParticle.h"
+//#include "xAODTruth/xAODTruthHelpers.h"
+#include "xAODTruth/TruthParticleContainer.h"
+#include "ITrackToVertex/ITrackToVertex.h"
+
+
+#include "GeneratorObjects/xAODTruthParticleLink.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/EgammaTruthxAODHelpers.h"
+
+#include <map>
+#include "TH1.h"
+#include "TH2.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+
+#include "AthenaBaseComps/AthAlgorithm.h"
+
+#include "GaudiKernel/ToolHandle.h"
+
+
+class IegammaTrkRefitterTool;
+
+
+class IDPerfMonJpsimumu : public AthAlgorithm
+{
+ public:
+  // Constructors & destructors
+
+  IDPerfMonJpsimumu(const std::string& name, ISvcLocator* pSvcLocator);
+
+  ~IDPerfMonJpsimumu();
+
+  // Overriden class functions.
+  virtual StatusCode initialize();
+  virtual StatusCode execute();
+  virtual StatusCode finalize();
+
+ protected:
+
+ private:
+  // Private class member functions.
+  void RegisterHistograms();
+  void FillRecParameters(const Trk::Track* track, double charge);
+    //void FillRecParameters(const xAOD::TrackParticle* trackparticle, double charge);
+  StatusCode FillTruthParameters(const xAOD::TrackParticle* track);
+  const xAOD::TruthParticle* getTruthParticle( const xAOD::IParticle& p );
+
+  // The Z0 tagger.
+  JpsimumuEvent     m_xZmm;
+  bool m_doIsoSelection;
+  bool m_isMC;
+  std::vector<std::string> m_regions;
+
+  /** @brief The track refitter */
+  ToolHandle<IegammaTrkRefitterTool>  m_TrackRefitter1;
+
+  /** @brief The track refitter */
+  ToolHandle<IegammaTrkRefitterTool>  m_TrackRefitter2;
+
+  /** @brief tool to extrapolate tracks to BL*/
+  ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool;
+
+  //Validation Ntuple Stuff
+  //!< boolean to switch to validation mode
+  bool                            m_validationMode;
+
+  //!< validation tree name - to be acessed by this from root
+  std::string                     m_defaultTreeName;       //Default ID Tracks
+  std::string                     m_refit1TreeName;        //Refit ID Tracks
+  std::string                     m_refit2TreeName;        //Refit ID Tracks
+  std::string                     m_truthTreeName;         //Truth Tracks
+  //  std::string                     m_meStacoTreeName;       //Extrapolated Staco not existent in xAOD anymore
+  std::string                     m_combStacoTreeName;     //Combined Staco
+  std::string                     m_combMuidTreeName;      //Combined Muid
+  //!< validation tree description - second argument in TTree
+  std::string                     m_ValidationTreeDescription;
+  //!< stream/folder to for the TTree to be written out
+  std::string                     m_defaultTreeFolder;
+  std::string                     m_refit1TreeFolder;
+  std::string                     m_refit2TreeFolder;
+  std::string                     m_truthTreeFolder;
+  //  std::string                     m_meStacoTreeFolder; // not existent in xAOD anymore
+  std::string                     m_combStacoTreeFolder;
+  std::string                     m_combMuidTreeFolder;
+
+  std::string m_truthName;          /// Track(Particle)TruthCollection input name
+  std::string m_trackParticleName;  /// TrackParticle input name
+  std::string m_truthLinkVecName;   /// link vector to map HepMC onto xAOD truth
+
+  //!< Root Validation Tree
+  TTree*                          m_defaultTree;
+  TTree*                          m_refit1Tree;
+  TTree*                          m_refit2Tree;
+  TTree*                          m_truthTree;
+  TTree*                          m_meStacoTree;
+  TTree*                          m_combStacoTree;
+  TTree*                          m_combMuidTree;
+
+  mutable unsigned int            m_runNumber;
+  mutable unsigned int            m_evtNumber;
+  mutable unsigned int            m_lumi_block;
+
+  double m_positive_px;
+  double m_positive_py;
+  double m_positive_pz;
+  double m_positive_z0;
+  double m_positive_d0;
+  double m_positive_z0_err;
+  double m_positive_d0_err;
+
+
+  double m_negative_px;
+  double m_negative_py;
+  double m_negative_pz;
+  double m_negative_z0;
+  double m_negative_d0;
+  double m_negative_z0_err;
+  double m_negative_d0_err;
+
+  std::string m_sTriggerChainName;
+  std::string m_outputTracksName;
+
+};
+//==============================================================================
+
+#endif
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonKshort.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonKshort.h
index e3debb35dcb211457469067b3541f251c21f50ba..63b7ed2bc8bd2e510c5e362cea98f8ed48795635 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonKshort.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonKshort.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPerfMonKshort_H
 #define IDPerfMonKshort_H
@@ -13,10 +13,11 @@
 #include "GaudiKernel/SystemOfUnits.h"
 #include "GaudiKernel/PhysicalConstants.h"
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
-//#include "InDetPerformanceMonitoring/IDPerfMonNtupleMaker.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
 
+#include "ITrackToVertex/ITrackToVertex.h"
+
 #include "xAODTracking/Vertex.h"
 #include "xAODTracking/VertexContainer.h"
 
@@ -24,6 +25,7 @@ class TH1;
 class TProfile;
 class TGraph;
 
+
 class IDPerfMonKshort : public ManagedMonitorToolBase
 {
 
@@ -36,19 +38,17 @@ public:
 	virtual StatusCode initialize();
 	virtual StatusCode bookHistograms();
 	virtual StatusCode fillHistograms();
-	virtual StatusCode procHistograms();
 
 	void RegisterHisto(MonGroup& mon, TH1* histo);
 	void RegisterHisto(MonGroup& mon, TProfile* histo);
 	void RegisterHisto(MonGroup& mon, TGraph* graph);
+	void RegisterTree(MonGroup& mon, TTree* tree);
 
 protected:
 
 	int m_histosBooked;
 
 	TH1F* m_mass;
-	TH1F* m_mass_scaled;
-	TH2F* m_massVsPhi;
 	TH1F* m_radius;
 	TH1F* m_radius_secVertices;
 	TH1F* m_radius_secVertices_sel;
@@ -79,30 +79,8 @@ protected:
 	TH1F* m_massVersusCurvatureDiff;
 	TH1F* m_widthVersusCurvatureDiff;
 
-	TH1F* m_massVersusPt_merged;
-	TH1F* m_widthVersusPt_merged;
-	TH1F* m_massVersusRadius_merged;
-	TH1F* m_widthVersusRadius_merged;
-	TH1F* m_massVersusEta_merged;
-	TH1F* m_widthVersusEta_merged;
-	TH1F* m_massVersusPhi_merged;
-	TH1F* m_widthVersusPhi_merged;
-	TH1F* m_massVersusCurvatureDiff_merged;
-	TH1F* m_widthVersusCurvatureDiff_merged;
-
-	const static Int_t m_nFittedBinsPt = 5 ;
-	const static Int_t m_nBinsPt = 46 ;
-	const static Int_t m_nFittedBinsRadius = 7 ;
-	const static Int_t m_nBinsRadius = 70 ;
-	TH1F* m_massVPtBinHistos[m_nBinsPt];
-	TH1F* m_massVEtaBinHistos[10];
-	TH1F* m_massVPhiBinHistos[10];
-	TH1F* m_massVCurvatureDiffBinHistos[6];
-	TH1F* m_massVRadiusBinHistos[m_nBinsRadius];
-	TH1F* m_massVPtBinFittedHistos[m_nFittedBinsPt];
-	TH1F* m_massVRadiusBinFittedHistos[m_nFittedBinsRadius];
-
 	TH1F* m_Nevents;
+	TH1F* m_Nevents_sel;
 
  private:
 
@@ -114,8 +92,41 @@ protected:
 	std::string m_VxContainerName;
 	std::string m_VxPrimContainerName;
 
-	//IDPerfMonNtupleMaker NtupleMaker;
-	//bool m_Ntuple;
+  	std::string m_defaultTreeName;       //Default ID Tracks
+	std::string m_ValidationTreeDescription;
+  
+  	TTree* m_defaultTree;
+
+  	ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool;
+
+  	mutable unsigned int m_runNumber;
+  	mutable unsigned int m_evtNumber;
+  	mutable unsigned int m_lumi_block;
+
+  	double m_Ks_x;
+  	double m_Ks_y;
+  	double m_Ks_z;
+
+  	double m_pv_x;
+  	double m_pv_y;
+  	double m_pv_z;
+
+  	double m_positive_px;
+  	double m_positive_py;
+  	double m_positive_pz;
+  	double m_positive_z0;
+  	double m_positive_d0;
+  	double m_positive_z0_err;
+  	double m_positive_d0_err;
+
+
+  	double m_negative_px;
+  	double m_negative_py;
+  	double m_negative_pz;
+  	double m_negative_z0;
+  	double m_negative_d0;
+  	double m_negative_z0_err;
+  	double m_negative_d0_err;
 
 };
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h
index 5ec0d3fa215b311eecbfe7d217a34224fa1fd87d..af9ef7eea425df2e22142a3c00e5b4437f5530c8 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonWenu.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPerfMonWenu_H
 #define IDPerfMonWenu_H
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
index ca15da2118046fa44ec1bd521ddd90f80d73aa5c..fdf6669a5a17bd2d42ae3b40f986104d8df53b22 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPerfMonZee_H
 #define IDPerfMonZee_H
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h
index 8792c28d7d97e4b5cd6260c08f6c74a09466170a..8b40d69fb2a7c8e9c12b82a0d2af48f1040f1e31 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPERFMON_ZMUMU_H
 #define IDPERFMON_ZMUMU_H
@@ -25,6 +25,8 @@
 #include "xAODEgamma/Electron.h"
 #include "xAODEgamma/EgammaTruthxAODHelpers.h"
 
+#include "TrackVertexAssociationTool/LooseTrackVertexAssociationTool.h"
+
 #include <map>
 #include "TH1.h"
 #include "TH2.h"
@@ -34,10 +36,26 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 
 #include "GaudiKernel/ToolHandle.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "TrkExInterfaces/IExtrapolator.h"
 
 
 class IegammaTrkRefitterTool;
+class IBeamCondSvc;
+
+namespace Trig{
+  class TrigDecisionTool;
+}
+
+namespace Trk{
+  class ITrackToVertexIPEstimator;
+  class IExtrapolator;
+}
+
 
+namespace InDet {
+  class IInDetTrackSelectionTool;
+}
 
 class IDPerfMonZmumu : public AthAlgorithm
 {
@@ -58,17 +76,33 @@ class IDPerfMonZmumu : public AthAlgorithm
  private:
   // Private class member functions.
   void RegisterHistograms();
-  void FillRecParameters(const Trk::Track* track, double charge);
-    //void FillRecParameters(const xAOD::TrackParticle* trackparticle, double charge);
-  StatusCode FillTruthParameters(const xAOD::TrackParticle* track);
+  const xAOD::Vertex* GetDiMuonVertex(const xAOD::TrackParticle*,const  xAOD::TrackParticle*);
+  bool FillRecParameters(const Trk::Track* track, const xAOD::TrackParticle* trackp_for_unbias, double charge,const xAOD::Vertex* vertex);
+  bool FillRecParametersTP(const xAOD::TrackParticle* trackp, const xAOD::TrackParticle* trackp_for_unbias,double charge,const xAOD::Vertex* vertex = NULL);
+  //void FillRecParameters(const xAOD::TrackParticle* trackparticle, double charge);
+StatusCode FillTruthParameters(const xAOD::TrackParticle* track);
+
   const xAOD::TruthParticle* getTruthParticle( const xAOD::IParticle& p );
+  StatusCode CheckTriggerStatusAndPrescale ();
 
   // The Z0 tagger.
   ZmumuEvent     m_xZmm;
+  bool m_UseTrigger;
   bool m_doIsoSelection;
+  bool m_doIPSelection;
+  double m_MassWindowLow;
+  double m_MassWindowHigh;
+  double m_LeadingMuonPtCut;
+  double m_SecondMuonPtCut;
+  double m_OpeningAngleCut;
+  double m_Z0GapCut;
   bool m_isMC;
+  bool m_doRefit;
+  bool m_useTrackSelectionTool;
+  bool m_doIP;
   std::vector<std::string> m_regions;
 
+
   /** @brief The track refitter */
   ToolHandle<IegammaTrkRefitterTool>  m_TrackRefitter1;
 
@@ -78,27 +112,42 @@ class IDPerfMonZmumu : public AthAlgorithm
   /** @brief tool to extrapolate tracks to BL*/
   ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool;
 
+  /** @brief The trigger decision tool */
+  ToolHandle<Trig::TrigDecisionTool> m_triggerDecision;
+
+  /** @brief The track selection Tool */
+  ToolHandle< InDet::IInDetTrackSelectionTool > m_selTool;
+
+  /** Needed for IP resolution studies **/
+  ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator;
+
+  /** used for truth parameters**/
+  ServiceHandle<IBeamCondSvc> m_beamSpotSvc;
+  ToolHandle<Trk::IExtrapolator> m_extrapolator;
+
   //Validation Ntuple Stuff
   //!< boolean to switch to validation mode
   bool                            m_validationMode;
 
   //!< validation tree name - to be acessed by this from root
-  std::string                     m_defaultTreeName;       //Default ID Tracks
+  std::string                     m_defaultTreeName;       //Default Tracks
+  std::string                     m_IDTreeName;            //Default ID Tracks
   std::string                     m_refit1TreeName;        //Refit ID Tracks
   std::string                     m_refit2TreeName;        //Refit ID Tracks
   std::string                     m_truthTreeName;         //Truth Tracks
   //  std::string                     m_meStacoTreeName;       //Extrapolated Staco not existent in xAOD anymore
-  std::string                     m_combStacoTreeName;     //Combined Staco
+  std::string                     m_combTreeName;     //Combined Staco
   std::string                     m_combMuidTreeName;      //Combined Muid
   //!< validation tree description - second argument in TTree
   std::string                     m_ValidationTreeDescription;
   //!< stream/folder to for the TTree to be written out
   std::string                     m_defaultTreeFolder;
+  std::string                     m_IDTreeFolder;
   std::string                     m_refit1TreeFolder;
   std::string                     m_refit2TreeFolder;
   std::string                     m_truthTreeFolder;
   //  std::string                     m_meStacoTreeFolder; // not existent in xAOD anymore
-  std::string                     m_combStacoTreeFolder;
+  std::string                     m_combTreeFolder;
   std::string                     m_combMuidTreeFolder;
 
   std::string m_truthName;          /// Track(Particle)TruthCollection input name
@@ -107,11 +156,12 @@ class IDPerfMonZmumu : public AthAlgorithm
 
   //!< Root Validation Tree
   TTree*                          m_defaultTree;
+  TTree*                          m_IDTree;
   TTree*                          m_refit1Tree;
   TTree*                          m_refit2Tree;
   TTree*                          m_truthTree;
   TTree*                          m_meStacoTree;
-  TTree*                          m_combStacoTree;
+  TTree*                          m_combTree;
   TTree*                          m_combMuidTree;
 
   mutable unsigned int            m_runNumber;
@@ -125,6 +175,11 @@ class IDPerfMonZmumu : public AthAlgorithm
   double m_positive_d0;
   double m_positive_z0_err;
   double m_positive_d0_err;
+  double m_positive_z0_PV;
+  double m_positive_d0_PV;
+  double m_positive_z0_PVerr;
+  double m_positive_d0_PVerr;
+
 
 
   double m_negative_px;
@@ -134,9 +189,21 @@ class IDPerfMonZmumu : public AthAlgorithm
   double m_negative_d0;
   double m_negative_z0_err;
   double m_negative_d0_err;
+  double m_negative_z0_PV;
+  double m_negative_d0_PV;
+  double m_negative_z0_PVerr;
+  double m_negative_d0_PVerr;
+
+  
+  int m_triggerPrescale;
 
   std::string m_sTriggerChainName;
   std::string m_outputTracksName;
+  bool m_doRemoval;
+  bool m_doDebug;
+
+  std::unique_ptr<CP::LooseTrackVertexAssociationTool> m_LooseT2VAssociationTool;
+
 
 };
 //==============================================================================
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMuonRefitter.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMuonRefitter.h
index a10cc72fe3133374ace88872543d8cda3352d7c1..3bbba5fa9f2f1f3e957d53c51c130c24a76e0361 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMuonRefitter.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMuonRefitter.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPerfMuonRefitterTER_H
 #define IDPerfMuonRefitterTER_H
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/JpsimumuEvent.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/JpsimumuEvent.h
new file mode 100644
index 0000000000000000000000000000000000000000..da11a62ae8cf112b0136cb7d3efeac0e7c6790ca
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/JpsimumuEvent.h
@@ -0,0 +1,131 @@
+#ifndef IDPERFMON_ZMUMUEVENT_H
+#define IDPERFMON_ZMUMUEVENT_H
+
+//==============================================================================
+// Include files...
+//==============================================================================
+#include "CLHEP/Vector/LorentzVector.h"
+#include "InDetPerformanceMonitoring/MuonSelectorForJpsi.h"
+
+#include "InDetPerformanceMonitoring/EventAnalysis.h"
+#include "InDetPerformanceMonitoring/PerfMonServices.h"
+
+//==============================================================================
+// Forward class declarations...
+//==============================================================================
+class TrackParticle;
+
+//==============================================================================
+// Class declaration...
+//==============================================================================
+class JpsimumuEvent : public EventAnalysis
+{
+ public:
+  JpsimumuEvent();
+  ~JpsimumuEvent();
+
+  enum
+  {
+    MUON1,
+    MUON2,
+    MUON3_OVR1,
+    MUON4_OVR2,
+    NUM_MUONS
+  };
+
+  enum
+  {
+    CENTRAL,
+    FORWARD,
+    BACKWARD,
+    UNDEF
+  };
+
+  enum ZTYPE
+  {
+    MS,     // Just the muon system ( uncorrected )
+    ME,     // The adjusted muon system properties ( corr. for cal. )
+    ID,     // Using the ID system.
+    CB,     // Using both the muon & ID system.
+    NUM_TYPES
+  };
+
+  virtual void Init();
+  virtual bool Reco();
+
+  // Public access methods
+  unsigned int  getNumberOfTaggedMuons()         {  return m_numberOfFullPassMuons; }
+  const std::string   getRegion() const ;
+
+  const xAOD::Muon*      getCombMuon(  unsigned int uPart )   { return (uPart < NUM_MUONS) ? m_pxRecMuon[uPart] : NULL;  }
+  const xAOD::TrackParticle*  getMSTrack (  unsigned int uPart )   { return (uPart < NUM_MUONS) ? m_pxMSTrack[uPart] : NULL;  }
+  const xAOD::TrackParticle*  getIDTrack (  unsigned int uPart )   { return (uPart < NUM_MUONS) ? m_pxIDTrack[uPart] : NULL;  }
+  const xAOD::TrackParticle*  getLooseIDTk( unsigned int uPart );
+
+  float getPtImbalance( ZTYPE eType );
+
+  const float& getZPt(   ZTYPE eType )                  {  return m_fZPt[eType];            }
+  const float& getZEta(  ZTYPE eType )                  {  return m_fZEtaDir[eType];        }
+  const float& getZPhi(  ZTYPE eType )                  {  return m_fZPhiDir[eType];        }
+  const float& getLeptonOpeningAngle( ZTYPE eType )     {  return m_fMuonDispersion[eType]; }
+  const float& getZMass( ZTYPE eType )                  {  return m_fInvariantMass[eType];  }
+
+  int  getZCharge( ZTYPE eType );
+  bool EventPassed() {    return m_passedSelectionCuts;   }
+
+  unsigned int getPosMuon( ZTYPE eType );
+  unsigned int getNegMuon( ZTYPE eType );
+
+  void doIsoSelection(bool doIso) {
+    m_xMuonID.doIsoSelection(doIso);
+  }
+
+  void setContainer( PerfMonServices::CONTAINERS container) { m_container = container; };
+
+ protected:
+  virtual void BookHistograms();
+
+ private:
+  typedef EventAnalysis PARENT;
+
+  // Private methods
+  void  Clear();
+  bool  EventSelection();
+  void  ReconstructKinematics();
+  void  RecordMuon( const xAOD::Muon* pxMuon );
+
+  // Active mu-cuts for the analysis
+  MuonSelectorForJpsi            m_xMuonID;
+  PerfMonServices::CONTAINERS m_container;
+
+  // Tag Setup variables
+  unsigned int m_uMuonTags;
+  unsigned int m_uTrackMatch;
+  bool m_bLooseMatch;
+  double m_etaCut;
+  bool m_doDebug;
+  // Member variables : Mostly to store relevant muon data for quick access.
+  unsigned int     m_numberOfFullPassMuons;
+  bool             m_passedSelectionCuts;
+
+  const            xAOD::Muon*      m_pxRecMuon[NUM_MUONS];
+  const            xAOD::TrackParticle*  m_pxMETrack[NUM_MUONS];  // Pointer to muon spectro ( corr. )
+  const            xAOD::TrackParticle*  m_pxMSTrack[NUM_MUONS];      // Pointer to muon spectro
+  const            xAOD::TrackParticle*  m_pxIDTrack[NUM_MUONS];       // Pointer to ID track
+
+  // Keep kinematic information on the Z
+  float m_fZPt[NUM_TYPES];
+  float m_fZEtaDir[NUM_TYPES];
+  float m_fZPhiDir[NUM_TYPES];
+  float m_fInvariantMass[NUM_TYPES];
+  float m_fMuonDispersion[NUM_TYPES];
+
+  // Graphs
+  enum HISTOS_1D
+  {
+    ZMASS_MUON, ZMASS_MUONADJ, ZMASS_TRACK, ZMASS_COMB,
+    NUM_1HISTOS
+  };
+};
+//==============================================================================
+#endif
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelector.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelector.h
index 9cb2d99e48a18cc2d31ddb72080215c9265984c7..a58aa17882c59ef553826e4e8397db1f51c37649 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelector.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelector.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPERFMON_MUONSELECTOR_H
 #define IDPERFMON_MUONSELECTOR_H
@@ -31,11 +31,15 @@ class MuonSelector : public EventAnalysis
   ~MuonSelector();
 
   bool passSelection( const xAOD::Muon* pxMuon );
-
+  void setDebug(bool debug){m_doDebug = debug;}
+ 
   // Override functions from EventAnalysis
   virtual void Init();
   virtual bool Reco();
-  void doIsoSelection(bool doIso) {m_doIsoSelection=doIso;}
+  inline void doIsoSelection (bool doIso) {m_doIsoSelection=doIso;}
+  inline void doIPSelection (bool doIPsel) {m_doIPSelection=doIPsel;}
+  inline void SetPtCut (double newvalue) {m_combPtCut = newvalue;}
+  inline double GetPtCut () {return m_combPtCut;}
 
  protected:
   virtual void BookHistograms();
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelectorForJpsi.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelectorForJpsi.h
new file mode 100644
index 0000000000000000000000000000000000000000..b0c30b062d7d39b5b0cc321db88f4616112d774e
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/MuonSelectorForJpsi.h
@@ -0,0 +1,98 @@
+#ifndef IDPERFMON_MUONSELECTOR_H
+#define IDPERFMON_MUONSELECTOR_H
+
+//==============================================================================
+// Include files...
+//==============================================================================
+#include "InDetPerformanceMonitoring/EventAnalysis.h"
+
+#include <map>
+#include "TH1.h"
+
+#include "xAODMuon/Muon.h"
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexContainer.h"
+
+//class TrackIsolationTool;
+
+//==============================================================================
+// Forward class declarations...
+//==============================================================================
+//class Muon;
+
+class MuonSelectorForJpsi : public EventAnalysis
+{
+ public:
+  MuonSelectorForJpsi();
+  ~MuonSelectorForJpsi();
+
+  bool passSelection( const xAOD::Muon* pxMuon );
+
+  // Override functions from EventAnalysis
+  virtual void Init();
+  virtual bool Reco();
+  void doIsoSelection(bool doIso) {m_doIsoSelection=doIso;}
+
+ protected:
+  virtual void BookHistograms();
+
+ private:
+  typedef EventAnalysis PARENT;
+
+  static unsigned int s_uNumInstances;
+
+  bool passQualCuts();
+  bool passPtCuts();
+  bool passIsolCuts();
+  bool passIPCuts();
+
+  // message stream
+  MsgStream * m_msgStream;
+
+  // Class variables
+  const xAOD::Muon*   m_pxMuon;
+  //  TrackIsolationTool* m_isolationTool;
+  double m_coneSize;
+
+
+  // Cut variables. To go into a struct.
+  unsigned char m_ucJMuon_Cut;
+  double        m_IsoCut;
+
+  bool  m_bCutOnCombKine;
+  float m_fEtaCut;
+  float m_fPtCut;
+
+  double m_combPtCut;
+  float m_ptMSCut;
+  float m_diffZCut;  // mm
+  float m_diffPtCut;
+  float m_pVZCut;  // mm
+
+
+  float m_fIDPtCut;
+  float m_fIDChiPerDofCut;
+  int   m_IDSiHitsCut;
+  unsigned char m_ucID_PIXCut;
+  unsigned char m_ucID_SCTCut;
+  unsigned char m_ucID_TRTCut;
+
+  bool m_doDebug;
+  bool m_doQualSelection;
+  bool m_doIsoSelection;
+  bool m_doPtSelection;
+  bool m_doIPSelection;
+
+
+  // Lock cut selection after first muon.
+  bool m_bLock;
+
+  // Graphs
+  enum HISTOS_1D
+  {
+    NMDT, NCSC, ECONE,
+    NUM_1HISTOS
+  };
+};
+
+#endif
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/PerfMonServices.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/PerfMonServices.h
index 0116f8cfcc92adf754bc4f3576a66b9d75a547e9..77ed0e23e08389f16a36c662a191b91ed613a5ac 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/PerfMonServices.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/PerfMonServices.h
@@ -1,7 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPERFMON_SERVICES_H
 #define IDPERFMON_SERVICES_H
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h
index 8caeec09a11ef50ce71abb9a160461603f2b0af5..513c2cf90270f526f4f658b06f5fd5551dfbb382 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/TRT_Electron_Monitoring_Tool.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef TRT_ELECTRON_MONITORING_TOOL_H
 #define TRT_ELECTRON_MONITORING_TOOL_H
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/ZmumuEvent.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/ZmumuEvent.h
index d774197cde640c3bd626ab98a9ba5011acfbbb1d..022b94eae111f0a3cd46004f3e51f1d5e6c39c93 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/ZmumuEvent.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/ZmumuEvent.h
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #ifndef IDPERFMON_ZMUMUEVENT_H
 #define IDPERFMON_ZMUMUEVENT_H
@@ -60,6 +60,7 @@ class ZmumuEvent : public EventAnalysis
   // Public access methods
   unsigned int  getNumberOfTaggedMuons()         {  return m_numberOfFullPassMuons; }
   const std::string   getRegion() const ;
+  void setDebugMode(bool debug) { m_doDebug=debug;}
 
   const xAOD::Muon*      getCombMuon(  unsigned int uPart )   { return (uPart < NUM_MUONS) ? m_pxRecMuon[uPart] : NULL;  }
   const xAOD::TrackParticle*  getMSTrack (  unsigned int uPart )   { return (uPart < NUM_MUONS) ? m_pxMSTrack[uPart] : NULL;  }
@@ -84,7 +85,22 @@ class ZmumuEvent : public EventAnalysis
     m_xMuonID.doIsoSelection(doIso);
   }
 
+  void doIPSelection(bool doIPsel) {
+    m_xMuonID.doIPSelection(doIPsel);
+  }
+
+  void        OrderMuonList ();
+  inline void SetMuonPtCut (double newvalue) { m_xMuonID.SetPtCut(newvalue);}
+
+  inline void SetMassWindowLow (double newvalue) {m_MassWindowLow = newvalue;}
+  inline void SetMassWindowHigh (double newvalue) {m_MassWindowHigh = newvalue;}
+  void SetLeadingMuonPtCut (double newvalue); 
+  void SetSecondMuonPtCut (double newvalue); 
+  inline void SetOpeningAngleCut (double newvalue) {m_OpeningAngleCut = newvalue;}
+  inline void SetZ0GapCut (double newvalue) {m_Z0GapCut = newvalue;}
+
   void setContainer( PerfMonServices::CONTAINERS container) { m_container = container; };
+  inline double GetInvMass() {return m_DiMuonPairInvMass;}
 
  protected:
   virtual void BookHistograms();
@@ -94,7 +110,7 @@ class ZmumuEvent : public EventAnalysis
 
   // Private methods
   void  Clear();
-  bool  EventSelection();
+  bool  EventSelection (ZTYPE eType);
   void  ReconstructKinematics();
   void  RecordMuon( const xAOD::Muon* pxMuon );
 
@@ -107,6 +123,15 @@ class ZmumuEvent : public EventAnalysis
   unsigned int m_uTrackMatch;
   bool m_bLooseMatch;
   double m_etaCut;
+  double m_DiMuonPairInvMass;
+
+  double m_LeadingMuonPtCut;
+  double m_SecondMuonPtCut;
+  double m_MassWindowLow;
+  double m_MassWindowHigh;
+  double m_OpeningAngleCut;
+  double m_Z0GapCut;
+
   bool m_doDebug;
   // Member variables : Mostly to store relevant muon data for quick access.
   unsigned int     m_numberOfFullPassMuons;
@@ -130,6 +155,14 @@ class ZmumuEvent : public EventAnalysis
     ZMASS_MUON, ZMASS_MUONADJ, ZMASS_TRACK, ZMASS_COMB,
     NUM_1HISTOS
   };
+
+  // muon selector configuration
+  bool m_SelectMuonByIso;
+  bool m_SelectMuonByIP;
+
+  // selected muon identifiers
+  int m_muon1;
+  int m_muon2;
 };
 //==============================================================================
 #endif
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/cmt/requirements b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/cmt/requirements
deleted file mode 100644
index 447827f8a93114097db095d1d55de04062943ee2..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/cmt/requirements
+++ /dev/null
@@ -1,97 +0,0 @@
-package InDetPerformanceMonitoring
-
-author Tobias Golling <TFGolling@lbl.gov>
-
-# General
-use AtlasPolicy AtlasPolicy-*
-
-private
-apply_tag ROOTMathLibs
-apply_tag ROOTGraphicsLibs
-
-# InDet packages which may be needed
-use InDetIdentifier 		InDetIdentifier-* 		InnerDetector/InDetDetDescr
-use InDetPrepRawData 		InDetPrepRawData-* 		InnerDetector/InDetRecEvent
-use IdDictDetDescr  		IdDictDetDescr-*     		DetectorDescription
-
-# Muons - for IDPerfMonZmumu by Jike Wang
-use GaudiInterface              GaudiInterface-*                External
-
-#packages needed for offline monitoring
-#use TrkExUtils             	TrkExUtils-*                 	Tracking/TrkExtrapolation
-use TrkV0Vertex 	       	TrkV0Vertex-*	       		Tracking/TrkEvent
-use TrkParameters         	TrkParameters-*   		Tracking/TrkEvent
-use TrkEventPrimitives 		TrkEventPrimitives-* 		Tracking/TrkEvent
-
-use  EventPrimitives            EventPrimitives-*               Event
-
-
-
-#packages needed for IDPerfMonZmumu
-use TrkTruthData        TrkTruthData-*          Tracking/TrkEvent
-
-# for electron monitoring by Sara Strandberg
-#use JetEvent              	JetEvent-*             		Reconstruction/Jet
-#use JetTagEvent             	JetTagEvent-*           	PhysicsAnalysis/JetTagging
-
-
-# for  E over P monitoring
-use egammaInterfaces       	egammaInterfaces-*          	Reconstruction/egamma
-use TrigDecisionTool       	TrigDecisionTool-*     	    	Trigger/TrigAnalysis
-use TrkTrackSummary        	TrkTrackSummary-*         	Tracking/TrkEvent
-
-# for Kshort monitoring by Jed Biesiada
-use TrkVertexAnalysisUtils   	TrkVertexAnalysisUtils-*  	Tracking/TrkVertexFitter
-
-use AtlasHepMC            AtlasHepMC-*        External
-use EventInfo             EventInfo-*         Event
-
-public
-use AtlasROOT         		AtlasROOT-* 			  External
-use AthenaMonitoring  		AthenaMonitoring-* 		  Control
-use GaudiInterface    		GaudiInterface-* 		  External
-use StoreGate         		StoreGate-* 			  Control
-use AtlasCLHEP        		AtlasCLHEP-* 			  External
-use LWHists   			LWHists-*   			  Tools
-use AthenaKernel        	AthenaKernel-*   	  	  Control
-use AthenaBaseComps       	AthenaBaseComps-*  		  Control
-
-# Tracking packages for Track histograms
-use TrkTrack 			TrkTrack-* 			Tracking/TrkEvent
-use TrkParameters         	TrkParameters-*         	Tracking/TrkEvent
-
-use TrkParticleBase      	TrkParticleBase-*      		Tracking/TrkEvent
-#use VxVertex                 	VxVertex-*                	Tracking/TrkEvent
-use ITrackToVertex              ITrackToVertex-*                Reconstruction/RecoTools
-
-use egammaEvent                 egammaEvent-*                   Reconstruction/egamma
-#use muonEvent                   muonEvent-*                     Reconstruction/MuonIdentification
-
-#Other InDet Packages
-use InDetReadoutGeometry 	InDetReadoutGeometry-* 		InnerDetector/InDetDetDescr
-use InDetRIO_OnTrack 		InDetRIO_OnTrack-* 		InnerDetector/InDetRecEvent
-#use InDetRawData 		InDetRawData-* 			InnerDetector/InDetRawEvent
-#use TRT_ConditionsServices 	TRT_ConditionsServices-* 	InnerDetector/InDetConditions
-
-use GeneratorObjects	GeneratorObjects-*	Generators/
-
-
-#xAOD packages
-use xAODEgamma            	xAODEgamma-*             Event/xAOD
-use xAODMuon		  	xAODMuon-*       	 Event/xAOD
-use xAODJet		  	xAODJet-*       	 Event/xAOD
-
-
-use xAODTracking		xAODTracking-*		 Event/xAOD
-use xAODTruth		  	xAODTruth-*		 Event/xAOD
-use xAODCaloEvent 	  	xAODCaloEvent-*		 Event/xAOD
-use xAODMissingET         	xAODMissingET-*          Event/xAOD
-
-use JetInterface     		JetInterface-*           Reconstruction/Jet
-
-use ElectronPhotonSelectorTools ElectronPhotonSelectorTools-*	PhysicsAnalysis/ElectronPhotonID
-#use IsolationSelection		IsolationSelection-*		PhysicsAnalysis/AnalysisCommon
-
-apply_pattern dual_use_library files=*.cxx
-apply_pattern declare_joboptions files="*.txt *.py" #InDetPerformanceMonitoring/*.py"
-#apply_pattern declare_python_modules files = "InDetPerformanceMonitoring/*.py *.py"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.C b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.C
deleted file mode 100644
index 790ef0be3cd9b75ad8b3165c2833a4cf8aa0d998..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.C
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include <iostream>
-
-#include "AtlasStyle.h"
-
-#include "TROOT.h"
-#include "TGraphErrors.h"
-#include "TGraphAsymmErrors.h"
-#include "TLine.h"
-#include "TMarker.h"
-#include "TPave.h"
-#include "TLatex.h"
-#include "TH1.h"
-
-void SetAtlasStyle ()
-{
-  
-  static TStyle * atlasStyle = 0;
-  if ( atlasStyle==0 ) atlasStyle = AtlasStyle();
-  
-  gROOT->SetStyle("ATLAS");
-  gROOT->ForceStyle();
-  
-}
-
-TStyle * AtlasStyle() 
-{
-  
-  TStyle *atlasStyle = new TStyle("ATLAS","Atlas style");
-
-  Int_t icol=0; 
-  
-  atlasStyle->SetFrameBorderMode(icol);
-  atlasStyle->SetFrameFillColor(icol);
-  atlasStyle->SetCanvasBorderMode(icol);
-  atlasStyle->SetCanvasColor(icol);
-  atlasStyle->SetPadBorderMode(icol);
-  atlasStyle->SetPadColor(icol);
-  atlasStyle->SetStatColor(icol);
-
-  atlasStyle->SetPaperSize(20,26);
-
-  atlasStyle->SetPadTopMargin(0.05);
-  atlasStyle->SetPadRightMargin(0.05);
-  atlasStyle->SetPadBottomMargin(0.16);
-  atlasStyle->SetPadLeftMargin(0.16);
-
-  atlasStyle->SetTitleXOffset(1.4);
-  atlasStyle->SetTitleYOffset(1.4);
-
-  Int_t font=42;
-  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");
-
-  atlasStyle->SetMarkerStyle(20);
-  atlasStyle->SetMarkerSize(1.2);
-  atlasStyle->SetHistLineWidth(2.);
-  atlasStyle->SetLineStyleString(2,"[12 12]");
-
-  atlasStyle->SetEndErrorSize(0.);
-
-  atlasStyle->SetOptTitle(0);
-  atlasStyle->SetOptStat(0);
-  atlasStyle->SetOptFit(0);
-
-  atlasStyle->SetPadTickX(1);
-  atlasStyle->SetPadTickY(1);
-
-  atlasStyle->SetPalette(1);
-  return atlasStyle;
-
-}
-
-
-
-#include <iostream>
-#include <cmath>
-
-
-#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");
-}
-
-
-void ATLASPRELIM_LABEL(Double_t x,Double_t y,double tsize, Color_t color) 
-{
-  TLatex l; //l.SetTextAlign(12); 
-  l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.SetTextFont(72);
-  l.SetTextColor(color);
-  l.DrawLatex(x,y,"ATLAS Preliminary");
-}
-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"); 
-
-
-  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) 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;
-
- TGraphErrors* g1= new TGraphErrors();
-
- Double_t x, y, ex, ey;
- for (Int_t i=0; 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,x,y);
-   g1->SetPointError(i,ex,ey);
-
- }
-
- //g1->Print();
-
- return g1;
-}
-
-void myText(Double_t x,Double_t y,Color_t color,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,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,char *text,Float_t msize, Float_t tsize) 
-{
-  //Double_t tsize=0.06;
-  Double_t x2=x-0.3*tsize;
-
-  TMarker *marker = new TMarker(x2-0.025,y,8);
-  marker->SetMarkerColor(color);  marker->SetNDC();
-  marker->SetMarkerStyle(mstyle);
-  marker->SetMarkerSize(msize);
-  marker->Draw();
-
-  TLatex l; l.SetTextAlign(12); l.SetTextSize(tsize); 
-  l.SetNDC();
-  l.DrawLatex(x,y,text);
-}
-
-void myLineText(
-   Double_t x, Double_t y,Int_t boxsize,Int_t mcolor,char *text, float tsize) {
- 
- //  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-0.05;
- 
-   printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2);
- 
-   TLine mline;
-   mline.SetLineWidth(4);
-   mline.SetLineColor(mcolor);
-   mline.SetLineStyle(boxsize);
-   y=(y1+y2)/2.;
-   mline.DrawLineNDC(x1,y,x2,y);
- 
-}
-
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.h
deleted file mode 100644
index f783b99088115c00e5cdc1f91caf357f8c0859bf..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef __ATLASSTYLE_H
-#define __ATLASSTYLE_H
-
-#include "TStyle.h"
-
-void SetAtlasStyle();
-
-TStyle * AtlasStyle(); 
-
-
-#include "TGraphErrors.h"
-#include "TGraphAsymmErrors.h"
-
-void ATLAS_LABEL(Double_t x,Double_t y,Color_t color=1); 
-void ATLASPRELIM_LABEL(Double_t x,Double_t y,double tsize, 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,char *text);
-
-void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text);
-
-void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text,Float_t msize=2., Float_t tsize=0.05); 
-
-void myLineText( Double_t x, Double_t y,Int_t boxsize,Int_t mcolor,char *text, float tsize=0.05); 
-#endif
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/ZmumuValidationExample.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/ZmumuValidationExample.cxx
deleted file mode 100644
index b586b4d37ff05d7aa32c881719604c197197a3c3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/ZmumuValidationExample.cxx
+++ /dev/null
@@ -1,1406 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#define ZMUMUVALIDATIONEXAMPLE_C
-
-#include <iostream>
-#include <list>
-#include "TMath.h"
-#include "TLorentzVector.h"
-#include "TF1.h"
-
-#include "ZmumuValidationExample.h"
-
-ZmumuValidationExample::ZmumuValidationExample( std::list<std::string> const & s_fileNames, string s_treeName
-                                          , std::string const & s_outFileName
-					  , bool isMC
-						) : m_fileNames( s_fileNames )
-						  , m_outfilename( s_outFileName )
-						  , m_file( s_outFileName.c_str(), "RECREATE" )
-						  , m_eventChain( s_treeName.c_str() )
-						  , m_truthChain( "TruthParams" )
-						  , m_PrintLevel(0)
-						  , m_EtaBins(1)
-						  , m_PhiBins(1)
-						  , m_isMC(isMC)
-						  , n_iteration(0)
-
-{
-   loadChains();
-   setBranchAddresses();
-   // bookHistograms();
-   
-   m_factor = 0.5; //factor to assign lambda corrections - nominal is 0.5
-   m_shift = 0; //shift in Z mass in MeV - nominal is 0
-   TempCanvasIterGaussFit = NULL;
-}
-
-
-ZmumuValidationExample::~ZmumuValidationExample()
-{
-   m_file.Close();
-   
-}
-
-
-/////////////////////////////////////////////////////////
-// load TChains using the user inputed list of strings
-/////////////////////////////////////////////////////////
-void ZmumuValidationExample::loadChains()
-{
-   std::cout << "Input Files:" << std::endl;
-
-   std::list<std::string>::const_iterator theEnd = m_fileNames.end();
-   for( std::list<std::string>::const_iterator itr = m_fileNames.begin()
-      ; itr != theEnd
-      ; ++itr
-      )
-   {
-      std::cout <<"  "<< *itr << std::endl;
-      
-      m_eventChain.Add( itr->c_str() );
-      if (m_isMC) m_truthChain.Add( itr->c_str() );
-   }
-   
-   return;
-}    
-
-
-//////////////////////////////////////////////////////
-// sets the branch address for each leaf to be used
-//////////////////////////////////////////////////////
-void ZmumuValidationExample::setBranchAddresses()
-{
-   /////////////////////////////////////////
-   // set branch addresses for event tree
-   /////////////////////////////////////////
-   m_eventChain.SetBranchAddress( "Positive_Px",  &m_px_pos,  &b_px_pos); 
-   m_eventChain.SetBranchAddress( "Positive_Py",  &m_py_pos,  &b_py_pos);	
-   m_eventChain.SetBranchAddress( "Positive_Pz",  &m_pz_pos,  &b_pz_pos);
-
-   m_eventChain.SetBranchAddress( "Negative_Px",  &m_px_neg,  &b_px_neg); 
-   m_eventChain.SetBranchAddress( "Negative_Py",  &m_py_neg,  &b_py_neg);	
-   m_eventChain.SetBranchAddress( "Negative_Pz",  &m_pz_neg,  &b_pz_neg);
-
-   m_eventChain.SetBranchAddress( "Positive_z0",  &m_z0_pos,  &b_z0_pos);
-   m_eventChain.SetBranchAddress( "Positive_d0",  &m_d0_pos,  &b_d0_pos);
-   
-   m_eventChain.SetBranchAddress( "Negative_z0",  &m_z0_neg,  &b_z0_neg);
-   m_eventChain.SetBranchAddress( "Negative_d0",  &m_d0_neg,  &b_d0_neg);
-
-   if (m_isMC) {
-   
-     m_truthChain.SetBranchAddress("Positive_Px",  &m_truth_px_pos,  &b_truth_px_pos);
-     m_truthChain.SetBranchAddress("Positive_Py",  &m_truth_py_pos,  &b_truth_py_pos);
-     m_truthChain.SetBranchAddress("Positive_Pz",  &m_truth_pz_pos,  &b_truth_pz_pos);
-						     	   	             
-     m_truthChain.SetBranchAddress("Negative_Px",  &m_truth_px_neg,  &b_truth_px_neg);
-     m_truthChain.SetBranchAddress("Negative_Py",  &m_truth_py_neg,  &b_truth_py_neg);
-     m_truthChain.SetBranchAddress("Negative_Pz",  &m_truth_pz_neg,  &b_truth_pz_neg);
-   }
-
-   return;   
-}
-
-
-////////////////////////////
-// initializes histograms
-////////////////////////////
-void ZmumuValidationExample::bookHistograms()
-{
-   ////////////////////////////////
-   // initialize histograms here
-   ////////////////////////////////
-  
-  const int fnEtaBins = m_EtaBins;
-  const int fnPhiBins = m_PhiBins;
-  const int fnQoverPtBins = 100;
-  
-  const double eta_bound = 2.5;
-  const double phi_bound = 3.1415;
-  const double p_bound = 0.5;
-  const double pt_bound = 15;
-  
-  const double z_bound = 0.4; //mm
-  const double d_bound = 0.15; //mm
-  
-  h_DELTA = new TH1F("h_DELTA",";#delta [GeV]",200,-50,50);
-  
-  h_pt = 	new TH1F("Pt","p_{T} of both #mu; p_{T} [GeV]",    100, 0., 100.);
-  h_pt_pos = 	new TH1F("Pt_Pos","p_{T} of #mu^{+}; p_{T} [GeV]", 100, 0., 100.);
-  h_pt_neg = 	new TH1F("Pt_Neg","p_{T} of #mu^{-}; p_{T} [GeV]", 100, 0., 100.);
-
-  h_z0     =	new TH1F("h_z0","z_{0}: longitudinal impact param.; z_{0} [mm]",    100, -150., 150.);
-  h_z0_pos =	new TH1F("h_z0_Pos","z_{0} of #mu^{+};z_{0} [mm]",100, -150., 150.);
-  h_z0_neg =	new TH1F("h_z0_Neg","z_{0} of #mu^{-};z_{0} [mm]",100, -150., 150.);
-  h_d0     =	new TH1F("h_d0","d_{0}: transvers. impact param.; d_{0} [mm]",    100, -0.08, 0.08);
-  h_d0_pos =	new TH1F("h_d0_Pos","d_{0} of #mu^{+};d_{0} [mm]",100, -0.08, 0.08);
-  h_d0_neg =	new TH1F("h_d0_Neg","d_{0} of #mu^{-};d_{0} [mm]",100, -0.08, 0.08);
-
-  h_mass =	 new TH1F("ZMass",";Mass [GeV]",100,70,110);
-
-//  pcorrected_mass =	 new TH1F("PCorrectedZMass",";Mass [GeV]",100,70,110);
-//  lambdacorrected_mass = new TH1F("LambdaCorrectedZMass",";Mass [GeV]",100,70,110);
-
-//  pcorrected_mass_vs_etaphi =      new TH3F("ZMassVsEtaPhi_P",";#eta;#phi;Mass [GeV]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 100,70,110);
-//  lambdacorrected_mass_vs_etaphi = new TH3F("ZMassVsEtaPhi_Lambda",";#eta;#phi;Mass [GeV]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 100,70,110);  
-  
-//  etaphi_pos = 		new TH2F("MuonEtaPhi_Positive",";#eta;#phi", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-//  etaphi_neg = 		new TH2F("MuonEtaPhi_Negative",";#eta;#phi", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-//  prof_pt_vs_etaphi = 	new TProfile2D("AvgPtVsEtaPhi",";#eta;#phi;<p_{T}>", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-  //z0 histograms ----------------------------
-
-  entries	= new TH2F("entries","Entries per #eta-#phi bin;#eta;#phi;entries", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-  
-  z0delta_vs_etaphi =	new TH3F("Delta_z0_VsEtaPhi",";#eta;#phi;#delta_{z_{0}} [mm]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 50,-z_bound,z_bound);    
-
-  z0deltacorrections_vs_etaphi =	new TH2D("z0CorrectionVsEtaPhi",";#eta;#phi;#delta_{z_{0}} [mm]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-  z0deltacorrections_vs_etaphi_err = new TH2D("z0CorrectionVsEtaPhi_Err",";#eta;#phi;#delta_{z_{0}}", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-
-  z0delta =	new TH1D("Delta_z0", ";#delta_{z_{0}} [mm]", 100,-z_bound,z_bound);
-
-  z0delta_pos =	new TH1D("Delta_z0_Pos",";#delta_{z_{0}} [mm]", 100,-z_bound,z_bound);
-
-  z0delta_neg =	new TH1D("Delta_z0_Neg",";#delta_{z_{0}} [mm]", 100,-z_bound,z_bound);
-
-  z0delta_etaphi =	new TH1D("Delta_z0_etaphi",";#delta_{z_{0}} [mm]", 100,-z_bound,z_bound);
-
-  z0delta_etaphi_pos =	new TH1D("Delta_z0_etaphi_Pos",";#delta_{z_{0}} [mm]", 100,-z_bound,z_bound);
-
-  z0delta_etaphi_neg =	new TH1D("Delta_z0_etaphi_Neg",";#delta_{z_{0}} [mm]", 100,-z_bound,z_bound);
-
-  //d0 Histograms------------------------------------------------------------------
-
-  d0delta_vs_etaphi =	new TH3F("Delta_d0_VsEtaPhi",";#eta;#phi;#delta_{d_{0}} [mm]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 50,-d_bound, d_bound);
-
-  d0deltacorrections_vs_etaphi =	new TH2D("d0CorrectionVsEtaPhi",";#eta;#phi;#delta_{d_{0}} [mm]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-  d0deltacorrections_vs_etaphi_err = new TH2D("d0CorrectionVsEtaPhi_Err",";#eta;#phi;#delta_{d_{0}}", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-  d0delta =	new TH1D("Delta_d0", ";#delta_{d_{0}} [mm]", 100,-d_bound,d_bound);
-
-  d0delta_pos =	new TH1D("Delta_d0_Pos",";#delta_{d_{0}} [mm]", 100,-d_bound,d_bound);
-
-  d0delta_neg =	new TH1D("Delta_d0_Neg",";#delta_{d_{0}} [mm]", 100,-d_bound,d_bound);
-
-  d0delta_etaphi =	new TH1D("Delta_d0_etaphi",";#delta_{d_{0}} [mm]", 100,-d_bound,d_bound);
-
-  d0delta_etaphi_pos =	new TH1D("Delta_d0_etaphi_Pos",";#delta_{d_{0}} [mm]", 100,-d_bound,d_bound);
-
-  d0delta_etaphi_neg =	new TH1D("Delta_d0_etaphi_Neg",";#delta_{d_{0}} [mm]", 100,-d_bound,d_bound);
-    
-  //delta - charge symmetric -----------------
-  delta_vs_etaphi = 				new TH3F("DeltaPVsEtaPhi",";#eta;#phi;#delta_{r}", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 100,-p_bound,p_bound);
-
-  deltacorrections_vs_etaphi = 			new TH2D("PCorrectionVsEtaPhi",";#eta;#phi;#delta_{r}", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-  
-  deltacorrections_vs_etaphi_err = 		new TH2D("PCorrectionVsEtaPhi_Err",";#eta;#phi;#delta_{r}", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-  
-  //lambda * pT - charge anti-symmetric -----------------
-  lambda_vs_etaphi = 			 	new TH3F("LambdaVsEtaPhi",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 100,-pt_bound,pt_bound);
-
-  lambdacorrections_vs_etaphi = 		new TH2D("LambdaCorrectionVsEtaPhi",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-  lambdacorrections_vs_etaphi_err = 		new TH2D("LambdaCorrectionVsEtaPhi_Err",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-  lambdacorrections_vs_etaphi_RMS =             new TH2D("LambdaCorrectionVsEtaPhi_RMS",";#eta;#phi;RMS #delta_{sagitta} [GeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-  //lambda * pT - charge anti-symmetric -----------------
-  lambda_vs_eta = 			 	new TH2F("LambdaVsEta",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, 100,-pt_bound,pt_bound);
-  lambda_vs_eta_pos = 			 	new TH2F("LambdaVsEta_Pos", ";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, 100,-pt_bound,pt_bound);
-  lambda_vs_eta_neg = 			 	new TH2F("LambdaVsEta_Neg", ";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, 100,-pt_bound,pt_bound);
-
-  lambdacorrections_vs_eta  = 			new TH1D("LambdaCorrectionVsEta",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound);
-
-  lambda =				     	new TH1D("Lambda",    ";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-  lambda_pos =				      	new TH1D("Lambda_Pos",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-  lambda_neg =				      	new TH1D("Lambda_Neg",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-
-  lambda_eta =  			        new TH1D("Lambda_eta",	 ";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-  lambda_eta_pos =			        new TH1D("Lambda_eta_Pos",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-  lambda_eta_neg =			        new TH1D("Lambda_eta_Neg",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-
-  lambda_etaphi =			        new TH1D("Lambda_etaphi",    ";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-  lambda_etaphi_pos =			        new TH1D("Lambda_etaphi_Pos",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-  lambda_etaphi_neg =			        new TH1D("Lambda_etaphi_Neg",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-
-  if (m_isMC) {
-
-    h_pt_truth = 			     new TH1D("Pt_Truth",     ";p_{T} [GeV]",500,0,500);
-    h_pt_pos_truth =			     new TH1D("Pt_Pos_Truth",";p_{T} [GeV]",500,0,500);
-    h_pt_neg_truth =			     new TH1D("Pt_Neg_Truth",";p_{T} [GeV]",500,0,500);
-
-    delta_vs_etaphi_truth = 		     new TH3F("DeltaPVsEtaPhi_Truth",";#eta;#phi;#delta_{r}", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 100,-p_bound,p_bound);
-    deltacorrections_vs_etaphi_truth = 	     new TH2D("PCorrectionVsEtaPhi_Truth",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);    
-    deltacorrections_vs_etaphi_truth_err =   new TH2D("PCorrectionVsEtaPhi_Truth_Err",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);    
-
-    lambda_vs_etaphi_truth = 		     new TH3F("LambdaVsEtaPhi_Truth",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound, 100,-pt_bound,pt_bound);
-    lambdacorrections_vs_etaphi_truth =      new TH2D("LambdaCorrectionVsEtaPhi_Truth",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-    lambdacorrections_vs_etaphi_truth_err =  new TH2D("LambdaCorrectionVsEtaPhi_Truth_Err",";#eta;#phi;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, fnPhiBins,-phi_bound,phi_bound);
-
-    lambda_vs_eta_truth =    		     new TH2F("LambdaVsEta_Truth",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, 100,-pt_bound,pt_bound);
-    lambdacorrections_vs_eta_truth = 	     new TH1D("LambdaCorrectionVsEta_Truth",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound);
-
-    truth_mom_bias_vs_eta =    		     new TH2F("TruthMomentumBiasVsEta",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, 100,-pt_bound,pt_bound);
-    truth_mom_biascorrections_vs_eta = 	     new TH1D("TruthMomentumBiasCorrectionVsEta",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound);
-
-    truth_mass_bias_vs_eta =		     new TH2F("TruthMassBiasVsEta",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound, 100,-pt_bound,pt_bound);
-    truth_mass_biascorrections_vs_eta =      new TH1D("TruthMassBiasCorrectionVsEta",";#eta;#delta_{sagitta} [TeV^{-1}]", fnEtaBins,-eta_bound,eta_bound);
-
-    lambda_truth = 			     new TH1D("Lambda_Truth",	 ";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-    lambda_truth_pos = 			     new TH1D("Lambda_Truth_Pos",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-    lambda_truth_neg =			     new TH1D("Lambda_Truth_Neg",";#delta_{sagitta} [TeV^{-1}]", 100,-pt_bound,pt_bound);
-
-    delta_phi_truth = 			     new TH1D("DeltaPhi_Truth",";#phi_{Truth} - #phi_{Rec}", 100,-0.01,0.01);	       
-    
-    delta_eta_truth =			     new TH1D("DeltaEta_Truth",";#eta_{Truth} - #eta_{Rec}", 100,-0.01,0.01);
-
-    delta_M2_vs_zpt_truth =		     new TH2D("delta_M2_vs_zpt_truth",";Z p_{T} [GeV]; #Delta (M^2)", 100,0,100, 100, -1.0, 1.0 );
-    delta_M2_vs_zpt =		     	     new TH2D("delta_M2_vs_zpt",";Z p_{T} [GeV]; #Delta (M^2)", 100,0,100, 100, -1.0, 1.0 );
-
-    delta_M2_vs_etaphi_pos =		     new TProfile2D("delta_M2_vs_etaphi_pos",";#eta;#phi; #Delta (M^2)", 20,-2.5,2.5, 20, -3.14, 3.14 );
-    delta_M2_vs_etaphi_neg =		     new TProfile2D("delta_M2_vs_etaphi_neg",";#eta;#phi; #Delta (M^2)", 20,-2.5,2.5, 20, -3.14, 3.14 );
-
-  }
-   
-  // Histograms of q/pt
-  h_QoverPt = new TH2F("h_QoverPt","q/p_{T} whole ID", 2*fnPhiBins, -phi_bound, phi_bound, fnQoverPtBins, -1/pt_bound, 1/pt_bound);
-  h_QoverPt->GetXaxis()->SetTitle("#phi [rad]");
-  h_QoverPt->GetYaxis()->SetTitle("q/p_{T} [GeV^{-1}]");
-  
-  h_QoverPt3D = new TH3F("h_QoverPt3D", "q/p_{T} whole ID", 
-			 fnEtaBins,      -eta_bound,  eta_bound,
-			 2*fnPhiBins,    -phi_bound,  phi_bound, 
-			 fnQoverPtBins, -1/pt_bound, 1/pt_bound);
-  h_QoverPt3D->GetXaxis()->SetTitle("#eta");
-  h_QoverPt3D->GetYaxis()->SetTitle("#phi [rad]");
-  h_QoverPt3D->GetZaxis()->SetTitle("q/p_{T} [GeV^{-1}]");
-}
-
-
-/////////////////////////////////////////
-// called by user to loop over TChains
-/////////////////////////////////////////
-void ZmumuValidationExample::loop( unsigned int maxEvents )
-{
-   std::cout << "  TrkValidation::loop()" << std::endl;
-   n_iteration++;
-   
-   //clear histograms to be fit
-   this->ResetHistograms();
-
-   unsigned int const nEvents = m_eventChain.GetEntries();
-   unsigned int const maxItr = ( maxEvents > 0 && maxEvents < nEvents ) ? maxEvents : nEvents;
-
-   //loop through events and fill histograms
-   if (m_PrintLevel >= 1) cout << " ** ZmumuValidationExample::loop ** start loop on events ... " << endl;
-   loopThroughEvents( maxItr );
-   
-   if (m_PrintLevel >= 1) cout<< " ** ZmumuValidationExample::loop ** Fitting histograms" << endl;
-   
-   //Fit corrections and add to previous corrections
-   profileZwithIterativeGaussFit(lambda_vs_etaphi,lambdacorrections_vs_etaphi, lambdacorrections_vs_etaphi_RMS, 1, lambdacorrections_vs_etaphi_err);
-   profileZwithIterativeGaussFit(delta_vs_etaphi,deltacorrections_vs_etaphi, 0, 1,deltacorrections_vs_etaphi_err);
-   profileYwithIterativeGaussFit(lambda_vs_eta,lambdacorrections_vs_eta);
-   
-   profileZwithIterativeGaussFit(z0delta_vs_etaphi,z0deltacorrections_vs_etaphi, 0, 1, z0deltacorrections_vs_etaphi_err);
-   profileZwithIterativeGaussFit(d0delta_vs_etaphi,d0deltacorrections_vs_etaphi, 0, 1, d0deltacorrections_vs_etaphi_err);
-   
-   if (m_isMC && n_iteration == 1) {  
-     profileZwithIterativeGaussFit(lambda_vs_etaphi_truth,  lambdacorrections_vs_etaphi_truth, 0, 1, lambdacorrections_vs_etaphi_truth_err);
-     profileZwithIterativeGaussFit(delta_vs_etaphi_truth,  deltacorrections_vs_etaphi_truth, 0, 1, deltacorrections_vs_etaphi_truth_err);
-     
-     profileYwithIterativeGaussFit(lambda_vs_eta_truth, lambdacorrections_vs_eta_truth);     
-     profileYwithIterativeGaussFit(truth_mom_bias_vs_eta, truth_mom_biascorrections_vs_eta);     
-     profileYwithIterativeGaussFit(truth_mass_bias_vs_eta, truth_mass_biascorrections_vs_eta);     
-   }
-
-  writeToFile(n_iteration);
-  
-  return;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-// loops over each event and calls fillHistograms() if there are tracks 
-//////////////////////////////////////////////////////////////////////////
-void ZmumuValidationExample::loopThroughEvents( unsigned int maxItr )
-{
-   std::cout << "  Looping over " << maxItr << " events"<< std::endl;
-       
-   for( unsigned int eventItr = 0
-      ; eventItr != maxItr
-      ; ++eventItr
-      )
-   {
-      if( eventItr % 10000 == 0 )
-      {
-	 std::cout << "  Processing event " << eventItr << " of " << maxItr << std::endl;
-      }
-        
-      if( !m_eventChain.LoadTree(eventItr) || (m_isMC && !m_truthChain.LoadTree(eventItr)) ) 
-	 continue;
-         
-      if( !m_eventChain.GetEntry(eventItr) || (m_isMC && !m_truthChain.GetEntry(eventItr)) )
-	 continue;
-      	 
-      fillHistograms();
-   }
-   
-   return;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void ZmumuValidationExample::fillHistograms()
-{
-  
-  const double muon_mass = 105.658;  //MeV
-  
-  //create lorentz vectors for both muons
-  TLorentzVector* vec_pos = new TLorentzVector(); 
-  TLorentzVector* vec_neg = new TLorentzVector();
-
-  //corrected z0 for both muons
-  double corrected_z0_pos;
-  double corrected_z0_neg;
-  double corrected_d0_pos;
-  double corrected_d0_neg;
-
-  vec_pos->SetXYZM(m_px_pos, m_py_pos, m_pz_pos, muon_mass);
-  vec_neg->SetXYZM(m_px_neg, m_py_neg, m_pz_neg, muon_mass);
-  
-  entries->Fill(vec_pos->Eta(),vec_pos->Phi(),1);
-  entries->Fill(vec_neg->Eta(),vec_neg->Phi(),1);
-  
-  fillHistogram( lambda,      vec_pos,  vec_neg,  1);
-  fillHistogram( lambda_pos,  vec_pos,  vec_neg,  1, +1);
-  fillHistogram( lambda_neg,  vec_pos,  vec_neg,  1, -1);
-  
-  //z0 etaphi
-  if ( m_d0_neg != 0  &&  m_d0_pos != 0){
-     // setting original z0values
-     corrected_z0_pos = m_z0_pos;
-     corrected_z0_neg = m_z0_neg;
-     // filling test histograms before correction
-     fillZd0Histogram( z0delta, corrected_z0_pos, corrected_z0_neg, 0);
-     fillZd0Histogram( z0delta_pos, corrected_z0_pos, corrected_z0_neg, 1);  
-     fillZd0Histogram( z0delta_neg, corrected_z0_pos, corrected_z0_neg, -1);
-     // adding correction to z0_pos/neg or d0_pos/neg
-     correctZd0(z0deltacorrections_vs_etaphi, vec_pos, vec_neg, corrected_z0_pos, corrected_z0_neg);
-	 // filling the main histogram to fit in the next step
-     fillZd0EtaPhiHistogram(z0delta_vs_etaphi, vec_pos, vec_neg, corrected_z0_pos, corrected_z0_neg);
-     // filling test histograms after correction
-     fillZd0Histogram( z0delta_etaphi, corrected_z0_pos, corrected_z0_neg, 0);
-     fillZd0Histogram( z0delta_etaphi_pos, corrected_z0_pos, corrected_z0_neg, 1);
-     fillZd0Histogram( z0delta_etaphi_neg, corrected_z0_pos, corrected_z0_neg, -1);
-  }
-
-  //d0 etaphi
-  if ( m_d0_neg != 0  &&  m_d0_pos != 0){
-     // setting original d0values
-     corrected_d0_pos = m_d0_pos;
-     corrected_d0_neg = m_d0_neg;
-     // filling test histograms before correction
-     fillZd0Histogram( d0delta, corrected_d0_pos, corrected_d0_neg, 0);
-     fillZd0Histogram( d0delta_pos, corrected_d0_pos, corrected_d0_neg, 1);
-     fillZd0Histogram( d0delta_neg, corrected_d0_pos, corrected_d0_neg, -1);
-     // adding correction to z0_pos/neg or d0_pos/neg
-     correctZd0(d0deltacorrections_vs_etaphi, vec_pos, vec_neg, corrected_d0_pos, corrected_d0_neg);
-	 // filling the main histogram to fit in the next step
-     fillZd0EtaPhiHistogram(d0delta_vs_etaphi, vec_pos, vec_neg, corrected_d0_pos, corrected_d0_neg);
-     // filling test histograms after correction
-     fillZd0Histogram( d0delta_etaphi, corrected_d0_pos, corrected_d0_neg, 0);
-     fillZd0Histogram( d0delta_etaphi_pos, corrected_d0_pos, corrected_d0_neg, 1);
-     fillZd0Histogram( d0delta_etaphi_neg, corrected_d0_pos, corrected_d0_neg, -1);
-  }
-      
-  //fill truth histograms on first iteration without correcting momentum
-  if (m_isMC && n_iteration == 1) {  
-
-    TLorentzVector* vec_truth_pos = new TLorentzVector();
-    TLorentzVector* vec_truth_neg = new TLorentzVector();
-
-    vec_truth_pos->SetXYZM(m_truth_px_pos, m_truth_py_pos, m_truth_pz_pos, muon_mass);
-    vec_truth_neg->SetXYZM(m_truth_px_neg, m_truth_py_neg, m_truth_pz_neg, muon_mass);
-
-    double z_mass = 91187.6;   //MeV
-    double mass = ((*vec_pos) + (*vec_neg)).M();
-    double mass_truth = ((*vec_truth_pos) + (*vec_truth_neg)).M();
-
-    double delta_M2 = (mass*mass - z_mass*z_mass)/(z_mass*z_mass);
-    double delta_M2_truth = (mass*mass - mass_truth*mass_truth)/(mass_truth*mass_truth);
-    double delta_M2_truth_bias = (mass_truth*mass_truth - z_mass*z_mass)/(z_mass*z_mass);
- 
-    h_pt_truth->Fill(vec_truth_pos->Pt()/1000.0);
-    h_pt_truth->Fill(vec_truth_neg->Pt()/1000.0);
-    h_pt_pos_truth->Fill(vec_truth_pos->Pt()/1000.0);
-    h_pt_neg_truth->Fill(vec_truth_neg->Pt()/1000.0);
-    
-    //truth momentum bias
-    double d_bias_truth_pos = +1/vec_truth_pos->Pt()*(1 - vec_truth_pos->P()/vec_pos->P())*1000000.0;
-    double d_bias_truth_neg = -1/vec_truth_neg->Pt()*(1 - vec_truth_neg->P()/vec_neg->P())*1000000.0;
-
-    truth_mom_bias_vs_eta->Fill(vec_truth_pos->Eta(), d_bias_truth_pos);
-    truth_mom_bias_vs_eta->Fill(vec_truth_neg->Eta(), d_bias_truth_neg);
-
-    //Z mass/method bias
-    double d_mass_bias_truth_pos = +1*delta_M2_truth_bias/vec_truth_pos->Pt()*1000000.0;
-    double d_mass_bias_truth_neg = -1*delta_M2_truth_bias/vec_truth_neg->Pt()*1000000.0;
-
-    truth_mass_bias_vs_eta->Fill(vec_truth_pos->Eta(), d_mass_bias_truth_pos);
-    truth_mass_bias_vs_eta->Fill(vec_truth_neg->Eta(), d_mass_bias_truth_neg);
-
-    //lambda corrections
-    double d_lambda_truth_pos = +1*delta_M2_truth/vec_truth_pos->Pt()*1000000.0;
-    double d_lambda_truth_neg = -1*delta_M2_truth/vec_truth_neg->Pt()*1000000.0;
-      
-    lambda_vs_etaphi_truth->Fill(vec_truth_pos->Eta(), vec_truth_pos->Phi(), d_lambda_truth_pos);
-    lambda_vs_etaphi_truth->Fill(vec_truth_neg->Eta(), vec_truth_neg->Phi(), d_lambda_truth_neg);
-
-    lambda_vs_eta_truth->Fill(vec_truth_pos->Eta(), d_lambda_truth_pos);
-    lambda_vs_eta_truth->Fill(vec_truth_neg->Eta(), d_lambda_truth_neg);
-
-    lambda_truth->Fill( d_lambda_truth_pos );
-    lambda_truth->Fill( d_lambda_truth_neg );
-    
-    lambda_truth_pos->Fill( d_lambda_truth_pos );
-    lambda_truth_neg->Fill( d_lambda_truth_neg );
-    
-    //delta corrections
-    double delta_truth_pos =  (vec_truth_pos->P() - vec_pos->P())/vec_truth_pos->P();
-    double delta_truth_neg =  (vec_truth_neg->P() - vec_neg->P())/vec_truth_neg->P();
-    
-    delta_vs_etaphi_truth->Fill(vec_truth_pos->Eta(), vec_truth_pos->Phi(), delta_truth_pos);
-    delta_vs_etaphi_truth->Fill(vec_truth_neg->Eta(), vec_truth_neg->Phi(), delta_truth_neg);
-
-    //check eta/phi biases
-    delta_phi_truth->Fill(vec_truth_pos->Phi() - vec_pos->Phi());
-    delta_phi_truth->Fill(vec_truth_neg->Phi() - vec_neg->Phi());
-
-    delta_eta_truth->Fill(vec_truth_pos->Eta() - vec_pos->Eta());
-    delta_eta_truth->Fill(vec_truth_neg->Eta() - vec_neg->Eta());
-
-    //other checks
-    double zpt_truth = ((*vec_truth_pos) + (*vec_truth_neg)).Pt();
-    
-    h_DELTA->Fill(delta_M2/(vec_pos->Pt() - vec_neg->Pt())*1000000);
-    //h_DELTA->Fill(delta_M2/(vec_truth_pos->Pt() - vec_truth_neg->Pt())*1000000);
-            
-    delta_M2_vs_zpt_truth->Fill(zpt_truth/1000.0,delta_M2_truth); 
-    delta_M2_vs_zpt->Fill(zpt_truth/1000.0,delta_M2); 
-  
-    delta_M2_vs_etaphi_pos->Fill(vec_pos->Eta(), vec_pos->Phi(), delta_M2);
-    delta_M2_vs_etaphi_neg->Fill(vec_neg->Eta(), vec_neg->Phi(), delta_M2);
-
-    delete vec_truth_pos;
-    delete vec_truth_neg;
-
-  } // end if of MC and truth info
-
-  //-----------------------------------------------------------------
-  //apply lambda momentum corrections in eta/phi
-  correctMomentum( lambdacorrections_vs_etaphi, vec_pos, vec_neg, 1);
-
-  fillHistogram( lambda_etaphi,      vec_pos,  vec_neg,  1);
-  fillHistogram( lambda_etaphi_pos,  vec_pos,  vec_neg,  1, +1);
-  fillHistogram( lambda_etaphi_neg,  vec_pos,  vec_neg,  1, -1);
-
-  //fill histograms
-  fillEtaPhiHistogram( lambda_vs_etaphi, vec_pos, vec_neg, 1);
-
-  // fill q/pt histograms
-  fillQoverPtHistograms (vec_pos, vec_neg);
-
-  //-----------------------------------------------------------------
-
-  //reset muon vectors and use original values
-  vec_pos->SetXYZM(m_px_pos, m_py_pos, m_pz_pos, muon_mass);
-  vec_neg->SetXYZM(m_px_neg, m_py_neg, m_pz_neg, muon_mass);
-  
-  //apply delta momentum corrections in eta/phi
-  correctMomentum( deltacorrections_vs_etaphi,  vec_pos, vec_neg, 0);
-  //fill histograms
-  fillEtaPhiHistogram( delta_vs_etaphi, vec_pos, vec_neg, 0);
-
-  //-----------------------------------------------------------------
-
-  //reset muon vectors and use original values
-  vec_pos->SetXYZM(m_px_pos, m_py_pos, m_pz_pos, muon_mass);
-  vec_neg->SetXYZM(m_px_neg, m_py_neg, m_pz_neg, muon_mass);
-
-  //apply lambda momentum corrections in eta
-  correctMomentum( lambdacorrections_vs_eta,  vec_pos, vec_neg, 1);
-
-  fillHistogram( lambda_eta,	  vec_pos,  vec_neg,  1);
-  fillHistogram( lambda_eta_pos,  vec_pos,  vec_neg,  1, +1);
-  fillHistogram( lambda_eta_neg,  vec_pos,  vec_neg,  1, -1);
-   
-  //fill histograms
-  fillEtaHistogram( lambda_vs_eta,      vec_pos,  vec_neg,  1);  
-  fillEtaHistogram( lambda_vs_eta_pos,  vec_pos,  vec_neg,  1, +1);	  
-  fillEtaHistogram( lambda_vs_eta_neg,  vec_pos,  vec_neg,  1, -1);	  
-  
-  //check corrected pt/mass distributions at each iteration
-  h_pt->Fill(vec_pos->Pt()/1000.0);
-  h_pt->Fill(vec_neg->Pt()/1000.0);
-  h_pt_pos->Fill(vec_pos->Pt()/1000.0);
-  h_pt_neg->Fill(vec_neg->Pt()/1000.0);
-   
-  h_mass->Fill(((*vec_pos)+(*vec_neg)).M()/1000.0);
-  
-  //check z0 distributions
-  h_z0->Fill(m_z0_pos);
-  h_z0->Fill(m_z0_neg);
-  h_z0_pos->Fill(m_z0_pos);
-  h_z0_neg->Fill(m_z0_neg);
-  //check d0 distributions
-  h_d0->Fill(m_d0_pos);
-  h_d0->Fill(m_d0_neg);
-  h_d0_pos->Fill(m_d0_pos);
-  h_d0_neg->Fill(m_d0_neg);
-  //-----------------------------------------------------------------
-
-  delete vec_pos;
-  delete vec_neg;
-   
-  return;
-}
-
-//--------------------------------------------------------------------------------------------------
-void ZmumuValidationExample::correctMomentum( TH1* h_corrections, TLorentzVector* muon_pos, TLorentzVector* muon_neg, int use_lambda)
-{   
-  double temp_pt_pos = muon_pos->Pt();
-  double temp_pt_neg = muon_neg->Pt();
-
-  // positive muon
-  double correction = h_corrections->GetBinContent(h_corrections->FindBin(muon_pos->Eta(), muon_pos->Phi()));
-  if (use_lambda) {
-    
-    double pt_true = muon_pos->Pt();
-    //double pt_true = muon_pos->Pt()/(1+(+1)*correction*muon_pos->Pt()/1000000.0);
-
-    muon_pos->SetXYZM(muon_pos->Px()/(1+correction*pt_true/1000000.0),
-  		      muon_pos->Py()/(1+correction*pt_true/1000000.0),
-		      muon_pos->Pz()/(1+correction*pt_true/1000000.0),
-		      muon_pos->M());    
-    if (m_PrintLevel >= 3) {
-      cout << " ** correctMomentum ** mu+ (eta,phi) (" << muon_pos->Eta() << ", " << muon_pos->Phi() << ") " 
-	   << " bin = " << h_corrections->FindBin(muon_pos->Eta(), muon_pos->Phi())
-	   << " correction = " << correction 
-	   << endl;
-    }
-  } 
-  else {
-    // mainly for delta corrections
-    muon_pos->SetXYZM(muon_pos->Px()*(1-correction),
-  		      muon_pos->Py()*(1-correction),
-		      muon_pos->Pz()*(1-correction),
-		      muon_pos->M());    
-  }
-  
-  // negative muon
-  correction = h_corrections->GetBinContent(h_corrections->FindBin(muon_neg->Eta(), muon_neg->Phi()));
-  if (use_lambda) {
-
-    double pt_true = muon_neg->Pt();
-    //double pt_true = muon_neg->Pt()/(1+(+1)*correction*muon_neg->Pt()/1000000.0);
-
-    muon_neg->SetXYZM(muon_neg->Px()/(1-correction*pt_true/1000000.0),
-  		      muon_neg->Py()/(1-correction*pt_true/1000000.0),
-		      muon_neg->Pz()/(1-correction*pt_true/1000000.0),
-		      muon_neg->M());    
-    if (m_PrintLevel >= 3) {
-      cout << " ** correctMomentum ** mu- (eta,phi) (" << muon_neg->Eta() << ", " << muon_neg->Phi() << ") " 
-	   << " bin = " << h_corrections->FindBin(muon_neg->Eta(), muon_neg->Phi())
-	   << " correction = " << correction 
-	   << endl;
-    }
-  } 
-  else {
-    // mainly for delta corrections
-    muon_neg->SetXYZM(muon_neg->Px()*(1-correction),
-  		      muon_neg->Py()*(1-correction),
-		      muon_neg->Pz()*(1-correction),
-		      muon_neg->M());    
-  }
-
-  if (m_PrintLevel >= 3) {
-    cout << " ** correctMomentum ** mu+ Pt: " << temp_pt_pos << " --> " << muon_pos->Pt() << " Delta = " << 100*(muon_pos->Pt()-temp_pt_pos)/temp_pt_pos << " %"<< endl
-	 << "                       mu- Pt: " << temp_pt_neg << " --> " << muon_neg->Pt() << " Delta = " << 100*(muon_neg->Pt()-temp_pt_neg)/temp_pt_neg << " %"<< endl;
-  }
-
-
-  return;
-}
-
-
-//-------------------------------------------------------------------------------
-void ZmumuValidationExample::fillEtaPhiHistogram(TH3* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int use_lambda)
-{
-   double z_mass = 91187.6 + m_shift;   //MeV
-   double mass = ((*v_pos) + (*v_neg)).M();
-   double delta_M2 = (mass*mass - z_mass*z_mass)/(z_mass*z_mass);
-
-   if (use_lambda) { 
-     // to estimate the correction factor from: pt -> pt /(1+q pt delta_sagitta): q DeltaM2/pt
-     hist->Fill(v_pos->Eta(), v_pos->Phi(), +1*m_factor*delta_M2/v_pos->Pt()*1000000.0);     
-     hist->Fill(v_neg->Eta(), v_neg->Phi(), -1*m_factor*delta_M2/v_neg->Pt()*1000000.0);
-     
-   } else { 
-     hist->Fill(v_pos->Eta(), v_pos->Phi(), +1*delta_M2/2);
-     hist->Fill(v_neg->Eta(), v_neg->Phi(), +1*delta_M2/2);   
-   }
-}
-
-
-//-------------------------------------------------------------------------------
-void ZmumuValidationExample::fillEtaHistogram(TH2* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int use_lambda, int charge)
-{
-   double z_mass = 91187.6 + m_shift;   //MeV
-   double mass = ((*v_pos) + (*v_neg)).M();
-   double delta_M2 = (mass*mass - z_mass*z_mass)/(z_mass*z_mass);
-   
-   if (use_lambda) {
-     if (charge == 0 || charge == +1) hist->Fill(v_pos->Eta(), +1*m_factor*delta_M2/v_pos->Pt()*1000000.0 );
-     if (charge == 0 || charge == -1) hist->Fill(v_neg->Eta(), -1*m_factor*delta_M2/v_neg->Pt()*1000000.0 );
-     
-   } else { 
-     hist->Fill(v_pos->Eta(), +1*delta_M2/2);
-     hist->Fill(v_neg->Eta(), +1*delta_M2/2);   
-   }
-}
-
-//-----------------------------------------------------------------------------------------------
-void ZmumuValidationExample::fillHistogram(TH1* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int fill_lambda, int charge)
-{
-   double z_mass = 91187.6 + m_shift;   //MeV
-   double mass = ((*v_pos) + (*v_neg)).M();
-   double delta_M2 = (mass*mass - z_mass*z_mass)/(z_mass*z_mass);
-   
-   if (fill_lambda) {
-     if (charge == 0 || charge == +1) hist->Fill( +1*m_factor*delta_M2/v_pos->Pt()*1000000.0 );
-     if (charge == 0 || charge == -1) hist->Fill( -1*m_factor*delta_M2/v_neg->Pt()*1000000.0 );
-     
-   } else { 
-     hist->Fill(+1*delta_M2/2);
-     hist->Fill(+1*delta_M2/2);   
-   }
-}
-
-//-----------------------------------------------------------------------------------------------
-void ZmumuValidationExample::fillQoverPtHistograms(TLorentzVector* v_pos, TLorentzVector* v_neg)
-{
-  h_QoverPt->Fill((*v_pos).Phi(),  1000/(*v_pos).Pt());  // 1000 is for MeV to GeV
-  h_QoverPt->Fill((*v_neg).Phi(), -1000/(*v_neg).Pt());
-
-  h_QoverPt3D->Fill((*v_pos).Eta(), (*v_pos).Phi(),  1000/(*v_pos).Pt());  // 1000 is for MeV to GeV
-  h_QoverPt3D->Fill((*v_neg).Eta(), (*v_neg).Phi(), -1000/(*v_neg).Pt());
-  return;
-}
-// impact parameter biases methods------------------------------------------------------------------
-void ZmumuValidationExample::correctZd0( TH1* h_corrections, TLorentzVector* muon_pos, TLorentzVector* muon_neg, double& zd0_muon_p, double& zd0_muon_n)
-{   
-  double correction = h_corrections->GetBinContent(h_corrections->FindBin(muon_pos->Eta(), muon_pos->Phi()));
-//  std::cout << "Pos Cor" << correction << std::endl; 
-
-	zd0_muon_p = zd0_muon_p + correction ;
-
-  correction = h_corrections->GetBinContent(h_corrections->FindBin(muon_neg->Eta(), muon_neg->Phi()));
-	zd0_muon_n = zd0_muon_n + correction ;
-//  std::cout << "Neg Cor" << correction << std::endl; 
-    
-}
-
-void ZmumuValidationExample::fillZd0EtaPhiHistogram(TH3* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, double zd0_muon_p, double zd0_muon_n)
-{
-   double deltazd0 = -(zd0_muon_p - zd0_muon_n);
-   hist->Fill(v_pos->Eta(),v_pos->Phi(), deltazd0);
-   hist->Fill(v_neg->Eta(),v_neg->Phi(), -1.*deltazd0);
-}
-
-void ZmumuValidationExample::fillZd0Histogram(TH1* hist, double zd0_muon_p, double zd0_muon_n, int pn)
-{
-    double deltazd0 = (zd0_muon_p - zd0_muon_n);
-	if (pn == +1) hist->Fill(deltazd0);
-	if (pn == -1) hist->Fill(-1.*deltazd0);
-	if (pn == 0) {
-		hist->Fill(-1.*deltazd0);
-		hist->Fill(deltazd0);
-	}
-}
-// impact parameter biases methods------------------------------------------------------------------
-
-///////////////////////////////////
-// saves root objects to a TFile
-///////////////////////////////////
-void ZmumuValidationExample::writeToFile(int iteration)
-{
-
-  m_file.cd(); 
-
-  if (m_isMC && iteration == 1) {
-
-    h_pt_truth->Write(); 
-    h_pt_pos_truth->Write(); 
-    h_pt_neg_truth->Write(); 
-  
-    deltacorrections_vs_etaphi_truth->Write();
-    deltacorrections_vs_etaphi_truth_err->Write();
-
-    lambdacorrections_vs_etaphi_truth->Write();
-    lambdacorrections_vs_etaphi_truth_err->Write();
-    
-    lambdacorrections_vs_eta_truth->Write();
-    lambda_vs_eta_truth->Write();
-      
-    truth_mom_biascorrections_vs_eta->Write();
-    truth_mom_bias_vs_eta->Write();  
-
-    truth_mass_biascorrections_vs_eta->Write();
-    truth_mass_bias_vs_eta->Write();   
-
-    lambda_truth->Write();
-    lambda_truth_pos->Write();
-    lambda_truth_neg->Write();
-    
-    delta_phi_truth->Write();
-    delta_eta_truth->Write();
-    
-    delta_M2_vs_zpt_truth->Write();
-    delta_M2_vs_zpt->Write();
-    
-    delta_M2_vs_etaphi_pos->Write();
-    delta_M2_vs_etaphi_neg->Write();
-
-  }
-  
-  if (iteration > 0) {
-    m_file.mkdir(Form("Iteration%i",iteration));
-    m_file.cd(Form("Iteration%i",iteration));
-  }
-
-  h_pt->Write(); 
-  h_pt_pos->Write(); 
-  h_pt_neg->Write(); 
-  h_mass->Write();
-  
-  h_z0->Write();
-  h_z0_pos->Write();
-  h_z0_neg->Write();
-  h_d0->Write();
-  h_d0_pos->Write();
-  h_d0_neg->Write();
-
-  deltacorrections_vs_etaphi->Write(); 
-  deltacorrections_vs_etaphi_err->Write(); 
-
-  entries->Write();
-  
-  lambdacorrections_vs_etaphi->Write();
-  lambdacorrections_vs_etaphi_err->Write();
-  lambdacorrections_vs_etaphi_RMS->Write();
-  lambdacorrections_vs_eta->Write();
-  
-  lambda_vs_eta->Write();
-  lambda_vs_etaphi->Write();
-  
-  lambda_vs_eta_pos->Write();
-  lambda_vs_eta_neg->Write();
-  
-  lambda->Write();   
-  lambda_pos->Write();
-  lambda_neg->Write();
-  
-  lambda_eta->Write();
-  lambda_eta_pos->Write();
-  lambda_eta_neg->Write();
-
-  lambda_etaphi->Write();
-  lambda_etaphi_pos->Write();
-  lambda_etaphi_neg->Write();
-  
-  z0delta_vs_etaphi->Write();
-  z0deltacorrections_vs_etaphi->Write();
-  z0deltacorrections_vs_etaphi_err->Write();
-
-  z0delta->Write();
-  z0delta_pos->Write();
-  z0delta_neg->Write();
-
-
-  z0delta_etaphi->Write();
-  z0delta_etaphi_pos->Write();
-  z0delta_etaphi_neg->Write();
-
-  d0delta_vs_etaphi->Write();
-  d0deltacorrections_vs_etaphi->Write();
-  d0deltacorrections_vs_etaphi_err->Write();
-
-  d0delta->Write();
-  d0delta_pos->Write();
-  d0delta_neg->Write();
-
-  d0delta_etaphi->Write();
-  d0delta_etaphi_pos->Write();
-  d0delta_etaphi_neg->Write();
-  
-  //cout<< "MEAN: " <<h_DELTA->GetMean()<<endl;
-  h_DELTA->Write();
-
-  //
-  h_QoverPt->Write();
-  h_QoverPt3D->Write();
-  // delta_vs_etaphi->Write();
-}
-
-
-//-------------------------------------------------------------
-void ZmumuValidationExample::profileZwithIterativeGaussFit(TH3* hist, TH2* mu_graph, TH2* sigma_graph, int num_bins, TH2* mu_err_graph, TH2* sigma_err_graph)
-{
-  if (!hist) {
-    cout<< "ProfileZwithIterativeGaussFit(): No histogram supplied!"<<endl;
-    return;
-  }
-
-  int minEntries = 50;
-  int fDebug = 0;
-
-  int num_bins_x = hist->GetXaxis()->GetNbins();
-  int num_bins_y = hist->GetYaxis()->GetNbins();
-
-  double num_not_converged = 0;
-  int num_skipped = 0;
-
-  double max_sigma = 0;
-  double min_sigma = 0;
-
-  double max_mu = 0;
-  double min_mu = 0;
-
-  TH1D* current_proj;
-
-  for (int i = 1; i < num_bins_x+(num_bins==1); i+=num_bins) {
-
-  for (int j = 1; j < num_bins_y+(num_bins==1); j+=num_bins) {
-
-    int index = i/num_bins;
-    int index_y = j/num_bins;
-
-    current_proj = hist->ProjectionZ(Form("%s_GaussProjection_%i_%i",hist->GetName(),index, index_y),i,i+num_bins-1,j,j+num_bins-1);
-    current_proj->SetTitle(Form("%s - Bin %i x %i",hist->GetName(), index,index_y));
-
-    double current_mu,current_err_mu, current_sigma, current_err_sigma;
-
-    if(current_proj->GetEntries() < minEntries) {
-      if (m_PrintLevel >= 1) cout << " ** profileZwithIterativeGaussFit ** fitting " << hist->GetName() << "  bin (" << index << ", " << index_y << ") "
-				  << " Not enough entries " << current_proj->GetEntries() << " < " << minEntries << endl;
-       //current_mu = -999;
-       current_mu = 0;
-       current_sigma = 0;
-       current_err_mu = 1;
-       current_err_sigma = 1;
-       
-       if (fDebug) std::cout<<"WARNING: Only "<<current_proj->GetEntries()<<" entries in bin "<<index<<","<<index_y<< " in histogram " <<hist->GetName()<< std::endl;
-       num_skipped++;
-
-    } else {
-      if (m_PrintLevel >= 1) cout << " ** profileZwithIterativeGaussFit ** fitting " << hist->GetName() << "  bin (" << index << ", " << index_y << ") " << endl;
-      
-      IterativeGaussFit(current_proj, current_mu, current_err_mu, current_sigma, current_err_sigma);
-
-      if (current_sigma > max_sigma || max_sigma == 0) max_sigma = current_sigma;
-      if (current_sigma < min_sigma || min_sigma == 0) min_sigma = current_sigma;
-      if (current_mu > max_mu || max_mu == 0) max_mu = current_mu;
-      if (current_mu < min_mu || min_mu == 0) min_mu = current_mu;
-
-    }//end if entries < minEntries
-
-    float x_coord = (hist->GetXaxis()->GetBinLowEdge(i) + hist->GetXaxis()->GetBinUpEdge(i+num_bins-1))/2;
-    float y_coord = (hist->GetYaxis()->GetBinLowEdge(j) + hist->GetYaxis()->GetBinUpEdge(j+num_bins-1))/2;
-
-    if (sigma_graph) sigma_graph->Fill(x_coord,y_coord,current_sigma);
-    if (mu_graph) mu_graph->Fill(x_coord,y_coord,current_mu);
-        
-    //should probably be replace bin content, not fill?
-    if (sigma_err_graph) sigma_err_graph->Fill(x_coord,y_coord,current_err_sigma);
-    if (mu_err_graph) mu_err_graph->Fill(x_coord,y_coord,current_err_mu);
-
-    delete current_proj;
-    
-  } //end loop on j (y)
-  } //end loop on i (x)
-  
-  if (mu_graph) {
-    mu_graph->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
-    mu_graph->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
-    mu_graph->GetYaxis()->SetTitleOffset(1);
-    mu_graph->GetZaxis()->SetTitle(hist->GetZaxis()->GetTitle());
-    mu_graph->GetZaxis()->SetTitleOffset(1.2);
-    mu_graph->SetTitle( "" );
-    //mu_graph->SetMaximum(max_mu + 0.1* (max_mu-min_mu));
-    //mu_graph->SetMinimum(min_mu - 0.1* (max_mu-min_mu));
-  }
-  
-  if (sigma_graph) {
-    sigma_graph->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
-    sigma_graph->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
-    sigma_graph->GetYaxis()->SetTitleOffset(1);
-    sigma_graph->GetZaxis()->SetTitle(hist->GetZaxis()->GetTitle());
-    sigma_graph->GetZaxis()->SetTitleOffset(1.2);
-    sigma_graph->SetTitle( "" );
-    //sigma_graph->SetMaximum(max_sigma + 0.1* (max_sigma-min_sigma));
-    //sigma_graph->SetMinimum(min_sigma - 0.1* (max_sigma-min_sigma));
-  }
-
-  if (mu_err_graph) {
-    mu_err_graph->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
-    mu_err_graph->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
-    mu_err_graph->GetYaxis()->SetTitleOffset(1);
-    mu_err_graph->GetZaxis()->SetTitle(Form("Error of fit #mu: %s",hist->GetZaxis()->GetTitle()));
-    mu_err_graph->GetZaxis()->SetTitleOffset(1.2);
-    mu_err_graph->SetTitle(hist->GetTitle());
-    //mu_err_graph->SetMaximum(max_mu + 0.1* (max_mu-min_mu));
-    //mu_err_graph->SetMinimum(min_mu - 0.1* (max_mu-min_mu));
-  }
-
-  if (sigma_err_graph) {
-    sigma_err_graph->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
-    sigma_err_graph->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
-    sigma_err_graph->GetYaxis()->SetTitleOffset(1);
-    sigma_err_graph->GetZaxis()->SetTitle(Form("Error of fit #sigma: %s",hist->GetZaxis()->GetTitle()));
-    sigma_err_graph->GetZaxis()->SetTitleOffset(1.2);
-    sigma_err_graph->SetTitle(hist->GetTitle());
-    //sigma_err_graph->SetMaximum(max_mu + 0.1* (max_mu-min_mu));
-    //sigma_err_graph->SetMinimum(min_mu - 0.1* (max_mu-min_mu));
-  }
-  
-
-  if (num_not_converged || num_skipped) std::cout<<"Fit Results for histogram: "<< hist->GetName()<<std::endl;
-  if (num_not_converged) std::cout<<"Non Convergent Bin Fraction: "<<num_not_converged<< " / " <<num_bins_x*num_bins_y - num_skipped<<std::endl;
-  if (num_skipped) std::cout<<"Number skipped bins: "<<num_skipped<< " / " <<num_bins_x*num_bins_y<<std::endl;
-
-  return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::profileYwithIterativeGaussFit(TH2* hist, TH1* mu_graph, TH1* sigma_graph, int num_bins)
-{
-
-  if (!hist) {
-    std::cout << "Error in ProfileYwithIterativeGaussFit(): Histogram not found" <<std::endl;
-    return;
-  }
-
-  if (num_bins < 1 ) {
-    std::cout << "Error in ProfileYwithIterativeGaussFit(): Invalid number of bins to integrate over." <<std::endl;
-    return;
-  }
-
-  const int minEntries = 50;
-  const int fDebug = 0; 
-
-  int num_bins_x = hist->GetXaxis()->GetNbins();
-  
-  if (mu_graph) mu_graph->Rebin(num_bins);
-  if (sigma_graph) sigma_graph->Rebin(num_bins);
-  
-  double* errs_mu = new double[num_bins_x/num_bins + 2]; // +2 for overflow!! 
-  double* errs_sigma = new double[num_bins_x/num_bins + 2];
-
-  errs_mu[0] = 0;
-  errs_mu[num_bins_x/num_bins + 1] = 0;
-
-  errs_sigma[0] = 0;
-  errs_sigma[num_bins_x/num_bins + 1] = 0;
-
-  double min_sigma = 0;
-  double max_sigma = 0; 
-  double min_mu = 0;
-  double max_mu = 0;
-
-  int num_skipped = 0;
-
-  TH1D* current_proj;
-
-  for (int i = 1; i < (num_bins_x + (num_bins == 1)); i+=num_bins) {
-
-    int index = i/num_bins;
-    if (num_bins == 1) index--;
-
-    current_proj = hist->ProjectionY(Form("%s_projection_%i",hist->GetName(),index),i,i+num_bins-1);
-
-    double mu, mu_err, sigma, sigma_err;
-
-    if(current_proj->GetEntries() < minEntries) {
-      mu = 0;
-      mu_err = 0;
-      sigma = 0;
-      sigma_err = 0;
-      num_skipped++;
-      if ( fDebug ) std::cout<<"WARNING: Not enough entries in bin "<<index<<std::endl;
-    } else {
-    
-      IterativeGaussFit(current_proj, mu, mu_err, sigma, sigma_err);
-
-      if (sigma > max_sigma || max_sigma == 0) max_sigma = sigma;
-      if (sigma < min_sigma || min_sigma == 0) min_sigma = sigma;
-      if (mu > max_mu || max_mu == 0) max_mu = mu;
-      if (mu < min_mu || min_mu == 0) min_mu = mu;
-
-    }
-    
-    double value_x = (hist->GetXaxis()->GetBinLowEdge(i) + hist->GetXaxis()->GetBinUpEdge(i+num_bins-1))/2;
-
-    //Important!! Use Fill to increment the graph with each iteration, or SetBinContent to replace contents...
-
-    //if (sigma_graph) sigma_graph->SetBinContent(i, sigma);
-    //if (mu_graph) mu_graph->SetBinContent(i, mu);
-
-    if (sigma_graph) sigma_graph->Fill(value_x, sigma);
-    if (mu_graph) mu_graph->Fill(value_x, mu);
-   
-    errs_mu[index + 1] = mu_err;
-    errs_sigma[index + 1] = sigma_err;
-    
-    delete current_proj;
-  }
-  
-  if (sigma_graph) {
-    sigma_graph->SetError(errs_sigma);
-    //sigma_graph->SetMaximum(max_sigma+0.15*(max_sigma - min_sigma));
-    //sigma_graph->SetMinimum(min_sigma-0.15*(max_sigma - min_sigma));
-    sigma_graph->GetYaxis()->SetTitleOffset(1.5);
-    sigma_graph->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
-    sigma_graph->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
-    sigma_graph->SetTitle("");
-  }
-  
-  if (mu_graph) {
-    mu_graph->SetError(errs_mu);
-    //mu_graph->SetMaximum(max_mu+0.15*(max_mu - min_mu));
-    //mu_graph->SetMinimum(min_mu-0.15*(max_mu - min_mu));
-    mu_graph->GetYaxis()->SetTitleOffset(1.5);
-    mu_graph->GetYaxis()->SetTitle(hist->GetYaxis()->GetTitle());
-    mu_graph->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
-    mu_graph->SetTitle("");
-  }
-  
-  if (fDebug && num_skipped)  std::cout<<" Number of skipped bins: "<<num_skipped<<std::endl;
-  
-  return;
-
-}
-
-//-----------------------------------------------------------------------------
-int ZmumuValidationExample::IterativeGaussFit(TH1* hist, double &mu, double &mu_err, double &sigma, double &sigma_err)
-{
-  
-  //constants for fitting algorithm
-  const int iteration_limit = 20;
-  const float percent_limit = 0.01;
-  const float fit_range_multiplier = 1.5;
-  const int fDebug = 0;
-  
-  double last_mu;
-  double last_sigma;
-  double current_mu;
-  double current_sigma;
-  double mu_percent_diff;
-  double sigma_percent_diff;
-  
-  if (!hist) {
-    if (fDebug) std::cout<< "Error in  Anp::IterativeGaussFit(): Histogram to be fit is missing" <<std::endl;
-    return 1;
-  }  
-  
-  this->HistogramConditioning(hist);
-
-  TF1* fit_func = new TF1("fit_func","gaus");
-
-  int bad_fit = hist->Fit(fit_func,"QN");
-
-  if (fDebug && bad_fit) std::cout <<"BAD INITIAL FIT: "<< hist->GetTitle() << std::endl;
-
-  last_mu = fit_func->GetParameter(1); 
-  last_sigma = fit_func->GetParameter(2);
-
-  if (bad_fit) last_mu = hist->GetMean();
-
-  // check as well that the last_mu is reasonable
-  if (fabs(last_mu - hist->GetMean()) > 5*hist->GetBinWidth(1)) last_mu =  hist->GetMean();  
-
-  fit_func->SetRange(last_mu-fit_range_multiplier*last_sigma,last_mu+fit_range_multiplier*last_sigma);
-
-  int iteration = 0;
-
-  while ( iteration < iteration_limit ) {
-
-    iteration++;
-
-    double FitRangeLower = last_mu-fit_range_multiplier*last_sigma;
-    double FitRangeUpper = last_mu+fit_range_multiplier*last_sigma;
-
-    // if range is to narrow --> broaden it
-    if ((FitRangeUpper-FitRangeLower)/hist->GetBinWidth(1) < 4) {
-      FitRangeLower -= hist->GetBinWidth(1);
-      FitRangeUpper += hist->GetBinWidth(1);
-    }
-
-    fit_func->SetRange(FitRangeLower, FitRangeUpper);
-    if (m_PrintLevel >= 3) cout << " ** IterativeGaussFit ** fit iter # " << iteration 
-				<< "   new fit range: " << FitRangeLower << " --> " << FitRangeUpper << endl; 
-
-
-
-    bad_fit = hist->Fit(fit_func, "RQN");
-
-    if (fDebug && bad_fit) std::cout<<" ** BAD FIT ** : bin "<< hist->GetTitle() <<"  iteration "<<iteration<<std::endl;
-
-    current_mu = fit_func->GetParameter(1); 
-    current_sigma = fit_func->GetParameter(2);
-
-    //std::cout<<"Iteration: "<<iteration<<" Current: "<<current_mu<<" "<<current_sigma<<" Last: "<<last_mu<<" "<<last_sigma<<std::endl;
-
-    float average_mu = (last_mu+current_mu)/2;
-    float average_sigma = (last_sigma+current_sigma)/2;
-
-    if (average_mu == 0) {
-      if ( fDebug ) std::cout<<" Average mu = 0 in bin "<< hist->GetTitle() <<std::endl;
-      average_mu = current_mu;
-    } 
-
-    if (average_sigma == 0) {
-      if ( fDebug ) std::cout<<"Average sigma = 0; Fit Problem in "<< hist->GetTitle() <<". "<<last_sigma<<" "<<current_sigma<<std::endl;
-      average_sigma = current_sigma;
-    }
-
-    mu_percent_diff = fabs((last_mu-current_mu)/average_mu);
-    sigma_percent_diff = fabs((last_sigma-current_sigma)/average_sigma);
-
-    if ( mu_percent_diff < percent_limit && sigma_percent_diff < percent_limit ) break;
-
-    if (iteration != iteration_limit) { //necessary?
-      last_mu = current_mu;
-      last_sigma = current_sigma;
-    }    
-    // check as well that the last_mu is reasonable
-    if (fabs(last_mu - hist->GetMean()) > 5*hist->GetBinWidth(1)) {
-      if (m_PrintLevel >= 3) cout << " ** IterativeGaussFit ** fit iter # " << iteration
-				  << " ** WARNING ** last_mu looks bad: " << last_mu
-				  << "    this iter mu: " << fit_func->GetParameter(1)
-				  << "    proposed mu: " << hist->GetMean() 
-				  << endl;
-      last_mu =  hist->GetMean();  
-    } 
-  }
-
-  if (iteration == iteration_limit) {
-    if (fDebug ) std::cout<<"WARNING: Fit did not converge to < "<<percent_limit*100<<"% in "<< hist->GetTitle() <<" in "<<iteration_limit<<" iterations. Percent Diffs: "<<mu_percent_diff*100<<"% (Mu),"<<" "<<sigma_percent_diff*100<<"% (Sigma)"<<std::endl;
-    //possibly return a value other than 0 to indicate not converged?
-  }
-
-  mu = current_mu;
-  mu_err = fit_func->GetParError(1);
-  sigma = current_sigma;
-  sigma_err = fit_func->GetParError(2);
-  
-  hist->GetListOfFunctions()->Add(fit_func);
-
-  if (m_PrintLevel >= 1 ) {
-    cout << " ** IterativeGaussFit ** fit result: histo name " << hist->GetName() << "    title: " << hist->GetTitle()  << endl
-	 << "    mu = " << mu << " +- " << mu_err << endl
-	 << " sigma = " << sigma << " +- " << sigma_err 
-	 << endl;
-    if (TempCanvasIterGaussFit == NULL) {
-      TempCanvasIterGaussFit = new TCanvas ("TempCanvasIterGaussFit","Iter Gauss fit", 400, 400);
-    }
-    hist->DrawCopy();
-    TempCanvasIterGaussFit->Update();
-    hist->Print();
-    string input = "";
-    cout << " ** IterativeGaussFit ** Please type RETURN to continue:\n>";
-    getline(cin, input);
-  }
-  
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::SetPrintLevel (int newprintlevel) 
-{
-  m_PrintLevel = newprintlevel;
-  if (m_PrintLevel < 0) m_PrintLevel = 0;
-  return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::SetEtaBins (int newbins) 
-{
-  m_EtaBins = newbins;
-  if (m_EtaBins < 1) m_EtaBins = 1;
-  if (m_EtaBins > 100) m_EtaBins = 100;
-  return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::SetPhiBins (int newbins) 
-{
-  m_PhiBins = newbins;
-  if (m_PhiBins < 1) m_PhiBins = 1;
-  if (m_PhiBins > 100) m_PhiBins = 100;
-  return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::DrawMap ()
-{
-  this->SymmetrizeHisto(lambdacorrections_vs_etaphi);
-
-  lambdacorrections_vs_etaphi->DrawCopy("colz");
-
-   return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::ResetHistograms ()
-{
-   delta_vs_etaphi->Reset();
-   
-   //
-   entries->Reset();
-   z0delta_vs_etaphi->Reset();
-
-   z0delta->Reset();
-   z0delta_pos->Reset();
-   z0delta_neg->Reset();
-   z0delta_etaphi->Reset();
-   z0delta_etaphi_pos->Reset();
-   z0delta_etaphi_neg->Reset();
-
-   d0delta_vs_etaphi->Reset();
-
-   d0delta->Reset();
-   d0delta_pos->Reset();
-   d0delta_neg->Reset();
-   d0delta_etaphi->Reset();
-   d0delta_etaphi_pos->Reset();
-   d0delta_etaphi_neg->Reset();
-   //
-   
-   h_DELTA->Reset();
-   h_pt->Reset();
-   h_pt_pos->Reset();
-   h_pt_neg->Reset();
-   h_mass->Reset();
-
-   delta_vs_etaphi->Reset();
-
-   deltacorrections_vs_etaphi->Reset();
-   deltacorrections_vs_etaphi_err->Reset();
-  
-   lambda_vs_etaphi->Reset();
-   lambdacorrections_vs_etaphi->Reset();
-   lambdacorrections_vs_etaphi_err->Reset();
-
-   lambda_vs_eta->Reset();
-   lambda_vs_eta_pos->Reset();
-   lambda_vs_eta_neg->Reset();
-
-   lambdacorrections_vs_eta->Reset();
-
-   lambda->Reset();
-   lambda_pos->Reset();
-   lambda_neg->Reset();
-
-   lambda_eta->Reset();
-   lambda_eta_pos->Reset();
-   lambda_eta_neg->Reset();
-
-   lambda_etaphi->Reset();
-   lambda_etaphi_pos->Reset();
-   lambda_etaphi_neg->Reset();
-
-   // impact param histos
-   h_z0->Reset();
-   h_z0_pos->Reset();
-   h_z0_neg->Reset();
-   h_d0->Reset();
-   h_d0_pos->Reset();
-   h_d0_neg->Reset();
-
-   return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::SymmetrizeHisto (TH2* hist)
-{
-  double RangeUpper = hist->GetBinContent(hist->GetMaximumBin());
-  double RangeLower = hist->GetBinContent(hist->GetMinimumBin());
-
-  double NewRangeUpper = RangeUpper;
-  double NewRangeLower = -RangeUpper;
-
-  if (RangeUpper < - RangeLower) {
-    NewRangeUpper = -RangeLower;
-    NewRangeLower =  RangeLower;
-  }
-
-  NewRangeUpper *= 1.01; // increase a bit the scale just to make sure everything fits in
-  NewRangeLower *= 1.01;
-
-  if (m_PrintLevel >= 3) {
-    cout <<  " ** SymmetrizeHisto ** old range: " << RangeLower << " --> " << RangeUpper << endl;
-    cout <<  "                       new range: " << NewRangeLower << " --> " << NewRangeUpper << endl;
-  }
-
-  hist->SetMaximum(NewRangeUpper);
-  hist->SetMinimum(NewRangeLower);
-  
-  return;
-}
-
-//-----------------------------------------------------------------------------
-void ZmumuValidationExample::HistogramConditioning (TH1* hist)
-{
-  if (m_PrintLevel>=3) cout << " ** HistogramConditioning ** START ** hist = " << hist->GetName() << endl; 
-
-  double MinEntriesMPB = 15;
-  Int_t NGroupBins = 2;
-
-  // goal:
-  // make sure that the most populated bin has a minimum number of entries
-  Int_t  MostPopulatedBin = (hist->GetMaximumBin());
-  double EntriesMPB = hist->GetBinContent(MostPopulatedBin);
-  if (EntriesMPB < MinEntriesMPB) {
-    // check the entries of the neighbour channels
-    if ((EntriesMPB + hist->GetBinContent(MostPopulatedBin+1) + hist->GetBinContent(MostPopulatedBin-1)) > MinEntriesMPB) {
-      NGroupBins = 2;
-    }
-    else {
-      NGroupBins = 3;
-    }
-
-    // now find the first divisor (factor of ) the original number of bins
-    Bool_t DivisorFound = false;
-    while (!DivisorFound) {
-      if ( hist->GetNbinsX() % NGroupBins == 0) {
-  	DivisorFound = true;
-      }
-      else {
-  	DivisorFound = false;
-  	NGroupBins++;
-      }
-    }
-    Int_t NBinsWas = hist->GetNbinsX();
-    hist = hist->Rebin(NGroupBins);
-    if (m_PrintLevel>=1) cout << " ** HistogramConditioning ** histogram had to be rebinned by: " << NGroupBins 
-			      << " NBins was: " << NBinsWas << " and now is: " << hist->GetNbinsX() << endl;
-
-  }
-    
-
-  return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/ZmumuValidationExample.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/ZmumuValidationExample.h
deleted file mode 100644
index ad99cc66267c2b6ebf9f45dc5c4ac9dc270959e3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/ZmumuValidationExample.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef ZMUMUVALIDATIONEXAMPLE_h
-#define ZMUMUVALIDATIONEXAMPLE_h
-
-#include <vector>
-#include <list>
-#include <string>
-
-#include "TROOT.h"
-#include "TChain.h"
-#include "TFile.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TProfile2D.h"
-#include "TLorentzVector.h"
-#include "TCanvas.h"
-
-class ZmumuValidationExample 
-{
-  private:
-
-   const std::list<std::string> m_fileNames;
-   string m_outfilename;
-   
-   TFile    m_file;
-      
-   TChain m_eventChain;
-   TChain m_truthChain;
-   
-   int m_eventCurrent;
-   int m_PrintLevel;
-   int m_EtaBins;
-   int m_PhiBins;
-
-  
-   bool m_isMC;
-   int n_iteration;         
-   double m_shift;
-   double m_factor;
-   
-   /////////////////////////////////////////////
-   // Declaration of leafs for the track tree
-   /////////////////////////////////////////////
-   double m_px_pos;
-   double m_py_pos;
-   double m_pz_pos;
-   
-   double m_px_neg;
-   double m_py_neg;
-   double m_pz_neg;
-   
-  double m_z0_pos;
-  double m_z0_neg;
-  double m_d0_pos;
-  double m_d0_neg;
-   
-   double m_truth_px_pos;
-   double m_truth_py_pos;   
-   double m_truth_pz_pos;
-   
-   double m_truth_px_neg;
-   double m_truth_py_neg;
-   double m_truth_pz_neg;
-  	           
-   /////////////////////////////////////
-   // List of branches for track tree
-   /////////////////////////////////////
-   TBranch * b_px_pos;
-   TBranch * b_py_pos;
-   TBranch * b_pz_pos;
-   
-   TBranch * b_px_neg;
-   TBranch * b_py_neg;
-   TBranch * b_pz_neg;      
-
-   TBranch * b_z0_pos;
-   TBranch * b_z0_neg;
-   TBranch * b_d0_pos;
-   TBranch * b_d0_neg;
-
-   TBranch * b_truth_px_pos;
-   TBranch * b_truth_py_pos;
-   TBranch * b_truth_pz_pos;
-   	            
-   TBranch * b_truth_px_neg;
-   TBranch * b_truth_py_neg;
-   TBranch * b_truth_pz_neg;	  
-      
-   /////////////////////
-   // Root histograms
-   /////////////////////
-
-   TH1 * h_DELTA; 
-
-   TH1 * h_pt; 
-   TH1 * h_pt_pos;
-   TH1 * h_pt_neg;
-
-   TH1 * h_pt_truth;
-   TH1 * h_pt_pos_truth;
-   TH1 * h_pt_neg_truth;
-   
-   TH1 * h_z0;
-   TH1 * h_z0_pos;
-   TH1 * h_z0_neg;
-   TH1 * h_d0;
-   TH1 * h_d0_pos;
-   TH1 * h_d0_neg;
-
-   TH1 * h_mass; 
-   TH1 * pcorrected_mass; 
-   TH1 * lambdacorrected_mass;
-
-   TH3 * pcorrected_mass_vs_etaphi; 
-   TH3 * lambdacorrected_mass_vs_etaphi;
-
-   TH2 * etaphi_pos;
-   TH2 * etaphi_neg;
-
-   TProfile2D * prof_pt_vs_etaphi;
-
-   //delta corrections p->p(1+delta) - charge symmetric
-   TH3 * delta_vs_etaphi;         
-
-   TH2 * deltacorrections_vs_etaphi; 
-
-   TH2 * deltacorrections_vs_etaphi_err; 
-
-   //lambda corrections p->p(1+Q*lambda*pT) - charge anti-symmetric
-   TH3 * lambda_vs_etaphi;         
-
-   TH2 * lambdacorrections_vs_etaphi;
-   TH2 * lambdacorrections_vs_etaphi_err;
-   TH2 * lambdacorrections_vs_etaphi_RMS;
-
-   TH2 * lambda_vs_eta;   
-   TH2 * lambda_vs_eta_pos;
-   TH2 * lambda_vs_eta_neg;
-
-   TH1 * lambdacorrections_vs_eta;
-    
-   TH1 * lambda;
-   TH1 * lambda_pos;
-   TH1 * lambda_neg;
-
-   TH1 * lambda_etaphi;
-   TH1 * lambda_etaphi_pos;
-   TH1 * lambda_etaphi_neg;
-
-   TH1 * lambda_eta;
-   TH1 * lambda_eta_pos;
-   TH1 * lambda_eta_neg;
-   
-   //z0 histograms 
-   TH2 * entries;
-   
-   TH3 * z0delta_vs_etaphi;         
-
-   TH2 * z0deltacorrections_vs_etaphi;
-   TH2 * z0deltacorrections_vs_etaphi_err;
-
-   TH1 * z0delta;
-   TH1 * z0delta_pos;
-   TH1 * z0delta_neg;
-
-   TH1 * z0delta_etaphi;
-   TH1 * z0delta_etaphi_pos;
-   TH1 * z0delta_etaphi_neg;
-
-   //d0 histograms
-   TH3 * d0delta_vs_etaphi;         
-
-   TH2 * d0deltacorrections_vs_etaphi;
-   TH2 * d0deltacorrections_vs_etaphi_err;
-
-   TH1 * d0delta;
-   TH1 * d0delta_pos;
-   TH1 * d0delta_neg;
-
-   TH1 * d0delta_etaphi;
-   TH1 * d0delta_etaphi_pos;
-   TH1 * d0delta_etaphi_neg;
-
-   //truth histograms	   
-   TH3 * delta_vs_etaphi_truth;     
-   TH2 * deltacorrections_vs_etaphi_truth; 
-   TH2 * deltacorrections_vs_etaphi_truth_err; 
-
-   TH3 * lambda_vs_etaphi_truth;    
-   TH2 * lambdacorrections_vs_etaphi_truth;
-   TH2 * lambdacorrections_vs_etaphi_truth_err;
-
-   TH2 * lambda_vs_eta_truth;       
-   TH1 * lambdacorrections_vs_eta_truth;
-
-   TH2 * truth_mom_bias_vs_eta;       
-   TH1 * truth_mom_biascorrections_vs_eta;
-
-   TH2 * truth_mass_bias_vs_eta;
-   TH1 * truth_mass_biascorrections_vs_eta;
-
-   TH1 * lambda_truth;
-   TH1 * lambda_truth_pos;
-   TH1 * lambda_truth_neg;
-
-   TH1 * delta_phi_truth;
-
-   TH1 * delta_eta_truth;
-    
-   TH2* delta_M2_vs_zpt_truth; 
-   TH2* delta_M2_vs_zpt;
-    
-   TProfile2D* delta_M2_vs_etaphi_pos; 
-   TProfile2D* delta_M2_vs_etaphi_neg; 
-
-   // q/Pt histograms
-   TH2* h_QoverPt; 
-   TH3* h_QoverPt3D; 
-   
-   ////////////////////////////
-   // canvas to show fit resutls
-   ////////////////////////////
-   TCanvas* TempCanvasIterGaussFit;
-
-   ////////////////////////////////////////////
-   // more helper methods
-   // 
-   // these methods are used to initialize
-   // histograms, perform cuts, and fill
-   // histograms
-   ////////////////////////////////////////////    
-   void loadChains();
-   void setBranchAddresses();
-   void bookHistograms();
-    
-   void loopThroughEvents( unsigned int maxItr );
-   void fillHistograms();
-   
-   void correctMomentum(TH1* h_corrections, TLorentzVector* muon_pos, TLorentzVector* muon_neg, int use_lambda);
-
-   void fillEtaPhiHistogram(TH3* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int use_lambda);
-   void fillEtaHistogram(TH2* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int use_lambda, int charge=0);
-   void fillHistogram(TH1* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int fill_lambda, int charge=0);
-
-   void fillZd0EtaPhiHistogram(TH3* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, double z0_muon_p, double z0_muon_n);
-   void fillZd0Histogram(TH1* hist, double z0_muon_p, double z0_muon_n, int pn);
-   void correctZd0( TH1* h_corrections, TLorentzVector* muon_pos, TLorentzVector* muon_neg, double& zd0_muon_p, double& zd0_muon_n);
-
-   void profileZwithIterativeGaussFit(TH3* hist, TH2* mu_graph, TH2* sigma_graph, int num_bins, TH2* mu_err_graph=0, TH2* sigma_err_graph=0);
-   void profileYwithIterativeGaussFit(TH2* hist, TH1* mu_graph = 0, TH1* sigma_graph = 0, int num_bins = 1);
-
-   int  IterativeGaussFit(TH1* hist, double &mu, double &mu_err, double &sigma, double &sigma_err);
-
-   //
-   void fillQoverPtHistograms(TLorentzVector* v_pos, TLorentzVector* v_neg);
-   void HistogramConditioning (TH1* hist);
-   void ResetHistograms ();
-   void SymmetrizeHisto (TH2* hist);
-    
-  public:
-   ZmumuValidationExample( std::list<std::string> const & s_fileNames
-		       , string s_treeName = "DefaultParams"
-      		       , std::string const & s_outFileName = "ZmumuValidationExampleOutput.root"
-		       , bool isMC = false
-      		       );
-   ~ZmumuValidationExample();
-   
-   void loop( unsigned maxEvents = 0 );
-   void SetPrintLevel (int newprintlevel=0);
-   void SetEtaBins (int newbins=20);
-   void SetPhiBins (int newbins=20);
-   void writeToFile(int iteration);
-   void DrawMap(); 
-};
-#endif
-
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/fit_EoverP.C b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/fit_EoverP.C
deleted file mode 100644
index b870e0eb788f9a876db0b7ce26ff18f89c03e775..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/fit_EoverP.C
+++ /dev/null
@@ -1,1523 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef __CINT__
-
-#include "RooGlobalFunc.h"
-#endif
-#include "RooRealVar.h"
-#include "RooDataSet.h"
-#include "RooAbsData.h"
-#include "RooDataHist.h"
-#include "RooGaussian.h"
-#include "RooLandau.h"
-#include "RooChebychev.h"
-#include "RooAddPdf.h"
-#include "RooExtendPdf.h"
-#include "RooCBShape.h"
-#include "RooNovosibirsk.h"
-#include "RooFFTConvPdf.h"
-#include "RooExponential.h"
-#include "RooSimultaneous.h"
-#include "RooPolynomial.h"
-#include "RooFitResult.h"
-#include "RooCategory.h"
-#include "RooBinning.h"
-#include "RooWorkspace.h"
-#include "RooChi2Var.h" 
-#include "RooMinuit.h"
-#include "RooFormulaVar.h"
-#include "RooPlot.h"
-
-
-
-#include<TFile.h>
-#include<TH2F.h>
-#include<TH3F.h>
-#include<TH1D.h>
-#include<TF1.h>
-#include<TMath.h>
-#include<TTree.h>
-#include<TChain.h>
-#include<TColor.h>
-#include<TGraphErrors.h>
-#include<TCanvas.h>
-#include<TProfile.h>
-#include<iostream>
-#include <iomanip>
-#include <cmath>
-
-#include "TROOT.h"
-#include "THStack.h"
-#include "AtlasStyle.C"
-
-using namespace RooFit ;
-
-
-void makeSuperAwesomePlots( RooAbsData* originalDataSet, 
-                                 RooRealVar& eOverP, 
-                                 RooRealVar& eta, 
-                                 int nBinsEta,  
-                                 RooRealVar& phi, 
-                                 int nBinsPhi,
-                                 TString extraCuts = "",
-                                 RooRealVar* Et = NULL );
-
-
-void makeSuperAwesomePlotsEtaPt( RooAbsData* originalDataSet, 
-                                 RooRealVar& eOverP, 
-                                 RooRealVar& eta, 
-                                 int nBinsEta,  
-                                 RooRealVar& Pt, 
-                                 int nBinsPt);                                 
-
-void makeSuperAwesomePlotsPhiPt( RooAbsData* originalDataSet, 
-                                 RooRealVar& eOverP, 
-                                 RooRealVar& phi, 
-                                 int nBinsEta,  
-                                 RooRealVar& Pt, 
-                                 int nBinsPt);
-
-void makeSuperAwesomePlots( RooAbsData* originalDataSet, 
-                            RooRealVar& eOverP,
-                            RooRealVar& eta, 
-                            RooRealVar& phi, 
-                            TH2F* meanPlotPos,
-                            TH2F* meanPlotNeg,
-                            TString additionalCut = ""
-                          );
-
-
-void makeSuperAwesomePlots( RooRealVar& xvar, 
-                            RooRealVar& yvar,                                 
-                            TH3F* dataPlotPos,
-                            TH3F* dataPlotNeg,
-                            TH2F* meanPlotPos,
-                            TH2F* meanPlotNeg);
-
-TH2F* getCorrections();
-
-double  GetCorrection(TH2F* corrections, double eta, double phi, double Et, double charge);
-
-void  makeEtMeans(RooDataSet* dataSet,RooRealVar& Et,RooRealVar& ClusterEta,int nBinsEats);
-
-                                 
-void makeAwesomeSlicePlots(TH2F* pos, TH2F* neg, bool sliceInEta);
-
-void ratioPlots(TH1D* h1, TH1D* h2, TString name);
-
-void MakeScaling(TString inputDir="");
-
-
-//TString PATH = "./CA_TRTL3Iter4-4Dv3_2011/";
-TString PATH = "./Results/";
-
-int main(){
-  return 0;
-}
-
-void fit_EoverP(int netabins=12, int nphibins=12)
-{
-
-  gROOT->LoadMacro("AtlasStyle.C");
-  SetAtlasStyle();
-   
-  RooRealVar ClusterEnergy("ClusterEnergy","ClusterEnergy",0,1e10,"MeV") ;
-  RooRealVar ClusterPhi("ClusterPhi","#phi",0);
-  RooRealVar ClusterEta("ClusterEta","#eta",0);
-  RooRealVar charge("charge","charge",0);
-  RooRealVar TrackTheta("TrackTheta","TrackTheta",0);
-  RooRealVar TrackQoverP("QoverP","QoverP",-1e10,1e10,"MeV^{-1}");
-  RooRealVar EoverP("EoverP","E/p",0,5,"");
-  RooRealVar Et("Et","E_{T}",0,1e10,"GeV");
-  RooRealVar Eta("Eta","#eta",-3,3,"");
-  
-  RooArgSet myarg;
-  myarg.add(ClusterEnergy);
-  myarg.add(ClusterPhi);
-  myarg.add(ClusterEta);
-  myarg.add(charge);
-  myarg.add(TrackTheta);
-  myarg.add(TrackQoverP);
-  myarg.add(EoverP);
-  myarg.add(Et);
-  myarg.add(Eta);
- 
-  TChain* eoverpTree = new TChain("EGrefitterSmall");
-  //eoverpTree->Add("./Wenu-EndcapShifts.root");
-  eoverpTree->Add("../run/215414/Level2/L2-alignment.root");
-  
-  
-  Double_t         temp_ClusterEnergy;
-  Double_t         temp_ClusterPhi;
-  Double_t         temp_ClusterEta;
-  Double_t         temp_charge;
-  Double_t         temp_TrackTheta;
-  Double_t         temp_QoverP;
-  
-  eoverpTree->SetBranchAddress("ClusterEnergy", &temp_ClusterEnergy);
-  eoverpTree->SetBranchAddress("ClusterPhi", &temp_ClusterPhi);
-  eoverpTree->SetBranchAddress("ClusterEta", &temp_ClusterEta);
-  eoverpTree->SetBranchAddress("charge", &temp_charge);
-  eoverpTree->SetBranchAddress("TrackTheta", &temp_TrackTheta);  
-  eoverpTree->SetBranchAddress("Refitted2_QoverP", &temp_QoverP);
-  
-  RooDataSet* dataSet = new RooDataSet("DataSet","DataSet",myarg);
-  
-  
-  TH2F* CORRECTIONS=getCorrections();
-  
-  if(!CORRECTIONS){
-    std::cout << "INFO :: Getting Correction" << std::endl;
-    TFile f("FinalCorrections.root");
-    CORRECTIONS =(TH2F*) f.Get("FinalCorrections");
-    if(!CORRECTIONS)
-      return;
-    else{
-    
-      std::cout << "INFO :: Got Corrections" << std::endl;      
-      CORRECTIONS->Print();
-      int binNumber = CORRECTIONS->FindBin(1, 1);
-      std::cout << "INFO :: Got Corrections "<< CORRECTIONS->GetBinContent(binNumber) << std::endl;      
-    
-    }
-  }
-
-  // loop on events
-  for (int i=0; i< eoverpTree->GetEntries(); i++) {
-    eoverpTree->GetEntry(i);
-        
-    charge.setVal(temp_charge);
-    Et.setVal(temp_ClusterEnergy*sin(temp_TrackTheta)*1e-3);
-    Eta.setVal(-log(tan(temp_TrackTheta/2)) );
-    ClusterPhi.setVal(temp_ClusterPhi);
-    ClusterEnergy.setVal(temp_ClusterEnergy);
-    ClusterEta.setVal(temp_ClusterEta);
-
-    int binNumber = CORRECTIONS->FindBin(temp_ClusterEta, temp_ClusterPhi);
-    double delta = CORRECTIONS->GetBinContent(binNumber); 
-  
-    double correction =  1.; //1.+temp_charge*Et.getVal()*delta;  
-    
-    if (false) std::cout << "delta " << delta << " correction " << correction << std::endl; 
-    
-    //double correction  = GetCorrection(CORRECTIONS,temp_ClusterEta,temp_ClusterPhi,temp_ClusterEnergy*sin(temp_TrackTheta)*1e-3,temp_charge);
-    EoverP.setVal(fabs(temp_QoverP)*temp_ClusterEnergy * correction);
-    //if(i<10) std::cout << EoverP.getVal() <<std::endl;
-    // store info
-    dataSet->add(myarg);
-  }
-  
-  TCanvas c;
-  c.Print(PATH+"test.pdf(");
-
-  makeSuperAwesomePlots( dataSet, EoverP, ClusterEta, netabins, ClusterPhi, nphibins ); 
-  //makeSuperAwesomePlots( dataSet, EoverP, ClusterEta, 25, ClusterPhi, 1, "&& ClusterPhi>0" ); 
-  //makeSuperAwesomePlots( dataSet, EoverP, ClusterEta, 25, ClusterPhi, 1, "&& ClusterPhi<0" ); 
-  //makeEtMeans( dataSet, Et, ClusterEta, 16 ); 
-  //makeSuperAwesomePlotsEtaPt( dataSet, EoverP, ClusterEta, 50, Et, -1 );   
-  //makeSuperAwesomePlotsPhiPt( dataSet, EoverP, ClusterPhi, -1, Et, -1 ); 
-  
-  c.Print(PATH+"test.pdf)");
-
-                                  
-}
-
-
-
-double  GetCorrection(TH2F* CORRECTIONS, double eta, double phi, double Et,double charge)
-{
-  //Q/p_constr=Q/p_recon*(1 + pT_recon*Q*delta)
-  if(!CORRECTIONS)
-    return 1;
-
-  
-  std::cout << "INFO :: GetCorrection -> Bin number "; //<< std::endl;
-  
-  int binNumber = CORRECTIONS->FindBin(eta, phi);
-
-  std::cout<< binNumber << std::endl;
-  
-
-  std::cout << "INFO :: GetCorrection -> delta" << std::endl;
-  double delta = CORRECTIONS->GetBinContent(binNumber); 
-  
-  return 1+charge*Et*delta;  
-}
-
-
-void  makeEtMeans(RooDataSet* dataSet,RooRealVar& Et,RooRealVar& ClusterEta,int nBinsEta)
-{
-
-  RooBinning etaBinning(-2.5,2.5);
-  etaBinning.addUniform(nBinsEta,-2.5,2.5);
-  
-	ClusterEta.setBinning(etaBinning);
- 
- 
-  RooBinning etBinning(20,100);
-  etBinning.addUniform(80,20,100);
-  
-	Et.setBinning(etBinning);
- 
-  TH2F*	myHistPos = dataSet->createHistogram(ClusterEta, Et, nBinsEta, 100,"charge > 0 ", "positive ET hit");
-  myHistPos->GetXaxis()->SetTitle("#eta");
-  myHistPos->GetYaxis()->SetTitle("e^{+} E_{T}  [GeV]");
-  
-  TH2F*	myHistNeg = dataSet->createHistogram(ClusterEta, Et, nBinsEta, 100,"charge < 0 ", "negative ET hit");
-  myHistNeg->GetXaxis()->SetTitle("#eta");
-  myHistNeg->GetYaxis()->SetTitle("e^{-} E_{T} [GeV]");
-
-  TCanvas* c =  new TCanvas();
-  const UInt_t Number = 3;
-  Double_t Green[Number]  = { 0.00, 1.00, 0.00};
-  Double_t Red[Number]    = { 1.00, 0.10, 0.00};
-  Double_t Blue[Number]   = { 0.10, 0.10, 1.00};
-  Double_t Length[Number] = { 0.00, 0.50, 1.00 };
-  Int_t nb=50;
-  TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
-  myHistPos->SetContour(nb);
-  c->SetRightMargin(0.12);
-  c->SetLogy(false);
-  myHistPos->Draw("colz");
-
-  TCanvas* c2 =  new TCanvas();
-  c2->cd();
-  TProfile* prof  = myHistPos->ProfileX("_pfx");
-  prof->Draw();
-  prof->GetYaxis()->SetTitle("e^{+} <E_{T}> [GeV]");
-
-  TCanvas* c3 =  new TCanvas();
-  c3->cd();
-  TProfile* prof2  = myHistNeg->ProfileX("_pfx2");
-  prof2->Draw();
-  prof2->GetYaxis()->SetTitle("e^{-} <E_{T}> [GeV]");
-
-}
-
-
-
-void makeSuperAwesomePlots( RooAbsData* originalDataSet, 
-                                 RooRealVar& eOverP, 
-                                 RooRealVar& eta, 
-                                 int nBinsEta,  
-                                 RooRealVar& phi, 
-                                 int nBinsPhi,
-                                 TString extraCuts,
-                                 RooRealVar* Et )
-{
- 
-  
-  
-  // Set up ranges
-  double etaRange[100];
-  if (nBinsEta == -1){
-    etaRange[0] = -2.5;
-    etaRange[1] = -2.2;
-    etaRange[2] = -2.0;
-    etaRange[3] = -1.8;
-    etaRange[4] = -1.6;
-    etaRange[5] = -1.4;
-    etaRange[6] = -1.2;
-    etaRange[7] = -1.0;
-    etaRange[8] = -0.8;
-    etaRange[9] = -0.6;
-    etaRange[10] = -0.4;
-    etaRange[11] = -0.2;
-    etaRange[12] = -0.0;
-    etaRange[24] = 2.5;
-    etaRange[23] = 2.2;
-    etaRange[22] = 2.0;
-    etaRange[21] = 1.8;
-    etaRange[20] = 1.6;
-    etaRange[19] = 1.4;
-    etaRange[18] = 1.2;
-    etaRange[17] = 1.0;
-    etaRange[16] = 0.8;
-    etaRange[15] = 0.6;
-    etaRange[14] = 0.4;
-    etaRange[13] = 0.2;
-    nBinsEta = 22;
-  } else {
-    double stepSize = 5/(double)nBinsEta;
-    for (int  i(0); i<= nBinsEta; ++i){
-      etaRange[i] = -2.5+stepSize*(double)i;
-    }
-  }
-
-  double phiRange[102];
-  double stepSize = 2 * TMath::Pi()/(double)nBinsPhi;
-  for (int  i(0); i<= nBinsPhi; ++i){
-    phiRange[i] = -TMath::Pi()+stepSize*(double)i;
-  }
-  
-  
-  TH2F *meanPlotPos = new TH2F("meanPlotPos"+extraCuts,"meanPlotPos"+extraCuts,nBinsEta,etaRange,nBinsPhi,phiRange ); 
-  meanPlotPos->GetXaxis()->SetTitle("#eta");
-  meanPlotPos->GetYaxis()->SetTitle("#phi [rad]");
-  TH2F *meanPlotNeg = new TH2F("meanPlotNeg"+extraCuts,"meanPlotNeg"+extraCuts,nBinsEta,etaRange,nBinsPhi,phiRange );
-  meanPlotNeg->GetXaxis()->SetTitle("#eta");
-  meanPlotNeg->GetYaxis()->SetTitle("#phi [rad]");
-  
-
-  
-  //RooAbsData* smallAbsDataSetPos = originalDataSet->reduce( Cut("charge > 0"+ extraCuts) );
-  //RooDataSet* smallDataSetPos = dynamic_cast<RooDataSet*>( smallAbsDataSetPos );
-  //RooAbsData* smallAbsDataSetNeg = originalDataSet->reduce( Cut("charge < 0"+ extraCuts)) ;
-  //RooDataSet* smallDataSetNeg = dynamic_cast<RooDataSet*>( smallAbsDataSetNeg );
-
-  makeSuperAwesomePlots(originalDataSet, 
-                        eOverP,
-                        eta,
-                        phi,
-                        meanPlotPos,
-                        meanPlotNeg,
-                        extraCuts);
-
-  TFile f(PATH+"fitEoverP.root","Recreate");
-  meanPlotPos->Write();
-  meanPlotNeg->Write();
-  
-  
-  if(Et != NULL ){ 
-    double ptRange[102];
-    stepSize = 1500;
-    for (int  i(0); i<= 100; ++i){
-      ptRange[i] = 20e3+stepSize*(double)i;
-    }
-    
-    double eopRange[102];
-    stepSize = 0.05;
-    for (int  i(0); i<= 100; ++i){
-      eopRange[i] = 0.8+stepSize*(double)i;
-    }
- 
-    TH2F *ptvsEta =  new TH2F("meanPtVsEta"+extraCuts,"meanPtVsEta"+extraCuts,nBinsEta,etaRange,100,ptRange);
-    TH2F *eoverPvsEta =  new TH2F("eoverPvsEta"+extraCuts,"eoverPvsEta"+extraCuts,nBinsEta,etaRange,100,eopRange);
-    
-    
-    for(int i=0; i < originalDataSet->numEntries(); i++)
-    {
-      originalDataSet->get(i);         
-      double valEt     = Et->getVal();
-      double valeOverP = eOverP.getVal(); 
-      double valEta    = eta.getVal();
-      
-      ptvsEta->Fill(valEta,valEt);
-      eoverPvsEta->Fill(valEta,valeOverP);
-
-    }
-  
-    ptvsEta->Write();
-    eoverPvsEta->Write();
-    
-  }
-  
-  
-  
-  f.Write();
-  f.Close();   
-}
-
-void makeSuperAwesomePlotsEtaPt( RooAbsData* originalDataSet, 
-                                 RooRealVar& eOverP, 
-                                 RooRealVar& eta, 
-                                 int nBinsEta,  
-                                 RooRealVar& Pt, 
-                                 int nBinsPt)
-{
- 
-  // Set up ranges
-  double etaRange[100];
-  if (nBinsEta == -1){
-    etaRange[0] = -2.5;
-    etaRange[1] = -1.5;
-    etaRange[2] = -0.8;
-    etaRange[3] =  0.;
-    etaRange[4] =  0.8;
-    etaRange[5] =  1.5;
-    etaRange[6] =  2.5;
-    nBinsEta = 6;
-  } else {
-    double stepSize = 5/(double)nBinsEta;
-    for (int  i(0); i<= nBinsEta; ++i){
-      etaRange[i] = -2.5+stepSize*(double)i;
-    }
-  }
-
-  double ptRange[100];
-  if (nBinsPt == -1){
-    ptRange[0] = 20;
-    ptRange[1] = 30;
-    ptRange[2] = 40;
-    ptRange[3] = 50;
-    ptRange[4] = 60;
-    ptRange[5] = 100;
-    ptRange[6] = 200;
-    nBinsPt = 5;
-  } else {
-    double stepSize = 100./(double)nBinsPt;
-    for (int  i(0); i<= nBinsPt; ++i){
-      ptRange[i] = 20+stepSize*(double)i;
-    }
-  }
-    
-  TH2F *meanPlotPos = new TH2F("meanPlotPosPt","meanPlotPosPt",nBinsEta,etaRange,nBinsPt,ptRange); 
-  meanPlotPos->GetXaxis()->SetTitle("#eta");
-  meanPlotPos->GetYaxis()->SetTitle("E_{T} [GeV]");
-  TH2F *meanPlotNeg = new TH2F("meanPlotNegPt","meanPlotNegPt",nBinsEta,etaRange,nBinsPt,ptRange);
-  meanPlotNeg->GetXaxis()->SetTitle("#eta");
-  meanPlotNeg->GetYaxis()->SetTitle("E_{T} [GeV]");
-  
-  
-  makeSuperAwesomePlots(originalDataSet, 
-                        eOverP,
-                        eta,
-                        Pt,
-                        meanPlotPos,
-                        meanPlotNeg );
-                        
-  TFile f(PATH+"fitEoverP_pt.root","Recreate");
-  meanPlotPos->Write();
-  meanPlotNeg->Write();
-  f.Write();
-  f.Close();   
-}
-
-
-void makeSuperAwesomePlotsPhiPt( RooAbsData* originalDataSet, 
-                                 RooRealVar& eOverP, 
-                                 RooRealVar& phi, 
-                                 int nBinsPhi,  
-                                 RooRealVar& Pt, 
-                                 int nBinsPt)
-{
- 
-  // Set up ranges
-  double phiRange[100];
-  if (nBinsPhi == -1){
-    nBinsPhi = 8;
-  } 
-
-  double stepSize = 2*TMath::Pi()/(double)nBinsPhi;
-  for (int  i(0); i<= nBinsPhi; ++i){
-    phiRange[i] = -TMath::Pi()+stepSize*(double)i;
-  }
-
-  double ptRange[100];
-  if (nBinsPt == -1){
-    ptRange[0] = 20;
-    ptRange[1] = 30;
-    ptRange[2] = 40;
-    ptRange[3] = 50;
-    ptRange[4] = 60;
-    ptRange[5] = 100;
-    ptRange[6] = 200;
-    nBinsPt = 5;
-  } else {
-    stepSize = 100./(double)nBinsPt;
-    for (int  i(0); i<= nBinsPt; ++i){
-      ptRange[i] = 20+stepSize*(double)i;
-    }
-  }
-    
-  TH2F *meanPlotPos = new TH2F("meanPlotPosPtPhi","meanPlotPosPtPhi",nBinsPhi,phiRange,nBinsPt,ptRange); 
-  meanPlotPos->GetXaxis()->SetTitle("#phi [rad]");
-  meanPlotPos->GetYaxis()->SetTitle("E_{T} [GeV]");
-  TH2F *meanPlotNeg = new TH2F("meanPlotNegPtPhi","meanPlotNegPtPhi",nBinsPhi,phiRange,nBinsPt,ptRange);
-  meanPlotNeg->GetXaxis()->SetTitle("#phi [rad]");
-  meanPlotNeg->GetYaxis()->SetTitle("E_{T} [GeV]");
-  
-  
-  makeSuperAwesomePlots(originalDataSet, 
-                        eOverP,
-                        phi,
-                        Pt,
-                        meanPlotPos,
-                        meanPlotNeg,
-                        " && ClusterEta > 1.5");
-                        
-  TFile f(PATH+"fitEoverP_PhiPt.root","Recreate");
-  meanPlotPos->Write();
-  meanPlotNeg->Write();
-  f.Write();
-  f.Close();   
-}
-
-
-
-
-void makeSuperAwesomePlots( RooAbsData* originalDataSet, 
-                            RooRealVar& eOverP, 
-                            RooRealVar& xvar, 
-                            RooRealVar& yvar,                                 
-                            TH2F* meanPlotPos,
-                            TH2F* meanPlotNeg,
-                            TString additionalCut
-                          )
-{
-  
-  TCanvas* c = new TCanvas();
-  SetAtlasStyle();
-
-  // Signal function
-  // -------------------------------------------------------------------------
-  
-  // Variables
-  RooRealVar meanPos("<E/p>+","meanPos",1,0.,2.8,"") ;
-  RooRealVar meanNeg("<E/p>-","meanNeg",1,0.,2.8,"") ;
-  RooRealVar sigma("#sigma","sigma",0.1,0,5,"") ; 
-  RooRealVar alpha("#alpha","alpha",-1,-100,-0.0001,"") ;
-  RooRealVar n("n","n",1,0.1,1000,"") ;
-  // define Landau parameters
-  RooRealVar LandauMeanPos ("LandauM+", "LandauMeanPos", 1,0.7,1.5,""); LandauMeanPos.setConstant(kFALSE);
-  RooRealVar LandauMeanNeg ("LandauM-", "LandauMeanNeg", 1,0.7,1.5,""); LandauMeanNeg.setConstant(kFALSE);
-  RooRealVar LandauS ("Landau #sigma", "Landau Sigma", 0.1,0,5,""); LandauS.setConstant(kFALSE);
-  
-
-  // Functions
-  RooGaussian gaussianPos("PosGauss", "initial Gauss", eOverP, meanPos, sigma);
-  RooGaussian gaussianNeg("NegGauss", "initial Gauss", eOverP, meanNeg, sigma);
-  RooCBShape  crystalBallPos("PosCB", "Crystal Ball shape", eOverP, meanPos, sigma, alpha, n);
-  RooCBShape  crystalBallNeg("NegCB", "Crystal Ball shape", eOverP, meanNeg, sigma, alpha, n);
-  
-  RooLandau  LandauPos ("PosLandau", "initial Landau", eOverP, LandauMeanPos, LandauS);
-  RooLandau  LandauNeg ("NegLandau", "initial Landau", eOverP, LandauMeanNeg, LandauS);
-  
-  //Landau-Gaussian convolution
-  RooFFTConvPdf LcwGPos ("LcwG_Pos", "Landau (x) Gauss", eOverP, LandauPos, gaussianPos); 
-  RooFFTConvPdf LcwGNeg ("LcwG_Neg", "Landau (x) Gauss", eOverP, LandauNeg, gaussianNeg); 
-
-
-
-  
-  
-  // Set the fit ranges etc
-  //eOverP.setRange("fitGauss",0.5,1.5);
-  eOverP.setRange("final", 0.0, 3.0) ;
-  eOverP.setBins(50);  // sets the number of bins of the E/P distribution
-  eOverP.setRange("finalFit", 0.8, 2.5);
-
-  
-  
-  static const int nBinsX = meanPlotPos->GetXaxis()->GetNbins();
-  static const int nBinsY = meanPlotPos->GetYaxis()->GetNbins();
-  
-  
-  RooAbsData* absDataSetPos = originalDataSet->reduce( Cut("charge > 0"+ additionalCut) );
-  RooDataSet* dataSetPos = dynamic_cast<RooDataSet*>( absDataSetPos );
-  RooAbsData* absDataSetNeg = originalDataSet->reduce( Cut("charge < 0"+ additionalCut)) ;
-  RooDataSet* dataSetNeg = dynamic_cast<RooDataSet*>( absDataSetNeg );
-
-  RooArgSet   vars(xvar,yvar,eOverP);
-  
-  RooDataSet* binnedDataPos[nBinsX][nBinsY];
-  RooDataSet* binnedDataNeg[nBinsX][nBinsY];
-
-  for(int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
-    for(int yvarStep(0); yvarStep<nBinsY; ++yvarStep){
-    
-      TString rangeName = xvar.getTitle() + "Bin";
-      rangeName += xvarStep;
-      rangeName += "_"+yvar.getTitle()+"Bin";
-      rangeName += yvarStep;
-      
-      binnedDataPos[xvarStep][yvarStep] = (RooDataSet*)originalDataSet->emptyClone() ;
-      binnedDataNeg[xvarStep][yvarStep] = (RooDataSet*)originalDataSet->emptyClone() ;
-    
-      binnedDataPos[xvarStep][yvarStep]->SetName(rangeName+"_Pos");
-      binnedDataNeg[xvarStep][yvarStep]->SetName(rangeName+"_Neg");
-    
-    }
-  }
-  
-  for (int i=0; i<dataSetPos->numEntries(); i++) {
-    const RooArgSet* args = dataSetPos->get(i);
-    vars= *args;
-    int globalbin = meanPlotPos->FindBin(xvar.getVal(),yvar.getVal());
-    int binx,biny,binz;
-    meanPlotPos->GetBinXYZ(globalbin,binx,biny,binz);
-    binnedDataPos[binx-1][biny-1]->add(*args);
-  }
-  
-  for (int i=0; i<dataSetNeg->numEntries(); i++) {
-    const RooArgSet* args = dataSetNeg->get(i);
-    vars= *args;   
-    int globalbin = meanPlotNeg->FindBin(xvar.getVal(),yvar.getVal());
-    int binx,biny,binz;
-    meanPlotNeg->GetBinXYZ(globalbin,binx,biny,binz);
-    binnedDataNeg[binx-1][biny-1]->add(*args);
-  }
-
-  
-  
-  for(int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
-    for(int yvarStep(0); yvarStep<nBinsY; ++yvarStep){
-      TString rangeName = xvar.getTitle() + "Bin";
-      rangeName += xvarStep;
-      rangeName += "_"+yvar.getTitle()+"Bin";
-      rangeName += yvarStep;
-      
-      
-      //Make frame to plot everything on
-      RooPlot* framePos = eOverP.frame(Title("E/P pos"),Range("final"));
-      RooPlot* frameNeg = eOverP.frame(Title("E/P neg"),Range("final"));
-
-
- 
-      RooDataSet* smallDataSetPos = binnedDataPos[xvarStep][yvarStep];
-      RooDataSet* smallDataSetNeg = binnedDataNeg[xvarStep][yvarStep];
-  
-      // Plot the data on the frame
-      smallDataSetPos->plotOn(framePos,LineColor(kBlue),MarkerColor(kBlue));
-      smallDataSetNeg->plotOn(frameNeg,LineColor(kRed),MarkerColor(kRed));
-      
-      // Reset paramaters
-      meanPos.setVal(1);
-      meanNeg.setVal(1);
-      sigma.setVal(0.1);
-      alpha.setVal(-1);
-      n.setVal(1);
-
-
-      // C r e a t e   i n d e x   c a t e g o r y   a n d   j o i n   s a m p l e s
-      // ---------------------------------------------------------------------------
-    
-      // Define category to distinguish physics and control samples events
-      RooCategory sample("sample","sample") ;
-      sample.defineType("Pos") ;
-      sample.defineType("Neg") ;
-    
-      // Construct combined dataset in (x,sample)
-      RooDataSet combData("combData","combined data",eOverP,Index(sample),Import("Pos",*smallDataSetPos),Import("Neg",*smallDataSetNeg)) ;
-       
-    
-      // C o n s t r u c t   a   s i m u l t a n e o u s   p d f   i n   ( x , s a m p l e )
-      // -----------------------------------------------------------------------------------
-    
-      // *** Gaussian ***
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfGS("simPdfGS","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfGS.addPdf(gaussianPos,"Pos") ;
-      simPdfGS.addPdf(gaussianNeg,"Neg") ;
-
-      // *** CristalBall ***
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfCB("simPdfCB","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfCB.addPdf(crystalBallPos,"Pos") ;
-      simPdfCB.addPdf(crystalBallNeg,"Neg") ;
-    
-      // *** Landau ***  
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfLnd("simPdfLnd","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfLnd.addPdf(LandauPos,"Pos") ;
-      simPdfLnd.addPdf(LandauNeg,"Neg") ;
-
-      // *** Landau-Gaussian Convolution ***
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfLcwG("simPdfLcwG","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfLcwG.addPdf(LcwGPos,"Pos") ;
-      simPdfLcwG.addPdf(LcwGNeg,"Neg") ;
-
-
-    
-      // P e r f o r m   a   s i m u l t a n e o u s   f i t
-      // ---------------------------------------------------
-    
-      double fitMeanPos, fitMeanNeg, fitSigma; 
-    
-      eOverP.setRange("fitGauss_Pos",0.5,1.5);
-      eOverP.setRange("fitGauss_Neg",0.5,1.5);
-      RooFitResult* fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save());
-      if(fitResult){
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT PRODUCED A FIT RESULT" <<std::endl;        
-      } else {
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT DID NOT PRODUCE A FIT RESULT" <<std::endl;        
-      }
-
-      fitMeanPos = meanPos.getVal();
-      fitMeanNeg = meanNeg.getVal();
-      fitSigma = sigma.getVal();
-      
-      eOverP.setRange("fitGauss_Pos",fitMeanPos-2*fitSigma,fitMeanPos+2*fitSigma);      
-      eOverP.setRange("fitGauss_Neg",fitMeanNeg-2*fitSigma,fitMeanNeg+2*fitSigma);      
-
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-        eOverP.setRange("fitGauss_Pos",0.1,1.9);
-        eOverP.setRange("fitGauss_Neg",0.1,1.9);
-      }
-      
-      fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save() );
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::SECOND GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-      }
-      
-      if (fitResult) delete fitResult;
-
-      fitMeanPos = meanPos.getVal();
-      fitMeanNeg = meanNeg.getVal();
-      fitSigma = sigma.getVal();
-     
-      eOverP.setRange("fitGauss_Pos",fitMeanPos-1.25*fitSigma,fitMeanPos+1*fitSigma);      
-      eOverP.setRange("fitGauss_Neg",fitMeanNeg-1.25*fitSigma,fitMeanNeg+1*fitSigma);      
-      fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(), Save() );
-
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::THIRD GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-        fitSigma = 0.3;
-      }
-      if(fitResult) delete fitResult;
-      
-      
-      //Perform simultaneous fit of model to data and model_ctl to data_ctl
-      eOverP.setRange("finalFit_Pos",fitMeanPos-1.5*fitSigma,2.5);      
-      eOverP.setRange("finalFit_Neg",fitMeanNeg-1.5*fitSigma,2.5);      
- 
-      if (fitMeanPos-1.5*fitSigma > 1.4 )
-        eOverP.setRange("finalFit_Pos",1.2,2.5);      
-      if (fitMeanNeg-1.5*fitSigma > 1.4 )
-        eOverP.setRange("finalFit_Neg",1.2,2.5);      
-
- //Here the range is fixed instead of using all teh above (25/Feb/14, S. Marti)
-      eOverP.setRange("finalFit_Pos",0.8,2.5);      
-      eOverP.setRange("finalFit_Neg",0.8,2.5);  
-      
-      meanPos.setVal(0);meanPos.setConstant(kTRUE);
-      meanNeg.setVal(0);meanNeg.setConstant(kTRUE);
-      sigma.setVal(0.2);    
-      
-
-//***** Choose one, CB, Landau or LcwG
-      //Fit with CrystalBall   
-    /*  fitResult = simPdfCB.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	crystalBallPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-        crystalBallNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); */
-
-
-      //Fit with Landau
-    /*  fitResult = simPdfLnd.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	LandauPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-        LandauNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); */
-
-      if (true) {
-	//Fit with Landau convoluted with Gaussian
-	fitResult = simPdfLcwG.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	LcwGPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-	LcwGNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); 
-      }
-
-      // hold on
-      if (false) {
-	string input = "";
-	cout << " ** fit_EoverP ** Please type RETURN to continue:\n>";
-	getline(cin, input);
-      }
-
-//*****
-      
-     
-      meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,LandauMeanPos.getVal());
-      meanPlotPos->SetBinError  (xvarStep+1,yvarStep+1,LandauMeanPos.getError());
-      meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,LandauMeanNeg.getVal());
-      meanPlotNeg->SetBinError  (xvarStep+1,yvarStep+1,LandauMeanNeg.getError());
-
-      if( fitResult && ( fitResult->status() != 0  || fitResult->covQual() != 3 )  ){
-        std::cout << "WARNING::FINAL CB FIT DID NOT CONVERGE FULLY" <<std::endl;
-        meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,1);
-        meanPlotPos->SetBinError  (xvarStep+1,yvarStep+1,0.5);
-        meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,1);
-        meanPlotNeg->SetBinError  (xvarStep+1,yvarStep+1,0.5);
-      }
-      
-      if(fitResult) delete fitResult;
-          
-      c->Clear();    
-      c->SetLogy(false);
-
-      framePos->Draw();
-      frameNeg->Draw("same");     
-      
-      //ATLASPRELIM_LABEL(0.25,0.88,0.03,1);
-      TString* xvarTString = new TString(xvar.getTitle());
-      TString* yvarTString = new TString(yvar.getTitle());
-      
-      const char *yvarChar = *yvarTString;
-      const char *xvarChar = *xvarTString;
-      
-      
-      myText(0.25,0.96,kBlack,Form("Slice %01.2f< %s <%01.2f, %01.2f< %s <%01.2f"
-                                  ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+1)
-                                  ,xvarChar
-                                  ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+2)
-                                  ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+1)
-                                  ,yvarChar
-                                  ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+2)) );
-                                  
-      myMarkerText(0.65,0.85,kBlue,20,Form("e^{+},  <E/p> %01.3f #pm %01.3f",meanPlotNeg->GetBinContent(xvarStep+1,yvarStep+1), meanPlotNeg->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
-      myMarkerText(0.65,0.80,kRed,20,Form("e^{-},  <E/p> %01.3f #pm %01.3f",meanPlotPos->GetBinContent(xvarStep+1,yvarStep+1), meanPlotPos->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
-      
-      
-      c->Print(PATH+"test.pdf");
-      
-      delete framePos;
-      delete frameNeg;
-      delete smallDataSetPos;
-      delete smallDataSetNeg;
-    }
-  }
-  
-  makeAwesomeSlicePlots(meanPlotPos ,meanPlotNeg, false);
-  makeAwesomeSlicePlots(meanPlotPos ,meanPlotNeg, true);
-  
-  const UInt_t Number = 3;
-  Double_t Green[Number]  = { 0.00, 1.00, 0.00};
-  Double_t Red[Number]    = { 1.00, 0.10, 0.00};
-  Double_t Blue[Number]   = { 0.10, 0.10, 1.00};
-  Double_t Length[Number] = { 0.00, 0.50, 1.00 };
-  Int_t nb=50;
-  //TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
-
-  
-  TH2F* clone =(TH2F*) meanPlotPos->Clone();
-  clone->Divide(meanPlotNeg);
-  clone->SetContour(nb);
-  
-  TH2F* clone2 =(TH2F*) meanPlotPos->Clone();
-  clone2->Add( meanPlotNeg, -1);
-  clone2->SetContour(nb);
-
-  Double_t minPlot,maxPlot;
-
-  c->Clear();
-  c->SetRightMargin(0.12);
-  c->SetLogy(false);
-  clone->Draw("colz");
-
-//Set Z axis centered in 1 so good points are in green
-  minPlot= clone->GetMinimum();
-  maxPlot= clone->GetMaximum();
-  if (maxPlot-1 > 1-minPlot) clone->SetMinimum(2-maxPlot);
-  else clone->SetMaximum(2-minPlot);
-  //cout << " HHHHHHHHHHHHEREE minPlot = " << minPlot << "  &  maxPlot = " << maxPlot << endl;
-
-  c->Print(PATH+"test.pdf");
-  
-  meanPlotPos->Draw("colz");
-  meanPlotPos->SetContour(nb);
-
-  //Set Z axis centered in 1 so good points are in green
-  minPlot= meanPlotPos->GetMinimum();
-  maxPlot= meanPlotPos->GetMaximum();
-  if (maxPlot-1 > 1-minPlot) meanPlotPos->SetMinimum(2-maxPlot);
-  else meanPlotPos->SetMaximum(2-minPlot);
-
-  c->Print(PATH+"test.pdf");
-  
-  meanPlotNeg->Draw("colz");
-  meanPlotNeg->SetContour(nb);
-
-  //Set Z axis centered in 1 so good points are in green
-  minPlot= meanPlotNeg->GetMinimum();
-  maxPlot= meanPlotNeg->GetMaximum();
-  if (maxPlot-1 > 1-minPlot) meanPlotNeg->SetMinimum(2-maxPlot);
-  else meanPlotNeg->SetMaximum(2-minPlot);
-
-  c->Print(PATH+"test.pdf");
-
-  TH1F* pull = new TH1F("pull","pull",50,-5,5);
-  pull->GetXaxis()->SetTitle("Fit Pull");
-  pull->GetYaxis()->SetTitle("Entries per 0.2");
-  
-  c->SetRightMargin(0.03);
-  TF1 myGauss("myGaus","gaus");
-  for(int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
-    for(int yvarStep(0); yvarStep<nBinsY; ++yvarStep){   
-      double R = clone->GetBinContent(xvarStep+1,yvarStep+1);
-      std::cout << "INFO : R "<< R << " Ratio delta " << (1-R)/(1+R) << " Diff Delta "<<  clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.  << " Diff Delta "<<  1-(clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.)/((1-R)/(1+R))  <<std::endl;
-      pull->Fill( ( 1-clone->GetBinContent(xvarStep+1,yvarStep+1))/clone->GetBinError  (xvarStep+1,yvarStep+1) );
-    } 
-  }
-  pull->Draw();
-  pull->Fit(&myGauss);
-  myMarkerText(0.7,0.85,kWhite,1,Form("Gaussian, #mu = %01.3f #pm %01.3f",myGauss.GetParameter(1), myGauss.GetParError(1) ),1.0,0.03);
-  myMarkerText(0.7,0.80,kWhite,1,Form("Gaussian, #sigma = %01.3f #pm %01.3f",myGauss.GetParameter(2), myGauss.GetParError(2) ),1.0,0.03);
-  myMarkerText(0.7,0.75,kWhite,1,Form("Mean,      = %01.3f #pm %01.3f",pull->GetMean(), pull->GetMeanError() ),1.0,0.03);
-  myMarkerText(0.7,0.70,kWhite,1,Form("RMS,       = %01.3f #pm %01.3f",pull->GetRMS(), pull->GetRMSError() ),1.0,0.03);
-  
-  c->Print(PATH+"test.pdf");
-
-  
-  delete clone;
-  delete clone2;
-  
-  
-}
-
-
-
-void makeSuperAwesomePlots( RooRealVar& xvar, 
-                            RooRealVar& yvar,                                 
-                            TH3F* dataPlotPos,
-                            TH3F* dataPlotNeg,
-                            TH2F* meanPlotPos,
-                            TH2F* meanPlotNeg
-                          )
-{
-  
-  TCanvas* c = new TCanvas();
-  SetAtlasStyle();
-
-
-
-  RooRealVar eOverP("E/p","EoverP",0,5);
-  RooRealVar weight("weight","weight",-1e50,1e50);
-
-  // Set the fit ranges etc
-  eOverP.setRange("final",0,3) ;
- 
-
-  // Signal function
-  // -------------------------------------------------------------------------
-  
-  // Variables
-  RooRealVar meanPos("<E/p>+","meanPos",1,0.2,2.8,"") ;
-  RooRealVar meanNeg("<E/p>-","meanNeg",1,0.2,2.8,"") ;
-  RooRealVar sigma("#sigma","sigma",0.1,0,5,"") ; 
-  RooRealVar alpha("#alpha","alpha",-1,-100,-0.0001,"") ;
-  RooRealVar n("n","n",1,0.1,1000,"") ;
-  // define Landau parameters
-  RooRealVar LandauMeanPos ("LandauM+", "LandauMeanPos", 1,0.2,2.8,""); LandauMeanPos.setConstant(kFALSE);
-  RooRealVar LandauMeanNeg ("LandauM-", "LandauMeanNeg", 1,0.2,2.8,""); LandauMeanNeg.setConstant(kFALSE);
-  RooRealVar LandauS ("Landau #sigma", "Landau Sigma", 0.1,0,5,""); LandauS.setConstant(kFALSE);
-  
-
-  // Functions
-  RooGaussian gaussianPos("PosGauss", "initial Gauss", eOverP, meanPos, sigma);
-  RooGaussian gaussianNeg("NegGauss", "initial Gauss", eOverP, meanNeg, sigma);
-  RooCBShape  crystalBallPos("PosCB", "Crystal Ball shape", eOverP, meanPos, sigma, alpha, n);
-  RooCBShape  crystalBallNeg("NegCB", "Crystal Ball shape", eOverP, meanNeg, sigma, alpha, n);
-  
-  RooLandau  LandauPos ("PosLandau", "initial Landau", eOverP, LandauMeanPos, LandauS);
-  RooLandau  LandauNeg ("NegLandau", "initial Landau", eOverP, LandauMeanNeg, LandauS);
-  
-  //Landau-Gaussian convolution
-  RooFFTConvPdf LcwGPos ("LcwG_Pos", "Landau (x) Gauss", eOverP, LandauPos, gaussianPos); 
-  RooFFTConvPdf LcwGNeg ("LcwG_Neg", "Landau (x) Gauss", eOverP, LandauNeg, gaussianNeg);   
-
-
-  RooArgSet   vars(eOverP,weight);
-
-  RooDataSet* dataSet = new RooDataSet("DataSetHist","DataSetHist",vars,"weight");    
-  dataSet->Print("v");
-  
-  int nBinsX = meanPlotPos->GetXaxis()->GetNbins();
-  int nBinsY = meanPlotPos->GetYaxis()->GetNbins();
-  
-  for(int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
-    for(int yvarStep(0); yvarStep<nBinsY; ++yvarStep){
-      TString rangeName = xvar.getTitle() + "Bin";
-      rangeName += xvarStep;
-      rangeName += "_"+yvar.getTitle()+"Bin";
-      rangeName += yvarStep;
-     
-      
-      //Make frame to plot everything on
-      RooPlot* framePos = eOverP.frame(Title("E/P pos"),Range("final"));
-      RooPlot* frameNeg = eOverP.frame(Title("E/P neg"),Range("final"));
- 
-      // Set the range of the xvar and yvar parameters
-      eOverP.setRange(rangeName,0,3) ;
-      
-      TH1D* posProjection = dataPlotPos->ProjectionZ(rangeName+"_Pos",xvarStep+1,xvarStep+1,yvarStep+1,yvarStep+1);
-      TH1D* negProjection = dataPlotNeg->ProjectionZ(rangeName+"_Neg",xvarStep+1,xvarStep+1,yvarStep+1,yvarStep+1);
-      
-
-      
-      // Create the datasets within range specified
-      RooDataSet* smallDataSetPos = (RooDataSet*)dataSet->emptyClone() ;
-      for (int i=1 ; i<=posProjection->GetNbinsX() ; i++) {
-        eOverP.setVal(posProjection->GetBinCenter(i));
-        weight.setVal(posProjection->GetBinContent(i));    
-        smallDataSetPos->add(vars,posProjection->GetBinContent(i)) ;
-      } 
-      smallDataSetPos->SetName(rangeName+"_Pos");
-      
-      
-      RooDataSet* smallDataSetNeg = (RooDataSet*)dataSet->emptyClone() ;
-      for (int i=1 ; i<=negProjection->GetNbinsX() ; i++) {
-        eOverP.setVal(negProjection->GetBinCenter(i));
-        weight.setVal(posProjection->GetBinContent(i));
-        smallDataSetNeg->add(vars,negProjection->GetBinContent(i)) ;
-      } 
-      smallDataSetNeg->SetName(rangeName+"_Neg");
-     
-     
-      delete posProjection;
-      delete negProjection;
- 
-      
-      // Plot the data on the frame
-      smallDataSetPos->plotOn(framePos,LineColor(kBlue),MarkerColor(kBlue));
-      smallDataSetNeg->plotOn(frameNeg,LineColor(kRed),MarkerColor(kRed));
-      
-      // Reset paramaters
-      meanPos.setVal(1);
-      meanNeg.setVal(1);
-      sigma.setVal(0.1);
-      alpha.setVal(-1);
-      n.setVal(1);
-
-
-      // C r e a t e   i n d e x   c a t e g o r y   a n d   j o i n   s a m p l e s
-      // ---------------------------------------------------------------------------
-    
-      // Define category to distinguish physics and control samples events
-      RooCategory sample("sample","sample") ;
-      sample.defineType("Pos") ;
-      sample.defineType("Neg") ;
-    
-      // Construct combined dataset in (x,sample)
-      RooDataSet combData("combData","combined data",vars,Index(sample),Import("Pos",*smallDataSetPos),Import("Neg",*smallDataSetNeg)) ;
-      std::cout << "************************************" <<std::endl;
-      combData.Print("v");
-    
- 
-     // C o n s t r u c t   a   s i m u l t a n e o u s   p d f   i n   ( x , s a m p l e )
-      // -----------------------------------------------------------------------------------
-    
-      // *** Gaussian ***
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfGS("simPdfGS","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfGS.addPdf(gaussianPos,"Pos") ;
-      simPdfGS.addPdf(gaussianNeg,"Neg") ;
-
-      // *** CristalBall ***
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfCB("simPdfCB","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfCB.addPdf(crystalBallPos,"Pos") ;
-      simPdfCB.addPdf(crystalBallNeg,"Neg") ;
-    
-      // *** Landau ***  
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfLnd("simPdfLnd","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfLnd.addPdf(LandauPos,"Pos") ;
-      simPdfLnd.addPdf(LandauNeg,"Neg") ;
-
-      // *** Landau-Gaussian Convolution ***
-      // Construct a simultaneous pdf using category sample as index
-      RooSimultaneous simPdfLcwG("simPdfLcwG","simultaneous pdf",sample) ;
-    
-      // Associate model with the physics state and model_ctl with the control state
-      simPdfLcwG.addPdf(LcwGPos,"Pos") ;
-      simPdfLcwG.addPdf(LcwGNeg,"Neg") ;
-
- 
-    
-    
-    
-      // P e r f o r m   a   s i m u l t a n e o u s   f i t
-      // ---------------------------------------------------
-    
-      double fitMeanPos, fitMeanNeg, fitSigma; 
-    
-      eOverP.setRange("fitGauss_Pos",0.5,1.5);
-      eOverP.setRange("fitGauss_Neg",0.5,1.5);
-      RooFitResult* fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save(),SumW2Error(kTRUE));
-      if(fitResult){
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT PRODUCED A FIT RESULT" <<std::endl;        
-      } else {
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT DID NOT PRODUCE A FIT RESULT" <<std::endl;        
-      }
-
-      fitMeanPos = meanPos.getVal();
-      fitMeanNeg = meanNeg.getVal();
-      fitSigma = sigma.getVal();
-      
-      eOverP.setRange("fitGauss_Pos",fitMeanPos-2*fitSigma,fitMeanPos+2*fitSigma);      
-      eOverP.setRange("fitGauss_Neg",fitMeanNeg-2*fitSigma,fitMeanNeg+2*fitSigma);      
-
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-        eOverP.setRange("fitGauss_Pos",0.1,1.9);
-        eOverP.setRange("fitGauss_Neg",0.1,1.9);
-      }
-      
-      fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save(),SumW2Error(kTRUE) );
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::SECOND GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-      }
-      
-      if (fitResult) delete fitResult;
-
-      fitMeanPos = meanPos.getVal();
-      fitMeanNeg = meanNeg.getVal();
-      fitSigma = sigma.getVal();
-     
-      eOverP.setRange("fitGauss_Pos",fitMeanPos-1.25*fitSigma,fitMeanPos+1*fitSigma);      
-      eOverP.setRange("fitGauss_Neg",fitMeanNeg-1.25*fitSigma,fitMeanNeg+1*fitSigma);      
-      fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(), Save() );
-
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::THIRD GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-        fitSigma = 0.3;
-      }
-      if(fitResult) delete fitResult;
-      
-      
-      //Perform simultaneous fit of model to data and model_ctl to data_ctl
-      eOverP.setRange("finalFit_Pos",fitMeanPos-1.5*fitSigma,2.5);      
-      eOverP.setRange("finalFit_Neg",fitMeanNeg-1.5*fitSigma,2.5);      
- 
-      if (fitMeanPos-1.5*fitSigma > 1.4 )
-        eOverP.setRange("finalFit_Pos",1.2,2.5);      
-      if (fitMeanNeg-1.5*fitSigma > 1.4 )
-        eOverP.setRange("finalFit_Neg",1.2,2.5);      
- 
-     //***** Choose one, CB, Landau or LcwG
-      //Fit with CrystalBall   
-    /*  fitResult = simPdfCB.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	crystalBallPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-        crystalBallNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); */
-
-
-      //Fit with Landau
-    /*  fitResult = simPdfLnd.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	LandauPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-        LandauNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); */
-
-      //Fit with Landau convoluted with Gaussian
-      fitResult = simPdfLcwG.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-      LcwGPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-      LcwGNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); 
-//*****
-
-     
-      meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,meanPos.getVal());
-      meanPlotPos->SetBinError  (xvarStep+1,yvarStep+1,meanPos.getError());
-      meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,meanNeg.getVal());
-      meanPlotNeg->SetBinError  (xvarStep+1,yvarStep+1,meanNeg.getError());
-
-      if( fitResult && ( fitResult->status() != 0  || fitResult->covQual() != 3 )  ){
-        std::cout << "WARNING::FINAL CB FIT DID NOT CONVERGE FULLY" <<std::endl;
-        meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,1);
-        meanPlotPos->SetBinError  (xvarStep+1,yvarStep+1,0.5);
-        meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,1);
-        meanPlotNeg->SetBinError  (xvarStep+1,yvarStep+1,0.5);
-      }
-      
-      if(fitResult) delete fitResult;
-          
-      c->Clear();    
-      c->SetLogy(false);
-
-      framePos->Draw();
-      frameNeg->Draw("same");     
-      
-      //ATLASPRELIM_LABEL(0.25,0.88,0.03,1);
-      TString* xvarTString = new TString(xvar.getTitle());
-      TString* yvarTString = new TString(yvar.getTitle());
-      
-      const char *yvarChar = *yvarTString;
-      const char *xvarChar = *xvarTString;
-      
-      
-      myText(0.25,0.96,kBlack,Form("Slice %01.2f< %s <%01.2f, %01.2f< %s <%01.2f"
-                                  ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+1)
-                                  ,xvarChar
-                                  ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+2)
-                                  ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+1)
-                                  ,yvarChar
-                                  ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+2)) );
-                                  
-      myMarkerText(0.65,0.85,kBlue,20,Form("e^{+},  <E/p> %01.3f #pm %01.3f",meanPlotNeg->GetBinContent(xvarStep+1,yvarStep+1), meanPlotNeg->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
-      myMarkerText(0.65,0.80,kRed,20,Form("e^{-},  <E/p> %01.3f #pm %01.3f",meanPlotPos->GetBinContent(xvarStep+1,yvarStep+1), meanPlotPos->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
-      
-      
-      c->Print(PATH+"test.pdf");
-      //c->SetLogy(true);
-      //c->Print("test.pdf");
-      
-      delete framePos;
-      delete frameNeg;
-      delete smallDataSetPos;
-      delete smallDataSetNeg;
-    }
-  }
-  
-  makeAwesomeSlicePlots(meanPlotPos ,meanPlotNeg, false);
-  makeAwesomeSlicePlots(meanPlotPos ,meanPlotNeg, true);
-  
-  const UInt_t Number = 3;
-  Double_t Green[Number]  = { 0.00, 1.00, 0.00};
-  Double_t Red[Number]    = { 1.00, 0.10, 0.00};
-  Double_t Blue[Number]   = { 0.10, 0.10, 1.00};
-  Double_t Length[Number] = { 0.00, 0.50, 1.00 };
-  Int_t nb=50;
-  TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
-
-  
-  TH2F* clone =(TH2F*) meanPlotPos->Clone();
-  clone->Divide(meanPlotNeg);
-  clone->SetContour(nb);
-  
-  TH2F* clone2 =(TH2F*) meanPlotPos->Clone();
-  clone2->Add( meanPlotNeg, -1);
-  clone2->SetContour(nb);
-  
-  c->Clear();
-  c->SetRightMargin(0.12);
-  c->SetLogy(false);
-  clone->Draw("colz");
-  c->Print(PATH+"test.pdf");
-  meanPlotPos->Draw("colz");
-  meanPlotPos->SetContour(nb);
-
-  c->Print(PATH+"test.pdf");
-  meanPlotNeg->Draw("colz");
-  meanPlotNeg->SetContour(nb);
-  c->Print(PATH+"test.pdf");
-
-  TH1F* pull = new TH1F("pull","pull",50,-5,5);
-  pull->GetXaxis()->SetTitle("Fit Pull");
-  pull->GetYaxis()->SetTitle("Entries per 0.2");
-  
-  c->SetRightMargin(0.03);
-  TF1 myGauss("myGaus","gaus");
-  for(int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
-    for(int yvarStep(0); yvarStep<nBinsY; ++yvarStep){   
-      double R = clone->GetBinContent(xvarStep+1,yvarStep+1);
-      std::cout << "INFO : R "<< R << " Ratio delta " << (1-R)/(1+R) << " Diff Delta "<<  clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.  << " Diff Delta "<<  1-(clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.)/((1-R)/(1+R))  <<std::endl;
-      pull->Fill( ( 1-clone->GetBinContent(xvarStep+1,yvarStep+1))/clone->GetBinError  (xvarStep+1,yvarStep+1) );
-    } 
-  }
-  pull->Draw();
-  pull->Fit(&myGauss);
-  myMarkerText(0.7,0.85,kWhite,1,Form("Gaussian, #mu = %01.3f #pm %01.3f",myGauss.GetParameter(1), myGauss.GetParError(1) ),1.0,0.03);
-  myMarkerText(0.7,0.80,kWhite,1,Form("Gaussian, #sigma = %01.3f #pm %01.3f",myGauss.GetParameter(2), myGauss.GetParError(2) ),1.0,0.03);
-  myMarkerText(0.7,0.75,kWhite,1,Form("Mean,      = %01.3f #pm %01.3f",pull->GetMean(), pull->GetMeanError() ),1.0,0.03);
-  myMarkerText(0.7,0.70,kWhite,1,Form("RMS,       = %01.3f #pm %01.3f",pull->GetRMS(), pull->GetRMSError() ),1.0,0.03);
-  
-  c->Print(PATH+"test.pdf");
-
-  
-  delete clone;
-  delete clone2;
-  
-  
-}
-
-
-
-
-void makeAwesomeSlicePlots(TH2F* pos, TH2F* neg, bool sliceInEta)
-{
-  std::cout << "INFO::makeAwesomeSlicePlots()" << std::endl;
-  
-  int maxStep(1);
-
-  if(sliceInEta){
-    maxStep = pos->GetNbinsX();
-  } else {
-    maxStep = pos->GetNbinsY();
-  }
-  
-  TString name; 
-  for (int i(0); i <maxStep; ++i ){
-    TH1D* posProjection;
-    TH1D* negProjection;
-    name  =  pos->GetName();
-    name += "_Slice";
-  
-    if (sliceInEta){
-      posProjection = pos->ProjectionY( "_py", i+1 , i+1);
-      negProjection = neg->ProjectionY( "_py", i+1 , i+1);
-      name+="X";
-      name+=i;
-      
-    } else {
-      posProjection = pos->ProjectionX( "_px", i+1 , i+1);
-      negProjection = neg->ProjectionX( "_px", i+1 , i+1);    
-      name+="Y";
-      name+=i;
-      
-    }
-    
-    
-    
-    ratioPlots(posProjection, negProjection, name );
-    delete posProjection;
-    delete negProjection;
-  }  
-  std::cout << "INFO::Finished makeAwesomeSlicePlots()" << std::endl;
-}
-
-
-
-
-void ratioPlots(TH1D* h1, TH1D* h2, TString name) {
-   std::cout << "INFO::Starting ratioPlots()" << std::endl;
-   TCanvas c1("C1","C1",600,600);
-   TPad *pad1 = new TPad("pad1","pad1",0,0.5,1,1);
-   pad1->SetTopMargin(0.05/0.5);
-   pad1->SetRightMargin(0.05);
-   pad1->SetBottomMargin(0.16);
-   pad1->SetLeftMargin(0.16);
-
-   pad1->SetBottomMargin(0);
-   pad1->Draw();
-   pad1->cd();
-   TH1D* h1clone = (TH1D*) h1->Clone();
-   h1->SetMarkerColor(kBlue);
-   h1->SetMarkerStyle(20);
-   h1->GetYaxis()->SetRangeUser(0.85,1.45);
-   h1->GetYaxis()->SetLabelSize(0.05/0.5);
-   h1->GetYaxis()->SetTitleSize(0.05/0.5);
-   h1->GetYaxis()->SetTitle("<E/p>");
-   h1->DrawCopy("pe");
-   h2->SetMarkerColor(kRed);
-   h2->SetMarkerStyle(22);
-   h2->Draw("samepe");
-   c1.cd();
-   TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.5);
-   pad2->SetTopMargin(0.05);
-   pad2->SetRightMargin(0.05);
-   pad2->SetBottomMargin(0.16/0.5);
-   pad2->SetLeftMargin(0.16);
-
-   //pad2->SetTopMargin(0);
-   pad2->Draw();
-   pad2->cd();
-   h1clone->Sumw2();
-   h1clone->SetStats(0);
-   h1clone->Divide(h2);
-   h1clone->SetMarkerColor(kBlack);
-   h1clone->SetMarkerStyle(20);
-   h1clone->GetYaxis()->SetLabelSize(0.05/0.5);
-   h1clone->GetXaxis()->SetLabelSize(0.05/0.5);
-   h1clone->GetYaxis()->SetTitleSize(0.05/0.5);
-   h1clone->GetXaxis()->SetTitleSize(0.05/0.5);
-   h1clone->GetYaxis()->SetRangeUser(0.925,1.075);
-   h1clone->GetYaxis()->SetTitle("<E/p>^{+}/<E/p>^{-}");
- 
-   h1clone->Draw("ep");
-   //h1->GetYaxis()->SetRangeUser(0.95,1.05);
-   c1.cd();
-   c1.Print( PATH + name+".eps");
-   delete h1clone;
-   delete pad1;
-   delete pad2;
-   std::cout << "INFO::Finished ratioPlots()" << std::endl;
-
-}
-
-
-TH2F* getCorrections()
-{
-  TH2F *FinalCorrections = new TH2F("FinalCorrections","FinalCorrections",16,-2.5,2.5,16,-3.14159,3.14159);
-  return FinalCorrections;
-}
-
-
-void MakeScaling(TString inputDir)
-{
-
-  TString dir = PATH;
-  if(inputDir != "") dir  = inputDir;
-  
-  TFile *file0 = TFile::Open(dir+"fitEoverP.root");
-  file0->ls();
-  TH2F* meanPlotNeg = (TH2F*) file0->Get("meanPlotNeg");
-  TH2F* meanPlotPos = (TH2F*) file0->Get("meanPlotPos");
-
-
-  if(!meanPlotNeg || !meanPlotNeg){
-    std::cout<< "ERROR  : inputfile does not contain the desired histograms "  << std::endl; 
-  }
-  
-  meanPlotNeg->Draw("colz");
-  meanPlotPos->Draw("colz");
-  meanPlotNeg->Sumw2();
-  meanPlotPos->Sumw2();
-
-
-  //Need to obtain the mean pt either from a histogram or from hardcoded values 
-/*  double pt[] = {39605.2,
-  40822.5,
-  41502.1,
-  40948.9,
-  40943.1,
-  41343.5,
-  40501.1,
-  39274.9};
-*/
-
-double pt[100];
-
-  TH2F* meanPtVsEta =  (TH2F*) file0->Get("meanPtVsEta");
-  for(int i(1); i <= meanPtVsEta->GetNbinsX(); ++i){
-    TH1D* projection =  meanPtVsEta->ProjectionY( "_py", i , i);
-    pt[i-1] = projection->GetMean();
-    delete projection;
-  }  
-  
-
-  TH2F* a = (TH2F*) meanPlotPos->Clone(); 
-  a->Add(meanPlotNeg,-1);
-  a->Scale(-0.5);
-  //a->Scale(1./38.);
-
-  for(int i(1); i <= a->GetNbinsX(); ++i){
-    for(int j(1); j <= a->GetNbinsY(); ++j){
-      double temp  =  a->GetBinContent(i,j);
-      a->SetBinContent(i,j, temp/pt[i-1]*1e3); 
-      temp  =  a->GetBinError(i,j);
-      a->SetBinError(i,j, temp/pt[i-1]*1e3);    
-    }
-  }
-  
-  a->Draw("colz");
-  
-  TFile f(dir+"Scaling.root","RECREATE");
-  a->SetName("FinalCorrections");
-  a->SetTitle("FinalCorrections");
-  a->Write();
-  f.ls();
-  f.Close();
-}
-
- 
-
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/make_eop_maps.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/make_eop_maps.cxx
deleted file mode 100644
index c4f6ea6cbd30ce1731110a4d1b6b9b3cecb3f0ec..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/make_eop_maps.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-/////////////////////////////////////////////////////////////
-//
-// root[0] .L make_eop_maps.cxx
-// root[1] make_eop_maps("path/to/fitEoverP.root",zrange)
-//   -- or --
-// root[1] make_sagitta_maps("path/to/Scaling.root",zrange)
-// 
-// @author: will.di.clemente@cern.ch
-//
-/////////////////////////////////////////////////////////////
-
-#include "TH2.h"
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TString.h"
-
-void make_eop_maps(TString path, Float_t range=0.2){ //zmin=0.8, Float_t zmax=1.2){
-
-  // Make the ratio histogram from the input file
-  TFile *f = new TFile(path);
-  TH2D *h1 = (TH2D*)f->Get("meanPlotPos");
-  TH2D *h2 = (TH2D*)f->Get("meanPlotNeg");
-  TH2D *outhist = h1->Clone();
-  outhist->Divide(h2);
-
-  // Set up the output canvas
-  TCanvas *c1 = new TCanvas("c1","c1",800,600);
-  c1->SetRightMargin(0.13);
-
-  // Set up ranges
-  Float_t zmin = 1.-range;
-  Float_t zmax = 1.+range;
-
-  // Plot aesthetics
-  outhist->SetTitle("E/p ratio <+>/<->");
-  outhist->GetZaxis()->SetRangeUser(zmin,zmax);
-  outhist->GetXaxis()->SetTitle("#eta");
-  outhist->GetXaxis()->SetTitleOffset(1);
-  outhist->GetYaxis()->SetTitle("#phi [rad]");
-  outhist->GetYaxis()->SetTitleOffset(.7);
-  TPaletteAxis *palette = (TPaletteAxis*)outhist->GetListOfFunctions()->FindObject("palette");
-  palette->SetX1NDC(0.87);
-  palette->SetX2NDC(0.92);
-  palette->SetY1NDC(0.1);
-  palette->SetY2NDC(0.9);
-
-  // Draw and print
-  outhist->Draw("colz");
-  c1->Print("EoverP.pdf","Portrait pdf");
-
-  return;
-}
-
-void make_sagitta_maps(TString path, Float_t range=0.004){
-
-  // Make the ratio histogram from the input file
-  TFile *f = new TFile(path);
-  TH2D *outhist = (TH2D*)f->Get("FinalCorrections");
-
-  // Set up the output canvas
-  TCanvas *c1 = new TCanvas("c1","c1",800,600);
-  c1->SetRightMargin(0.16);
-
-  // Set up ranges
-  range = fabs(range);
-  Float_t zmin = (-1.)*range;
-  Float_t zmax = range;
-
-  // Plot aesthetics
-  outhist->SetTitle("Sagitta Bias");
-  outhist->GetZaxis()->SetRangeUser(zmin,zmax);
-  outhist->GetXaxis()->SetTitle("#eta");
-  outhist->GetXaxis()->SetTitleOffset(1);
-  outhist->GetYaxis()->SetTitle("#phi [rad]");
-  outhist->GetYaxis()->SetTitleOffset(.7);
-  TPaletteAxis *palette = (TPaletteAxis*)outhist->GetListOfFunctions()->FindObject("palette");
-  palette->SetX1NDC(0.84);
-  palette->SetX2NDC(0.89);
-  palette->SetY1NDC(0.1);
-  palette->SetY2NDC(0.9);
-  TGaxis::SetMaxDigits(2);
-
-  // Draw and print
-  outhist->Draw("colz");
-  c1->Print("Sagitta.pdf","Portrait pdf");
-
-  return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/run_EoverP.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/run_EoverP.cxx
deleted file mode 100644
index 80cc43be20780631da2d5872f37206ef1fd2e367..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/run_EoverP.cxx
+++ /dev/null
@@ -1,990 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef __CINT__
-
-#include "RooGlobalFunc.h"
-#endif
-#include "RooRealVar.h"
-#include "RooDataSet.h"
-#include "RooAbsData.h"
-#include "RooDataHist.h"
-#include "RooGaussian.h"
-#include "RooLandau.h"
-#include "RooChebychev.h"
-#include "RooAddPdf.h"
-#include "RooExtendPdf.h"
-#include "RooCBShape.h"
-#include "RooNovosibirsk.h"
-#include "RooFFTConvPdf.h"
-#include "RooExponential.h"
-#include "RooSimultaneous.h"
-#include "RooPolynomial.h"
-#include "RooFitResult.h"
-#include "RooCategory.h"
-#include "RooBinning.h"
-#include "RooWorkspace.h"
-#include "RooChi2Var.h" 
-#include "RooMinuit.h"
-#include "RooFormulaVar.h"
-#include "RooPlot.h"
-
-
-
-#include<TFile.h>
-#include<TH2F.h>
-#include<TH3F.h>
-#include<TH1D.h>
-#include<TF1.h>
-#include<TMath.h>
-#include<TTree.h>
-#include<TChain.h>
-#include<TColor.h>
-#include<TGraphErrors.h>
-#include<TCanvas.h>
-#include<TProfile.h>
-#include<TString.h>
-#include<iostream>
-#include<TLegend.h>
-#include <iomanip>
-#include <cmath>
-
-#include "TROOT.h"
-#include "THStack.h"
-#include "AtlasStyle.C"
-
-using namespace RooFit ;
-
-// general functions
-void initialize();
-int main(){
-  return 0;
-}
-
-// plotting functions
-void makePlots( RooAbsData* originalDataSet, 
-		RooRealVar& eOverP, 
-		RooRealVar& eta, 
-		int nBinsEta,  
-		RooRealVar& phi, 
-		int nBinsPhi,
-		RooRealVar& Et,
-		TString extraCuts = "");
-void  makeFits( RooAbsData* originalDataSet, 
-	        RooRealVar& eOverP,
-	        RooRealVar& eta, 
-	        RooRealVar& phi, 
-	        TH2F* meanPlotPos,
-	        TH2F* meanPlotNeg,
-	        TString additionalCut = "" );
-void makeSlicePlots(TH2F* pos, TH2F* neg, bool sliceInEta);
-void makeRatioPlots(TH1D* h1, TH1D* h2, TString name);
-
-// corrections functions
-TH2F*   makeCorrectionHist();
-double  getCorrections(TH2F* corrections, double eta, double phi, double Et, double charge);
-//void    makeEtMeans(RooDataSet* dataSet,RooRealVar& Et,RooRealVar& ClusterEta,int nBinsEats);
-void    makeScalingHist(TString inputDir);
-
-// derpy global variable
-TString PATH = "./Results/";
-
-void run_EoverP(TString fileName = "../share/eoverpValidationOut.root", int refit=2, int netabins=12, int nphibins=12){
-
-  // ----------
-  // initialize
-  // ----------
-  initialize();
-   
-  // ----------
-  // check validity of input vars
-  // ----------
-  if( !((refit >= 0) && (refit <= 2)) ){
-    std::cout << "ERROR :: Input parameter 'refit' must be equal to 0, 1, or 2!" << std::endl;
-    std::exit(0);
-  }
-  if( (netabins < 1) || (nphibins < 1) ){
-    std::cout << "ERROR :: Can't have less than one bin in eta/phi!" << std::endl;
-    std::exit(0);
-  }
-
-  // ----------
-  // set up our RooFit variables
-  // ----------
-  RooRealVar ClusterEnergy("ClusterEnergy","ClusterEnergy",0,1e10,"MeV") ;
-  RooRealVar ClusterPhi("ClusterPhi","#phi",0);
-  RooRealVar ClusterEta("ClusterEta","#eta",0);
-  RooRealVar charge("charge","charge",0);
-  RooRealVar TrackTheta("TrackTheta","TrackTheta",0);
-  RooRealVar TrackQoverP("QoverP","QoverP",-1e10,1e10,"MeV^{-1}");
-  RooRealVar EoverP("EoverP","E/p",0,5,"");
-  RooRealVar Et("Et","E_{T}",0,1e10,"GeV");
-  RooRealVar Eta("Eta","#eta",-3,3,"");
-  
-  RooArgSet arg;
-  arg.add(ClusterEnergy);
-  arg.add(ClusterPhi);
-  arg.add(ClusterEta);
-  arg.add(charge);
-  arg.add(TrackTheta);
-  arg.add(TrackQoverP);
-  arg.add(EoverP);
-  arg.add(Et);
-  arg.add(Eta);
- 
-  // ---------
-  // Open our TFile(s) and set up our event variables
-  //  (in this format, each "event" is one electron)
-  // ---------
-  TChain *eoverpTree = new TChain("EGrefitterSmall");
-  eoverpTree->Add(fileName);
-  
-  Double_t         el_ClusterEnergy;
-  Double_t         el_ClusterPhi;
-  Double_t         el_ClusterEta;
-  Double_t         el_charge;
-  Double_t         el_TrackTheta;
-  Double_t         el_QoverP;
-  Double_t         el_QoverP1;
-  Double_t         el_QoverP2;
-  eoverpTree->SetBranchAddress("ClusterEnergy", &el_ClusterEnergy);
-  eoverpTree->SetBranchAddress("ClusterPhi", &el_ClusterPhi);
-  eoverpTree->SetBranchAddress("ClusterEta", &el_ClusterEta);
-  eoverpTree->SetBranchAddress("charge", &el_charge);
-  eoverpTree->SetBranchAddress("TrackTheta", &el_TrackTheta);  
-  eoverpTree->SetBranchAddress("Default_QoverP", &el_QoverP);
-  eoverpTree->SetBranchAddress("Refitted1_QoverP", &el_QoverP1);
-  eoverpTree->SetBranchAddress("Refitted2_QoverP", &el_QoverP2);
-  
-  RooDataSet* dataSet = new RooDataSet("DataSet","DataSet",arg);
-  
-  // which refit QoverP do we want?  -- Hardcoded for now...
-  //Int_t refit = 2 // 0 = original; 1 = refit1; 2 = refit2
-
-  // ----------
-  // Loop over the events and fill the variables
-  // ----------
-  Int_t nEl = eoverpTree->GetEntries();
-  for (Int_t i=0; i<nEl; i++){
-    if( (i%10000) == 0 )
-      std::cout << "Filling variables for electron #" << i << std::endl;
-    eoverpTree->GetEntry(i);
-
-    charge.setVal(el_charge);
-    Et.setVal(el_ClusterEnergy*sin(el_TrackTheta)*1e-3);
-    Eta.setVal(-log(tan(el_TrackTheta/2)) );
-    ClusterPhi.setVal(el_ClusterPhi);
-    ClusterEnergy.setVal(el_ClusterEnergy);
-    ClusterEta.setVal(el_ClusterEta);
-    //std::cout << "default: " << el_QoverP*el_ClusterEnergy << " refit1: " << el_QoverP1*el_ClusterEnergy << " refit2: " << el_QoverP2*el_ClusterEnergy << std::endl;
-    if(refit == 0){
-      EoverP.setVal(fabs(el_QoverP)*el_ClusterEnergy);
-      //std::cout << "refit = " << refit << "   Using " << 1./el_QoverP << std::endl;
-    }
-    else if(refit == 1){
-      EoverP.setVal(fabs(el_QoverP1)*el_ClusterEnergy);
-      //std::cout << "refit = " << refit << "   Using " << 1./el_QoverP1 << std::endl;
-    }
-    else{
-      EoverP.setVal(fabs(el_QoverP2)*el_ClusterEnergy);
-      //std::cout << "refit = " << refit << "   Using " << 1./el_QoverP2 << std::endl;
-    }
-    
-    dataSet->add(arg);
-
-  }
-
-  TCanvas c; // put a blank page at the start of the output. because reasons.
-  c.Print(PATH+"new_eoverp_plots.pdf(");
-
-  // ----------
-  // Pass the data off to the plotting functions
-  // ----------
-  makePlots(dataSet, 
-	    EoverP, 
-	    ClusterEta, 
-	    netabins, 
-	    ClusterPhi, 
-	    nphibins,
-	    Et); 
-  
-  c.Print(PATH+"new_eoverp_plots.pdf)"); // put a blank page at the end of the output. yup.
-
-  makeScalingHist(PATH);
-
-  return;
-
-}
-
-void makePlots( RooAbsData* originalDataSet, 
-		RooRealVar& eOverP, 
-		RooRealVar& eta, 
-		int nBinsEta,  
-		RooRealVar& phi, 
-		int nBinsPhi,
-		RooRealVar& Et,
-		TString extraCuts )
-{
-  // Set up ranges
-  double etaRange[nBinsEta+1];
-  double stepSize = 5./nBinsEta;
-  for (int  i(0); i<= nBinsEta; ++i){
-    etaRange[i] = -2.5+stepSize*(double)i;
-  }
-
-  double phiRange[nBinsPhi+1];
-  stepSize = 2 * TMath::Pi()/nBinsPhi;
-  for (int  i(0); i<= nBinsPhi; ++i){
-    phiRange[i] = -TMath::Pi()+stepSize*(double)i;
-  }
-  
-  
-  TH2F *meanPlotPos = new TH2F("meanPlotPos"+extraCuts,"meanPlotPos"+extraCuts,nBinsEta,etaRange,nBinsPhi,phiRange ); 
-  meanPlotPos->SetTitle("Mean Plot Positive "+extraCuts);
-  meanPlotPos->GetXaxis()->SetTitle("#eta");
-  meanPlotPos->GetYaxis()->SetTitle("#phi [rad]");
-  TH2F *meanPlotNeg = new TH2F("meanPlotNeg"+extraCuts,"meanPlotNeg"+extraCuts,nBinsEta,etaRange,nBinsPhi,phiRange );
-  meanPlotNeg->SetTitle("Mean Plot Negative "+extraCuts);
-  meanPlotNeg->GetXaxis()->SetTitle("#eta");
-  meanPlotNeg->GetYaxis()->SetTitle("#phi [rad]");
-
-  makeFits(originalDataSet, 
-	   eOverP,
-	   eta,
-	   phi,
-	   meanPlotPos,
-	   meanPlotNeg,
-	   extraCuts);
-
-  TFile f(PATH+"fitEoverP.root","Recreate");
-  meanPlotPos->Write();
-  meanPlotNeg->Write();
-  
-  
-  //if(Et != NULL ){
-  double ptRange[102];
-  stepSize = 1500;
-  for (int  i=0; i<= 100; i++){
-    ptRange[i] = (20e3+stepSize*(double)i)/1000.; // GeV
-    //std::cout << ptRange[i] << std::endl;
-  }
-  
-  double eopRange[102];
-  stepSize = 0.05;
-  for (int  i=0; i<= 100; i++){
-    eopRange[i] = 0.8+stepSize*(double)i;
-  }
-  
-  TH2F *ptvsEta =  new TH2F("meanPtVsEta"+extraCuts,"meanPtVsEta"+extraCuts,nBinsEta,etaRange,100,ptRange);
-  TH2F *eoverPvsEta =  new TH2F("eoverPvsEta"+extraCuts,"eoverPvsEta"+extraCuts,nBinsEta,etaRange,100,eopRange);
-  
-  RooArgSet vars(Et,eOverP,eta);
-  for(int i=0; i < originalDataSet->numEntries(); i++){
-    // wkd2 -- this is giving the same value of all the parameters for all i, need to fix it!
-    const RooArgSet* args = originalDataSet->get(i);
-    vars = *args;
-    //originalDataSet->get(i);         
-    double valEt     = Et.getVal();
-    double valeOverP = eOverP.getVal(); 
-    double valEta    = eta.getVal();
-    
-    //std::cout << "valEta: " << valEta << "  valEt: " << valEt << std::endl;
-
-    ptvsEta->Fill(valEta,valEt);
-    eoverPvsEta->Fill(valEta,valeOverP);
-  }
-  
-  ptvsEta->Write();
-  eoverPvsEta->Write();
-  //} // end if(Et != NULL)
-
-  //f.Write();
-  f.Close();   
-}
-
-
-void makeFits( RooAbsData* originalDataSet, 
-	       RooRealVar& eOverP, 
-	       RooRealVar& xvar, 
-	       RooRealVar& yvar,                                 
-	       TH2F* meanPlotPos,
-	       TH2F* meanPlotNeg,
-	       TString additionalCut )
-{
- 
-  //----------
-  // Initialize canvas
-  //----------
-  TCanvas *c = new TCanvas();
-  SetAtlasStyle();
-
-  //----------
-  // Set up variables for the fits
-  //----------
-  // Variables
-  RooRealVar meanPos("<E/p>+","meanPos",1,0.,2.8,"") ;
-  RooRealVar meanNeg("<E/p>-","meanNeg",1,0.,2.8,"") ;
-  RooRealVar sigma("#sigma","sigma",0.1,0,5,"") ; 
-  RooRealVar alpha("#alpha","alpha",-1,-100,-0.0001,"") ;
-  RooRealVar n("n","n",1,0.1,1000,"") ;
-
-  // Landau parameters
-  RooRealVar LandauMeanPos ("LandauM+", "LandauMeanPos", 1,0.7,1.5,""); 
-  LandauMeanPos.setConstant(kFALSE);
-  RooRealVar LandauMeanNeg ("LandauM-", "LandauMeanNeg", 1,0.7,1.5,""); 
-  LandauMeanNeg.setConstant(kFALSE);
-  RooRealVar LandauS ("Landau #sigma", "Landau Sigma", 0.1,0,5,""); 
-  LandauS.setConstant(kFALSE);
-
-  // Functions
-  RooGaussian gaussianPos("PosGauss", "Initial Gauss", eOverP, meanPos, sigma);
-  RooGaussian gaussianNeg("NegGauss", "Initial Gauss", eOverP, meanNeg, sigma);
-  RooCBShape  crystalBallPos("PosCB", "Crystal Ball shape", eOverP, meanPos, sigma, alpha, n);
-  RooCBShape  crystalBallNeg("NegCB", "Crystal Ball shape", eOverP, meanNeg, sigma, alpha, n);
-  RooLandau  LandauPos ("PosLandau", "Initial Landau", eOverP, LandauMeanPos, LandauS);
-  RooLandau  LandauNeg ("NegLandau", "Initial Landau", eOverP, LandauMeanNeg, LandauS);
-
-  // Landau-Gaussian convolution
-  RooFFTConvPdf LcwGPos ("LcwG_Pos", "Landau (x) Gauss", eOverP, LandauPos, gaussianPos); 
-  RooFFTConvPdf LcwGNeg ("LcwG_Neg", "Landau (x) Gauss", eOverP, LandauNeg, gaussianNeg);
-
-  // Setup fit ranges for eOverP variable we filled earlier
-  eOverP.setBins(50);
-  eOverP.setRange("fitGauss",0.5,1.5);
-  eOverP.setRange("fitLandau",0.5,1.5);
-  eOverP.setRange("final",0.0,3.0);
-  eOverP.setRange("finalFit",0.8,2.5);
-
-  //----------
-  // Set up separate eta/phi binned data sets for positive/negative electrons
-  //----------
-  // get number of bins in eta(x)/phi(y)
-  static const int nBinsX = meanPlotPos->GetXaxis()->GetNbins();
-  static const int nBinsY = meanPlotPos->GetYaxis()->GetNbins();
-
-  RooAbsData* absDataSetPos = originalDataSet->reduce( Cut("charge > 0"+ additionalCut) );
-  RooAbsData* absDataSetNeg = originalDataSet->reduce( Cut("charge < 0"+ additionalCut) );
-  RooDataSet* dataSetPos = dynamic_cast<RooDataSet*>( absDataSetPos ); // positron data set
-  RooDataSet* dataSetNeg = dynamic_cast<RooDataSet*>( absDataSetNeg ); // electron data set
-  RooArgSet   vars(xvar,yvar,eOverP);
-  
-  RooDataSet* binnedDataPos[nBinsX][nBinsY]; // positron data set broken up by eta/phi bin
-  RooDataSet* binnedDataNeg[nBinsX][nBinsY]; // electron data set broken up by eta/phi bin
-
-  // name each of our eta/phi bins in binnedDataPos/Neg
-  for(int xvarStep = 0; xvarStep<nBinsX; xvarStep++){ // eta
-    for(int yvarStep = 0; yvarStep<nBinsY; yvarStep++){ // phi
-    
-      TString rangeName = xvar.getTitle() + "Bin";
-      rangeName += xvarStep;
-      rangeName += "_"+yvar.getTitle()+"Bin";
-      rangeName += yvarStep;
-      
-      binnedDataPos[xvarStep][yvarStep] = (RooDataSet*)originalDataSet->emptyClone() ;
-      binnedDataNeg[xvarStep][yvarStep] = (RooDataSet*)originalDataSet->emptyClone() ;
-    
-      binnedDataPos[xvarStep][yvarStep]->SetName(rangeName+"_Pos");
-      binnedDataNeg[xvarStep][yvarStep]->SetName(rangeName+"_Neg");
-    
-    }
-  }
-
-  //----------
-  // Fill pos/neg binned data sets
-  //----------
-  // positive
-  for (int i=0; i<dataSetPos->numEntries(); i++) {
-    const RooArgSet* args = dataSetPos->get(i);
-    vars= *args;
-    int globalbin = meanPlotPos->FindBin(xvar.getVal(),yvar.getVal());
-    int binx,biny,binz;
-    meanPlotPos->GetBinXYZ(globalbin,binx,biny,binz);
-    binnedDataPos[binx-1][biny-1]->add(*args);
-  }
-  // negative
-  for (int i=0; i<dataSetNeg->numEntries(); i++) {
-    const RooArgSet* args = dataSetNeg->get(i);
-    vars= *args;
-    int globalbin = meanPlotNeg->FindBin(xvar.getVal(),yvar.getVal());
-    int binx,biny,binz;
-    meanPlotNeg->GetBinXYZ(globalbin,binx,biny,binz);
-    binnedDataNeg[binx-1][biny-1]->add(*args);
-  }
-
-  //----------
-  // Time to make the donuts
-  //----------
-  for(int xvarStep = 0; xvarStep<nBinsX; xvarStep++){ // eta
-    for(int yvarStep = 0; yvarStep<nBinsY; yvarStep++){ // phi
-      // some naming like we did before
-      TString rangeName = xvar.getTitle() + "Bin";
-      rangeName += xvarStep;
-      rangeName += "_"+yvar.getTitle()+"Bin";
-      rangeName += yvarStep;
-
-      // set up the framse for pos/neg plots
-      RooPlot* framePos = eOverP.frame(Title("E/P pos"),Range("final"));
-      RooPlot* frameNeg = eOverP.frame(Title("E/P neg"),Range("final"));
-
-      // make data sets from the relevent bin of the binned sets to be easier to work with
-      RooDataSet* smallDataSetPos = binnedDataPos[xvarStep][yvarStep];
-      RooDataSet* smallDataSetNeg = binnedDataNeg[xvarStep][yvarStep];
-
-      // plot the smallDataSet on the corresponding frame: -- Pos(Blue) & Neg(Red)
-      smallDataSetPos->plotOn(framePos,LineColor(kBlue),MarkerColor(kBlue));
-      smallDataSetNeg->plotOn(frameNeg,LineColor(kRed),MarkerColor(kRed));
-
-      // reset the fit paramaters
-      meanPos.setVal(1);
-      meanNeg.setVal(1);
-      sigma.setVal(0.1);
-      alpha.setVal(-1);
-      n.setVal(1);
-
-      //----------
-      // Set up samples
-      //----------
-      RooCategory sample("sample","sample"); // separate positive and negative
-      sample.defineType("Pos");
-      sample.defineType("Neg");
-      RooDataSet combData("combData","combined data",eOverP,Index(sample),Import("Pos",*smallDataSetPos),Import("Neg",*smallDataSetNeg)); // combined data set in (x, sample)
-
-      //----------
-      // Set up simultaneous pdfs in (x,sample)
-      //----------
-      // gaussian
-      RooSimultaneous simPdfGS("simPdfGS","simultaneous pdf",sample);
-      simPdfGS.addPdf(gaussianPos,"Pos");
-      simPdfGS.addPdf(gaussianNeg,"Neg");
-      // cristal ball
-      RooSimultaneous simPdfCB("simPdfCB","simultaneous pdf",sample);
-      simPdfCB.addPdf(crystalBallPos,"Pos");
-      simPdfCB.addPdf(crystalBallNeg,"Neg");
-      // landau
-      RooSimultaneous simPdfLnd("simPdfLnd","simultaneous pdf",sample);
-      simPdfLnd.addPdf(LandauPos,"Pos");
-      simPdfLnd.addPdf(LandauNeg,"Neg");
-      // landau-gaussian convolution
-      RooSimultaneous simPdfLcwG("simPdfLcwG","simultaneous pdf",sample);
-      simPdfLcwG.addPdf(LcwGPos,"Pos");
-      simPdfLcwG.addPdf(LcwGNeg,"Neg");
-
-      //----------
-      // Perform simultaneous fit
-      //----------
-      // some fit vars
-      double fitMeanPos = -999.;
-      double fitMeanNeg = -999.;
-      double fitSigma   = -999.;
-
-      // set up ranges for first fit
-      eOverP.setRange("fitGauss_Pos",0.5,1.5);
-      eOverP.setRange("fitGauss_Neg",0.5,1.5);
-      // fit the gaussian & check if it produced a result
-      RooFitResult* fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save());
-      if(fitResult)
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT PRODUCED A FIT RESULT" <<std::endl;        
-      else
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT DID NOT PRODUCE A FIT RESULT" <<std::endl;        
-      // update fit vars
-      fitMeanPos = meanPos.getVal();
-      fitMeanNeg = meanNeg.getVal();
-      fitSigma = sigma.getVal();
-      // set up for 2nd fit
-      eOverP.setRange("fitGauss_Pos",fitMeanPos-2*fitSigma,fitMeanPos+2*fitSigma);      
-      eOverP.setRange("fitGauss_Neg",fitMeanNeg-2*fitSigma,fitMeanNeg+2*fitSigma);      
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING:: FIRST GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-        eOverP.setRange("fitGauss_Pos",0.1,1.9);
-        eOverP.setRange("fitGauss_Neg",0.1,1.9);
-      }
-      // will ---
-      
-      fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save() );
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::SECOND GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-      }
-      
-      //if (fitResult) delete fitResult;
-      
-      /*
-      // do some more fits 
-      int counter = 0;
-      do{
-	if(counter > 5){
-	  std::cout<< "WARNING:: REACHED MAX FIT ATTEMPTS WITH NO CONVERGENCE" << std::endl;
-	  break;
-	}
-	std::cout << "INFO:: TRYING GAUSSIAN FIT #"<< counter+2  << std::endl;
-
-	fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(),Save() );
-	if ( fitResult && fitResult->status() != 0){
-	  std::cout << "WARNING:: GAUSSIAN FIT #"<< counter+2 << " DID NOT CONVERGE" <<std::endl;
-	  meanPos.setVal(1.);
-	  meanNeg.setVal(1.);
-	  sigma.setVal(0.2+0.2*counter);
-	}
-	counter++;
-	} while(fitResult && fitResult->status() != 0);*/
-      // --- will
-
-      if (fitResult) delete fitResult;
-      fitMeanPos = meanPos.getVal();
-      fitMeanNeg = meanNeg.getVal();
-      fitSigma = sigma.getVal();
-     
-      eOverP.setRange("fitGauss_Pos",fitMeanPos-1.25*fitSigma,fitMeanPos+1*fitSigma);      
-      eOverP.setRange("fitGauss_Neg",fitMeanNeg-1.25*fitSigma,fitMeanNeg+1*fitSigma);      
-
-      // do final fit
-      fitResult = simPdfGS.fitTo(combData,Range("fitGauss"),SplitRange(), Save() );
-      if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::FINAL GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
-        meanPos.setVal(1);
-        meanNeg.setVal(1);
-        sigma.setVal(0.2);
-        fitSigma = 0.3;
-      }
-      if(fitResult) delete fitResult;
-      
-      //std::cout << "INFO: meanPos = " << meanPos.getVal() << " meanNeg = " << meanNeg.getVal() << " sigma = " << sigma.getVal() << std::endl;
-
-      /*
-      //Fit with Landau
-      fitResult = simPdfLnd.fitTo(combData, Range("fitLandau"),SplitRange(), Save() ) ;
-       if ( fitResult && fitResult->status() != 0){
-        std::cout << "WARNING::TEST LANDAU FIT DID NOT CONVERGE" <<std::endl;
-        LandauMeanPos.setVal(1);
-        LandauMeanNeg.setVal(1);
-        LandauS.setVal(0.2);
-        //fitSigma = 0.3;
-      }
-      if(fitResult) delete fitResult;
-      
-      fitMeanPos = (meanPos.getVal()+LandauMeanPos.getVal())/2.;
-      fitMeanNeg = (meanNeg.getVal()+LandauMeanNeg.getVal())/2.;
-      fitSigma = sigma.getVal() > LandauS.getVal() ? sigma.getVal() : LandauS.getVal();
-      
-      std::cout << "INFO: meanPos = " << meanPos.getVal() << " meanNeg = " << meanNeg.getVal() << " sigma = " << sigma.getVal() << std::endl;
-      std::cout << "INFO: LandauMeanPos = " << LandauMeanPos.getVal() << " LandauMeanNeg = " << LandauMeanNeg.getVal() << " LandauS = " << LandauS.getVal() << std::endl;
-      std::cout << "INFO: Fit Mean Pos: " << fitMeanPos << " Fit Mean Pos: " << fitMeanNeg << "Fit Sigma: " << fitSigma << std::endl;
-      */
-
-      //Perform simultaneous fit of model to data and model_ctl to data_ctl
-      eOverP.setRange("finalFit_Pos",fitMeanPos-1.5*fitSigma,2.5);      
-      eOverP.setRange("finalFit_Neg",fitMeanNeg-1.5*fitSigma,2.5);      
- 
-      if (fitMeanPos-1.5*fitSigma > 1.4 )
-        eOverP.setRange("finalFit_Pos",1.2,2.5);      
-      if (fitMeanNeg-1.5*fitSigma > 1.4 )
-        eOverP.setRange("finalFit_Neg",1.2,2.5);      
-
-      //Here the range is fixed instead of using all teh above (25/Feb/14, S. Marti)
-      eOverP.setRange("finalFit_Pos",0.8,2.5);      
-      eOverP.setRange("finalFit_Neg",0.8,2.5);  
-      //LandauMeanPos.setVal(1.);//LandauMeanPos.setConstant(kTRUE);
-      //LandauMeanNeg.setVal(1.);//LandauMeanNeg.setConstant(kTRUE);     
-      //meanPos.setVal(0.);meanPos.setConstant(kTRUE);
-      //meanNeg.setVal(0.);meanNeg.setConstant(kTRUE);
-      //sigma.setVal(0.2);    
-      
-
-//***** Choose one, CB, Landau or LcwG
-      //Fit with CrystalBall   
-      alpha.setVal(1.2);
-      meanPos.setVal(1.);
-      meanNeg.setVal(1.);
-      fitResult = simPdfCB.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-      crystalBallPos.plotOn(framePos,LineColor(kAzure-2),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-      crystalBallNeg.plotOn(frameNeg,LineColor(kRed-7),Range("finalFit_Neg"),NormRange("finalFit_Neg")); 
-
-
-      //Fit with Landau
-    /*  fitResult = simPdfLnd.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	LandauPos.plotOn(framePos,LineColor(kOrange+1),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-        LandauNeg.plotOn(frameNeg,LineColor(kGreen+1),Range("finalFit_Neg"),NormRange("finalFit_Neg")); */
-
-      
-      //Fit with Landau convoluted with Gaussian
-      if(false){
-	int simCount = 0;
-	do{
-	  if(simCount > 5) break;
-	  fitResult = simPdfLcwG.fitTo(combData, Range("finalFit"),SplitRange(), Save() ) ;
-	  simCount++;
-	} while(fitResult && ( fitResult->status() != 0  || fitResult->covQual() != 3 ));
-	
-	LcwGPos.plotOn(framePos,LineColor(kAzure-2),Range("finalFit_Pos"),NormRange("finalFit_Pos"));
-	LcwGNeg.plotOn(frameNeg,LineColor(kRed-7),Range("finalFit_Neg"),NormRange("finalFit_Neg")); 
-      }
-
-      // hold on
-      if (false) {
-	string input = "";
-	cout << " ** fit_EoverP ** Please type RETURN to continue:\n>";
-	getline(cin, input);
-      }
-
-//*****
-      
-      meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,meanPos.getVal());
-      meanPlotPos->SetBinError  (xvarStep+1,yvarStep+1,meanPos.getError());
-      meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,meanNeg.getVal());
-      meanPlotNeg->SetBinError  (xvarStep+1,yvarStep+1,meanNeg.getError());
-
-      if( fitResult && ( fitResult->status() != 0  || fitResult->covQual() != 3 )  ){
-        std::cout << "WARNING::FINAL SIM FIT DID NOT CONVERGE FULLY" <<std::endl;
-        meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,1);
-        meanPlotPos->SetBinError  (xvarStep+1,yvarStep+1,0.5);
-        meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,1);
-        meanPlotNeg->SetBinError  (xvarStep+1,yvarStep+1,0.5);
-      }
-      
-      if(fitResult) delete fitResult;
-          
-      c->Clear();    
-      c->SetLogy(false);
-
-      framePos->Draw();
-      frameNeg->Draw("same");     
-      
-      //ATLASPRELIM_LABEL(0.25,0.88,0.03,1);
-      TString* xvarTString = new TString(xvar.getTitle());
-      TString* yvarTString = new TString(yvar.getTitle());
-      
-      const char *yvarChar = *yvarTString;
-      const char *xvarChar = *xvarTString;
-      
-      
-      myText(0.25,0.96,kBlack,Form("Slice %01.2f< %s <%01.2f, %01.2f< %s <%01.2f"
-                                  ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+1)
-                                  ,xvarChar
-                                  ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+2)
-                                  ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+1)
-                                  ,yvarChar
-                                  ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+2)) );
-                                  
-      myMarkerText(0.65,0.85,kBlue,20,Form("e^{+},  <E/p> %01.3f #pm %01.3f",meanPlotPos->GetBinContent(xvarStep+1,yvarStep+1), meanPlotNeg->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
-      myMarkerText(0.65,0.80,kRed,20,Form("e^{-},  <E/p> %01.3f #pm %01.3f",meanPlotNeg->GetBinContent(xvarStep+1,yvarStep+1), meanPlotPos->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
-      
-      
-      c->Print(PATH+"new_eoverp_plots.pdf");
-      
-      delete framePos;
-      delete frameNeg;
-      delete smallDataSetPos;
-      delete smallDataSetNeg;
-    }
-  }
-  
-  makeSlicePlots(meanPlotPos ,meanPlotNeg, false);
-  makeSlicePlots(meanPlotPos ,meanPlotNeg, true);
-  
-  const UInt_t Number = 3;
-  Double_t Green[Number]  = { 0.00, 1.00, 0.00};
-  Double_t Red[Number]    = { 1.00, 0.10, 0.00};
-  Double_t Blue[Number]   = { 0.10, 0.10, 1.00};
-  Double_t Length[Number] = { 0.00, 0.50, 1.00 };
-  Int_t nb=50;
-  //TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
-
-  
-  TH2F* clone =(TH2F*) meanPlotPos->Clone();
-  clone->Divide(meanPlotNeg);
-  clone->SetContour(nb);
-  
-  TH2F* clone2 =(TH2F*) meanPlotPos->Clone();
-  clone2->Add( meanPlotNeg, -1);
-  clone2->SetContour(nb);
-
-  Double_t minPlot,maxPlot;
-
-  c->Clear();
-  c->SetRightMargin(0.12);
-  c->SetLogy(false);
-  clone->Draw("colz");
-
-  //Set Z axis centered in 1 so good points are in green
-  minPlot= clone->GetMinimum();
-  maxPlot= clone->GetMaximum();
-  if (maxPlot-1 > 1-minPlot) clone->SetMinimum(2-maxPlot);
-  else clone->SetMaximum(2-minPlot);
-  
-  c->Print(PATH+"new_eoverp_plots.pdf");
-  
-  meanPlotPos->Draw("colz");
-  meanPlotPos->SetContour(nb);
-
-  //Set Z axis centered in 1 so good points are in green
-  minPlot= meanPlotPos->GetMinimum();
-  maxPlot= meanPlotPos->GetMaximum();
-  if (maxPlot-1 > 1-minPlot) meanPlotPos->SetMinimum(2-maxPlot);
-  else meanPlotPos->SetMaximum(2-minPlot);
-
-  c->Print(PATH+"new_eoverp_plots.pdf");
-  
-  meanPlotNeg->Draw("colz");
-  meanPlotNeg->SetContour(nb);
-
-  //Set Z axis centered in 1 so good points are in green
-  minPlot= meanPlotNeg->GetMinimum();
-  maxPlot= meanPlotNeg->GetMaximum();
-  if (maxPlot-1 > 1-minPlot) meanPlotNeg->SetMinimum(2-maxPlot);
-  else meanPlotNeg->SetMaximum(2-minPlot);
-
-  c->Print(PATH+"new_eoverp_plots.pdf");
-
-  TH1F* pull = new TH1F("pull","pull",50,-5,5);
-  pull->GetXaxis()->SetTitle("Fit Pull");
-  pull->GetYaxis()->SetTitle("Entries per 0.2");
-  
-  c->SetRightMargin(0.03);
-  TF1 myGauss("myGaus","gaus");
-  for(int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
-    for(int yvarStep(0); yvarStep<nBinsY; ++yvarStep){   
-      double R = clone->GetBinContent(xvarStep+1,yvarStep+1);
-      std::cout << "INFO : R "<< R << " Ratio delta " << (1-R)/(1+R) << " Diff Delta "<<  clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.  << " Diff Delta "<<  1-(clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.)/((1-R)/(1+R))  <<std::endl;
-      pull->Fill( ( 1-clone->GetBinContent(xvarStep+1,yvarStep+1))/clone->GetBinError  (xvarStep+1,yvarStep+1) );
-    } 
-  }
-  pull->Draw();
-  pull->Fit(&myGauss);
-  myMarkerText(0.7,0.85,kWhite,1,Form("Gaussian, #mu = %01.3f #pm %01.3f",myGauss.GetParameter(1), myGauss.GetParError(1) ),1.0,0.03);
-  myMarkerText(0.7,0.80,kWhite,1,Form("Gaussian, #sigma = %01.3f #pm %01.3f",myGauss.GetParameter(2), myGauss.GetParError(2) ),1.0,0.03);
-  myMarkerText(0.7,0.75,kWhite,1,Form("Mean,      = %01.3f #pm %01.3f",pull->GetMean(), pull->GetMeanError() ),1.0,0.03);
-  myMarkerText(0.7,0.70,kWhite,1,Form("RMS,       = %01.3f #pm %01.3f",pull->GetRMS(), pull->GetRMSError() ),1.0,0.03);
-  
-  c->Print(PATH+"new_eoverp_plots.pdf");
-
-  
-  delete clone;
-  delete clone2;
-  
-  
-}
-
-
-void makeSlicePlots(TH2F* pos, TH2F* neg, bool sliceInEta)
-{
-  std::cout << "INFO::makeSlicePlots()" << std::endl;
-
-  int maxStep(1);
-
-  if(sliceInEta){
-    maxStep = pos->GetNbinsX();
-  } else {
-    maxStep = pos->GetNbinsY();
-  }
-  
-  TString name; 
-  for (int i(0); i <maxStep; ++i ){
-    TH1D* posProjection;
-    TH1D* negProjection;
-    name  =  pos->GetName();
-    name += "_Slice";
-  
-    if (sliceInEta){
-      posProjection = pos->ProjectionY( "_py", i+1 , i+1);
-      negProjection = neg->ProjectionY( "_py", i+1 , i+1);
-      name+="X";
-      name+=i;
-      
-    } else {
-      posProjection = pos->ProjectionX( "_px", i+1 , i+1);
-      negProjection = neg->ProjectionX( "_px", i+1 , i+1);    
-      name+="Y";
-      name+=i;
-      
-    }
-    
-    
-    
-    makeRatioPlots(posProjection, negProjection, name );
-    delete posProjection;
-    delete negProjection;
-  }  
-  std::cout << "INFO::Finished makeSlicePlots()" << std::endl;
-}
-
-
-
-
-void makeRatioPlots(TH1D* h1, TH1D* h2, TString name) {
-   std::cout << "INFO::Starting makeRatioPlots()" << std::endl;
-   TCanvas c1("C1","C1",600,600);
-   TPad *pad1 = new TPad("pad1","pad1",0,0.5,1,1);
-   pad1->SetTopMargin(0.05/0.5);
-   pad1->SetRightMargin(0.05);
-   pad1->SetBottomMargin(0.16);
-   pad1->SetLeftMargin(0.16);
-
-   pad1->SetBottomMargin(0);
-   pad1->Draw();
-   pad1->cd();
-
-   TH1D* h1clone = (TH1D*) h1->Clone();
-   h1->SetMarkerColor(kBlue);
-   h1->SetMarkerStyle(20);
-   h1->GetYaxis()->SetRangeUser(0.85,1.45);
-   h1->GetYaxis()->SetLabelSize(0.05/0.5);
-   h1->GetYaxis()->SetTitleSize(0.05/0.5);
-   h1->GetYaxis()->SetTitle("<E/p>");
-   h1->DrawCopy("pe");
-   h2->SetMarkerColor(kRed);
-   h2->SetMarkerStyle(22);
-   h2->Draw("samepe");
-   c1.cd();
-   TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.5);
-   pad2->SetTopMargin(0.05);
-   pad2->SetRightMargin(0.05);
-   pad2->SetBottomMargin(0.16/0.5);
-   pad2->SetLeftMargin(0.16);
-
-   //pad2->SetTopMargin(0);
-   pad2->Draw();
-   pad2->cd();
-   h1clone->Sumw2();
-   h1clone->SetStats(0);
-   h1clone->Divide(h2);
-   h1clone->SetMarkerColor(kBlack);
-   h1clone->SetMarkerStyle(20);
-   h1clone->GetYaxis()->SetLabelSize(0.05/0.5);
-   h1clone->GetXaxis()->SetLabelSize(0.05/0.5);
-   h1clone->GetYaxis()->SetTitleSize(0.05/0.5);
-   h1clone->GetXaxis()->SetTitleSize(0.05/0.5);
-   h1clone->GetYaxis()->SetRangeUser(0.8,1.2);
-   h1clone->GetYaxis()->SetTitle("<E/p>^{+}/<E/p>^{-}");
- 
-   h1clone->Draw("ep");
-   //h1->GetYaxis()->SetRangeUser(0.95,1.05);
-   c1.cd();
-
-   // legend title setup
-   TString title;
-   if(name.Contains("Y",TString::kExact))
-     title += "Phi slice ";
-   else
-     title += "Eta slice ";
-   title += name[name.Length()-1];
-
-   TLegend *leg1 = new TLegend(0.75,0.82,0.9,0.92);
-   leg1->SetBorderSize(0);
-   leg1->SetFillColor(0);
-   leg1->AddEntry("",title,"");
-   leg1->AddEntry(h1,"Positive","p");
-   leg1->AddEntry(h2,"Negative","p");
-   leg1->Draw();
-
-   //c1.Print( PATH + name+".pdf");
-   c1.Print(PATH+"new_eoverp_plots.pdf");
-   delete h1clone;
-   delete pad1;
-   delete pad2;
-   std::cout << "INFO::Finished makeRatioPlots()" << std::endl;
-
-}
-
-void initialize(){
-  // Set up ATLAS style and other things before we get started
-  gROOT->LoadMacro("AtlasStyle.C");
-  SetAtlasStyle();
-  gROOT->SetBatch();
-  return;
-}
-
-TH2F* makeCorrectionHist(){
-  TH2F *FinalCorrections = new TH2F("FinalCorrections","FinalCorrections",16,-2.5,2.5,16,-3.14159,3.14159);
-  return FinalCorrections;
-}
-
-double getCorrections(TH2F* corrections, double eta, double phi, double Et, double charge){
-  //Q/p_constr=Q/p_recon*(1 + pT_recon*Q*delta)
-  if(!corrections)
-    return 1;
-
-  
-  std::cout << "INFO :: GetCorrection -> Bin number "; //<< std::endl;
-  
-  int binNumber = corrections->FindBin(eta, phi);
-
-  //std::cout<< binNumber << std::endl;
-  
-
-  std::cout << "INFO :: GetCorrection -> delta" << std::endl;
-  double delta = corrections->GetBinContent(binNumber); 
-  
-  return 1+charge*Et*delta;  
-}
-
-void makeScalingHist(TString inputDir)
-{
-  std::cout << "INFO :: In makeScalingHist()" << std::endl;
-
-  TString dir = PATH;
-  if(inputDir != "") dir  = inputDir;
-  else{
-    std::cout << "ERROR :: makeScalingHist(): No input directory specified!" << std::endl;
-    return;
-  }
-  
-  TFile *file0 = TFile::Open(dir+"fitEoverP.root");
-  file0->ls();
-  TH2F* meanPlotNeg = (TH2F*) file0->Get("meanPlotNeg");
-  TH2F* meanPlotPos = (TH2F*) file0->Get("meanPlotPos");
-
-
-  if(!meanPlotNeg || !meanPlotNeg){
-    std::cout<< "ERROR :: makeScalingHist(): inputfile does not contain the desired histograms "  << std::endl; 
-    return;
-  }
-  
-  meanPlotNeg->Draw("colz");
-  meanPlotPos->Draw("colz");
-  meanPlotNeg->Sumw2();
-  meanPlotPos->Sumw2();
-
-
-  //Need to obtain the mean pt either from a histogram or from hardcoded values 
-  double pt[1000];
-
-  TH2F* meanPtVsEta =  (TH2F*) file0->Get("meanPtVsEta");
-  if(!meanPtVsEta){
-    std::cout << "ERROR :: makeScalingHist(): inputfile does not contain the meanPtVsEta histogram "  << std::endl; 
-    return;
-  }
-  for(int i=1; i<=meanPtVsEta->GetNbinsX(); i++){
-    TH1D* projection =  meanPtVsEta->ProjectionY( "_py", i , i);
-    pt[i-1] = (projection->GetMean()*1000.); //MeV
-    delete projection;
-  }  
-  
-
-  TH2F* a = (TH2F*) meanPlotPos->Clone(); 
-  a->Add(meanPlotNeg,-1);
-  a->Scale(-0.5); // divide by 2
-
-  for(int i=1; i <= a->GetNbinsX(); i++){
-    for(int j=1; j <= a->GetNbinsY(); j++){
-      double temp  =  a->GetBinContent(i,j);
-      a->SetBinContent(i,j, temp/pt[i-1]*1e3); 
-      temp  =  a->GetBinError(i,j);
-      a->SetBinError(i,j, temp/pt[i-1]*1e3);    
-    }
-  }
-  
-  a->Draw("colz");
-  
-  TFile f(dir+"Scaling.root","RECREATE");
-  a->SetName("FinalCorrections");
-  a->SetTitle("FinalCorrections");
-  a->Write();
-  f.ls();
-  f.Close();
-}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/run_ZmumuValidationExample.C b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/run_ZmumuValidationExample.C
deleted file mode 100644
index 0f4ee4a09ceb6e0080829b87039bb35a2fc515c7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/run_ZmumuValidationExample.C
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
- #include <iostream>
-#include <string>
-#include <list>
-#include "TROOT.h"
-#include "ZmumuValidationExample.cxx"
-
-void run_ZmumuValidationExample(Int_t nIterationsUserInput=20)
-{
-
-   //////////////////////////////////
-   // compile ZmumuValidationExample
-   //////////////////////////////////
-  //  gROOT->ProcessLine(".L ZmumuValidationExample.cxx+");
-
-   /////////////////////////////////////////
-   // define list of files to be analysed
-   /////////////////////////////////////////
-   std::list <std::string > s_fileNames;
-
-   string output_dir = "./";
-   string output_file_name = "ZmumuValidationExampleOutput.root";
-
-
-   //test files
-   //s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data11_7TeV.periodM2.physics_Muons.PhysCont.DESD_ZMUMU.t0pro09_v01.ZmumuValidationTest");
-   //s_fileNames.push_back("/home/stahlman/testarea/AlignmentDev/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/ZmumuValidationOut.root");
-
-   //190608_191239 tag validation
-   //string output_tag = "190608_191239"; s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data11_7TeV.190608_191239.physics_Muons.recon.DESD_ZMUMU.f411_m716_f411.ZmumuTuple.v1");
-
-   //189598_189845 tag validation
-   //string output_tag = "189598_189845"; s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data11_7TeV.189598_189845.physics_Muons.recon.DESD_ZMUMU.f406_m716_f406.ZmumuTuple");
-
-   //2012 Period A
-   string output_tag = "PeriodA";
-   //   s_fileNames.push_back("/afs/cern.ch/user/s/sthenkel/work/A20ProjectArea/Validation/Zmumu/local/0/ZmumuValidationOut.root");
-   s_fileNames.push_back("/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/ProcessedOutput/Zmumu_BS_mig/user.sthenkel.t12.valid1.167824.Sherpa_CT10_ZmumuMassiveCBPt280_500_BFilter.ESD.e3099_s1982_s1964_r6006_ZmumuValidation/mergedOutput/MergedZmumuValidation.root");
-   /*
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA3.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142453");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA3.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.12042714251
-0");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA3.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142526");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142559");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142622");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142644");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142704");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142729");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142756");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA4.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142818");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA5.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142854");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA6.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427142940");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA7.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427143018");
-   s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.data12_8TeV.periodA7.physics_Muons.PhysCont.DESD_ZMUMU.t0pro12_v01.ZmumuTuple.v1.120427143034");
-   */
-
-   //MC validation study - big ZDeltaPhi
-   //string output_tag = "ZDeltaPhi_01";  s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.mc10_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e574_s933_s946_r2425.ZmumuTuple.ZDeltaPhi_01.v4.120326010304");
-
-   //MC validation study - small ZDeltaPhi
-   //string output_tag = "ZDeltaPhi_02";  s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.mc10_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e574_s933_s946_r2425.ZmumuTuple.ZDeltaPhi_02.v1.120403101909");
-
-   //MC validation study - RDeltaPhi
-   //string output_tag = "RDeltaPhi_01";  s_fileNames.push_back("/local_data0/stahlman/data/ZmumuValidation/user.stahlman.mc10_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e574_s933_s946_r2425.ZmumuTuple.RDeltaPhi_01.v4.120326010436");
-
-   /////////////////////////////////////////////////
-   //define job parameters and run
-   /////////////////////////////////////////////////
-   int nIterations = 5; if (nIterationsUserInput > 0) nIterations = nIterationsUserInput;
-   int nEvents = 0;
-   bool isMC = false;
-
-   //string tree_name = "DefaultParams";
-   string tree_name = "Refit1Params";
-
-   string output_tag_mod = "";
-   //string output_tag_mod = "ZScaleUp500.";
-   //string output_tag_mod = "ZScaleDn500.";
-
-   string output_file = Form("%sZmumuValidationExampleOutput.%s.%s.%s%s.root", output_dir.c_str(), (isMC ? "MC":"Data"), output_tag.c_str(), output_tag_mod.c_str(), tree_name.c_str());
-
-   ZmumuValidationExample myZmumuValidationExample(s_fileNames, tree_name, output_file, isMC);
-   myZmumuValidationExample.SetPrintLevel(0);
-   myZmumuValidationExample.SetEtaBins(10);
-   myZmumuValidationExample.SetPhiBins(10);
-   myZmumuValidationExample.bookHistograms();
-
-   for (int i = 0; i < nIterations; i++) {
-     std::cout<< endl << " ==== ZmumuValidation ==== starting iteration "<< i+1 <<" of " << nIterations<< std::endl;
-     myZmumuValidationExample.loop(nEvents);
-   }
-
-   myZmumuValidationExample.writeToFile(0);
-   myZmumuValidationExample.DrawMap();
-
-   std::cout<< "Finished - Output File: " << output_file << std::endl;
-
-   return;
-}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/ElectronEoverPTracking.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/ElectronEoverPTracking.py
index 1458131bd88b1b1c53875a9e23a00643130113e4..aba9b84bbcbf4e3a259dee9c9ba52e970dd77476 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/ElectronEoverPTracking.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/ElectronEoverPTracking.py
@@ -60,7 +60,7 @@ import MagFieldServices.SetupField
 # set up geometry
 #
 
-#include('TrkDetDescrSvc/AtlasTrackingGeometrySvc.py')
+
 #include('/afs/cern.ch/user/s/sthenkel/work/ProjectArea/Tracking/TrkDetDescr/TrkDetDescrSvc/python/AtlasTrackingGeometrySvc.py')
 #from __main__ import AtlasTrackingGeometrySvc
 #
@@ -80,7 +80,7 @@ ToolSvc += ElectronTrkStepPropagator
 #
 from TrkExTools.TrkExToolsConf import Trk__Navigator
 ElectronTrkNavigator = Trk__Navigator(name = 'ElectronTrkNavigator',
-                                #TrackingGeometrySvc = AtlasTrackingGeometrySvc
+                                      #TrackingGeometrySvc = AtlasTrackingGeometrySvc
                                 )
 ToolSvc += ElectronTrkNavigator
 #
@@ -280,6 +280,7 @@ ToolSvc += DNATrackFitter
 from TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf import Trk__GlobalChi2Fitter
 GX2TrackFitter = Trk__GlobalChi2Fitter(name                  = 'GX2TrackFitter',
                                          OutputLevel = 4,
+                                       #TrackingGeometrySvc     = AtlasTrackingGeometrySvc,
 					 ExtrapolationTool     = ElectronTrkExtrapolator,
                                          NavigatorTool         = ElectronTrkNavigator,
                                          PropagatorTool        = ElectronTrkPropagator,
@@ -352,6 +353,17 @@ MuonRefitterTool2 = egammaTrkRefitterTool(name = 'MuonRefitterTool2',
                                             OutputLevel =4)
 ToolSvc += MuonRefitterTool2
 
+### (SH) Commented out for now since not offically supported in
+#MuonRefitterTool3 = egammaTrkRefitterTool(name = 'MuonRefitterTool3',
+#                                          FitterTool = GX2TrackFitter,
+#                                          matEffects = 2,
+#                                          minNoSiHits = -1,
+#                                          RemoveTRTHits = True,
+#                                          RemoveIBLHits = True,
+#                                          useBeamSpot = False,
+#                                          OutputLevel =4)
+#ToolSvc += MuonRefitterTool3
+
 
 GSFTrackCollection = "RefittedElectronTracks"
 DNATrackCollection = "RefittedElectronTracks2"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py
index 6d4805c7162be5cf2d2b17e346be8602282ee63c..b0fc2f6bf5e56aa8dec794e001c40e05a622cbe5 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py
@@ -1,6 +1,12 @@
 ################################
+import os
+#from runzmumu_run2paper import useWeightInMonitoring
+try:
+    useWeightInMonitoring
+except:
+    useWeightInMonitoring = False
+###############################
 # setup of alignment monitoring
-
 from AthenaMonitoring.DQMonFlags import DQMonFlags
 from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
 InDetAlignMonManager = AthenaMonManager( name                = "InDetAlignMonManager",
@@ -21,9 +27,10 @@ allSelection = InDetAlignMon__TrackSelectionTool(
         PassAllTracks = True, ## Uncomment this line to bypass track slection
 )
 ToolSvc += allSelection
+print " == runzmumu_script == "
+print allSelection
 
 # Align tracks selection
-
 from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetTrtDriftCircleCutTool
 trtDCtool = InDet__InDetTrtDriftCircleCutTool(
     name = "TrtHitsEtaCutTool",
@@ -39,69 +46,100 @@ InDetTrackSummaryTool = ToolSvc.InDetTrackSummaryTool
 #import egammaRec.EMCommonTrackSummary
 #InDetTrackSummaryTool = ToolSvc.InDetTrackSummaryTool #egammaRec.EMCommonTrackSummary.egammaInDetTrackSummaryTool
 
-from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-trackSelector = InDet__InDetDetailedTrackSelectorTool(
-    name = "TrackSelector",
-    OutputLevel = 7,
-    #OutputLevel = DEBUG,
-    TrackSummaryTool = InDetTrackSummaryTool,
-    pTMin = 10000.,
-    IPd0Max = 500.,
-    IPz0Max = 500.,
-    #nHitSct = 4,
-    nHitPix = 1,
-    nHitPixPhysical = 1,
-    nHitBLayerPlusPix = 0,
-    nHitBLayer = 0,
-    nHitSi = 9,
-    nHitSiPhysical = 7,
-    nHitTrt = 0,
-    #useEtaDepententMinHitTrt = True,
-    TrtDCCutTool = trtDCtool,
-#    addToMinHitTrt = -3
-)
-trackSelector.useEtaDepententMinHitTrt = True
-ToolSvc += trackSelector
 
-
-alignTrackSelection = InDetAlignMon__TrackSelectionTool(
-                                                        name = "InDetAlignMonAlignTrackSelectionTool",
-                                                        #PassAllTracks = True, ## Uncomment this line to bypass track slection
-                                                        TrackSelectorTool = trackSelector
-                                                        )
-ToolSvc += alignTrackSelection
+# salva 13/April/2017 #from InDetTrackSelectionTool.InDetTrackSelectionToolConf   import InDet__InDetTrackSelectionTool           #loading the InDetTrackSelectionTool
+
+m_TrackSelectorTool_NoCut = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolNoCut",
+							       UseTrkTrackTools = True,
+							       CutLevel = "NoCut",
+							       TrackSummaryTool    = InDetTrackSummaryTool,
+							       Extrapolator        = InDetExtrapolator)
+ToolSvc +=  m_TrackSelectorTool_NoCut
+print " == runzmumu_script == TrackSelectorTool_NoCut "
+print m_TrackSelectorTool_NoCut
+
+m_TrackSelectorTool_TP = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolTightPrimary",
+                                                        UseTrkTrackTools = True,
+                                                        CutLevel = "TightPrimary",
+                                                        minPt = 4000,
+                                                        minNPixelHitsPhysical = 2,
+                                                        minNSctHitsPhysical = 2,
+                                                        TrackSummaryTool    = InDetTrackSummaryTool,
+                                                        Extrapolator        = InDetExtrapolator)
+ToolSvc +=  m_TrackSelectorTool_TP
+print " == runzmumu_script == TrackSelectorTool_TP "
+print m_TrackSelectorTool_TP
+
+
+
+# define the loose primary and tight primary selections to be used in the monitoring
+LPSelection = InDetAlignMon__TrackSelectionTool(
+	name = "InDetAlignMonTracksSelectionTool_LP",
+	PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
+	UseIDTrackSelectionTool = True,
+	IDTrackSelectionTool = m_TrackSelectorTool_NoCut,
+	#TrackSelectorTool    = InDetDetailedTrackSelector_Default
+	)
+ToolSvc += LPSelection
+print " == runzmumu_script == LPSelection "
+print LPSelection
+
+TPSelection = InDetAlignMon__TrackSelectionTool(
+	name = "InDetAlignMonTracksSelectionTool_TP",
+	PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
+	UseIDTrackSelectionTool = True,
+	IDTrackSelectionTool = m_TrackSelectorTool_TP,
+	)
+ToolSvc += TPSelection
+print " == runzmumu_script == TPSelection "
+print TPSelection
+
+allSelection = InDetAlignMon__TrackSelectionTool(name = "InDetAlignMonAlignTrackSelectionTool",
+                                                     PassAllTracks = True, ## Uncomment this line to bypass track slection
+                                                     PrimVtxContainerName = InDetKeys.xAODVertexContainer(),
+                                                     UseIDTrackSelectionTool = True,
+                                                     IDTrackSelectionTool = m_TrackSelectorTool_NoCut,
+                                                     #TrackSelectorTool    = InDetDetailedTrackSelector_Default
+							)
+ToolSvc += allSelection
 
 
 from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonResiduals
 from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks
 from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonEfficiencies
-tracks = trackCollections[0]
+
 
 for trackCollection in trackCollections:
+        theTrackSelection = LPSelection
+        if ("CombinedInDetTracks" in trackCollection):
+                theTrackSelection = TPSelection
+        print " == runzmumu_script == monitoring for ",trackCollection," --> ",theTrackSelection
         # Selected tracks
-        print "Loading monitoring"
+        print "== runzmumu_script == Loading IDAlignMonResiduals for trackCollection:",trackCollection
         InDetAlignMonResiduals = IDAlignMonResiduals(
+                OutputLevel = DEBUG,
                 name = "InDetAlignMonResiduals_"+trackCollection,
-                trackSelection = alignTrackSelection,#allSelection,
+                trackSelection = theTrackSelection,
                 tracksName = trackCollection,
                 useExtendedPlots = True,
-                triggerChainName = "all",
+                triggerChainName = "Tracks",
                 Pixel_Manager = InDetKeys.PixelManager(),
                 SCT_Manager = InDetKeys.SCT_Manager(),
                 TRT_Manager = InDetKeys.TRT_Manager(),
-                minPIXResXFillRange = -0.1,
-                maxPIXResXFillRange =  0.1,
-                #minPIXResXFillRange = -0.5,
-                #maxPIXResXFillRange =  0.5,
-                minPIXResYFillRange = -0.5,
-                maxPIXResYFillRange =  0.5,
-                minSCTResFillRange  = -0.2,
-                maxSCTResFillRange =   0.2,
-                #minSCTResFillRange  = -0.5,
-                #maxSCTResFillRange =   0.5,
+                minPIXResXFillRange = -0.050,
+                maxPIXResXFillRange =  0.050,
+                minPIXResYFillRange = -0.360,
+                maxPIXResYFillRange =  0.360,
+                minSCTResFillRange  = -0.090,
+                maxSCTResFillRange =   0.090,
+                minTRTResidualWindow = -0.550,
+                maxTRTResidualWindow =  0.550,
                 NSplitMap = 4,
-                RangeOfPullHistos  =   5
-
+                RangeOfPullHistos  =   5,
+                applyHistWeight = useWeightInMonitoring,
+                hWeightHistName = "h_eventMuVsTrkEta",
+                hWeightInFileName = "usr/WorkDir/21.0.68/InstallArea/x86_64-slc6-gcc62-opt/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/hWeight.root"
+              #ROOT FILE SHOULD BE TAKEN FROM CALIB AREA USING PATH RESOLVER!!! NEEDS TO CHANGE!!!
         )
         print InDetAlignMonResiduals
 
@@ -110,20 +148,28 @@ for trackCollection in trackCollections:
 
         InDetAlignMonGenericTracks = IDAlignMonGenericTracks(
                 name = "InDetAlignMonGenericTracks_"+trackCollection,
-                trackSelection = alignTrackSelection,#allSelection,
+                trackSelection = theTrackSelection,
                 tracksName = trackCollection,
                 useExtendedPlots = True,
-                triggerChainName = "all",
-                VxPrimContainerName = InDetKeys.PrimaryVertices()
+                triggerChainName = "Tracks",
+                VxPrimContainerName = InDetKeys.PrimaryVertices(),
+                d0BsRange = 0.090,
+                z0Range = 160.,
+                applyHistWeight = useWeightInMonitoring,
+                hWeightHistName = "h_eventMuVsTrkEta",
+                hWeightInFileName = "usr/WorkDir/21.0.23/InstallArea/x86_64-slc6-gcc62-opt/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/hWeight.root"
+                 #ROOT FILE SHOULD BE TAKEN FROM CALIB AREA USING PATH RESOLVER!!! NEEDS TO CHANGE!!!
         )
+        print InDetAlignMonGenericTracks
+        
         ToolSvc += InDetAlignMonGenericTracks
         InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ]
 
         InDetAlignMonSelectedTracksEfficiencies = IDAlignMonEfficiencies (
                 name = "InDetAlignMonEfficiencies_"+trackCollection,
-                trackSelection = alignTrackSelection,#allSelection,
+                trackSelection = theTrackSelection,
                 tracksName = trackCollection,
-                triggerChainName = "all",
+                triggerChainName = "Tracks",
                 #HoleSearch = InDetExtendedHoleSearchTool,
                 Pixel_Manager = InDetKeys.PixelManager(),
                 SCT_Manager = InDetKeys.SCT_Manager(),
@@ -143,15 +189,6 @@ InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name  = "InDetAlignMonBeam
                                                                                                          vxContainerWithBeamConstraint  = InDetFlags.useBeamConstraint(),
 						                                    #                     vxContainerWithBeamConstraint  = False,
 						                                                          OutputLevel= 1)
-ToolSvc += InDetAlignMonBeamSpot_noTrig
-InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonBeamSpot_noTrig ]
-
-# write out BS info
-#from AthenaCommon.AppMgr    import ServiceMgr as svcMgr
-#from IOVDbSvc.IOVDbSvcConf  import IOVDbSvc
-#svcMgr += IOVDbSvc()
-#IOVDbSvc.dbConnection  = "impl=cool;techno=sqlite;schema=beamspot.db;X:TESTCOOL"
-
 
 
 if not hasattr(ServiceMgr, 'THistSvc'):
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/batch_EoverP.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/batch_EoverP.py
index b7058b5007e432a3ef7679621223f4b2c36bf46d..b39ba6d11baa4ae1aafeb0b5173c11a5f054352f 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/batch_EoverP.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/batch_EoverP.py
@@ -49,7 +49,7 @@ def getConfig():
     p.add_option("--inputList", "-i", dest="inputList", help="Text file with paths to the data files to be used", default="test.txt")
     p.add_option("--nFilesPerJob", "-n", dest="nFilesPerJob", type="int", help="Number of files per subjob", default=1)
     p.add_option("--queue", "-q", dest="queue", help="Which lxbatch queue to submit to", default='atlasb1')
-    p.add_option("--athena", "-a", dest="athRel", help="Which Athena release do you want", default='20.1.5.12')
+    p.add_option("--athena", "-a", dest="athRel", help="Which Athena release do you want", default='20.7.7.9')
     (config, sys.argv[1:]) = p.parse_args(sys.argv[1:])
     return config
     
@@ -83,6 +83,9 @@ def writeRunner(dataFiles,path,jobNum,athrel):
     # write JO copy
     f.write('echo "copy JO"\n'+
             'cp ${TESTAREA}/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runEoverPValidationBatch.py .\n\n')
+    ### xrootd patch for athena version 20.7.7.X
+    f.write('source /afs/cern.ch/work/w/wdicleme/public/Alignment/20.7.8/linker.sh\n\n')
+    ###
     # write execute JO
     f.write('echo "running the code"\n'+
             'athena runEoverPValidationBatch.py '+
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL.py
index 2f007381973c34c2671bd58e7fefba32df343afc..19c19bedbc851f94fa5604168b21f08cefe9fab6 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL.py
@@ -14,17 +14,17 @@ svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
 from GoodRunsLists.GoodRunsListsConf import *
 ToolSvc += GoodRunsListSelectorTool()
 
-GoodRunsListSelectorTool.GoodRunsListVec = [ '$TestArea/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/data15_13TeV.periodAllYear_DetStatus-v69-pro19-03_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml' ]
-#GoodRunsListSelectorTool.GoodRunsListVec = [ 'data15_13TeV.periodAllYear_DetStatus-v65-pro19-01_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml' ]
+GoodRunsListSelectorTool.GoodRunsListVec = [ '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20170619/data15_13TeV.periodAllYear_DetStatus-v89-pro21-02_Unknown_PHYS_StandardGRL_All_Good_25ns.xml
+' ]
+GoodRunsListSelectorTool.GoodRunsListVec += [ '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20180129/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml' ]
+
 
-#GoodRunsListSelectorTool.GoodRunsListVec = [ 'data15_13TeV.periodAllYear_DetStatus-v63-pro18-01_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml' ]
-#GoodRunsListSelectorTool.OutputLevel = VERBOSE
 
 ## This Athena job consists of algorithms that loop over events;
 ## here, the (default) top sequence is used:
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-job = AlgSequence()
-seq = AthSequencer("AthFilterSeq")
+#from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
+#job = AlgSequence()
+#seq = AthSequencer("AthFilterSeq")
 
 ## AthFilterSeq is always executed before the top sequence, and is configured such that
 ## any follow-up sequence (eg. top sequence) is not executed in case GRLTriggerAlg1 does
@@ -33,7 +33,7 @@ seq = AthSequencer("AthFilterSeq")
 ## are skipped when an event gets rejects
 from GoodRunsListsUser.GoodRunsListsUserConf import *
 seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']        ## pick up correct name from inside xml file!
+seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good_25ns']        ## pick up correct name from inside xml file!
 #seq.GRLTriggerAlg1.TriggerSelectionRegistration = 'L1_MBTS_1' ## set this to your favorite trigger, eg. L1_MBTS_1_1
 
 ## Add the ntuple dumper to the top sequence, as usual
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL_2015.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL_2015.py
new file mode 100644
index 0000000000000000000000000000000000000000..830aafe54c9341cf3d38253a8052f6119c7fbf55
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL_2015.py
@@ -0,0 +1,49 @@
+from GaudiSvc.GaudiSvcConf import THistSvc
+
+# add LumiBlockMetaDataTool to ToolSvc and configure
+from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
+ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
+LumiBlockMetaDataTool.calcLumi = True # False by default
+
+# add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
+from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
+svcMgr += MetaDataSvc( "MetaDataSvc" )
+svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
+
+# Configure the goodrunslist selector tool
+from GoodRunsLists.GoodRunsListsConf import *
+ToolSvc += GoodRunsListSelectorTool()
+
+#GoodRunsListSelectorTool.GoodRunsListVec = [ '/project/atlas/users/pbutti/Maps_v2/run/GRLs/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec = [ '$TestArea/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec = [ './grls/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml' ]
+GoodRunsListSelectorTool.GoodRunsListVec = [ './grls/data15_13TeV.periodAllYear_DetStatus-v89-pro21-02_Unknown_PHYS_StandardGRL_All_Good_25ns.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec = [ 'InDetPerformanceMonitoring/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec += [ '$TestArea/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec = [ 'InDetPerformanceMonitoring/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml' ]
+
+
+
+## This Athena job consists of algorithms that loop over events;
+## here, the (default) top sequence is used:
+#from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
+#job = AlgSequence()
+#seq = AthSequencer("AthFilterSeq")
+
+## AthFilterSeq is always executed before the top sequence, and is configured such that
+## any follow-up sequence (eg. top sequence) is not executed in case GRLTriggerAlg1 does
+## not pass the event
+## In short, the sequence AthFilterSeq makes sure that all algs in the job sequence
+## are skipped when an event gets rejects
+from GoodRunsListsUser.GoodRunsListsUserConf import *
+seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
+seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good_25ns']        ## pick up correct name from inside xml file!
+#seq.GRLTriggerAlg1.TriggerSelectionRegistration = 'L1_MBTS_1' ## set this to your favorite trigger, eg. L1_MBTS_1_1
+
+## Add the ntuple dumper to the top sequence, as usual
+## DummyDumperAlg1 is run in the top sequence, but is not executed in case GRLTriggerAlg1 rejects the event.
+job += DummyDumperAlg('DummyDumperAlg1')
+# job.DummyDumperAlg1.RootFileName = 'selection1.root'
+ServiceMgr += THistSvc()
+ServiceMgr.THistSvc.Output = ["new DATAFILE='selection1.root' TYP='ROOT' OPT='RECREATE'"];
+job.DummyDumperAlg1.GRLNameVec = [ 'LumiBlocks_GoodDQ0', 'IncompleteLumiBlocks_GoodDQ0' ]
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL_2016.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL_2016.py
new file mode 100644
index 0000000000000000000000000000000000000000..29eafad41029ee9969df7caddc0ebc2a70d88f13
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/jobOptions_useGRL_2016.py
@@ -0,0 +1,46 @@
+from GaudiSvc.GaudiSvcConf import THistSvc
+
+# add LumiBlockMetaDataTool to ToolSvc and configure
+from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
+ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
+LumiBlockMetaDataTool.calcLumi = True # False by default
+
+# add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
+from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
+svcMgr += MetaDataSvc( "MetaDataSvc" )
+svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
+
+# Configure the goodrunslist selector tool
+from GoodRunsLists.GoodRunsListsConf import *
+ToolSvc += GoodRunsListSelectorTool()
+
+#GoodRunsListSelectorTool.GoodRunsListVec = [ '/project/atlas/users/pbutti/Maps_v2/run/GRLs/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec = [ '$TestArea/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml' ]
+GoodRunsListSelectorTool.GoodRunsListVec = [ '$TestArea/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml' ]
+#GoodRunsListSelectorTool.GoodRunsListVec = [ './grls/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml' ]
+
+
+
+## This Athena job consists of algorithms that loop over events;
+## here, the (default) top sequence is used:
+#from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
+#job = AlgSequence()
+#seq = AthSequencer("AthFilterSeq")
+
+## AthFilterSeq is always executed before the top sequence, and is configured such that
+## any follow-up sequence (eg. top sequence) is not executed in case GRLTriggerAlg1 does
+## not pass the event
+## In short, the sequence AthFilterSeq makes sure that all algs in the job sequence
+## are skipped when an event gets rejects
+from GoodRunsListsUser.GoodRunsListsUserConf import *
+seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
+seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good_25ns']        ## pick up correct name from inside xml file!
+#seq.GRLTriggerAlg1.TriggerSelectionRegistration = 'L1_MBTS_1' ## set this to your favorite trigger, eg. L1_MBTS_1_1
+
+## Add the ntuple dumper to the top sequence, as usual
+## DummyDumperAlg1 is run in the top sequence, but is not executed in case GRLTriggerAlg1 rejects the event.
+job += DummyDumperAlg('DummyDumperAlg1')
+# job.DummyDumperAlg1.RootFileName = 'selection1.root'
+ServiceMgr += THistSvc()
+ServiceMgr.THistSvc.Output = ["new DATAFILE='selection1.root' TYP='ROOT' OPT='RECREATE'"];
+job.DummyDumperAlg1.GRLNameVec = [ 'LumiBlocks_GoodDQ0', 'IncompleteLumiBlocks_GoodDQ0' ]
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runEoverPValidationData.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runEoverPValidationData.py
index ce681d7b14260914a37848e0e501403f0a5078c9..e9f85216b981dcea40859a957f99ef18cfd14636 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runEoverPValidationData.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runEoverPValidationData.py
@@ -54,8 +54,8 @@ athenaCommonFlags.EvtMax = EvtMax
 athenaCommonFlags.SkipEvents = SkipEvents
 
 from AthenaCommon.GlobalFlags import globalflags
-globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2015-09")
-globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-03-01-00")
+globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-21")
+globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2016-00-01-00")
 
 from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
 GeoModelSvc = GeoModelSvc()
@@ -103,8 +103,8 @@ from IOVDbSvc.CondDB import conddb
 inputCollections = []#["Iter4_AlignmentConstants.root"]
 #inputCollections = ["/afs/cern.ch/user/m/mdanning/hias/public/13TeV/20.1.5.8/run_DCSfix/DCS_L2fixedThenL27_andL3/Iter3/Iter0_AlignmentConstants.root"]
 readPool  = False
-conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-25NS')
-conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-25NS')
+#conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-25NS')
+#conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-25NS')
 
 if readPool :
   conddb.blockFolder("/Indet/Align")
@@ -136,7 +136,7 @@ from GaudiSvc.GaudiSvcConf import THistSvc
 ServiceMgr += THistSvc()
 ServiceMgr.THistSvc.Output += ["eoverpValidation DATAFILE='eoverpValidationOut.root' OPT='RECREATE'"]
 ServiceMgr.THistSvc.Output += ["eoverpValidation2 DATAFILE='eoverpValidationOut.root' OPT='RECREATE'"]
-include ("ElectronEoverPTracking.py")
+include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
 from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonEoverP
 funIDPerfMonEoverP = IDPerfMonEoverP(name = 'IDPerfMonEoverP',
                                      ReFitterTool = ElectronRefitterTool,
@@ -147,6 +147,7 @@ funIDPerfMonEoverP = IDPerfMonEoverP(name = 'IDPerfMonEoverP',
                                      RefittedElectronTrackContainer2 = DNATrackCollection,
                                      RefitTracks = True,
                                      isDATA = True,
+                                     isxAOD = False,
                                      FillDetailedTree = True,
                                      OutputLevel = INFO)
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJpsimumuValidation.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJpsimumuValidation.py
new file mode 100644
index 0000000000000000000000000000000000000000..21066ee839ef24cfe49d831484f7c9d09264a36b
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJpsimumuValidation.py
@@ -0,0 +1,152 @@
+#example of personal topOptions
+#
+# to use it
+# athena >! athena.log
+#  ( myTopOptions.py is defaulted through jobOptions.py soft link)
+#
+# see RecExCommon/share/RecExCommon_flags.py for more available flags
+# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
+# for more complete documentation.
+#
+# doESD, DetDescrVersion and other flags
+# needs be set before the include, since several
+# secondary flags are configured according to that one
+#
+#   1) Specify the input in here
+#      - One file
+#PoolInput = ["/afs/cern.ch/work/s/sthenkel/work/testarea/20.1.0.6/MCsets/valid1.167824.Sherpa_CT10_ZmumuMassiveCBPt280_500_BFilter.recon.ESD.e3099_s1982_s1964_r6006_tid04628773_00/ESD.04628773._000033.pool.root.1"]
+#PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/MC/valid3.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3099_s2578_r6588_tid05292497_00/ESD.05292497._000150.pool.root.1"]
+#   2) Feed files when executing the script
+if 'inputFiles' in dir():
+  print inputFiles
+PoolInput = inputFiles
+
+
+#      - Multiple files
+#PoolInput = ["root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._007903.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._007027.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005086.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005166.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005436.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005561.pool.root.1"]
+
+# number of event to process
+EvtMax=-1
+SkipEvents = 0
+
+NoBeamConstraint=True
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+pmjp.PerfMonFlags.doFastMon=True
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-REPPST-007-08")
+#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+#rec.doPerfMon.set_Value_and_Lock(True)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+#rec.doMuon.set_Value_and_Lock(True)
+#rec.doMuonCombined.set_Value_and_Lock(True)
+#rec.doEgamma.set_Value_and_Lock(True)
+#rec.doJetMissingETTag.set_Value_and_Lock(True)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+rec.doTruth.set_Value_and_Lock(False)
+
+
+from LArConditionsCommon.LArCondFlags import larCondFlags
+larCondFlags.LoadElecCalib.set_Value_and_Lock(True)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+#with beamconstraint
+if NoBeamConstraint:
+  from InDetRecExample.InDetJobProperties import InDetFlags
+  InDetFlags.useBeamConstraint.set_Value_and_Lock(False)
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+DetFlags.Calo_setOn()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+
+#USE temporary to DEBUG
+#from AthenaCommon.AppMgr import theApp
+#theApp.ReflexPluginDebugLevel=1
+
+
+readPool = False
+
+from IOVDbSvc.CondDB import conddb
+
+if not conddb.folderRequested('PIXEL/PixReco'):
+  conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
+
+
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+
+from GaudiSvc.GaudiSvcConf import THistSvc
+ServiceMgr += THistSvc()
+ServiceMgr.THistSvc.Output += ["JpsimumuValidation DATAFILE='JpsimumuValidationOut.root' OPT='RECREATE'"]
+include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonJpsimumu
+iDPerfMonJpsimumu = IDPerfMonJpsimumu(name = 'IDPerfMonJpsimumu',
+                                     ReFitterTool1 = MuonRefitterTool,
+                                     ReFitterTool2 = MuonRefitterTool2,
+				     OutputTracksName =  "SelectedMuons",
+#				     isMC = True,
+				     isMC = False,
+				     doIsoSelection = False,
+                                     OutputLevel= DEBUG)
+
+
+#ToolSvc += funIDPerfMonJpsimumu
+job += iDPerfMonJpsimumu
+
+trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+#StoreGateSvc = Service("StoreGateSvc")
+#StoreGateSvc.Dump = True
+include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runKShortValidation.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runKShortValidation.py
index 826ec5c782b14b2bf29aa488e0e258b926e0a067..6300a62d122133377931a01b2f89779d7dd3f716 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runKShortValidation.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runKShortValidation.py
@@ -13,17 +13,24 @@
 # secondary flags are configured according to that one
 #
 #   1) Specify the input in here
-#      - One file
-#PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/data/lowMuRun/group.det-indet.data15_13TeV.00267358.physics_MinBias.DxAODMinBias.f597.ConvKSv004_EXT0/group.det-indet.5709497.EXT0._000011.DxAODMinBias.pool.root"]
+     # - One file
+PoolInput = ["../run/data16_13TeV.00310249.physics_Main.merge.AOD.f755_m1699._lb1328._0003.1"]
+# PoolInput = ["../run/data15_13TeV/ESD.08262633._004792.pool.root.1"]
+
+
 #   2) Feed files when executing the script
-if 'inputFiles' in dir():
-  print inputFiles
-PoolInput = inputFiles
+# if 'inputFiles' in dir():
+#   print inputFiles
+# PoolInput = inputFiles
 
-# number of event to process
-EvtMax=10000
+# number of events to process
+EvtMax=1000
 SkipEvents = 0
 
+# refit for ESD
+doRefit=False
+
+
 NoBeamConstraint=True
 
 # DetFlags modifications are best set here (uncomment RecExCommon_flags first)
@@ -37,19 +44,19 @@ from AthenaCommon.AlgSequence import AthSequencer
 
 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
 athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax)
 athenaCommonFlags.SkipEvents = SkipEvents
 
 from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-REPPST-007-08")
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
+globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-19")
+globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-03-29-00")
 
 from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
 GeoModelSvc = GeoModelSvc()
 GeoModelSvc.IgnoreTagDifference = True
 
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
+from RecExConfig.RecFlags import rec #set the reconstruction, which reconstruction should run
+rec.AutoConfiguration=['everything'] #picks up info from ESD, conditions tag...
 rec.doAOD.set_Value_and_Lock(False)
 rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
 rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
@@ -57,9 +64,12 @@ rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making alg
 rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
 rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
 rec.doCBNT.set_Value_and_Lock(False)
-#rec.doPerfMon.set_Value_and_Lock(True)
+# rec.doPerfMon.set_Value_and_Lock(True)
 rec.doPerfMon.set_Value_and_Lock(False)
+
+
 rec.doInDet.set_Value_and_Lock(True)
+
 rec.doTile.set_Value_and_Lock(False)
 rec.doLArg.set_Value_and_Lock(False)
 rec.doCalo.set_Value_and_Lock(False)
@@ -86,7 +96,7 @@ if NoBeamConstraint:
 
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr
 
-include ("RecExCond/RecExCommon_flags.py")
+include ("RecExCond/RecExCommon_flags.py") #What raw info should we use - gives matrix in output
 # switch off ID, calo, or muons
 DetFlags.ID_setOn()
 #DetFlags.Calo_setOn()
@@ -101,22 +111,13 @@ DetFlags.detdescr.Calo_setOn()
 #from AthenaCommon.AppMgr import theApp
 #theApp.ReflexPluginDebugLevel=1
 
-
 readPool = False
 
-from IOVDbSvc.CondDB import conddb
+from IOVDbSvc.CondDB import conddb #Here I can specify eg alignment tag
 #conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_189598_189845v0')
 #conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_189598_189845v0')
 #conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
 
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
 #conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_ZDeltaPhi_01')
 #conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_ZDeltaPhi_01')
 #conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
@@ -126,35 +127,94 @@ from IOVDbSvc.CondDB import conddb
 if not conddb.folderRequested('PIXEL/PixReco'):
   conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
 
+if not conddb.folderRequested('/PIXEL/PixelClustering/PixelClusNNCalib'):
+  conddb.addFolder("PIXEL_OFL","/PIXEL/PixelClustering/PixelClusNNCalib")
+
 if readPool :
-	conddb.blockFolder("/Indet/Align")
-	conddb.blockFolder("/TRT/Align")
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	# set this to the file containing AlignableTransform objects
-	ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-	ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-	print ServiceMgr.CondProxyProvider
-	# this preload causes callbacks for read in objects to be activated,
-	# allowing GeoModel to pick up the transforms
-	ServiceMgr.IOVSvc.preLoadData=True
-	ServiceMgr.IOVSvc.OutputLevel=INFO
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
 
 include ("InDetRecExample/InDetRecConditionsAccess.py")
 
+# Setup for V0 finder
+InDetFlags.doxAOD.set_Value_and_Lock(True)
+InDetFlags.postProcessing.set_Value_and_Lock(True)
+InDetFlags.loadTools          = True
+InDetFlags.doVertexFinding    = False
+InDetFlags.doParticleCreation = False
+InDetFlags.doConversions      = False
+InDetFlags.doV0Finder         = True
+InDetFlags.doSimpleV0Finder   = True
+InDetFlags.doRefit            = False
+InDetFlags.doPrintConfigurables = True
+InDetFlags.useV0Fitter        = True
+
+# Modify the name of the output xAOD particles and the V0 container to ensure we are not overwriting anything
+from InDetRecExample.InDetKeys import InDetKeys
+InDetKeys.xAODV0VertexContainer = "NewContainerV0"
+
+
+# Setup for refitting of tracks in ESD
+if doRefit:
+  InDetFlags.preProcessing      = False
+  InDetFlags.doPRDFormation        = False                                                                                                            
+  InDetFlags.doSpacePointFormation = False                                                                                                                                                                                     
+  InDetFlags.doNewTracking      = False
+  InDetFlags.doiPatRec          = False
+  InDetFlags.doxKalman          = False
+  InDetFlags.doLowPt            = False
+  InDetFlags.doBackTracking     = False
+  InDetFlags.doTRTStandalone    = False
+  InDetFlags.doTrtSegments      = False
+  InDetFlags.doTrackSegmentsPixel = False
+  InDetFlags.doTrackSegmentsSCT = False
+  InDetFlags.doTrackSegmentsTRT = False
+  InDetFlags.doSlimming         = False
+  InDetFlags.doVertexFinding    = True
+  InDetFlags.doParticleCreation = True
+  InDetFlags.doSecVertexFinder  = False
+  InDetFlags.doTrkNtuple        = False
+  InDetFlags.doPixelTrkNtuple   = False
+  InDetFlags.doSctTrkNtuple     = False
+  InDetFlags.doTrtTrkNtuple     = False
+  InDetFlags.doPixelClusterNtuple = False
+  InDetFlags.doSctClusterNtuple   = False
+  InDetFlags.doTrtDriftCircleNtuple = False
+  InDetFlags.doVtxNtuple        = False
+  InDetFlags.doConvVtxNtuple    = False
+  InDetFlags.doV0VtxNtuple      = False
+  InDetFlags.doRefit            = True
+  InDetFlags.doLowBetaFinder    = False
+  InDetFlags.doMinBias          = True
+
+  # Modify the name of the output xAOD particles and the V0 container to ensure we are not overwriting anything
+  InDetKeys.xAODTrackParticleContainer = "RefittedTrackParticles"
+  InDetKeys.xAODVertexContainer = "NewContainerPrimary"
+
+
 # main jobOption
 include ("RecExCommon/RecExCommon_topOptions.py")
 
 from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonKshort
 iDPerfMonKshort = IDPerfMonKshort(name = 'IDPerfMonKshort',
-                                  tracksName = "InDetTrackParticles",
+                                  tracksName = InDetKeys.xAODTrackParticleContainer(), # Point to the newly created xAOD track particles
                                   #CheckRate = 1000,
                                   triggerChainName = "NoTriggerSelection",
-                                  VxContainerName = "V0UnconstrVertices",
+                                  VxContainerName = InDetKeys.xAODV0VertexContainer(), # Point to the newly created xAOD V0 container
                                   VxPrimContainerName = "PrimaryVertices",
-                                  OutputLevel = DEBUG)
+                                  OutputLevel = ERROR)
 
 ToolSvc += iDPerfMonKshort
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation.py
index 24352bfae23b52f04e285d17173586474f4b0182..d7ccea4df3136edf38382b935660de02d581005f 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation.py
@@ -14,19 +14,19 @@
 #
 #   1) Specify the input in here
 #      - One file
-#PoolInput = ["/afs/cern.ch/work/s/sthenkel/work/testarea/20.1.0.6/MCsets/valid1.167824.Sherpa_CT10_ZmumuMassiveCBPt280_500_BFilter.recon.ESD.e3099_s1982_s1964_r6006_tid04628773_00/ESD.04628773._000033.pool.root.1"]
+PoolInput = ["/afs/cern.ch/work/s/sthenkel/work/testarea/20.1.0.6/MCsets/valid1.167824.Sherpa_CT10_ZmumuMassiveCBPt280_500_BFilter.recon.ESD.e3099_s1982_s1964_r6006_tid04628773_00/ESD.04628773._000033.pool.root.1"]
 #PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/MC/valid3.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3099_s2578_r6588_tid05292497_00/ESD.05292497._000150.pool.root.1"]
 #   2) Feed files when executing the script
 if 'inputFiles' in dir():
   print inputFiles
-PoolInput = inputFiles
+  PoolInput = inputFiles
 
 
 #      - Multiple files
 #PoolInput = ["root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._007903.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._007027.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005086.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005166.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005436.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005561.pool.root.1"]
 
 # number of event to process
-EvtMax=-1
+EvtMax=5
 SkipEvents = 0
 
 NoBeamConstraint=True
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation_data.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation_data.py
index a35ceecd5ef711d3b3d6309a8aa3c745b53e55a3..c4eb0446eb444fb7d015ded2170a25a0417461dc 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation_data.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runZmumuValidation_data.py
@@ -23,7 +23,7 @@ PoolInput = inputFiles
 
 
 # number of event to process
-EvtMax=-1
+EvtMax=100
 SkipEvents = 0
 
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/run_alignmentpaper.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/run_alignmentpaper.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d5598d563de247b0e5fa0f7be7fd91be5b306f2
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/run_alignmentpaper.py
@@ -0,0 +1,450 @@
+###############################
+# Rel 21
+###############################
+
+import commands
+import os
+
+# For colored printouts
+RED   = "\033[1;31m"
+BLUE  = "\033[1;34m"
+CYAN  = "\033[1;36m"
+GREEN = "\033[0;32m"
+RESET = "\033[0;0m"
+BOLD    = "\033[;1m"
+sys.stdout.write(BLUE)
+print ' == ALIGNMENT PAPER == START == TestArea = ',os.getenv("TestArea")
+print ' == ALIGNMENT PAPER == CHECK if the TestArea is setup such that the setup.sh is sourced '
+theCommand = "source %s/build/x86_64-slc6-gcc62-opt/setup.sh" %(os.getenv("TestArea"))
+theOutput =  commands.getoutput(theCommand)
+print ' == ALIGNMENT PAPER == Rel21 init command: ',theCommand
+print '                output: ', theOutput
+###############################
+# enable outputs
+zmumuval = True
+jpsival=False
+upsilonval=False
+
+globalAlignmentMon = True #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+
+# use GRL
+useGRL = True
+
+# MC
+#MC_bool = False # Will be set automatically later when reading metadata of the file you are running over
+
+#do Trigger
+DoTrigger = False
+
+# where to run
+grid = True
+
+# handle input constants
+readPool = False
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
+
+# weight file for IDAlignment monitoring
+useWeightInMonitoring = False
+
+# use configuration for conditions (True) or autoconfigured (False)
+useConfigConditions = False
+
+# use IDAlignment dynamic folders for 2016 data
+useIDADynamicFolders = False
+
+print ' ========= ALIGNMENT PAPER === config == start == '
+print ' == runzmumu selection =', zmumuval
+print ' == run jpsi selection =', jpsival
+print ' == run upsilon selection =', upsilonval
+print ' == globalAlignmentMon = ', globalAlignmentMon
+print ' == useConfigConditions = ', useConfigConditions
+print ' == useWeightInMonitoring =', useWeightInMonitoring
+print ' == useIDADynamicFolders =', useIDADynamicFolders
+print 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
+print ' \n\n\n== gridMode =', grid, "\n\n\n"
+print 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
+print ' ========= ALIGNMENT PAPER === config == end == '
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+if grid == True:
+    #
+    # (SH) - When running on the grid, you need to choose a local file (either MC or data),
+    #        please let me know in case you find a better solution
+    #PoolInput = ["/data/sthenkel/work/Performance/Alignment/data16_13TeV.00306310.physics_Main.merge.AOD.r9264_p3083/AOD.11138483._002020.pool.root.1"]
+     PoolInput = ["/data/sthenkel/work/Performance/Alignment/mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.merge.AOD.e3601_s2576_s2132_r10005_r7676/AOD.12298370._000065.pool.root.1"]
+
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+
+EvtMax= -1 #
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+
+
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+#
+# Get information about the input file
+#(SH)
+from PyUtils import AthFile
+af = AthFile.fopen( athenaCommonFlags.FilesInput()[0] )
+camp = af.fileinfos['tag_info']['project_name']
+
+if "IS_DATA" in af.fileinfos['evt_type'][0]:
+    print "-- INFO :: user JO ----------------------------"
+    print "- You run on data -"
+    print "-----------------------------------------------"
+    MC_bool = False
+elif "IS_SIMULATION" in af.fileinfos['evt_type'][0]:
+    print "-- INFO :: user JO ----------------------------"
+    print "- You run on MC -"
+    print "-----------------------------------------------"
+    if [zmumuval, jpsival, upsilonval].count(True) > 1:
+        print '-- > EXIT :: you try to run on MC for more then one mumu resonance... choose one when running on MC!'
+        sys.exit()
+    MC_bool = True
+
+else:
+    print "ERROR :: Define what the evt type is! ... aborting, currently think it is : ", af.fileinfos['evt_type']
+    sys.exit()
+
+
+###############
+# GRL
+###############
+if useGRL and not "IS_SIMULATION" in camp:
+    print "-- INFO :: user JO ----------------------------"
+    print "- Enabling GRL for "+str(camp)+"-"
+    print "-----------------------------------------------"
+    if "15" in camp:
+        print "INFO (user JO) :: Importing 2015 GRL ------"
+        include("InDetPerformanceMonitoring/jobOptions_useGRL_2015.py")
+
+    if "16" in camp:
+        print "INFO (user JO) :: Importing 2016 GRL ------"
+        include("InDetPerformanceMonitoring/jobOptions_useGRL_2016.py")
+
+###############
+# END GRL
+###############
+
+from AthenaCommon.GlobalFlags import globalflags
+myConditionsTag = "auto-configured"
+if (useConfigConditions):
+    if not MC_bool: # --> real data
+        myConditionsTag = "CONDBR2-BLKPA-2016-21" # Hide 21/03/17
+        print " === ALIGNMENT PAPER -- globalflags.ConditionsTag -> manually configured to ", myConditionsTag
+        globalflags.ConditionsTag.set_Value_and_Lock(myConditionsTag)
+    #else:
+    #    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+else:
+    print " === ALIGNMENT PAPER -- globalflags.ConditionsTag -> auto configured "
+
+myDetDescr = "auto-configured"
+if (useConfigConditions):
+    myDetDescr = "ATLAS-R2-2015-04-00-00"
+    myDetDescr = "ATLAS-R2-2015-03-29-00" # Hide 21/03/17
+    print " === ALIGNMENT PAPER -- globalflags.DetDescrVersion -> manually configured to ", myDetDescr
+    globalflags.DetDescrVersion.set_Value_and_Lock(myDetDescr)#ATLAS-R2-2015-04-00-00  ATLAS-R2-2016-00-01-00
+else:
+    print " === ALIGNMENT PAPER -- globalflags.DetDescrVersion -> no user setting -> ", myDetDescr
+
+# Resetting the colored print out
+sys.stdout.write(RESET)
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+#use dynamic alignment
+from InDetRecExample.InDetJobProperties import InDetFlags
+InDetFlags.useDynamicAlignFolders.set_Value_and_Lock(useIDADynamicFolders)
+
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn() # Salva R21.0.8
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+#DetFlags.Tile_setOn() # Salva R21.0.8
+#DetFlags.LAr_setOn() # Salva R21.0.8
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+
+from IOVDbSvc.CondDB import conddb
+if (useIDADynamicFolders):
+    conddb.addOverride("/Indet/AlignL1/ID" ,"IndetAlignL1ID-Repro-Rel21-nonUPD-00")
+    conddb.addOverride("/Indet/AlignL2/PIX" ,"IndetAlignL2PIX-Repro-Rel21-nonUPD-00")
+    conddb.addOverride("/Indet/AlignL2/SCT" ,"IndetAlignL2SCT-Repro-Rel21-nonUPD-00")
+    conddb.addOverride("/Indet/AlignL3" ,"IndetAlignL3-Repro-Rel21-nonUPD-00")
+    conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-Repro-Rel21-nonUPD-00")
+    conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-Repro-Rel21-nonUPD-00")
+    conddb.addOverride("/TRT/AlignL2", "TRTAlignL2-Repro-Rel21-nonUPD-00")
+
+    conddb.addOverride("/Indet/Beampos", "IndetBeampos-Dec16-dataXX_13TevRepro2016-v0")
+
+
+blocked_folders = [
+     '/LAR/ElecCalibMC/AutoCorr',
+     ]
+for f in blocked_folders:
+    conddb.blockFolder (f)
+    sys.stdout.write(BLUE)
+    print " == ALIGNMENT PAPER == folder ",f," --> blocked "
+    sys.stdout.write(RESET)
+
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+
+
+if readPool :
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=INFO
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                               CutLevel = "Loose",
+                                                               minPt = 400
+#                                                                  maxD0overSigmaD0 = 1.5
+                                                                  )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                      CutLevel = "TightPrimary",
+                                                                      minPt = 400
+                                                             #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+#use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool, # If set to True, the truth parameters will be filled, have a look into FillTruthParameters
+                                    doRefit = False, #True for evaluation of new alignment constants / False for update of weak mode recommendations -- refits tracks according to provided conditions db and/or external root file containing alignment constants
+                                    doIPextrToPV = False, # True for IP resolution studies, extrapolates IP parameters to primary vertex
+                                    UseTrackSelectionTool = False, # If set to True, it will use the specified TrackSelectionTool in the next Line
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth", # Only filled if isMC is set to True
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",# Only filled if doRefit is set to True
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",# Only filled if doRefit is set to True
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    doIsoSelection = False,
+                                    doIPSelection = True,
+                                    MassWindowLow = 60.,
+                                    MassWindowHigh = 120.,
+                                    PtLeadingMuon = 15.0,
+                                    PtSecondMuon = 15.0,
+                                    OpeningAngle = .0, # in radians. 1 radian ~60 deg
+                                    OutputLevel= DEBUG)
+    job += iDPerfMonZmumu
+    print iDPerfMonZmumu
+
+if jpsival == True:
+    ServiceMgr.THistSvc.Output += ["JpsimumuValidationUserSel DATAFILE='JpsimumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonJPsi = IDPerfMonZmumu(name = 'IDPerfMonJPsi',
+                                       ReFitterTool1 = MuonRefitterTool,
+                                       ReFitterTool2 = MuonRefitterTool2,
+                                       OutputTracksName =  "SelectedMuons",
+                                       isMC = MC_bool,
+                                       doRefit = False,
+                                       doIPextrToPV = False,
+                                       UseTrackSelectionTool = False,
+                                       TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                       TrackParticleName = 'InnerDetectorTrackParticles',
+#                                       TrackParticleName= 'CombinedMuonTrackParticles'
+                                       defaultTreeFolder = "/JpsimumuValidationUserSel/default",
+                                       truthTreeFolder = "/JpsimumuValidationUserSel/truth",
+                                       refit1TreeFolder = "/JpsimumuValidationUserSel/refit1",
+                                       refit2TreeFolder = "/JpsimumuValidationUserSel/refit2",
+                                       combTreeFolder = "/JpsimumuValidationUserSel/comb",
+                                       doIsoSelection = False,
+                                       doIPSelection = True,
+                                       MassWindowLow = 1.0,
+                                       MassWindowHigh = 6.,
+                                       PtLeadingMuon = 1.0,
+                                       PtSecondMuon = 1.0,
+                                       OpeningAngle = .0,
+                                       OutputLevel= DEBUG)
+    job += iDPerfMonJPsi
+    print iDPerfMonJPsi
+
+if upsilonval == True:
+    ServiceMgr.THistSvc.Output += ["UpsilonmumuValidationUserSel DATAFILE='UpsilonmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonUpsilon = IDPerfMonZmumu(name = 'IDPerfMonUpsilon',
+                                       ReFitterTool1 = MuonRefitterTool,
+                                       ReFitterTool2 = MuonRefitterTool2,
+                                       OutputTracksName =  "SelectedMuons",
+                                       isMC = MC_bool,
+                                       doRefit = False,
+                                       doIPextrToPV = False,
+                                       UseTrackSelectionTool = False,
+                                       TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                       TrackParticleName = 'InnerDetectorTrackParticles',
+#                                       TrackParticleName= 'CombinedMuonTrackParticles'
+                                       defaultTreeFolder = "/UpsilonmumuValidationUserSel/default",
+                                       truthTreeFolder = "/UpsilonmumuValidationUserSel/truth",
+                                       refit1TreeFolder = "/UpsilonmumuValidationUserSel/refit1",
+                                       refit2TreeFolder = "/UpsilonmumuValidationUserSel/refit2",
+                                       combTreeFolder = "/UpsilonmumuValidationUserSel/comb",
+                                       doIsoSelection = False,
+                                       doIPSelection = True,
+                                       MassWindowLow = 6,
+                                       MassWindowHigh = 12.,
+                                       PtLeadingMuon = 5.0,
+                                       PtSecondMuon = 5.0,
+                                       OpeningAngle = .0,
+                                       OutputLevel= DEBUG)
+    job += iDPerfMonUpsilon
+    print iDPerfMonUpsilon
+
+
+
+
+
+
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                        resonName = "Zmumu",
+                        minInvmass = 10.,
+                        maxInvmass = 120.,
+                        nMassBins = 60,
+                        triggerChainName = "NoTrig",
+                        regions = ["All","BB","EAEA","ECEC"],
+                        varsVSmean = varsVSmeanZmumu,
+                        varsVSwidth = varsVSwidthZmumu,
+                        varsDistr = varsDistrZmumu,
+                        doFits = True,
+                        doSaveFits = False,
+    #                               setDebug = True,
+    OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+#    trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_DYNAMICALIGNMENT.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_DYNAMICALIGNMENT.py
new file mode 100644
index 0000000000000000000000000000000000000000..0a42219b80f1c4abac5a948b73b73131c0381543
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_DYNAMICALIGNMENT.py
@@ -0,0 +1,287 @@
+# enable outputs
+zmumuval = True
+globalAlignmentMon = False #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+
+# use GRL
+useGRL = False
+
+# MC
+MC_bool = False
+
+#do Trigger
+DoTrigger = False
+
+# where to run
+grid = False
+
+# run dynamic alignment
+dynamicAlign = True
+
+
+
+# handle input constants
+readPool = True
+inputConstants = "$TestArea/run_batch/2016_dynamicAlignment_reprocessing/constants_postTSI/Iter0_AlignmentConstants.root"
+
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+if grid == True:
+    PoolInput = ["/afs/cern.ch/work/o/oestrada/public/alignment2/Jpsi_20.7.3.8/20.7.3.8/JpsiNtuplesMC/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587._0004.1"]
+
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+
+EvtMax=-1
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL:
+  include("InDetPerformanceMonitoring/jobOptions_useGRL.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+if not MC_bool:
+    globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
+else:
+    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+
+#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
+globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-03-29-00")
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+
+###
+### Prepare to call DYNAMIC Alignment structure
+###
+if(dynamicAlign):
+    from InDetRecExample.InDetJobProperties import InDetFlags
+    InDetFlags.useDynamicAlignFolders.set_Value_and_Lock(True)
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+from IOVDbSvc.CondDB import conddb
+
+if not MC_bool and dynamicAlign:
+    conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID-RUN2-ReproPrep-UPD3-00")
+    conddb.addOverride("/Indet/AlignL2/PIX","IndetAlignL2PIX-RUN2-ReproPrep-UPD3-00")
+    conddb.addOverride("/Indet/AlignL2/SCT","IndetAlignL2SCT-RUN2-ReproPrep-UPD3-00")
+    conddb.addOverride("/Indet/AlignL3","InDetAlign_R2dynamic_Post_TS1_newGeo_Initial")
+    conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-RUN2-ReproPrep-UPD3-00")
+    conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-RUN2-ReproPrep-UPD3-00")
+    conddb.addOverride("/TRT/AlignL2", "TRTAlign_R2dynamic_Post_TS1_newGeo_Initial")
+
+
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+
+
+if readPool:
+    # for old setup
+    conddb.blockFolder("/Indet/Align")
+#Si only    conddb.blockFolder("/TRT/Align")
+    # for dynamic setup
+    conddb.blockFolder("/Indet/AlignL3")
+##Si only    conddb.blockFolder("/TRT/AlignL2")
+    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+    from AthenaCommon.AppMgr import ServiceMgr
+    ServiceMgr += CondProxyProvider()
+    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+    ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+    ServiceMgr.CondProxyProvider.OutputLevel=INFO
+    print ServiceMgr.CondProxyProvider
+    # this preload causes callbacks for read in objects to be activated,
+    # allowing GeoModel to pick up the transforms
+    ServiceMgr.IOVSvc.preLoadData=True
+    ServiceMgr.IOVSvc.OutputLevel=INFO
+
+
+
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                           CutLevel = "Loose",
+                                                           minPt = 400
+                                                           #                                                                  maxD0overSigmaD0 = 1.5
+                                                           )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt = 400
+                                                                  #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+
+    #    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+#use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool, # If set to True, the truth parameters will be filled, have a look into FillTruthParameters
+                                    doRefit = False, #True for evaluation of new alignment constants / False for update of weak mode recommendations -- refits tracks according to provided conditions db and/or external root file containing alignment constants
+                                    doIPextrToPV = False, # True for IP resolution studies, extrapolates IP parameters to primary vertex
+                                    UseTrackSelectionTool = True,
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles',
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
+                                    doIsoSelection = False,
+                                    doIPSelection = True,
+                                    #loose selection to have Z and JPsi in the n tuple
+                                    MassWindowLow = 1.,
+                                    MassWindowHigh = 120.,
+                                    PtLeadingMuon = 1.0,
+                                    OpeningAngle = 0.001,
+                                    OutputLevel=INFO)
+    job += iDPerfMonZmumu
+
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                        resonName = "Zmumu",
+                        minInvmass = 10.,
+                        maxInvmass = 120.,
+                        nMassBins = 60,
+                        triggerChainName = "NoTrig",
+                        regions = ["All","BB","EAEA","ECEC"],
+                        varsVSmean = varsVSmeanZmumu,
+                        varsVSwidth = varsVSwidthZmumu,
+                        varsDistr = varsDistrZmumu,
+                        doFits = True,
+                        doSaveFits = False,
+    #                               setDebug = True,
+    OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+#    trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_IP.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_IP.py
new file mode 100644
index 0000000000000000000000000000000000000000..857203bba2058b6fbf56e2958f8d5d94d66b264c
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_IP.py
@@ -0,0 +1,281 @@
+
+# enable outputs
+zmumuval = True
+globalAlignmentMon = True #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+
+# use GRL
+useGRL = False
+
+# MC
+MC_bool = False
+
+#do Trigger
+DoTrigger = False
+
+# where to run
+grid = False
+
+# handle input constants
+readPool = False
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
+
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+if grid == True:
+    #PoolInput = ["/afs/cern.ch/work/o/oestrada/public/alignment2/Jpsi_20.7.3.8/20.7.3.8/JpsiNtuplesMC/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587._0004.1"]
+    PoolInput = ["/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s2832_r8014/ESD.09385287._001000.pool.root.1"]
+    #PoolInput = ["/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data16_13TeV/Run00300800_preTS1_Rel21/DESDM_ZMUMU.10722146._000001.pool.root.1"]
+    #PoolInput = ["/afs/cern.ch/user/o/oestrada/eos/atlas/user/o/oestrada/mc15_13TeV.424100.Pythia8B_A14_CTEQ6L1_Jpsimu4mu4.merge.AOD.e3735_s2726_r7326_r6282/AOD.07103156._000849.pool.root.1"]
+
+    # include patch to resolve issue with xrootd in 20.7.7+ releases, Thanks Will diClemente for following up this -- https://its.cern.ch/jira/browse/ATEAM-340
+    #include("InDetPerformanceMonitoring/xrootd-patch.py")
+
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+
+EvtMax= 100 # -1
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL:
+  include("InDetPerformanceMonitoring/jobOptions_useGRL.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+if (False):
+    if not MC_bool:
+        print " -- salva -- globalflags.ConditionsTag -> manually configured "
+        globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-21")
+    #else:
+    #    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+else:
+    print " -- salva -- globalflags.ConditionsTag -> auto configured "
+
+myDetDescr = "auto-configured"
+if (False):
+    myDetDescr = "ATLAS-R2-2015-04-00-00"
+    print " -- salva -- globalflags.DetDescrVersion -> manually configured to ", myDetDescr
+    globalflags.DetDescrVersion.set_Value_and_Lock(myDetDescr)#ATLAS-R2-2015-04-00-00  ATLAS-R2-2016-00-01-00
+else:
+    print " -- salva -- globalflags.DetDescrVersion -> no user setting -> ", myDetDescr
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+#use dynamic alignment
+from InDetRecExample.InDetJobProperties import InDetFlags
+InDetFlags.useDynamicAlignFolders.set_Value_and_Lock(False)
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+
+from IOVDbSvc.CondDB import conddb
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+
+
+if readPool :
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=INFO
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                           CutLevel = "Loose",
+                                                           minPt = 400
+#                                                                  maxD0overSigmaD0 = 1.5
+                                                                  )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt = 400
+                                                             #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+
+#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+#use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool, # If set to True, the truth parameters will be filled, have a look into FillTruthParameters
+                                    doRefit = False, #True for evaluation of new alignment constants / False for update of weak mode recommendations -- refits tracks according to provided conditions db and/or external root file containing alignment constants
+                                    doIPextrToPV = False, # True for IP resolution studies, extrapolates IP parameters to primary vertex
+                                    UseTrackSelectionTool = False, # If set to True, it will use the specified TrackSelectionTool in the next Line
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth", # Only filled if isMC is set to True
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",# Only filled if doRefit is set to True
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",# Only filled if doRefit is set to True
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    doIsoSelection = False,
+                                    doIPSelection = True,
+                                    #loose selection to have Z and JPsi in the n tuple
+                                    MassWindowLow = 60.,
+                                    MassWindowHigh = 120.,
+                                    PtLeadingMuon = 15.0,
+                                    PtSecondMuon = 15.0,
+                                    OpeningAngle = 1.00, # in radians. 1 radian ~60 deg
+                                    OutputLevel= DEBUG)
+    job += iDPerfMonZmumu
+    print iDPerfMonZmumu
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                        resonName = "Zmumu",
+                        minInvmass = 10.,
+                        maxInvmass = 120.,
+                        nMassBins = 60,
+                        triggerChainName = "NoTrig",
+                        regions = ["All","BB","EAEA","ECEC"],
+                        varsVSmean = varsVSmeanZmumu,
+                        varsVSwidth = varsVSwidthZmumu,
+                        varsDistr = varsDistrZmumu,
+                        doFits = True,
+                        doSaveFits = False,
+    #                               setDebug = True,
+    OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+#    trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py
new file mode 100644
index 0000000000000000000000000000000000000000..9c87fc183489dee7646db40d8123a5ef287ead4b
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py
@@ -0,0 +1,391 @@
+##############################
+# Rel 21
+###############################
+import commands
+import os
+#
+print ' == runzmumu == START == TestArea = ',os.getenv("TestArea")
+print ' == runzmumu  == CHECK if the TestArea is setup such that the setup.sh is sourced '
+theCommand = "source %s/build/x86_64-slc6-gcc62-opt/setup.sh" %(os.getenv("TestArea"))
+theOutput =  commands.getoutput(theCommand)
+print ' == runzmumu == Rel21 init command: ',theCommand
+print '                output: ', theOutput
+#
+WorkDir_PLATFORM = "x86_64-slc6-gcc62-opt"
+Athena_VERSION = "21.0.68"
+try:
+    WorkDir_PLATFORM= os.getenv("WorkDir_PLATFORM")
+except:
+    WorkDir_PLATFORM = "x86_64-slc6-gcc62-opt"
+try:
+    Athena_VERSION = os.getenv("Athena_VERSION")
+except:
+    Athena_VERSION = "21.0.68"
+###############################
+# enable outputs
+zmumuval = True
+globalAlignmentMon = True #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+monitoringAllTracks = True
+
+# use GRL
+useGRL = False
+
+# MC
+MC_bool = False
+
+# do Trigger
+DoTrigger = False
+
+# where to run
+grid = True
+
+# handle input constants
+readPool = True
+readLocalDynamicDB = True
+
+inputConstants = "step7_Iter1_AlignmentConstants.root"
+inputdb = "step7_Iter1_mycool.db"
+#inputConstants = "MisalignmentSet11_p01.pool.root"
+#inputConstants = "AlignmentConstants_Galo_2018BaseLine.root"
+if (readPool):
+    print " readPool = True file: %s" %(inputConstants)
+    import socket
+    print(" Using host: %s" %socket.gethostname())
+    if ("lxplus" not in socket.gethostname()):
+        inputConstants = "usr/WorkDir/%s/InstallArea/%s/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/%s" % (Athena_VERSION, WorkDir_PLATFORM, inputConstants)
+        inputdb = "usr/WorkDir/%s/InstallArea/%s/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/%s" % (Athena_VERSION, WorkDir_PLATFORM, inputdb)
+
+# weight file for IDAlignment monitoring
+useWeightInMonitoring = False
+
+# use configuration for conditions (True) or autoconfigured (False)
+useConfigConditions = False
+
+# use IDAlignment dynamic folders for 2016 data
+useIDADynamicFolders = True
+if (MC_bool): useIDADynamicFolders = False # dynamic folders must be disabled in MC
+
+print ' ========= runzmumu === config == start == '
+print ' == MC_bool =', MC_bool
+print ' == globalAlignmentMon = ', globalAlignmentMon
+print ' == useConfigConditions = ', useConfigConditions
+print ' == useWeightInMonitoring =', useWeightInMonitoring
+print ' == useIDADynamicFolders =', useIDADynamicFolders
+print ' == useGRL =', useGRL
+print ' == grid =',grid
+print ' == readPool =',readPool
+if (readPool): 
+    print ' == inputConstants =',inputConstants
+print ' == readLocalDynamicDB =',readLocalDynamicDB
+if (readLocalDynamicDB):
+    print ' == inputdb =',inputdb
+print ' ========= runzmumu === config == end == '
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+if grid == True:
+    #PoolInput = [ "/afs/cern.ch/work/w/wollrath/private/IDAlignment/inputFiles/data16_13TeV/AOD.11063137._018527.pool.root.1" ]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1"]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data15_5TeV/DESDM_ZMUMU.11207033._000001.pool.root.1"]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_ZMUMU/data18_13TeV.00348354.physics_Main.merge.DESDM_ZMUMU.f920_m1831_f920_m1951._0001.1"]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00349977.physics_Main.merge.DESDM_MCP.f933_m1964._0027.1"]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0027.1",
+    #              "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0028.1",
+    #              "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0029.1"]
+    PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0027.1",
+                  "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0127.1"]
+else:
+    #PoolInput = [ "/home/jw1095/storage/IDAlignment/inputFiles/data17_13TeV/data17_13TeV.00327265.physics_Main.merge.DESDM_ZMUMU.f832_m1616_f832_m1816._0518.1" ]
+    if (MC_bool): 
+        PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1"
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001884.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001883.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001300.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001200.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001100.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001101.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001000.pool.root.1"]
+    else:
+        PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data16_13TeV/data16_13TeV.00303338.physics_Main.merge.DESDM_MCP.f716_m1624._0001.1"]
+
+EvtMax= -1
+#EvtMax= 100
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL:
+  include("InDetPerformanceMonitoring/jobOptions_useGRL.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput = PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+myConditionsTag = "auto-configured"
+if (useConfigConditions):
+    if not MC_bool: # --> real data 
+        #myConditionsTag = "CONDBR2-BLKPA-2016-21" # Hide 21/03/17 
+        myConditionsTag = "CONDBR2-BLKPA-2018-07" 
+        print " == runzmumu == globalflags.ConditionsTag -> manually configured to ", myConditionsTag
+        globalflags.ConditionsTag.set_Value_and_Lock(myConditionsTag)
+    #else:
+    #    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+else: 
+    print " == runzmumu == globalflags.ConditionsTag -> auto configured "
+
+myDetDescr = "auto-configured"
+if (useConfigConditions):
+    myDetDescr = "ATLAS-R2-2016-01-00-01"
+    print " == runzmumu == globalflags.DetDescrVersion -> manually configured to ", myDetDescr
+    globalflags.DetDescrVersion.set_Value_and_Lock(myDetDescr)#ATLAS-R2-2015-04-00-00  ATLAS-R2-2016-00-01-00
+else:
+    print " == runzmumu == globalflags.DetDescrVersion -> no user setting -> ", myDetDescr
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+#use dynamic alignment 
+from InDetRecExample.InDetJobProperties import InDetFlags 
+InDetFlags.useDynamicAlignFolders.set_Value_and_Lock(useIDADynamicFolders)
+
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+
+
+from IOVDbSvc.CondDB import conddb
+if (useIDADynamicFolders):
+    if (False):
+        print (" == runzmumu == configuring data17_1stBatch_Initial family ") 
+        conddb.addOverride("/Indet/AlignL1/ID" ,"InDetAlignL1_ID_R2dynamic_data17_1stBatch_Initial")
+        conddb.addOverride("/Indet/AlignL2/PIX" ,"InDetAlignL2PIX_R2dynamic_data17_1stBatch_Initial")
+        conddb.addOverride("/Indet/AlignL2/SCT" ,"InDetAlignL2SCT_R2dynamic_data17_1stBatch_Initial")
+        conddb.addOverride("/Indet/AlignL3" ,"InDetAlignL3_R2dynamic_data17_1stBatch_Initial")
+        conddb.addOverride("/Indet/IBLDist", "InDetAlignIBLDist_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1_R2dynamic_data17_1stBatch_Initial")
+        conddb.addOverride("/TRT/AlignL2", "TRTAlignL2_R2dynamic_data17_1stBatch_Initial")
+    if (True):
+        if readPool :
+            conddb.blockFolder("/Indet/AlignL3")
+            conddb.blockFolder("/TRT/AlignL2")
+
+        if readLocalDynamicDB :
+            conddb.blockFolder("/Indet/AlignL1/ID")
+            conddb.blockFolder("/Indet/AlignL2/PIX")
+            conddb.blockFolder("/Indet/AlignL2/SCT")
+            conddb.blockFolder("/TRT/AlignL1/TRT")
+            conddb.blockFolder("/Indet/IBLDist")
+
+            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/AlignL1/ID','IndetL1Test',True);
+            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/AlignL2/PIX','IndetL2PIXTest',True);
+            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/AlignL2/SCT','IndetL2SCTTest',True);
+            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/TRT/AlignL1/TRT','IndetL1TRTTest',True);
+            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/IBLDist','IndetIBLDist',True); 
+##
+
+
+blocked_folders = [
+     '/LAR/ElecCalibMC/AutoCorr',
+     ]
+for f in blocked_folders:
+    conddb.blockFolder (f)
+    print " == runzmumu == folder ",f," --> blocked "
+
+
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+    print " == runzmumu == inputConstants in dir() == ", inputConstants
+
+if readPool:
+    if (MC_bool):
+        conddb.blockFolder("/Indet/Align")
+        conddb.blockFolder("/TRT/Align")
+
+    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+    from AthenaCommon.AppMgr import ServiceMgr
+    ServiceMgr += CondProxyProvider()
+    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+    # set this to the file containing AlignableTransform objects
+    ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+    ServiceMgr.CondProxyProvider.OutputLevel=INFO
+    print ServiceMgr.CondProxyProvider
+    # this preload causes callbacks for read in objects to be activated,
+    # allowing GeoModel to pick up the transforms
+    ServiceMgr.IOVSvc.preLoadData=True
+    ServiceMgr.IOVSvc.OutputLevel=INFO
+    
+include("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name     = "InDetTrackSelectorLoose",
+                                                           CutLevel = "Loose",
+                                                           minPt    = 400)
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name     = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt    = 400)
+ToolSvc += m_TrackSelectorTool_TightPrimary
+print m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+if zmumuval == True:
+    include("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+    #use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool, # If set to True, the truth parameters will be filled, have a look into FillTruthParameters
+                                    doRefit = True, #True for evaluation of new alignment constants / False for update of weak mode recommendations -- refits tracks according to provided conditions db and/or external root file containing alignment constants
+                                    doIPextrToPV = False, # True for IP resolution studies, extrapolates IP parameters to primary vertex
+                                    UseTrackSelectionTool = False, # If set to True, it will use the specified TrackSelectionTool in the next Line
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth", # Only filled if isMC is set to True
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",# Only filled if doRefit is set to True
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",# Only filled if doRefit is set to True
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    doIsoSelection = True,
+                                    doIPSelection = True,
+                                    #loose selection to have Z and JPsi in the n tuple
+                                    MassWindowLow = 50.,
+                                    MassWindowHigh = 140.,
+                                    PtLeadingMuon = 15.,
+                                    PtSecondMuon = 15.,
+                                    OpeningAngle = 0.01, # in radians. 1 radian ~60 deg
+                                    OutputLevel = INFO)
+    job += iDPerfMonZmumu
+    print iDPerfMonZmumu
+    
+    ##### run dimuon monitoring
+    if (dimuonmon):
+        from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+        
+        
+        varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+        varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+        varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+        
+        ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                            resonName = "Zmumu",
+                            minInvmass = 10.,
+                            maxInvmass = 120.,
+                            nMassBins = 60,
+                            triggerChainName = "NoTrig",
+                            regions = ["All","BB","EAEA","ECEC"],
+                            varsVSmean = varsVSmeanZmumu,
+                            varsVSwidth = varsVSwidthZmumu,
+                            varsDistr = varsDistrZmumu,
+                            doFits = True,
+                            doSaveFits = False,
+                            #setDebug = True,
+                            OutputLevel = DEBUG)
+        ToolSvc += ZmumuMon
+    
+    # continue
+        from AthenaMonitoring.DQMonFlags import DQMonFlags
+        from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+        IDPerfMonManager = AthenaMonManager(name            = "IDPerfMonManager",
+                                            FileKey             = DQMonFlags.monManFileKey(),
+                                            ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                            DataType            = DQMonFlags.monManDataType(),
+                                            Environment         = "user",
+                                            ManualRunLBSetup    = True,
+                                            Run                 = 1,
+                                            LumiBlock           = 1)
+        IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+        ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+        IDPerfMonManager.FileKey = "DiMuMon"
+    
+        topSequence += IDPerfMonManager
+    
+### add CombinedInDetTracks (can be used for monitoring purposes) ###
+if (monitoringAllTracks):
+    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__TrackCollectionProvider
+    trackCollectionProvider=Trk__TrackCollectionProvider("TrackCollectionProvider",
+                                                         OutputLevel = DEBUG,
+                                                         InputTrkCol = "CombinedInDetTracks")
+    print " == runzmumu_script == track collection provider -- "
+    print trackCollectionProvider
+    ToolSvc += trackCollectionProvider
+
+#### run global alignment monitoring
+if (zmumuval and globalAlignmentMon):
+    trackCollections = ["SelectedMuonsRefit1", "SelectedMuonsRefit2", "Tracks"]
+    if (monitoringAllTracks): trackCollections.append("CombinedInDetTracks")
+#   trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False # True in case of debug ** WARNING ** very large output
+    include("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_maps.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_maps.py
new file mode 100644
index 0000000000000000000000000000000000000000..c610ab3e25771543f29858f31c677704a2759a89
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_maps.py
@@ -0,0 +1,251 @@
+# enable outputs
+zmumuval = True
+globalAlignmentMon = False
+dimuonmon = False
+
+#is MC or not
+MC_bool = False
+
+# use GRL
+useGRL = False
+
+# where to run
+grid = False
+
+
+# handle input constants
+readPool = False
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.roo"
+
+
+
+
+if grid == True:
+#    PoolInput = ["root://eosatlas//eos/atlas/user/s/sthenkel/Alignment/data/data15_13TeV.00281411.physics_Main.recon.DESDM_ZMUMU.r7562_r7562/DESDM_ZMUMU.07688582._000001.pool.root.1"]
+#    PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/Alignment/data/data15_13TeV.00281411.physics_Main.recon.DESDM_ZMUMU.r7562_r7562/DESDM_ZMUMU.07688582._000001.pool.root.1"]
+    PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/Alignment/2016_data/data16_13TeV.00308084.physics_Main.merge.DESDM_ZMUMU.f741_m1616_f741_m1677/data16_13TeV.00308084.physics_Main.merge.DESDM_ZMUMU.f741_m1616_f741_m1677._0149.1"]
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+EvtMax=100
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL:
+  include("InDetPerformanceMonitoring/jobOptions_useGRL.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+#if not MC_bool:
+globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
+#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-03-01-00")
+globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+from IOVDbSvc.CondDB import conddb
+inputCollections = [inputConstants]
+#conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-25NS')
+#conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-25NS')
+#if not MC_bool:
+#    conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-REPRO25NS')
+#    conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-REPRO25NS')
+
+if readPool :
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                          CutLevel = "Loose",
+                                                        minPt = 400
+#                                                                  maxD0overSigmaD0 = 1.5
+                                                                  )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt = 400
+                                                             #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+    #use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool,
+                                    doRefit = True,
+                                    UseTrackSelectionTool = False,
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
+                                    doIsoSelection = True,
+                                    #Change to 70 GeV since the Zmumu MC derivations use this cut
+                                    MassWindowLow = 70.,
+                                    MassWindowHigh = 100.,
+                                    PtLeadingMuon = 20.,
+                                    PtSecondMuon = 25.,
+                                    OutputLevel= INFO)
+    job += iDPerfMonZmumu
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                               resonName = "Zmumu",
+                               minInvmass = 60.,
+                               maxInvmass = 120.,
+                               nMassBins = 60,
+                               triggerChainName = "NoTrig",
+                               regions = ["All","BB","EAEA","ECEC"],
+                               varsVSmean = varsVSmeanZmumu,
+                               varsVSwidth = varsVSwidthZmumu,
+                               varsDistr = varsDistrZmumu,
+                               doFits = True,
+                               doSaveFits = False,
+#                               setDebug = True,
+                               OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_maps_grid.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_maps_grid.py
new file mode 100644
index 0000000000000000000000000000000000000000..24a98315a2feca9665d1e9c7440ecfab5564506a
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_maps_grid.py
@@ -0,0 +1,250 @@
+# enable outputs
+zmumuval = True
+globalAlignmentMon = False
+dimuonmon = False
+
+#is MC or not
+MC_bool = False
+
+# use GRL
+useGRL = False
+
+# where to run
+grid = True
+
+
+# handle input constants
+readPool = False
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.roo"
+
+
+
+
+if grid == True:
+#    PoolInput = ["root://eosatlas//eos/atlas/user/s/sthenkel/Alignment/data/data15_13TeV.00281411.physics_Main.recon.DESDM_ZMUMU.r7562_r7562/DESDM_ZMUMU.07688582._000001.pool.root.1"]
+#    PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/Alignment/data/data15_13TeV.00281411.physics_Main.recon.DESDM_ZMUMU.r7562_r7562/DESDM_ZMUMU.07688582._000001.pool.root.1"]
+    PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/Alignment/2016_data/data16_13TeV.00308084.physics_Main.merge.DESDM_ZMUMU.f741_m1616_f741_m1677/data16_13TeV.00308084.physics_Main.merge.DESDM_ZMUMU.f741_m1616_f741_m1677._0149.1"]
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+EvtMax=-1
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL:
+  include("InDetPerformanceMonitoring/jobOptions_useGRL.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+#if not MC_bool:
+globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
+globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(False)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+from IOVDbSvc.CondDB import conddb
+inputCollections = [inputConstants]
+#conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-25NS')
+#conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-25NS')
+#if not MC_bool:
+#    conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-REPRO25NS')
+#    conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-REPRO25NS')
+
+if readPool :
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                          CutLevel = "Loose",
+                                                        minPt = 400
+#                                                                  maxD0overSigmaD0 = 1.5
+                                                                  )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt = 400
+                                                             #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+    #use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool,
+                                    doRefit = False,
+                                    UseTrackSelectionTool = False,
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
+                                    doIsoSelection = True,
+                                    #Change to 70 GeV since the Zmumu MC derivations use this cut
+                                    MassWindowLow = 70.,
+                                    MassWindowHigh = 100.,
+                                    PtLeadingMuon = 20.,
+                                    PtSecondMuon = 25.,
+                                    OutputLevel= INFO)
+    job += iDPerfMonZmumu
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                               resonName = "Zmumu",
+                               minInvmass = 60.,
+                               maxInvmass = 120.,
+                               nMassBins = 60,
+                               triggerChainName = "NoTrig",
+                               regions = ["All","BB","EAEA","ECEC"],
+                               varsVSmean = varsVSmeanZmumu,
+                               varsVSwidth = varsVSwidthZmumu,
+                               varsDistr = varsDistrZmumu,
+                               doFits = True,
+                               doSaveFits = False,
+#                               setDebug = True,
+                               OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations.py
new file mode 100644
index 0000000000000000000000000000000000000000..d250325deba0c70b40e7915845b2abb4834e88a7
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations.py
@@ -0,0 +1,279 @@
+# enable outputs
+zmumuval = True
+globalAlignmentMon = False #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+
+# use GRL
+useGRL = False
+
+# MC
+MC_bool = False
+
+#do Trigger
+DoTrigger = False
+
+# where to run
+grid = False
+
+# handle input constants
+readPool = False
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
+
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+if grid == True:
+    PoolInput = ["/afs/cern.ch/work/o/oestrada/public/alignment2/Jpsi_20.7.3.8/20.7.3.8/JpsiNtuplesMC/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587._0004.1"]
+
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+
+
+EvtMax=-1
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+#
+# Get information about the input file
+#(SH)
+from PyUtils import AthFile
+af = AthFile.fopen( athenaCommonFlags.FilesInput()[0] )
+camp = af.fileinfos['tag_info']['project_name']
+print af.fileinfos['tag_info']
+###############
+# GRL
+###############
+if useGRL:
+    print "-- INFO :: user JO ----------------------------"
+    print "- Enabling GRL for "+str(camp)+"-"
+    print "-----------------------------------------------"
+    if "15" in camp:
+        include("InDetPerformanceMonitoring/jobOptions_useGRL_2015.py")
+
+    if "16" in camp:
+        include("InDetPerformanceMonitoring/jobOptions_useGRL_2016.py")
+
+
+
+
+
+
+
+from AthenaCommon.GlobalFlags import globalflags
+if not MC_bool:
+    globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
+else:
+    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+
+#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+
+from IOVDbSvc.CondDB import conddb
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+
+
+if readPool :
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=INFO
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                          CutLevel = "Loose",
+                                                        minPt = 400
+#                                                                  maxD0overSigmaD0 = 1.5
+                                                                  )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt = 400
+                                                             #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+
+#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+#use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool,
+                                    doRefit = False,
+                                    UseTrackSelectionTool = True,
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles',
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
+                                    doIsoSelection = False,
+                                    doIPSelection = True,
+                                    #loose selection to have Z and JPsi in the n tuple
+                                    MassWindowLow = 1.,
+                                    MassWindowHigh = 120.,
+                                    PtLeadingMuon = 1.0,
+                                    OpeningAngle = 0.001,
+                                    OutputLevel= DEBUG)
+    job += iDPerfMonZmumu
+
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                        resonName = "Zmumu",
+                        minInvmass = 10.,
+                        maxInvmass = 120.,
+                        nMassBins = 60,
+                        triggerChainName = "NoTrig",
+                        regions = ["All","BB","EAEA","ECEC"],
+                        varsVSmean = varsVSmeanZmumu,
+                        varsVSwidth = varsVSwidthZmumu,
+                        varsDistr = varsDistrZmumu,
+                        doFits = True,
+                        doSaveFits = False,
+    #                               setDebug = True,
+    OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+#    trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations_grid.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations_grid.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c64d189b37a14ba88cc3e508ff536b80acdcdef
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations_grid.py
@@ -0,0 +1,264 @@
+# enable outputs
+zmumuval = True
+globalAlignmentMon = False #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+
+# use GRL
+useGRL = True
+d2015 = False
+d2016 = True
+
+# MC
+MC_bool = False
+
+#do Trigger
+DoTrigger = False
+
+# where to run
+grid =True
+
+# handle input constants
+readPool = False
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
+
+if grid == True:
+    PoolInput = ["/data/sthenkel/work/Performance/Alignment/data16_13TeV.00297730.physics_Main.merge.DESDM_MCP.r9264_p3082_p3082/DESDM_MCP.11056398._000011.pool.root.1"]
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+
+elif 'inputFiles' in dir():
+    print inputFiles
+    PoolInput = inputFiles
+else:
+    print 'WARNING: No inputfiles specified'
+
+#    print inputFiles
+#PoolInput = inputFiles
+# number of event to process
+
+EvtMax=-1
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL and d2015:
+      include("InDetPerformanceMonitoring/jobOptions_useGRL_2015.py")
+if useGRL and d2016:
+      include("InDetPerformanceMonitoring/jobOptions_useGRL_2016.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput=PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+
+#if not MC_bool:
+#    globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
+#else:
+#    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+
+#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include ("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+#DetFlags.Calo_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+#DetFlags.Tile_setOff()
+
+#DetFlags.makeRIO.Calo_setOff()
+#DetFlags.detdescr.Calo_setOn()
+
+
+
+from IOVDbSvc.CondDB import conddb
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+
+
+if readPool :
+  conddb.blockFolder("/Indet/Align")
+  conddb.blockFolder("/TRT/Align")
+  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+  from AthenaCommon.AppMgr import ServiceMgr
+  ServiceMgr += CondProxyProvider()
+  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+  # set this to the file containing AlignableTransform objects
+  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+  ServiceMgr.CondProxyProvider.OutputLevel=INFO
+  print ServiceMgr.CondProxyProvider
+  # this preload causes callbacks for read in objects to be activated,
+  # allowing GeoModel to pick up the transforms
+  ServiceMgr.IOVSvc.preLoadData=True
+  ServiceMgr.IOVSvc.OutputLevel=INFO
+
+include ("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
+                                                          CutLevel = "Loose",
+                                                        minPt = 400
+#                                                                  maxD0overSigmaD0 = 1.5
+                                                                  )
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt = 400
+                                                             #     maxD0overSigmaD0 = 1.5,
+
+                                                                  )
+ToolSvc += m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+
+if zmumuval == True:
+
+#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+#use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool,
+                                    doRefit = False,
+                                    UseTrackSelectionTool = True,
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles',
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
+                                    doIsoSelection = False,
+                                    doIPSelection = True,
+                                    #loose selection to have Z and JPsi in the n tuple
+                                    MassWindowLow = 1.,
+                                    MassWindowHigh = 120.,
+                                    PtLeadingMuon = 1.0,
+                                    OpeningAngle = 0.001,
+                                    OutputLevel= DEBUG)
+    job += iDPerfMonZmumu
+
+
+##### run dimuon monitoring
+if dimuonmon == True:
+    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+
+
+    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+
+    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                        resonName = "Zmumu",
+                        minInvmass = 10.,
+                        maxInvmass = 120.,
+                        nMassBins = 60,
+                        triggerChainName = "NoTrig",
+                        regions = ["All","BB","EAEA","ECEC"],
+                        varsVSmean = varsVSmeanZmumu,
+                        varsVSwidth = varsVSwidthZmumu,
+                        varsDistr = varsDistrZmumu,
+                        doFits = True,
+                        doSaveFits = False,
+    #                               setDebug = True,
+    OutputLevel = INFO)
+    ToolSvc += ZmumuMon
+
+    from AthenaMonitoring.DQMonFlags import DQMonFlags
+    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
+                                    FileKey             = DQMonFlags.monManFileKey(),
+                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                    DataType            = DQMonFlags.monManDataType(),
+                                    Environment         = "user",
+                                    ManualRunLBSetup    = True,
+                                    Run                 = 1,
+                                    LumiBlock           = 1)
+    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+    IDPerfMonManager.FileKey = "DiMuMon"
+
+    topSequence += IDPerfMonManager
+
+#### run global alignment monitoring
+
+if zmumuval == True and globalAlignmentMon == True:
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+#    trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False
+    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_run2paper.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_run2paper.py
new file mode 100644
index 0000000000000000000000000000000000000000..1c059574ea827a44166ab7c9692d3fec08979f37
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_run2paper.py
@@ -0,0 +1,351 @@
+##############################
+# Rel 21
+###############################
+import commands
+import os
+#
+print ' == run2paper == START == TestArea = ',os.getenv("TestArea")
+print ' == run2paper  == CHECK if the TestArea is setup such that the setup.sh is sourced '
+theCommand = "source %s/build/x86_64-slc6-gcc62-opt/setup.sh" %(os.getenv("TestArea"))
+theOutput =  commands.getoutput(theCommand)
+print ' == run2paper == Rel21 init command: ',theCommand
+print '                output: ', theOutput
+###############################
+# enable outputs
+zmumuval = True
+globalAlignmentMon = True #no refitting for extracting the recommendations, only bulk as it comes out
+dimuonmon = False
+monitoringAllTracks = True
+
+# use GRL
+useGRL = False
+
+# MC
+MC_bool = False
+
+# do Trigger
+DoTrigger = False
+
+# where to run
+grid = True
+
+# handle input constants
+readPool = False
+#inputConstants = "MisalignmentSet11_p01.pool.root"
+inputConstants = "AlignmentConstants_Galo_2018BaseLine.root"
+if (readPool):
+    inputConstants = "usr/WorkDir/21.0.69/InstallArea/x86_64-slc6-gcc62-opt/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/%s" % inputConstants
+    #inputConstants = "%s" % inputConstants
+
+# weight file for IDAlignment monitoring
+useWeightInMonitoring = False
+
+# use configuration for conditions (True) or autoconfigured (False)
+useConfigConditions = False
+
+# use IDAlignment dynamic folders for 2016 data
+useIDADynamicFolders = True
+if (MC_bool): useIDADynamicFolders = False # dynamic folders must be disabled in MC
+
+print ' ========= runzmumu === config == start == '
+print ' == MC_bool =', MC_bool
+print ' == globalAlignmentMon = ', globalAlignmentMon
+print ' == useConfigConditions = ', useConfigConditions
+print ' == useWeightInMonitoring =', useWeightInMonitoring
+print ' == useIDADynamicFolders =', useIDADynamicFolders
+print ' == useGRL =', useGRL
+print ' == grid =',grid
+print ' == readPool =',readPool
+if (readPool): print ' == inputConstants =',inputConstants
+print ' ========= runzmumu === config == end == '
+
+#include("InDetSimpleVisual/GetDetectorPositions.py")
+
+if grid == True:
+    #PoolInput = [ "/afs/cern.ch/work/w/wollrath/private/IDAlignment/inputFiles/data16_13TeV/AOD.11063137._018527.pool.root.1" ]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1"]
+    #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data15_5TeV/DESDM_ZMUMU.11207033._000001.pool.root.1"]
+    PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_ZMUMU/data18_13TeV.00348354.physics_Main.merge.DESDM_ZMUMU.f920_m1831_f920_m1951._0001.1"]
+else:
+    #PoolInput = [ "/home/jw1095/storage/IDAlignment/inputFiles/data17_13TeV/data17_13TeV.00327265.physics_Main.merge.DESDM_ZMUMU.f832_m1616_f832_m1816._0518.1" ]
+    if (MC_bool): 
+        PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1"
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001884.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001883.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001300.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001200.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001100.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001101.pool.root.1",
+                      "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001000.pool.root.1"]
+    else:
+        PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data16_13TeV/data16_13TeV.00303338.physics_Main.merge.DESDM_MCP.f716_m1624._0001.1"]
+
+EvtMax= -1
+#EvtMax= 100
+SkipEvents = 0
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+from AthenaCommon.AlgSequence import AthSequencer
+
+job = AlgSequence()
+seq = AthSequencer("AthFilterSeq")
+
+###############
+# GRL
+###############
+
+if useGRL:
+  include("InDetPerformanceMonitoring/jobOptions_useGRL.py")
+
+###############
+# END GRL
+###############
+
+# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
+#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
+#pmjp.PerfMonFlags.doFastMon=True
+
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.FilesInput = PoolInput
+athenaCommonFlags.EvtMax = EvtMax
+athenaCommonFlags.SkipEvents = SkipEvents
+
+from AthenaCommon.GlobalFlags import globalflags
+myConditionsTag = "auto-configured"
+if (useConfigConditions):
+    if not MC_bool: # --> real data 
+        myConditionsTag = "CONDBR2-BLKPA-2016-21" # Hide 21/03/17 
+        print " -- run2paper -- globalflags.ConditionsTag -> manually configured to ", myConditionsTag
+        globalflags.ConditionsTag.set_Value_and_Lock(myConditionsTag)
+    #else:
+    #    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+else: 
+    print " -- run2paper -- globalflags.ConditionsTag -> auto configured "
+
+myDetDescr = "auto-configured"
+if (useConfigConditions):
+    myDetDescr = "ATLAS-R2-2016-01-00-01"
+    print " -- run2paper -- globalflags.DetDescrVersion -> manually configured to ", myDetDescr
+    globalflags.DetDescrVersion.set_Value_and_Lock(myDetDescr)#ATLAS-R2-2015-04-00-00  ATLAS-R2-2016-00-01-00
+else:
+    print " -- run2paper -- globalflags.DetDescrVersion -> no user setting -> ", myDetDescr
+
+from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
+GeoModelSvc = GeoModelSvc()
+GeoModelSvc.IgnoreTagDifference = True
+
+from RecExConfig.RecFlags import rec
+rec.AutoConfiguration=['everything']
+rec.doAOD.set_Value_and_Lock(False)
+rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
+rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
+rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
+rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
+rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doInDet.set_Value_and_Lock(True)
+rec.doTile.set_Value_and_Lock(False)
+rec.doLArg.set_Value_and_Lock(False)
+rec.doCalo.set_Value_and_Lock(False)
+rec.doMuon.set_Value_and_Lock(False)
+rec.doMuonCombined.set_Value_and_Lock(False)
+rec.doEgamma.set_Value_and_Lock(False)
+rec.doJetMissingETTag.set_Value_and_Lock(False)
+rec.doTau.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
+rec.doTruth.set_Value_and_Lock(False)
+
+#rec.doMonitoring.set_Value_and_Lock(True)
+#from AthenaMonitoring.DQMonFlags import DQMonFlags
+#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
+
+#use dynamic alignment 
+from InDetRecExample.InDetJobProperties import InDetFlags 
+InDetFlags.useDynamicAlignFolders.set_Value_and_Lock(useIDADynamicFolders)
+
+
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+include("RecExCond/RecExCommon_flags.py")
+# switch off ID, calo, or muons
+DetFlags.ID_setOn()
+DetFlags.Calo_setOff()
+DetFlags.Muon_setOn()
+
+
+from IOVDbSvc.CondDB import conddb
+if (useIDADynamicFolders):
+    if (False):
+        conddb.addOverride("/Indet/AlignL1/ID" ,"InDetAlignL1_ID_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/Indet/AlignL2/PIX" ,"InDetAlignL2PIX_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/Indet/AlignL2/SCT" ,"InDetAlignL2SCT_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/Indet/AlignL3" ,"InDetAlignL3_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/Indet/IBLDist", "InDetAlignIBLDist_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1_R2dynamic_data17_2ndBatch_Initial")
+        conddb.addOverride("/TRT/AlignL2", "TRTAlignL2_R2dynamic_data17_2ndBatch_Initial")
+    if (False):
+        conddb.addOverride("/Indet/AlignL1/ID",  "IndetAlignL1ID-RUN2-BLK-UPD4-07")
+        conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX-RUN2-BLK-UPD4-07")
+        conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT-RUN2-BLK-UPD4-07")
+        conddb.addOverride("/Indet/AlignL3" ,    "IndetAlignL3-RUN2-BLK-UPD4-07")
+        conddb.addOverride("/Indet/IBLDist",     "IndetIBLDist-RUN2-BLK-UPD4-07") 
+        conddb.addOverride("/TRT/AlignL1/TRT",   "TRTAlignL1-RUN2-BLK-UPD4-07")
+        conddb.addOverride("/TRT/AlignL2",       "TRTAlignL2-RUN2-BLK-UPD4-07")
+
+
+blocked_folders = [
+     '/LAR/ElecCalibMC/AutoCorr',
+     ]
+for f in blocked_folders:
+    conddb.blockFolder (f)
+    print " == runzmumu == folder ",f," --> blocked "
+
+
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
+    print " == runzmumu == inputConstants in dir() == ", inputConstants
+
+if readPool:
+    if (MC_bool):
+        conddb.blockFolder("/Indet/Align")
+        conddb.blockFolder("/TRT/Align")
+
+    from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
+    from AthenaCommon.AppMgr import ServiceMgr
+    ServiceMgr += CondProxyProvider()
+    ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
+    # set this to the file containing AlignableTransform objects
+    ServiceMgr.CondProxyProvider.InputCollections += inputCollections
+    ServiceMgr.CondProxyProvider.OutputLevel=INFO
+    print ServiceMgr.CondProxyProvider
+    # this preload causes callbacks for read in objects to be activated,
+    # allowing GeoModel to pick up the transforms
+    ServiceMgr.IOVSvc.preLoadData=True
+    ServiceMgr.IOVSvc.OutputLevel=INFO
+    
+include("InDetRecExample/InDetRecConditionsAccess.py")
+
+# main jobOption
+include("RecExCommon/RecExCommon_topOptions.py")
+
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
+print svcMgr.IOVDbSvc
+
+
+####  Track Selection Tool
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name     = "InDetTrackSelectorLoose",
+                                                           CutLevel = "Loose",
+                                                           minPt    = 400)
+ToolSvc += m_TrackSelectorTool_Loose
+
+m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name     = "InDetTrackSelectorTightPrimary",
+                                                                  CutLevel = "TightPrimary",
+                                                                  minPt    = 400)
+ToolSvc += m_TrackSelectorTool_TightPrimary
+print m_TrackSelectorTool_TightPrimary
+
+#### run zmumu validation
+if zmumuval == True:
+    include("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
+
+    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
+
+    #use to run with qualityselection that needs to be set in MuonSelector
+    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
+    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                    ReFitterTool1 = MuonRefitterTool,
+                                    ReFitterTool2 = MuonRefitterTool2,
+                                    OutputTracksName =  "SelectedMuons",
+                                    isMC = MC_bool, # If set to True, the truth parameters will be filled, have a look into FillTruthParameters
+                                    doRefit = True, #True for evaluation of new alignment constants / False for update of weak mode recommendations -- refits tracks according to provided conditions db and/or external root file containing alignment constants
+                                    doIPextrToPV = True, # True for IP resolution studies, extrapolates IP parameters to primary vertex
+                                    UseTrackSelectionTool = False, # If set to True, it will use the specified TrackSelectionTool in the next Line
+                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
+                                    TrackParticleName = 'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees
+                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    truthTreeFolder = "/ZmumuValidationUserSel/truth", # Only filled if isMC is set to True
+                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",# Only filled if doRefit is set to True
+                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",# Only filled if doRefit is set to True
+                                    combTreeFolder = "/ZmumuValidationUserSel/comb",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    doIsoSelection = True,
+                                    doIPSelection = True,
+                                    #loose selection to have Z and JPsi in the n tuple
+                                    MassWindowLow = 60.,
+                                    MassWindowHigh = 120.,
+                                    PtLeadingMuon = 15.,
+                                    PtSecondMuon = 15.,
+                                    OpeningAngle = 0.01, # in radians. 1 radian ~60 deg
+                                    
+                                    OutputLevel = DEBUG)
+    job += iDPerfMonZmumu
+    print iDPerfMonZmumu
+    
+    ##### run dimuon monitoring
+    if (dimuonmon):
+        from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
+        
+        
+        varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
+        varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
+        varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
+        
+        ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
+                            resonName = "Zmumu",
+                            minInvmass = 10.,
+                            maxInvmass = 120.,
+                            nMassBins = 60,
+                            triggerChainName = "NoTrig",
+                            regions = ["All","BB","EAEA","ECEC"],
+                            varsVSmean = varsVSmeanZmumu,
+                            varsVSwidth = varsVSwidthZmumu,
+                            varsDistr = varsDistrZmumu,
+                            doFits = True,
+                            doSaveFits = False,
+                            #setDebug = True,
+                            OutputLevel = DEBUG)
+        ToolSvc += ZmumuMon
+    
+    # continue
+        from AthenaMonitoring.DQMonFlags import DQMonFlags
+        from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+        IDPerfMonManager = AthenaMonManager(name            = "IDPerfMonManager",
+                                            FileKey             = DQMonFlags.monManFileKey(),
+                                            ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
+                                            DataType            = DQMonFlags.monManDataType(),
+                                            Environment         = "user",
+                                            ManualRunLBSetup    = True,
+                                            Run                 = 1,
+                                            LumiBlock           = 1)
+        IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
+
+
+        ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
+        IDPerfMonManager.FileKey = "DiMuMon"
+    
+        topSequence += IDPerfMonManager
+    
+### add CombinedInDetTracks (can be used for monitoring purposes) ###
+if (monitoringAllTracks):
+    from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__TrackCollectionProvider
+    trackCollectionProvider=Trk__TrackCollectionProvider("TrackCollectionProvider",
+                                                         OutputLevel = DEBUG,
+                                                         InputTrkCol = "CombinedInDetTracks")
+    print " == runzmumu_script == track collection provider -- "
+    print trackCollectionProvider
+    ToolSvc += trackCollectionProvider
+
+#### run global alignment monitoring
+if (zmumuval and globalAlignmentMon):
+    trackCollections = ["SelectedMuonsRefit1", "SelectedMuonsRefit2", "Tracks"]
+    if (monitoringAllTracks): trackCollections.append("CombinedInDetTracks")
+#   trackCollections = ["SelectedMuonsDefault"]
+    StoreGateSvc = Service("StoreGateSvc")
+    StoreGateSvc.Dump = False # True in case of debug ** WARNING ** very large output
+    include("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_runallmonitoring.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_runallmonitoring.py
index 3b6462ed756c13944bb99c08b802fd5ec5c4a39e..a1261b5404f9572f8513d9e8afe01cc1275590f8 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_runallmonitoring.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_runallmonitoring.py
@@ -1,23 +1,35 @@
+
 # enable outputs
 zmumuval = True
 globalAlignmentMon = True
-dimuonmon = True
+dimuonmon = False
 
 # use GRL
-useGRL = True
+useGRL = False
+
+# MC
+MC_bool = False
+
+#do Trigger
+DoTrigger = False
 
 # where to run
 grid = True
 
 # handle input constants
 readPool = False
-inputConstants = "./Iter1_AlignmentConstants.root"
-
+inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
 
 
+#include("InDetSimpleVisual/GetDetectorPositions.py")
 
 if grid == True:
-    PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/MC/valid3.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3099_s2578_r6588_tid05292497_00/ESD.05292497._000150.pool.root.1"]
+    #PoolInput = ["/afs/cern.ch/work/o/oestrada/public/alignment2/Jpsi_20.7.3.8/20.7.3.8/JpsiNtuplesMC/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587._0004.1"]#
+    PoolInput = ["/afs/cern.ch/work/d/dhaliwal/public/ForOscar/test.pool.root"]
+
+    # xx
+    # xx
+    
 elif 'inputFiles' in dir():
     print inputFiles
     PoolInput = inputFiles
@@ -27,7 +39,8 @@ else:
 #    print inputFiles
 #PoolInput = inputFiles
 # number of event to process
-EvtMax=-1
+
+EvtMax=100
 SkipEvents = 0
 
 
@@ -58,8 +71,13 @@ athenaCommonFlags.EvtMax = EvtMax
 athenaCommonFlags.SkipEvents = SkipEvents
 
 from AthenaCommon.GlobalFlags import globalflags
-globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2015-14")
-globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-03-01-00")
+if not MC_bool:
+    globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
+else:
+    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
+
+globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
+
 
 from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
 GeoModelSvc = GeoModelSvc()
@@ -84,7 +102,7 @@ rec.doMuonCombined.set_Value_and_Lock(False)
 rec.doEgamma.set_Value_and_Lock(False)
 rec.doJetMissingETTag.set_Value_and_Lock(False)
 rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(False)
+rec.doTrigger.set_Value_and_Lock(DoTrigger)
 rec.doTruth.set_Value_and_Lock(False)
 
 #rec.doMonitoring.set_Value_and_Lock(True)
@@ -108,9 +126,9 @@ DetFlags.Muon_setOn()
 
 
 from IOVDbSvc.CondDB import conddb
-inputCollections = [inputConstants]
-conddb.addOverride('/Indet/Align', 'InDetAlign-RUN2-25NS')
-conddb.addOverride('/TRT/Align',   'TRTAlign-RUN2-25NS')
+inputCollectons =[]
+if 'inputConstants' in dir():
+    inputCollections = [inputConstants]
 
 
 if readPool :
@@ -134,9 +152,23 @@ include ("InDetRecExample/InDetRecConditionsAccess.py")
 # main jobOption
 include ("RecExCommon/RecExCommon_topOptions.py")
 
+from PerfMonComps.PerfMonFlags import jobproperties
+jobproperties.PerfMonFlags.doMonitoring = False
+
 print svcMgr.IOVDbSvc
 
 
+####  Track Selection Tool
+
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+m_TrackSelectorTool_LooseMuon = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLooseMuon",
+                                                               CutLevel = "LooseMuon",
+                                                               minPt = 25000
+                                                               
+                                                               )
+ToolSvc += m_TrackSelectorTool_LooseMuon
+
+
 #### run zmumu validation
 
 if zmumuval == True:
@@ -145,17 +177,44 @@ if zmumuval == True:
     include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
 
     from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
-    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
-                                    ReFitterTool1 = MuonRefitterTool,
-                                    ReFitterTool2 = MuonRefitterTool2,
-                                    OutputTracksName =  "SelectedMuons",
-                                    isMC = False,
-                                    doIsoSelection = False,
-                                    OutputLevel= INFO)
-
-
-    job += iDPerfMonZmumu
-
+    if (True): 
+        iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
+                                        ReFitterTool1 = MuonRefitterTool,
+                                        ReFitterTool2 = MuonRefitterTool2,
+                                        OutputTracksName =  "SelectedMuons",
+                                        isMC = MC_bool,
+                                        doIsoSelection = True,
+                                        doIPSelection  = True,
+                                        UseTrigger     = DoTrigger,
+                                        OutputLevel= INFO,
+                                        UseTrackSelectionTool = True,
+                                        MassWindowLow        = 70,
+                                        MassWindowHigh       = 110,
+                                        PtLeadingMuon        = 25,
+                                        PtSecondMuon         = 25,
+                                        TrackSelectionTool = m_TrackSelectorTool_LooseMuon,
+                                        TrackParticleName= 'CombinedMuonTrackParticles')
+        
+        job += iDPerfMonZmumu
+        print iDPerfMonZmumu
+
+    if (False):
+        iDPerfMonJPsi = IDPerfMonZmumu(name = 'IDPerfMonJPsi',
+                                       ReFitterTool1 = MuonRefitterTool,
+                                       ReFitterTool2 = MuonRefitterTool2,
+                                       OutputTracksName =  "SelectedMuons",
+                                       isMC = False,
+                                       doIsoSelection = False,
+                                       doIPSelection = True,
+                                       OutputLevel= INFO,
+                                       MassWindowLow = 1.0,
+                                       MassWindowHigh = 120.,
+                                       PtLeadingMuon = 1.0,
+                                       OpeningAngle = 0.001,
+				       #TrackTruthName ="TrackTruthCollection",
+                                       TrackParticleName= 'CombinedMuonTrackParticles')
+        job += iDPerfMonJPsi
+        print iDPerfMonJPsi
 
 
 
@@ -169,19 +228,19 @@ if dimuonmon == True:
     varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
 
     ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
-                               resonName = "Zmumu",
-                               minInvmass = 60.,
-                               maxInvmass = 120.,
-                               nMassBins = 60,
-                               triggerChainName = "NoTrig",
-                               regions = ["All","BB","EAEA","ECEC"],
-                               varsVSmean = varsVSmeanZmumu,
-                               varsVSwidth = varsVSwidthZmumu,
-                               varsDistr = varsDistrZmumu,
-                               doFits = True,
-                               doSaveFits = False,
-#                               setDebug = True,
-                               OutputLevel = INFO)
+                        resonName = "Zmumu",
+                        minInvmass = 10.,
+                        maxInvmass = 120.,
+                        nMassBins = 60,
+                        triggerChainName = "NoTrig",
+                        regions = ["All","BB","EAEA","ECEC"],
+                        varsVSmean = varsVSmeanZmumu,
+                        varsVSwidth = varsVSwidthZmumu,
+                        varsDistr = varsDistrZmumu,
+                        doFits = True,
+                        doSaveFits = False,
+    #                               setDebug = True,
+    OutputLevel = INFO)
     ToolSvc += ZmumuMon
 
     from AthenaMonitoring.DQMonFlags import DQMonFlags
@@ -205,7 +264,8 @@ if dimuonmon == True:
 #### run global alignment monitoring
 
 if zmumuval == True and globalAlignmentMon == True:
-    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
+    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2","]
+#    trackCollections = ["SelectedMuonsDefault"]
     StoreGateSvc = Service("StoreGateSvc")
     StoreGateSvc.Dump = False
     include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/xrootd-patch.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/xrootd-patch.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba6099f706c442396be8feb657fc8bad68dab8cf
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/xrootd-patch.py
@@ -0,0 +1,34 @@
+### for 20.7.7+ athena releases the following
+# setting up environmental variables for xrootd patch
+# get your local copy from:
+# /afs/cern.ch/work/w/wdicleme/public/Alignment/20.7.8/xrootd-4.2.3-install
+# and put it in your $TestArea/. path
+#
+
+import os
+print "xrootd path"
+xrootd_path = os.getenv("TestArea") + "/xrootd-4.2.3-install/"
+print "TestArea contents"
+os.listdir(os.getenv("TestArea"))
+print "xrootd_path contents"
+os.listdir(xrootd_path)
+
+if os.path.exists(xrootd_path):
+    print "Patching xrootd with ",xrootd_path
+else:
+    print "xrootd patch not found. This will probably fail..."
+
+if not 'LD_LIBRARY_PATH' in os.environ:
+    os.environ['LD_LIBRARY_PATH'] = ":" + xrootd_path + "lib64"
+else:
+    os.environ['LD_LIBRARY_PATH'] += ":" +xrootd_path + "lib64"
+
+if not 'PATH' in os.environ:
+    os.environ['PATH'] = ":" +xrootd_path + "bin"
+else:
+    os.environ['PATH'] += ":" +xrootd_path + "bin"
+
+if not 'ROOT_INCLUDE_PATH' in os.environ:
+    os.environ['ROOT_INCLUDE_PATH'] = ":" +xrootd_path + "include"
+else:
+    os.environ['ROOT_INCLUDE_PATH'] += ":" +xrootd_path + "include"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/EventAnalysis.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/EventAnalysis.cxx
index 7cc4812386a43071f3568fd762a08726f96391a9..bad1ea46ff992368367951a65d4bde7994346e96 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/EventAnalysis.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/EventAnalysis.cxx
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 #include "InDetPerformanceMonitoring/EventAnalysis.h"
 #include "InDetPerformanceMonitoring/PerfMonServices.h"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonEoverP.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonEoverP.cxx
index 39f89e52cf9b9d916de51c7d3b931949e39f73d8..4a13b9002f4a4f1b9f96ea138a2581a555b935d7 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonEoverP.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonEoverP.cxx
@@ -1,6 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
+ * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+ */
 
 /********************************************************************
 
@@ -88,7 +88,8 @@ IDPerfMonEoverP::IDPerfMonEoverP(const std::string& name,
   m_smallValidationTreeName("EGrefitterSmall"),
   m_smallValidationTreeDescription("Small Tree for E/p fits"),
   m_smallValidationTreeFolder("/eoverpValidation2/efitterValidation2"),
-  m_smallValidationTree(0)
+  m_smallValidationTree(0),
+  m_isxAOD(false)
 {
 
 // The following properties are specified at run-time
@@ -109,6 +110,7 @@ IDPerfMonEoverP::IDPerfMonEoverP(const std::string& name,
   declareProperty("ValidationMode",                   m_validationMode);
   declareProperty("FillDetailedTree",                 m_fillDetailedTree);
   declareProperty("ElectronLikelihoodTune",           m_lhTune="mc15_20150712");
+  declareProperty("isxAOD",                           m_isxAOD);
 }
 
 // DESTRUCTOR:
@@ -185,7 +187,8 @@ StatusCode IDPerfMonEoverP::initialize()
   m_PID_TrackCaloMatchType_Names.push_back( std::make_pair( xAOD::EgammaParameters::deltaPhi2,"deltaphi2"));//21
   //  m_PID_TrackCaloMatchType_Names.push_back( std::make_pair( xAOD::EgammaParameters::deltaPhiRescaled,"deltaphiRescaled"));//22
   // Following are of summary type
-  //  m_PID_SummaryType_Names.push_back( std::make_pair(xAOD::expectBLayerHit,"expectHitInBLayer"));//23 // throwing an error for some reason
+  //m_PID_SummaryType_Names.push_back( std::make_pair(xAOD::expectBLayerHit,"expectHitInBLayer"));//23 // throwing an error for some reason
+  //m_PID_SummaryType_Names.push_back( std::make_pair(xAOD::numberOfBLayerHits+xAOD::numberOfBLayerOutliers,"BLayerHitsPlusOutliers"));//24
 
 
   //
@@ -290,6 +293,9 @@ StatusCode IDPerfMonEoverP::initialize()
       m_validationTree->Branch("nTRT"               , m_nTRT , "nTRT[nElectrons]/I");
       m_validationTree->Branch("nSCT"               , m_nSCT, "nSCT[nElectrons]/I");
       m_validationTree->Branch("nBLayer"            , m_nBLayer, "nBLayer[nElectrons]/I");
+      m_validationTree->Branch("nBLayerOutlier"     , m_nBLayerOutlier,"nBLayerOutlier[nElectrons]/I");
+      m_validationTree->Branch("nexpectBLayer"      , m_nexpectBLayer, "nexpectBLayer[nElectrons]/I");
+      m_validationTree->Branch("nBLayerHitPlusOutlier",m_nBLayerHitPlusOutlier,"nBLayerHitPlusOutlier[nElectrons]/I");
       m_validationTree->Branch("nPIX"               , m_nPIX, "nPIX[nElectrons]/I");
       m_validationTree->Branch("nTRTout"            , m_nTRTout, "nTRTout[nElectrons]/I");
       m_validationTree->Branch("nSCTout"            , m_nSCTout, "nSCTout[nElectrons]/I");
@@ -368,6 +374,8 @@ StatusCode IDPerfMonEoverP::initialize()
       m_WenuTightElectronET  = new TH1F("WenuTightElectronET","WenuTightElectronET", 100, 00000 ,100000);
       m_WenuTightW_PT  = new TH1F("WenuTightW_PT","WenuTightW_PT", 100, 00000 ,100000);
 
+      m_LHResult = new TH1F("LHResult","LHResult (all/none/l/m/t)",5,0,5);
+
       m_ZeeMediumOS_ClusterPtEta   = new TH2F("ZeeMediumOS_ClusterPtEta", "ZeeMediumOS_ClusterPtEta",100,20000,120000,50,-2.5,2.5);
       m_WenuTightElectron_PTEtaPos = new TH2F("WenuTightElectron_PTEtaPos", "WenuTightElectron_PTEtaPos",100,20000,120000,50,-2.5,2.5);
       m_WenuTightElectron_PTEtaNeg = new TH2F("WenuTightElectron_PTEtaNeg", "WenuTightElectron_PTEtaNeg",100,20000,120000,50,-2.5,2.5);
@@ -398,6 +406,8 @@ StatusCode IDPerfMonEoverP::initialize()
         ATH_MSG_ERROR("initialize() Could not register histogram ");
       if ( (tHistSvc->regHist(m_smallValidationTreeFolder + "/WenuTightElectron_PTEtaNeg",m_WenuTightElectron_PTEtaNeg )).isFailure() )
         ATH_MSG_ERROR("initialize() Could not register histogram ");
+      if ( (tHistSvc->regHist(m_smallValidationTreeFolder + "/LHResult",m_LHResult )).isFailure() )
+	ATH_MSG_ERROR("initialize() Could not register histogram LHResult");
 
       ATH_MSG_INFO("Booked Small Tree add histograms");
 
@@ -420,6 +430,7 @@ StatusCode IDPerfMonEoverP::initialize()
     ATH_MSG_WARNING("Failure setting primary vertex container " << m_primaryVertexCollection << "in tight electron likelihood tool");
 
   //Set up electron LH level
+  /* Depricated -- I will restore this to functionality at some point in case we ever need to use old tunes
   std::string confDir = "ElectronPhotonSelectorTools/offline/"+m_lhTune+"/";
   std::string configFileL = confDir+"ElectronLikelihoodLooseOfflineConfig2015.conf";
   std::string configFileM = confDir+"ElectronLikelihoodMediumOfflineConfig2015.conf";
@@ -431,6 +442,14 @@ StatusCode IDPerfMonEoverP::initialize()
     ATH_MSG_WARNING("Failure loading ConfigFile in medium electron likelihood tool.");
   if((m_LHToolTight2015->setProperty("ConfigFile",configFileT)).isFailure())
     ATH_MSG_WARNING("Failure loading ConfigFile in tight electron likelihood tool.");
+  */
+
+  if((m_LHToolLoose2015->setProperty("WorkingPoint","LooseLHElectron")).isFailure())
+    ATH_MSG_WARNING("Failure loading ConfigFile in loose electron likelihood tool.");
+  if((m_LHToolMedium2015->setProperty("WorkingPoint","MediumLHElectron")).isFailure())
+    ATH_MSG_WARNING("Failure loading ConfigFile in medium electron likelihood tool.");
+  if((m_LHToolTight2015->setProperty("WorkingPoint","TightLHElectron")).isFailure())
+    ATH_MSG_WARNING("Failure loading ConfigFile in tight electron likelihood tool.");
 
   StatusCode lhl = m_LHToolLoose2015->initialize();
   if(lhl.isFailure())
@@ -460,7 +479,7 @@ StatusCode IDPerfMonEoverP::finalize()
 
 StatusCode IDPerfMonEoverP::execute()
 {
-  ATH_MSG_DEBUG( "Executing IDPerfMonEoverP" );
+  ATH_MSG_VERBOSE( "Executing IDPerfMonEoverP" );
 
   StatusCode sc(StatusCode::SUCCESS);
 
@@ -473,7 +492,7 @@ StatusCode IDPerfMonEoverP::execute()
     return sc;
   }
 
-  ATH_MSG_DEBUG("Retrieving event info.");
+  ATH_MSG_VERBOSE("Retrieving event info.");
   const EventInfo * eventInfo;
   if (evtStore()->retrieve(eventInfo).isFailure())
     ATH_MSG_ERROR("Could not retrieve event info.");
@@ -484,16 +503,16 @@ StatusCode IDPerfMonEoverP::execute()
     m_lumi_block = eventInfo->event_ID()->lumi_block();
   }
 
-  ATH_MSG_DEBUG("Retrieved Trigger info.");
+  ATH_MSG_VERBOSE("Retrieved Trigger info.");
   fillTriggerInformation();
 
   if ( fillVertexInformation() ){
-    ATH_MSG_DEBUG("Retrieved Primary Vertex info.");
+    ATH_MSG_VERBOSE("Retrieved Primary Vertex info.");
   } else {
     ATH_MSG_DEBUG("No Primary Vertex");
   }
 
-  ATH_MSG_DEBUG("MET info.being stored");
+  ATH_MSG_VERBOSE("MET info.being stored");
   if( storeMETinformation() )
     ATH_MSG_DEBUG("MET info. stored");
 
@@ -525,7 +544,7 @@ StatusCode IDPerfMonEoverP::execute()
   electron_iterator iterEnd = ElectronInput_container->end();
 
   // Loop over the Electrons
-  ATH_MSG_DEBUG("Electron info. being stored");
+  ATH_MSG_VERBOSE("Electron info. being stored");
   //std::cout << "No Electrons: " << ElectronInput_container->size() <<std::endl;
   for(; iter != iterEnd ; iter++) {
 
@@ -550,7 +569,10 @@ StatusCode IDPerfMonEoverP::execute()
       m_nTRT[m_electronCounter]      = mytp->summaryValue(  dummy , xAOD::numberOfTRTHits  )? dummy :-1;
       m_nSCT[m_electronCounter]      = mytp->summaryValue(  dummy , xAOD::numberOfSCTHits )? dummy :-1;
       m_nPIX[m_electronCounter]      = mytp->summaryValue(  dummy , xAOD::numberOfPixelHits )? dummy :-1;
-      m_nBLayer[m_electronCounter]   = mytp->summaryValue(  dummy , xAOD::numberOfBLayerHits)? dummy :-1;
+      m_nBLayer[m_electronCounter]        = mytp->summaryValue(  dummy , xAOD::numberOfBLayerHits)? dummy :-1;
+      m_nBLayerOutlier[m_electronCounter] = mytp->summaryValue(  dummy , xAOD::numberOfBLayerOutliers)? dummy :-1;
+      m_nexpectBLayer[m_electronCounter]  = mytp->summaryValue(  dummy , xAOD::expectBLayerHit)?dummy :-1;
+      m_nBLayerHitPlusOutlier[m_electronCounter] = m_nBLayer[m_electronCounter] + m_nBLayerOutlier[m_electronCounter];
       m_nTRTout[m_electronCounter]   = mytp->summaryValue(  dummy , xAOD::numberOfTRTOutliers)? dummy :-1;
       m_nSCTout[m_electronCounter]   = mytp->summaryValue(  dummy , xAOD::numberOfSCTOutliers)? dummy :-1;
       m_nTRTHT[m_electronCounter]    = mytp->summaryValue(  dummy , xAOD::numberOfTRTHighThresholdHits)? dummy :-1;
@@ -564,58 +586,69 @@ StatusCode IDPerfMonEoverP::execute()
     VxPos myVxPos = findAssociatedVertex( (*iter) );
     m_associatedToVtx[m_electronCounter] = myVxPos.second;
 
+    if( m_isxAOD ){
+      // if it's an xAOD, we don't have a track particle, so we can't fill all the cool stuff
+      // Instead we'll just fill the small ntuple with the xAOD quantities
+      addToValidationNtuplexAOD(ELE);
+    }
 
-    if( mytp->track() ){
-      const Trk::Track* oTrkTrack = mytp->track();
-         if (oTrkTrack){
-           const Trk::Perigee* oMeasPer =  oTrkTrack->perigeeParameters() ;
-	   if (oMeasPer) addToValidationNtuple( oMeasPer, (*iter)->caloCluster(), 0 );
-           fillLastMeasurement( oTrkTrack , 0 );
-         }
-       }
-
-
-    if(m_refitEverything) {
-      // First Refitter................
-
-      ATH_MSG_DEBUG(  "Refitting the track" );
-
-      StatusCode sc = m_TrackRefitter->refitElectronTrack( (*iter) );
-
-      if (sc == StatusCode::SUCCESS){
-        m_refittedTracks_no1->push_back(m_TrackRefitter->refittedTrack());
-        addToValidationNtuple( m_TrackRefitter->refittedTrackPerigee() ,(*iter)->caloCluster(), 1 );
-        fillLastMeasurement( m_TrackRefitter->refittedTrack(), 1 );
-      } else {
-        ATH_MSG_DEBUG(  "Track Refit Failed" );
+    else{
+      if( mytp->track() ){
+	const Trk::Track* oTrkTrack = mytp->track();
+	if (oTrkTrack){
+	  const Trk::Perigee* oMeasPer =  oTrkTrack->perigeeParameters() ;
+	  if (oMeasPer) addToValidationNtuple( oMeasPer, (*iter)->caloCluster(), 0 );
+	  fillLastMeasurement( oTrkTrack , 0 );
+	}
       }
-
-
-      //******************************************************//
-      // Refit tracks using the second refitter if it is present
-      //******************************************************//
-      ATH_MSG_DEBUG(  "Refitting the track again" );
-
-      sc = m_TrackRefitter_no2->refitElectronTrack( (*iter) );
-
-      if (sc == StatusCode::SUCCESS){
-        //Add the refitted track to the TrackCollection
-        m_refittedTracks_no2->push_back( m_TrackRefitter_no2->refittedTrack() );
-        //Add data to the trkRefitterNtuple
-        addToValidationNtuple( m_TrackRefitter_no2->refittedTrackPerigee() ,(*iter)->caloCluster(), 2 );
-        fillLastMeasurement( m_TrackRefitter_no2->refittedTrack(), 2 );
+      else {
+	ATH_MSG_DEBUG( "Could not retrieve track from track particle" );
+      }
+      
+      
+      if(m_refitEverything) {
+	// First Refitter................
+	
+	ATH_MSG_VERBOSE(  "Refitting the track" );
+	
+	StatusCode sc = m_TrackRefitter->refitElectronTrack( (*iter) );
+	
+	if (sc == StatusCode::SUCCESS){
+	  m_refittedTracks_no1->push_back(m_TrackRefitter->refittedTrack());
+	  addToValidationNtuple( m_TrackRefitter->refittedTrackPerigee() ,(*iter)->caloCluster(), 1 );
+	  fillLastMeasurement( m_TrackRefitter->refittedTrack(), 1 );
+	} else {
+	  ATH_MSG_DEBUG(  "Track Refit Failed" );
+	}
+	
+	
+	//******************************************************//
+	// Refit tracks using the second refitter if it is present
+	//******************************************************//
+	ATH_MSG_VERBOSE(  "Refitting the track again" );
+	
+	sc = m_TrackRefitter_no2->refitElectronTrack( (*iter) );
+	
+	if (sc == StatusCode::SUCCESS){
+	  //Add the refitted track to the TrackCollection
+	  m_refittedTracks_no2->push_back( m_TrackRefitter_no2->refittedTrack() );
+	  //Add data to the trkRefitterNtuple
+	  addToValidationNtuple( m_TrackRefitter_no2->refittedTrackPerigee() ,(*iter)->caloCluster(), 2 );
+	  fillLastMeasurement( m_TrackRefitter_no2->refittedTrack(), 2 );
+	} else {
+	  ATH_MSG_DEBUG( "Track Refit Failed" );
+	}
       } else {
-        ATH_MSG_DEBUG( "Track Refit Failed" );
+	
+	ATH_MSG_DEBUG(  "Not Refitting the track -- DO NOTHING" );
+	
       }
-    } else {
+    }// end if not xAOD
 
-      ATH_MSG_DEBUG(  "Not Refitting the track -- DO NOTHING" );
-
-    }//End if >6 silicon hits;
-    //Increment the electron counter for the validation nutple
+      //Increment the electron counter for the validation nutple
     ++m_electronCounter;
   }
-
+  
   // Commit Data to Ntuple;
   if( m_validationMode ) validationAction();
 
@@ -658,37 +691,54 @@ StatusCode IDPerfMonEoverP::execute()
   }
 
 
-  ATH_MSG_DEBUG(  "execute completed successfully");
+  ATH_MSG_VERBOSE(  "execute completed successfully");
 
   return StatusCode::SUCCESS;
 }
 
+void IDPerfMonEoverP::addToValidationNtuplexAOD(const xAOD::Electron* ele) const{
+  const xAOD::TrackParticle* ele_track = ele->trackParticle();
+  m_electrond0[0][m_electronCounter]     = ele_track->d0();
+  m_electronz0[0][m_electronCounter]     = ele_track->z0();
+  m_electronPhi[0][m_electronCounter]    = ele_track->phi0();
+  m_electronTheta[0][m_electronCounter]  = ele_track->theta();
+  m_electronQoverP[0][m_electronCounter] = ele_track->qOverP();
+  for(int i=1;i<3;i++){ // fill the "refit" information with 0 for obvious reasons
+    m_electrond0[i][m_electronCounter]     = 0;
+    m_electronz0[i][m_electronCounter]     = 0;
+    m_electronPhi[i][m_electronCounter]    = 0;
+    m_electronTheta[i][m_electronCounter]  = 0;
+    m_electronQoverP[i][m_electronCounter] = 0;
+  }
+  return;
+}
+
 void IDPerfMonEoverP::addToValidationNtuple(const Trk::Perigee* perigee,const xAOD::CaloCluster* /*cluster*/, int isOriginal){
   if (perigee){
-    ATH_MSG_DEBUG(  "Adding data to ntuple" );
+    ATH_MSG_VERBOSE(  "Adding data to ntuple" );
     if (isOriginal >=  0  &&  isOriginal <3){
 
-      m_electrond0[isOriginal][m_electronCounter] = perigee->parameters()[Trk::d0];
-      m_electronz0[isOriginal][m_electronCounter] = perigee->parameters()[Trk::z0];
-      m_electronPhi[isOriginal][m_electronCounter] = perigee->parameters()[Trk::phi0];
-      m_electronTheta[isOriginal][m_electronCounter]= perigee->parameters()[Trk::theta];
-      m_electronQoverP[isOriginal][m_electronCounter]= perigee->parameters()[Trk::qOverP];
+      m_electrond0[isOriginal][m_electronCounter]     = perigee->parameters()[Trk::d0];
+      m_electronz0[isOriginal][m_electronCounter]     = perigee->parameters()[Trk::z0];
+      m_electronPhi[isOriginal][m_electronCounter]    = perigee->parameters()[Trk::phi0];
+      m_electronTheta[isOriginal][m_electronCounter]  = perigee->parameters()[Trk::theta];
+      m_electronQoverP[isOriginal][m_electronCounter] = perigee->parameters()[Trk::qOverP];
 
 
       const AmgSymMatrix(5)* matrix = perigee->covariance();
       if (matrix){
-        m_electronErrd0[isOriginal][m_electronCounter] =sqrt( (*matrix)(Trk::d0,Trk::d0) );
-        m_electronErrz0[isOriginal][m_electronCounter] = sqrt( (*matrix)(Trk::z0,Trk::z0) );
-        m_electronErrPhi[isOriginal][m_electronCounter] = sqrt( (*matrix)(Trk::phi0,Trk::phi0) );
-        m_electronErrTheta[isOriginal][m_electronCounter]= sqrt( (*matrix)(Trk::theta,Trk::theta) );
-        m_electronErrQoverP[isOriginal][m_electronCounter]= sqrt( (*matrix)(Trk::qOverP,Trk::qOverP) );
+        m_electronErrd0[isOriginal][m_electronCounter]     = sqrt( (*matrix)(Trk::d0,Trk::d0) );
+        m_electronErrz0[isOriginal][m_electronCounter]     = sqrt( (*matrix)(Trk::z0,Trk::z0) );
+        m_electronErrPhi[isOriginal][m_electronCounter]    = sqrt( (*matrix)(Trk::phi0,Trk::phi0) );
+        m_electronErrTheta[isOriginal][m_electronCounter]  = sqrt( (*matrix)(Trk::theta,Trk::theta) );
+        m_electronErrQoverP[isOriginal][m_electronCounter] = sqrt( (*matrix)(Trk::qOverP,Trk::qOverP) );
       }
     }
   } else {
    ATH_MSG_DEBUG(  "No MeasuredPerigee - cannot add data to ntuple" );
   }
 
-   ATH_MSG_DEBUG(  "Finished adding data to ntuple" );
+   ATH_MSG_VERBOSE(  "Finished adding data to ntuple" );
 
 }
 
@@ -703,32 +753,38 @@ void IDPerfMonEoverP::fillIsEM(const xAOD::Electron *eg) const
 
   m_isGoodOQ[m_electronCounter] = el_goodOQ;
 
+  m_LHResult->Fill(0.);
+
   // check loose LH
   bool val_loose=m_LHToolLoose2015->accept(eg);
-  ATH_MSG_DEBUG( "Loose value : " << val_loose);
-  //if(eg->passSelection(val_loose, "Loose")) {
+  //ATH_MSG_DEBUG( "Loose value : " << val_loose);
   if(val_loose){
-    //ATH_MSG_DEBUG( "Loose  selection exists");
     m_IsEMLoose[m_electronCounter] = val_loose;
-  }//else{ATH_MSG_DEBUG("Loose electron not defined !");}
+    m_LHResult->Fill(2.);
+  }
 
   // check medium LH
   bool val_med=m_LHToolMedium2015->accept(eg);
-  ATH_MSG_DEBUG( "Medium value : " << val_med );
-  //if(eg->passSelection(val_med, "Medium")) {
+  //ATH_MSG_DEBUG( "Medium value : " << val_med );
   if(val_med){
-    //ATH_MSG_DEBUG( "Medium  selection exists");
     m_IsEMMedium[m_electronCounter] = val_med;
-  }//else{ATH_MSG_DEBUG("Mediu, electron not defined !");}
+    m_LHResult->Fill(3.);
+  }
 
   // check tight LH
   bool val_tight=m_LHToolTight2015->accept(eg);
-  ATH_MSG_DEBUG( "Tight value : " << val_tight);
-  //if(eg->passSelection(val_tight, "Tight")) {
+  //ATH_MSG_DEBUG( "Tight value : " << val_tight);
   if(val_tight){
-    //ATH_MSG_DEBUG( "Tight selection exists");
     m_IsEMTight[m_electronCounter] = val_tight;
-  }//else{ATH_MSG_DEBUG("Tight electron not defined !");}
+    m_LHResult->Fill(4.);
+  }
+
+  if( (val_loose+val_med+val_tight) == 0 )
+    m_LHResult->Fill(1.);
+
+  // print out result for debug purposes
+  ATH_MSG_DEBUG( "Tight/Medium/Loose: " << val_tight << val_med << val_loose );
+  
   return;
 
 }
@@ -736,7 +792,7 @@ void IDPerfMonEoverP::fillIsEM(const xAOD::Electron *eg) const
 
 void IDPerfMonEoverP::fillGeneral(const xAOD::Electron *eg) const
 {
-  ATH_MSG_DEBUG(  "fillGeneral" );
+  ATH_MSG_VERBOSE(  "fillGeneral" );
   const xAOD::CaloCluster* cluster = eg->caloCluster();
   if(!cluster) return;
   m_ClusterEnergy[m_electronCounter] = cluster->e();
@@ -980,19 +1036,20 @@ bool IDPerfMonEoverP::fillVertexInformation() const
 	      sumpt += trk->p4().Perp();
 	    }
 	  }
-	  ATH_MSG_DEBUG( "Reco PV " << npv << ": ("
-			 << primaryVertex->position().x() << ","
-			 << primaryVertex->position().y() << ","
-			 << primaryVertex->position().z() << ")"
-			 << " type=" << type
-			 << " nbtk=" << nbtk
-			 << " sumpt=" << sumpt);
-
+	  ATH_MSG_VERBOSE( "Reco PV " << npv << ": ("
+			   << primaryVertex->position().x() << ","
+			   << primaryVertex->position().y() << ","
+			   << primaryVertex->position().z() << ")"
+			   << " type=" << type
+			   << " nbtk=" << nbtk
+			   << " sumpt=" << sumpt);
+	  
 	  if(npv >= NO_PV) {
 	    ATH_MSG_WARNING( "More than " << NO_PV << " reconstructed primary vertices in event "
 			     << "for run= " << m_runNumber << " evt= " << m_evtNumber
 			     << ". Truncated event. " );
-	  } else {
+	  } 
+	  else {
 	    m_pvtype[npv] = type;
 	    m_pvnbtk[npv] = nbtk;
 	    m_pvsumpt[npv] = sumpt;
@@ -1007,7 +1064,8 @@ bool IDPerfMonEoverP::fillVertexInformation() const
 	    //m_covpvzpvx[npv] = (primaryVertex->covariancePosition())(Trk::z,Trk::x);
 	  }
 	  ++npv;
-	} else {
+	} 
+	else {
 	  ATH_MSG_DEBUG( "Vertex " << npv << " has no tracks associated to it!"  );
 	}
       }
@@ -1071,11 +1129,11 @@ void IDPerfMonEoverP::fillTriggerInformation() const
   ATH_MSG_VERBOSE("In fillTriggerInformation()");
 
   //std::cout << "Filling Trigger Info!" << std::endl;
-  ATH_MSG_DEBUG( "Pass state All = " << m_trigDec->isPassed( ".*" ) );
-  ATH_MSG_DEBUG( "Pass state L1 = " << m_trigDec->isPassed( "L1_.*" ) );
-  ATH_MSG_DEBUG( "Pass state L2 = " << m_trigDec->isPassed( "L2_.*" ) );
-  ATH_MSG_DEBUG( "Pass state EF = " << m_trigDec->isPassed( "EF_.*" ) );
-  ATH_MSG_DEBUG("HLT_.* is passed: " << m_trigDec->isPassed("HLT_.*"));
+  ATH_MSG_VERBOSE( "Pass state All = " << m_trigDec->isPassed( ".*" ) );
+  ATH_MSG_VERBOSE( "Pass state L1 = " << m_trigDec->isPassed( "L1_.*" ) );
+  ATH_MSG_VERBOSE( "Pass state L2 = " << m_trigDec->isPassed( "L2_.*" ) );
+  ATH_MSG_VERBOSE( "Pass state EF = " << m_trigDec->isPassed( "EF_.*" ) );
+  ATH_MSG_VERBOSE("HLT_.* is passed: " << m_trigDec->isPassed("HLT_.*"));
 
   ///
   //  auto cg = m_trigDec->getChainGroup("HLT_.*");
@@ -1236,9 +1294,11 @@ bool IDPerfMonEoverP::passZeeSelection(std::vector<int>& electrons)
     }
   }
 
+  ATH_MSG_DEBUG("N Medium electrons " << goodMediumElectrons.size());
+
   //Reject events with more than two good electrons
   if (goodMediumElectrons.size() != 2) return false;
-
+  
   // Make the mass out of the highest pt electrons ....
   double mass = getMassCluster(goodMediumElectrons[0],goodMediumElectrons[1]);
   if (mass > 66000 && mass < 116000){
@@ -1319,7 +1379,7 @@ bool IDPerfMonEoverP::passWenuSelection(std::vector<int>& electrons)
   }
 
   //Reject events with more than one good electron
-  if (nMediumElectrons >2)
+  if (nMediumElectrons > 1)
     return false;
   //Reject events with no tight electrons;
   if (nTightElectrons <1)
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonJpsimumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonJpsimumu.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..863b1fa6f7912857843a18805d4da3f8ebda4bec
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonJpsimumu.cxx
@@ -0,0 +1,798 @@
+//==================================================================================
+
+//==================================================================================
+// Include files...
+//==================================================================================
+
+// This files header
+#include "InDetPerformanceMonitoring/IDPerfMonJpsimumu.h"
+// Standard headers
+#include <string>
+#include "TTree.h"
+#include "TLorentzVector.h"
+
+#include "InDetPerformanceMonitoring/PerfMonServices.h"
+#include "InDetPerformanceMonitoring/JpsimumuEvent.h"
+
+//#include "TrkFitterInterfaces/ITrackFitter.h"
+#include "egammaInterfaces/IegammaTrkRefitterTool.h"
+
+#include "EventPrimitives/EventPrimitivesHelpers.h"
+//#include "xAODTruth/xAODTruthHelpers.h"
+//For extrapolation
+
+// ATLAS headers
+#include "GaudiKernel/IInterface.h"
+#include "StoreGate/StoreGateSvc.h"
+
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+
+#include "HepMC/GenParticle.h"
+#include "HepMC/GenVertex.h"
+
+#include "TrkTruthData/TrackTruthCollection.h"
+#include "TrkTruthData/TrackTruthKey.h"
+
+
+//==================================================================================
+// Public Methods
+//==================================================================================
+IDPerfMonJpsimumu::IDPerfMonJpsimumu(const std::string& name,
+  ISvcLocator* pSvcLocator):
+  AthAlgorithm(name, pSvcLocator),
+  m_isMC(false),
+  m_TrackRefitter1(""),
+  m_TrackRefitter2(""),
+    m_trackToVertexTool("Reco::TrackToVertex"),
+  m_validationMode(true),
+  m_defaultTreeName("DefaultParams"),
+  m_refit1TreeName("Refit1Params"),
+  m_refit2TreeName("Refit2Params"),
+  m_truthTreeName("TruthParams"),
+  //  m_meStacoTreeName("MEStacoParams"),  //not existent in xAOD anymore
+  m_combStacoTreeName("CombStacoParams"),
+  m_combMuidTreeName("CombMuidParams"),
+  m_ValidationTreeDescription("Small Tree for Jpsimumu fits"),
+  m_defaultTreeFolder("/JpsimumuValidation/default"),
+  m_refit1TreeFolder("/JpsimumuValidation/refit1"),
+  m_refit2TreeFolder("/JpsimumuValidation/refit2"),
+  m_truthTreeFolder("/JpsimumuValidation/truth"),
+  //  m_meStacoTreeFolder("/JpsimumuValidation/mestaco"),
+  m_combStacoTreeFolder("/JpsimumuValidation/combstaco"),
+  m_defaultTree(0),
+  m_refit1Tree(0),
+  m_refit2Tree(0),
+  m_truthTree(0),
+  //  m_meStacoTree(0),   // not existent in xAOD anymore
+  m_combStacoTree(0),
+  m_combMuidTree(0)
+
+{
+  // Properties that are set from the python scripts.
+
+
+  declareProperty("triggerChainName", m_sTriggerChainName               );
+  declareProperty("OutputTracksName", m_outputTracksName = "JpsimumuTracks");
+  declareProperty("doIsoSelection",   m_doIsoSelection = true           );
+
+  declareProperty("ReFitterTool1",    m_TrackRefitter1, "ToolHandle for track fitter implementation");
+  declareProperty("ReFitterTool2",    m_TrackRefitter2, "ToolHandle for track fitter implementation");
+
+  declareProperty ("TrackToVertexTool", m_trackToVertexTool);
+
+  declareProperty("ValidationMode",   m_validationMode);
+
+  declareProperty("TrackTruthName",     m_truthName="TrackTruthCollection");
+  declareProperty("TrackParticleName",  m_trackParticleName="InDetTrackParticles");
+  //    declareProperty("TrackParticleName",  m_trackParticleName="TruthParticles");
+  //  declareProperty("TrackParticleName",  m_trackParticleName="CombinedMuonTrackParticles");
+
+  declareProperty("xAODTruthLinkVector",m_truthLinkVecName="xAODTruthLinks");
+
+  declareProperty("isMC",   m_isMC = false);
+}
+
+
+
+IDPerfMonJpsimumu::~IDPerfMonJpsimumu()
+{}
+
+
+
+StatusCode IDPerfMonJpsimumu::initialize()
+{
+
+  // Setup the services
+  ISvcLocator* pxServiceLocator = serviceLocator();
+  if ( pxServiceLocator != NULL ) {
+      StatusCode xSC = PerfMonServices::InitialiseServices( pxServiceLocator );
+      if ( xSC == !StatusCode::SUCCESS )
+	{
+          ATH_MSG_FATAL("Problem Initializing PerfMonServices");
+	  //return PARENT::initialize();
+	}
+  }
+
+  // Retrieve fitter
+  if (m_TrackRefitter1.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Unable to retrieve " << m_TrackRefitter1 );
+    return StatusCode::FAILURE;
+  } else {
+    ATH_MSG_INFO("Retrieved tool" << m_TrackRefitter1 );
+  }
+
+  // Retrieve the second fitter
+  if (m_TrackRefitter2.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Unable to retrieve " << m_TrackRefitter2 );
+    return StatusCode::FAILURE;
+  } else {
+    ATH_MSG_INFO("Retrieved tool" << m_TrackRefitter2 );
+  }
+
+
+  if (m_trackToVertexTool.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Unable to retrieve " << m_trackToVertexTool );
+    return StatusCode::FAILURE;
+  } else {
+    ATH_MSG_INFO("Retrieved tool" << m_trackToVertexTool );
+  }
+
+
+
+  if( m_defaultTree == 0){
+
+    m_defaultTree = new TTree(m_defaultTreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_defaultTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_defaultTree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
+    m_defaultTree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+
+    m_defaultTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_defaultTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_defaultTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_defaultTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_defaultTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_defaultTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_defaultTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+    m_defaultTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_defaultTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_defaultTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_defaultTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_defaultTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_defaultTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_defaultTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+  }
+
+  if( m_refit1Tree == 0){
+
+    m_refit1Tree = new TTree(m_refit1TreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_refit1Tree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_refit1Tree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
+    m_refit1Tree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+
+    m_refit1Tree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_refit1Tree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_refit1Tree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_refit1Tree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_refit1Tree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_refit1Tree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_refit1Tree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+
+    m_refit1Tree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_refit1Tree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_refit1Tree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_refit1Tree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_refit1Tree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_refit1Tree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_refit1Tree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+  }
+
+  if( m_refit2Tree == 0){
+
+    m_refit2Tree = new TTree(m_refit2TreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_refit2Tree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_refit2Tree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
+    m_refit2Tree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+
+    m_refit2Tree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_refit2Tree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_refit2Tree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_refit2Tree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_refit2Tree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_refit2Tree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_refit2Tree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+
+
+    m_refit2Tree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_refit2Tree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_refit2Tree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_refit2Tree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_refit2Tree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_refit2Tree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_refit2Tree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+   }
+
+  //  if( m_meStacoTree == 0){
+
+  //m_meStacoTree = new TTree(m_meStacoTreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+  //m_meStacoTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+  //m_meStacoTree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
+  //m_meStacoTree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+
+  //m_meStacoTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+  //m_meStacoTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+  //m_meStacoTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+  //m_meStacoTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+  //m_meStacoTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+
+  //m_meStacoTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+  //m_meStacoTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+  //m_meStacoTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+  //m_meStacoTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+  //m_meStacoTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+  //}
+
+  if( m_combStacoTree == 0){
+
+    m_combStacoTree = new TTree(m_combStacoTreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_combStacoTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_combStacoTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
+    m_combStacoTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
+
+    m_combStacoTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_combStacoTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_combStacoTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_combStacoTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_combStacoTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_combStacoTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_combStacoTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+
+    m_combStacoTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_combStacoTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_combStacoTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_combStacoTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_combStacoTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_combStacoTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_combStacoTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+  }
+
+
+  if( m_combMuidTree == 0){
+
+    m_combMuidTree = new TTree(m_combMuidTreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_combMuidTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_combMuidTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
+    m_combMuidTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
+
+    m_combMuidTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_combMuidTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_combMuidTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_combMuidTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_combMuidTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_combMuidTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_combMuidTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+
+
+    m_combMuidTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_combMuidTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_combMuidTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_combMuidTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_combMuidTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_combMuidTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_combMuidTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+  }
+
+  if( m_isMC && m_truthTree == 0){
+
+    m_truthTree = new TTree(m_truthTreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_truthTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_truthTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
+    m_truthTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
+
+    m_truthTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_truthTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_truthTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_truthTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_truthTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_truthTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_truthTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+    m_truthTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_truthTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_truthTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_truthTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_truthTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_truthTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_truthTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+  }
+
+    // now register the Trees
+  ITHistSvc* tHistSvc = 0;
+  if (service("THistSvc",tHistSvc).isFailure()){
+    ATH_MSG_ERROR("initialize() Could not find Hist Service -> Switching ValidationMode Off !");
+    m_validationMode = false;
+  }
+
+  if ((tHistSvc->regTree(m_defaultTreeFolder, m_defaultTree)).isFailure() ) {
+    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+    delete m_defaultTree; m_defaultTree = 0;
+    m_validationMode = false;
+  }
+
+  if ((tHistSvc->regTree(m_refit1TreeFolder, m_refit1Tree)).isFailure() ) {
+    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+    delete m_refit1Tree; m_refit1Tree = 0;
+    m_validationMode = false;
+  }
+  if ((tHistSvc->regTree(m_refit2TreeFolder, m_refit2Tree)).isFailure() ) {
+    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+    delete m_refit2Tree; m_refit2Tree = 0;
+    m_validationMode = false;
+  }
+
+  //  if ((tHistSvc->regTree(m_meStacoTreeFolder, m_meStacoTree)).isFailure() ) {
+  //ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+  //delete m_meStacoTree; m_meStacoTree = 0;
+  //m_validationMode = false;
+  //}
+
+  if ((tHistSvc->regTree(m_combStacoTreeFolder, m_combStacoTree)).isFailure() ) {
+    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+    delete m_combStacoTree; m_combStacoTree = 0;
+    m_validationMode = false;
+  }
+
+  if ((tHistSvc->regTree(m_combMuidTreeFolder, m_combMuidTree)).isFailure() ) {
+    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+    delete m_combMuidTree; m_combMuidTree = 0;
+    m_validationMode = false;
+  }
+
+  if (m_isMC) {
+  if ((tHistSvc->regTree(m_truthTreeFolder, m_truthTree)).isFailure() ) {
+    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+    delete m_truthTree; m_truthTree = 0;
+    m_validationMode = false;
+  }
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+
+void IDPerfMonJpsimumu::RegisterHistograms()
+{
+  return;
+}
+
+
+StatusCode IDPerfMonJpsimumu::execute()
+{
+
+  ATH_MSG_DEBUG("Retrieving event info.");
+  const EventInfo * eventInfo;
+  if (evtStore()->retrieve(eventInfo).isFailure())
+    ATH_MSG_ERROR("Could not retrieve event info.");
+  else
+  {
+    m_runNumber = eventInfo->event_ID()->run_number();
+    m_evtNumber = eventInfo->event_ID()->event_number();
+    m_lumi_block = eventInfo->event_ID()->lumi_block();
+  }
+
+  //Fill Staco muon parameters only
+  m_xZmm.setContainer(PerfMonServices::MUON_COLLECTION);
+  //  m_xZmm.Reco();
+  if(!m_xZmm.Reco()){
+    //failed reconstruction
+    return StatusCode::SUCCESS;
+  }
+    const xAOD::Muon* muon_pos = m_xZmm.getCombMuon(m_xZmm.getPosMuon(JpsimumuEvent::CB));
+    const xAOD::Muon* muon_neg = m_xZmm.getCombMuon(m_xZmm.getNegMuon(JpsimumuEvent::CB));
+    const xAOD::TrackParticle* p1_comb = muon_pos->trackParticle(xAOD::Muon::CombinedTrackParticle);
+    const xAOD::TrackParticle* p2_comb = muon_neg->trackParticle(xAOD::Muon::CombinedTrackParticle);
+  if ( m_xZmm.EventPassed() ) {
+    //fill Combined Staco parameters
+    if (!muon_pos || !muon_neg) {
+      ATH_MSG_WARNING("CB Staco Muons missing!");
+    } else {
+      //       FillRecParameters(muon_pos->combinedMuonTrackParticle()->originalTrack(), muon_pos->combinedMuonTrackParticle()->charge());
+      //       FillRecParameters(muon_neg->combinedMuonTrackParticle()->originalTrack(), muon_neg->combinedMuonTrackParticle()->charge());
+      std::cout <<"######### >> before fill rec with comb << #########"<< std::endl;
+      FillRecParameters(p1_comb->track(), p1_comb->charge());
+      FillRecParameters(p2_comb->track(), p2_comb->charge());
+      m_combStacoTree->Fill();
+    }
+
+  }
+
+
+  //Now use MUID collection to find ID tracks
+  //m_xZmm.setContainer(PerfMonServices::MUID_COLLECTION);
+  //m_xZmm.Reco();
+
+  if ( !m_xZmm.EventPassed() ) {
+    //failed cuts, continue to next event
+    return StatusCode::SUCCESS;
+  }
+  //const std::string region = m_xZmm.getRegion();
+  //  const xAOD::TrackParticle* p1 = m_xZmm.getIDTrack(m_xZmm.getPosMuon(JpsimumuEvent::ID));
+  //  const xAOD::TrackParticle* p2 = m_xZmm.getIDTrack(m_xZmm.getNegMuon(JpsimumuEvent::ID));
+  TrackCollection* muonTrks  = new TrackCollection(SG::OWN_ELEMENTS);
+  TrackCollection* muonTrksRefit1  = new TrackCollection(SG::OWN_ELEMENTS);
+  TrackCollection* muonTrksRefit2  = new TrackCollection(SG::OWN_ELEMENTS);
+
+  // changed refitting to combinedparticles since run II DESDM_Jpsimumu did not store InDetTrackParticles
+  if (!p1_comb->track() || !p2_comb->track()) {
+     ATH_MSG_WARNING("Track missing!  Skipping Event");
+     return StatusCode::SUCCESS;
+  }
+
+
+  Trk::Track* defaultMuonTrk1 = 0;
+  Trk::Track* defaultMuonTrk2 = 0;
+  Trk::Track* refit1MuonTrk1 = 0;
+  Trk::Track* refit2MuonTrk1 = 0;
+  Trk::Track* refit1MuonTrk2 = 0;
+  Trk::Track* refit2MuonTrk2 = 0;
+
+  const xAOD::Electron* egam = 0;
+
+  StatusCode fitStatus;
+  //save default and refit track parameters
+  if( p1_comb->track() ) {
+    defaultMuonTrk1 = new Trk::Track(*p1_comb->track());
+
+    fitStatus = m_TrackRefitter1->refitTrack( p1_comb->track(),egam );
+    if (fitStatus.isFailure()) {
+       ATH_MSG_DEBUG("Track Refit1 Failed. Skipping Event");
+       return StatusCode::SUCCESS;
+    } else {
+      refit1MuonTrk1 = m_TrackRefitter1->refittedTrack();
+      muonTrksRefit1->push_back(refit1MuonTrk1);
+      ATH_MSG_DEBUG("Successfully refitted (1) track");
+    }
+
+
+    fitStatus = m_TrackRefitter2->refitTrack( p1_comb->track(),egam );
+    if (fitStatus.isFailure()) {
+      ATH_MSG_DEBUG("Track Refit2 Failed. Skipping Event");
+      return StatusCode::SUCCESS;
+    } else {
+      refit2MuonTrk1 = m_TrackRefitter2->refittedTrack();
+      muonTrksRefit2->push_back(refit2MuonTrk1);
+      ATH_MSG_DEBUG("Successfully refitted (2) track");
+    }
+
+  }
+
+  if( p2_comb->track() ) {
+    defaultMuonTrk2 = new Trk::Track(*p2_comb->track());
+
+    fitStatus = m_TrackRefitter1->refitTrack( p2_comb->track(),egam );
+    if (fitStatus.isFailure()) {
+      ATH_MSG_DEBUG("Track Refit1 Failed. Skipping Event");
+      return StatusCode::SUCCESS;
+    } else {
+      refit1MuonTrk2 = m_TrackRefitter1->refittedTrack();
+      muonTrksRefit1->push_back(refit1MuonTrk2);
+      ATH_MSG_DEBUG("Successfully refitted (1) track");
+    }
+
+
+    fitStatus = m_TrackRefitter2->refitTrack( p2_comb->track(),egam );
+    if (fitStatus.isFailure()) {
+      ATH_MSG_DEBUG("Track Refit2 Failed. Skipping Event");
+      return StatusCode::SUCCESS;
+    } else {
+      refit2MuonTrk2 = m_TrackRefitter2->refittedTrack();
+      muonTrksRefit2->push_back(refit2MuonTrk2);
+      ATH_MSG_DEBUG("Successfully refitted (2) track");
+    }
+  }
+
+  //save tracks to storegrate	/
+  muonTrks->push_back(defaultMuonTrk1);
+  muonTrks->push_back(defaultMuonTrk2);
+
+  StatusCode sc = evtStore()->record(muonTrks, m_outputTracksName, false);
+  if (sc.isFailure()) {
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName << endreq;
+  }
+  else{
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrks->size() << " " << m_outputTracksName <<" into StoreGate" << endreq;
+  }
+
+  sc = evtStore()->record(muonTrksRefit1, m_outputTracksName + "Refit1", false);
+  if (sc.isFailure()) {
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName + "Refit1" << endreq;
+  } else {
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrksRefit1->size() << " " << m_outputTracksName  + "Refit1" <<" into StoreGate" << endreq;
+	}
+
+  sc = evtStore()->record(muonTrksRefit2, m_outputTracksName + "Refit2", false);
+  if (sc.isFailure()) {
+    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName +"Refit2" << endreq;
+  } else {
+    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrksRefit2->size() << " " << m_outputTracksName + "Refit2" <<" into StoreGate" << endreq;
+  }
+
+  //fill truth first in case no truth match found
+  if (m_isMC) {
+
+     if (FillTruthParameters(p1_comb).isFailure()){
+	ATH_MSG_WARNING("Failed to fill truth parameters - skipping event");
+  	return StatusCode::SUCCESS;
+     }
+     if (FillTruthParameters(p2_comb).isFailure()){
+	ATH_MSG_WARNING("Failed to fill truth parameters - skipping event");
+  	return StatusCode::SUCCESS;
+     }
+     ATH_MSG_DEBUG("fill truthTree with parameters : ");
+     ATH_MSG_DEBUG("######   (negative)   ########## ");
+     ATH_MSG_DEBUG("Negative px: " << m_negative_px << "\n"
+	       << "Negative py: " << m_negative_py << "\n"
+	       << "Negative pz: " << m_negative_pz << "\n"
+	       << "Negative d0: " << m_negative_d0 << "\n"
+	       << "Negative z0: " << m_negative_z0 << "\n");
+
+
+     ATH_MSG_DEBUG("######   (positive)   ########## ");
+     ATH_MSG_DEBUG( "Positive px: " << m_positive_px << "\n"
+		    << "Positive py: " << m_positive_py << "\n"
+		    << "Positive pz: " << m_positive_pz << "\n"
+		    << "Positive d0: " << m_positive_d0 << "\n"
+		    << "Positive z0: " << m_positive_z0 << "\n");
+
+     m_truthTree->Fill();
+  }
+
+  //fill default ID parameters
+  if (muonTrks->size()<2){
+    ATH_MSG_WARNING("Default muon tracks are missing!");
+  }else{
+    std::cout <<"######### >> before fill rec default << #########"<< std::endl;
+    FillRecParameters(defaultMuonTrk1, p1_comb->charge());
+    FillRecParameters(defaultMuonTrk2, p2_comb->charge());
+    m_defaultTree->Fill();
+  }
+  //fill refit1 ID parameters
+  if (muonTrksRefit1->size()<2) {
+    ATH_MSG_WARNING("Refit1 muon tracks are missing!");
+  }else{
+    std::cout <<"######### >> before fill rec refit1 << #########"<< std::endl;
+    FillRecParameters(refit1MuonTrk1, p1_comb->charge());
+    FillRecParameters(refit1MuonTrk2, p2_comb->charge());
+
+  ATH_MSG_DEBUG("fill refit1Tree with parameters : ");
+  ATH_MSG_DEBUG("######   (negative)   ########## ");
+  ATH_MSG_DEBUG("Negative px: " << m_negative_px << "\n"
+		<< "Negative py: " << m_negative_py << "\n"
+		<< "Negative pz: " << m_negative_pz << "\n"
+		<< "Negative d0: " << m_negative_d0 << "\n"
+		<< "Negative z0: " << m_negative_z0 << "\n");
+
+
+  ATH_MSG_DEBUG("######   (positive)   ########## ");
+  ATH_MSG_DEBUG( "Positive px: " << m_positive_px << "\n"
+		 << "Positive py: " << m_positive_py << "\n"
+		 << "Positive pz: " << m_positive_pz << "\n"
+		 << "Positive d0: " << m_positive_d0 << "\n"
+		 << "Positive z0: " << m_positive_z0 << "\n");
+
+
+
+  m_refit1Tree->Fill();
+  }
+  //fill refit2 ID parameters
+
+  if (muonTrksRefit2->size()<2) {
+    ATH_MSG_WARNING("Refit2 muon tracks are missing!");
+  }else{
+    std::cout <<"######### >> before fill rec refit2 << #########"<< std::endl;
+    FillRecParameters(refit2MuonTrk1, p1_comb->charge());
+    FillRecParameters(refit2MuonTrk2, p2_comb->charge());
+    m_refit2Tree->Fill();
+  }
+
+  if (!muon_pos || !muon_neg) {
+    ATH_MSG_WARNING("CB Muons missing!");
+  } else {
+    std::cout <<"######### >> before fill rec comb << #########"<< std::endl;
+    FillRecParameters(p1_comb->track(), p1_comb->charge());
+    FillRecParameters(p2_comb->track(), p2_comb->charge());
+    m_combMuidTree->Fill();
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+
+void IDPerfMonJpsimumu::FillRecParameters(const Trk::Track* track, double charge)
+{
+
+  if (!track){
+    ATH_MSG_WARNING("Empty Track. Skipping.");
+    return;
+  }
+  const Trk::Perigee* trkPerigee = track->perigeeParameters();
+  //  const AmgSymMatrix(5)* covariance = trkPerigee ? trkPerigee->covariance() : NULL;
+  //  if (covariance == NULL) {
+  //    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq;
+  //  }
+
+  double px = 0;
+  double py = 0;
+  double pz = 0;
+  double d0 = 0;
+  double z0 = 0;
+  //  double d0_err = 0;
+  //  double z0_err = 0;
+
+  if(trkPerigee){
+    //    std::cout << "################## >>> does not fail trkperigee" << std::endl;
+    double qOverP   = trkPerigee->parameters()[Trk::qOverP];
+    if (qOverP) {
+      px = trkPerigee->momentum().x();
+      py = trkPerigee->momentum().y();
+      pz = trkPerigee->momentum().z();
+      d0 = trkPerigee->parameters()[Trk::d0];
+      z0 = trkPerigee->parameters()[Trk::z0];
+    }
+        std::cout << "trkPerigee -- px " << px << " py : " << py << " pz : " << pz << " d0 : "<< d0 << "  z0 : "<< z0 << std::endl;
+    //    delete trkPerigee;
+  }
+
+  //const Trk::AtaStraightLine*  atBL =   dynamic_cast<const Trk::AtaStraightLine*>(m_trackToVertexTool->trackAtBeamline( *track ));
+  auto atBL = m_trackToVertexTool->trackAtBeamline( *track );
+
+  if (atBL){
+    std::cout << "################## >>> does not fail atBL extrapolation" << std::endl;
+    double qOverP   = atBL->parameters()[Trk::qOverP];
+    if(qOverP){
+      px = atBL->momentum().x();
+      py = atBL->momentum().y();
+      pz = atBL->momentum().z();
+      d0 = atBL->parameters()[Trk::d0];
+      z0 = atBL->parameters()[Trk::z0];
+      //      z0_err = Amg::error(*trkPerigee->covariance(),Trk::z0);
+      //      d0_err = Amg::error(*trkPerigee->covariance(),Trk::d0);
+    }
+    std::cout << "atBL -- px " << px << " py : " << py << " pz : " << pz << " d0 : "<< d0 << "  z0 : "<< z0 << std::endl;
+    delete atBL;
+
+  }
+
+
+
+  if (charge == 1) {
+    m_positive_px = px;
+    m_positive_py = py;
+    m_positive_pz = pz;
+    m_positive_z0 = z0;
+    m_positive_d0 = d0;
+    ATH_MSG_DEBUG("(Filled charge == 1 ) (reco)-> px : "<< px <<" py: "<<py <<" pz: "<<pz <<" d0: "<<d0<<" z0: "<< z0);
+    //    m_positive_z0_err = z0_err;
+    //    m_positive_d0_err = d0_err;
+  } else  if (charge == -1) {
+    m_negative_px = px;
+    m_negative_py = py;
+    m_negative_pz = pz;
+    m_negative_z0 = z0;
+    m_negative_d0 = d0;
+    ATH_MSG_DEBUG("(Filled charge == -1 ) (reco)-> px : "<< px <<" py: "<<py <<" pz: "<<pz <<" d0: "<<d0<<" z0: "<<z0 );
+    //    m_negative_z0_err = z0_err;
+    //    m_negative_d0_err = d0_err;
+  }
+
+  return;
+}
+
+StatusCode IDPerfMonJpsimumu::FillTruthParameters(const xAOD::TrackParticle* trackParticle)
+{
+  double momX(0),momY(0),momZ(0), vtxX(0),vtxY(0),vtxZ(0);
+  //  const xAOD::TruthParticle* truthParticle = xAOD::TruthHelpers::getTruthParticle( *trackParticle );
+  //  const xAOD::TruthParticle* truthParticle = xAOD::EgammaHelpers::getTruthParticle( trackParticle );
+  const xAOD::TruthParticle* truthParticle = getTruthParticle( *trackParticle );
+        if(truthParticle->hasProdVtx()){
+	  vtxX = truthParticle->prodVtx()->x();
+	  vtxY = truthParticle->prodVtx()->y();
+	  vtxZ = truthParticle->prodVtx()->z();
+	  momX = truthParticle->px();
+	  momY = truthParticle->py();
+	  momZ = truthParticle->pz();
+        }
+    Amg::Vector3D pos(vtxX,vtxY,vtxZ);
+    Amg::Vector3D mom(momX,momY,momZ);
+    double charge = 0;
+    if(truthParticle->pdgId() == 13) charge = -1.;
+    else if(truthParticle->pdgId() == -13) charge = 1.;
+    //    Trk::Perigee* candidatePerigee  = new Trk::Perigee(pos,mom,charge,pos);
+    Trk::TrackParameters* parameters  = new Trk::Perigee(pos,mom,charge,pos);
+
+    const Trk::AtaStraightLine*  atBLi =
+      dynamic_cast<const Trk::AtaStraightLine*>(m_trackToVertexTool->trackAtBeamline( *parameters ));
+
+    if(atBLi){
+      if (charge == 1) {
+	double qOverP   = atBLi->parameters()[Trk::qOverP];
+	if (qOverP) {
+	  m_positive_px = atBLi->momentum().x();
+	  m_positive_py = atBLi->momentum().y();
+	  m_positive_pz = atBLi->momentum().z();
+	  m_positive_z0 = atBLi->parameters()[Trk::z0];
+	  m_positive_d0 = atBLi->parameters()[Trk::d0];
+
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) px : "<< atBLi->momentum().x());
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) py : "<< atBLi->momentum().y());
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) pz : "<< atBLi->momentum().z());
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) d0 : "<< atBLi->parameters()[Trk::d0]);
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) z0 : "<< atBLi->parameters()[Trk::z0]);
+	  ATH_MSG_DEBUG("(Filled charge == 1 ) (truth)-> px : "<< m_positive_px <<" py: "<<m_positive_py <<" pz: "<<m_positive_pz <<" d0: "<<m_positive_d0<<" z0: "<<m_positive_z0);
+	}
+      } else  if (charge == -1) {
+	double qOverP   = atBLi->parameters()[Trk::qOverP];
+	if (qOverP) {
+	  m_negative_px = atBLi->momentum().x();
+	  m_negative_py = atBLi->momentum().y();
+	  m_negative_pz = atBLi->momentum().z();
+	  m_negative_z0 = atBLi->parameters()[Trk::z0];
+	  m_negative_d0 = atBLi->parameters()[Trk::d0];
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) px : "<< atBLi->momentum().x());
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) py : "<< atBLi->momentum().y());
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) pz : "<< atBLi->momentum().z());
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) d0 : "<< atBLi->parameters()[Trk::d0]);
+	  ATH_MSG_DEBUG("cand perig HEP particle (truth) z0 : "<< atBLi->parameters()[Trk::z0]);
+	  ATH_MSG_DEBUG("(Filled charge == -1 ) (truth)-> px : "<< m_negative_px <<" py: "<<m_negative_py <<" pz: "<<m_negative_pz <<" d0: "<<m_negative_d0<<" z0: "<<m_negative_z0);
+	}
+      }
+    }//atBL
+
+
+
+    return StatusCode::SUCCESS;
+}
+
+
+const xAOD::TruthParticle* IDPerfMonJpsimumu::getTruthParticle( const xAOD::IParticle& p ) {
+
+
+  /// A convenience type declaration
+  typedef ElementLink< xAOD::TruthParticleContainer > Link_t;
+
+  /// A static accessor for the information
+  static SG::AuxElement::ConstAccessor< Link_t > acc( "truthParticleLink" );
+
+  // Check if such a link exists on the object:
+  if( ! acc.isAvailable( p ) ) {
+    return 0;
+  }
+
+  // Get the link:
+  const Link_t& link = acc( p );
+
+  // Check if the link is valid:
+  if( ! link.isValid() ) {
+    return 0;
+  }
+
+  // Everything has passed, let's return the pointer:
+  return *link;
+}
+
+StatusCode IDPerfMonJpsimumu::finalize()
+{
+  return StatusCode::SUCCESS;
+}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
index 1339bdc29d0836174e01812cacf9520045512f85..e56a61ef17b51e3bafe8ef78d64ef18b58c1ec72 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 // **********************************************************************
 // IDPerfMonKshort.cxx
 // AUTHORS: Jed Biesiada, Tobias Golling, Beate Heinemann
@@ -17,7 +13,7 @@
 #include "TF1.h"
 #include "TMath.h"
 #include "TRandom.h"
-
+#include "TTree.h"
 
 #include "GaudiKernel/IJobOptionsSvc.h"
 
@@ -39,7 +35,6 @@
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
 
-// #include "AthenaMonitoring/AthenaMonManager.h"
 #include "InDetPerformanceMonitoring/IDPerfMonKshort.h"
 
 
@@ -48,17 +43,18 @@
 // *********************************************************************
 
 IDPerfMonKshort::IDPerfMonKshort( const std::string & type, const std::string & name, const IInterface* parent )
-	     :ManagedMonitorToolBase( type, name, parent ),
-	      m_triggerChainName("NoTriggerSelection")
-
+  :ManagedMonitorToolBase( type, name, parent ),
+  m_triggerChainName("NoTriggerSelection"),
+  m_defaultTreeName("DefaultParams"),
+  m_ValidationTreeDescription("Small Tree for Kshort mass fits"),
+  m_trackToVertexTool("Reco::TrackToVertex")
 {
   declareProperty("tracksName",m_tracksName);
   declareProperty("CheckRate",m_checkrate=1000);
   declareProperty("triggerChainName",m_triggerChainName);
-  declareProperty("VxContainerName",m_VxContainerName="V0UnconstrVertices");
-  declareProperty("VxPrimContainerName",m_VxPrimContainerName="PrimaryVertices");
-  //  declareProperty("MakeNtuple",m_Ntuple = false);
-
+  declareProperty("VxContainerName",m_VxContainerName=m_VxContainerName);
+  declareProperty("VxPrimContainerName",m_VxPrimContainerName=m_VxPrimContainerName);
+  declareProperty ("TrackToVertexTool", m_trackToVertexTool);
 }
 
 IDPerfMonKshort::~IDPerfMonKshort() { }
@@ -68,13 +64,7 @@ StatusCode IDPerfMonKshort::initialize()
 {
   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "IDPerfMonKshort initialize() started"<< endreq;
 
-   m_histosBooked = 0;
-
-//   // Get StoreGate
-//   if ( service("StoreGateSvc",m_storeGate).isFailure() ) {
-//     if(msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Unable to get pointer to StoreGateSvc" << endreq;
-//     return StatusCode::FAILURE;
-//   }
+  m_histosBooked = 0;
 
   if (m_tracksName.empty())     if(msgLvl(MSG::ERROR)) msg(MSG::ERROR) << " no track collection given"<<endreq;
 
@@ -83,11 +73,13 @@ StatusCode IDPerfMonKshort::initialize()
   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "IDPerfMonKshort initialize() finished"<< endreq;
   if(!sc.isSuccess()) return StatusCode::SUCCESS;
 
-//   if (m_Ntuple) {
-//     if (!NtupleMaker.initializeTools()) {
-//       m_Ntuple=false;
-//     }
-//  }
+
+  if (m_trackToVertexTool.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Unable to retrieve " << m_trackToVertexTool );
+    return StatusCode::FAILURE;
+  } else {
+    ATH_MSG_INFO("Retrieved tool" << m_trackToVertexTool );
+  }
 
   return StatusCode::SUCCESS;
 }
@@ -97,18 +89,11 @@ StatusCode IDPerfMonKshort::bookHistograms()
 {
   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "IDPerfMonKshort bookHistograms() started"<< endreq;
 
-  Double_t myPi = TMath::Pi();
-
   MonGroup al_kshort_mon ( this, "IDPerfMon/Kshort/" + m_triggerChainName, run);
 
-  //"" is for chain, "weightedAverage" is for merge, run is stored in interval
-  //MonGroup al_kshort_mon_average ( this, "IDPerfMon/Kshort/" + m_triggerChainName,  run, "", "weightedAverage" );
-
   //ASK CONFIRMATION for ATTRIB_MANAGED
   MonGroup al_kshort_mon_average(this, "IDPerfMon/Kshort/" + m_triggerChainName,run,ATTRIB_MANAGED,"","weightedAverage");
 
-  //  MonGroup al_kshort_debug ( this, "IDPerfMon/Kshort/" + m_triggerChainName,  debug, run);
-
   if ( AthenaMonManager::environment() == AthenaMonManager::online ) {
     // book histograms that are only made in the online environment...
   }
@@ -117,59 +102,22 @@ StatusCode IDPerfMonKshort::bookHistograms()
     // book histograms that are only relevant for cosmics data...
   }
 
-
-
-
-
-  if ( newLowStat || newLumiBlock ) {
+  if ( newLowStatFlag() || newLumiBlockFlag() ) {
 
   }
 
-  if( newRun ) {
+  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;
 
-    Double_t ptBins[m_nFittedBinsPt] = {1.05,1.85,2.45,3.35,4.5};
-    Double_t radiusBins[m_nFittedBinsRadius] = {15.,35.,50.,70.,90.,120.,185.};
-    Double_t phiBins[10] = { (-4.5*myPi / 5) ,
-			     (-3.5*myPi / 5) ,
-			     (-2.5*myPi / 5) ,
-			     (-1.5*myPi / 5) ,
-			     (-0.5*myPi / 5) ,
-			     (0.5*myPi / 5) ,
-			     (1.5*myPi / 5) ,
-			     (2.5*myPi / 5) ,
-			     (3.5*myPi / 5) ,
-			     (4.5*myPi / 5) };
-    Double_t etaBins[10] = {-2.25,-1.75,-1.25,-0.75,-0.25,0.25,0.75,1.25,1.75,2.25};
-    Double_t curvatureDiffBins[6] = {-0.0010,-0.0006,-0.0002,0.0002,0.0006,0.0010};
-
-    m_mass = new TH1F("ks_mass", "Invariant mass of K^{0}_{S} candidate", 60, 0.45, 0.55);
+    m_mass = new TH1F("ks_mass", "Invariant mass of K^{0}_{S} candidate", 100, 0.3, 0.7);
     m_mass->SetYTitle("K^{0}_{S} Candidates");
     m_mass->SetXTitle("Mass (Gev / c^{2})");
     m_mass->SetMarkerStyle(20);
     m_mass->SetMinimum(0.);
     RegisterHisto(al_kshort_mon,m_mass) ;
-    m_mass_scaled = new TH1F("ks_mass_scaled", "Invariant mass of K^{0}_{S} candidate scaled to per event", 60, 0.45, 0.55);
-    m_mass_scaled->SetYTitle("K^{0}_{S} Candidates");
-    m_mass_scaled->SetXTitle("Mass (Gev / c^{2})");
-    m_mass_scaled->SetMarkerStyle(20);
-    m_mass_scaled->SetMinimum(0.);
-    RegisterHisto(al_kshort_mon,m_mass_scaled) ;
-
-
-    m_massVsPhi = new TH2F("ks_massVsPhi", "Invariant mass - world average of K^{0}_{S} candidate", 10, (-1.0* myPi), myPi, 50, -.5, .5);
-    m_massVsPhi->SetXTitle("#phi");
-    m_massVsPhi->SetYTitle("Mass (Gev / c^{2}) - World Average [MeV]");
-    //    m_massVsPhi->SetMarkerStyle(20);
-    //    m_massVsPhi->SetMinimum(0.);
-    RegisterHisto(al_kshort_mon,m_massVsPhi) ;
-
-
-
-
 
     m_pt = new TH1F("ks_pt", "p_{T} of K^{0}_{S} candidate", 100, 0., 10.);
     m_pt->SetYTitle("K^{0}_{S} Candidates");
@@ -191,7 +139,6 @@ StatusCode IDPerfMonKshort::bookHistograms()
     RegisterHisto(al_kshort_mon,m_YVsX_secVertex_sel) ;
 
 
-
     m_radiusVsZ_secVertex_Ks = new TH2F("secVertex_radiusVsZ_Ks", "sec.vertices (reco) of K^{0}_{S} candidates;z [mm];Decay radius [mm]",180, -600., 600.,180.,0.,180.);
     RegisterHisto(al_kshort_mon,m_radiusVsZ_secVertex_Ks) ;
 
@@ -206,23 +153,22 @@ StatusCode IDPerfMonKshort::bookHistograms()
     RegisterHisto(al_kshort_mon,m_radius_secVertices_sel) ;
 
 
-
-    m_YVsX_primVertex = new TH2F("primVertex_YVsX", "all primary vertices (reco);PV x [mm];PV y [mm]",300, -1.5,1.5, 300, -1.5, 1.5);
+    m_YVsX_primVertex = new TH2F("primVertex_YVsX", "all primary vertices (reco);PV x [mm];PV y [mm]",300, -1.0,0.0, 300, -1.0, 0.0);
     RegisterHisto(al_kshort_mon,m_YVsX_primVertex) ;
 
-    m_XVsZ_primVertex = new TH2F("primVertex_XVsZ", "all primary vertices (reco);PV z [mm];PV x [mm]",200, -350.,350, 300, -1.5, 1.5);
+    m_XVsZ_primVertex = new TH2F("primVertex_XVsZ", "all primary vertices (reco);PV z [mm];PV x [mm]",200, -200.,200, 300, -1.0, 0.0);
     RegisterHisto(al_kshort_mon,m_XVsZ_primVertex) ;
 
-    m_YVsZ_primVertex = new TH2F("primVertex_YVsZ", "all primary vertices (reco);PV z [mm];PV y [mm]",200, -350.,350., 100, -1.5, 1.5);
+    m_YVsZ_primVertex = new TH2F("primVertex_YVsZ", "all primary vertices (reco);PV z [mm];PV y [mm]",200, -200.,200., 100, -1.0, 0.0);
     RegisterHisto(al_kshort_mon,m_YVsZ_primVertex) ;
-
-    m_YVsX_primVertex_Ks = new TH2F("primVertex_YVsX_Ks", "all primary vertices (reco);PV x [mm];PV y [mm]",300, -1.5,1.5, 300, -1.5, 1.5);
+    
+    m_YVsX_primVertex_Ks = new TH2F("primVertex_YVsX_Ks", "all primary vertices (reco);PV x [mm];PV y [mm]",300, -1.0,0.0, 300, -1.0, 0.0);
     RegisterHisto(al_kshort_mon,m_YVsX_primVertex_Ks) ;
 
-    m_XVsZ_primVertex_Ks = new TH2F("primVertex_XVsZ_Ks", "all primary vertices (reco);PV z [mm];PV x [mm]",200, -350.,350, 300, -1.5, 1.5);
+    m_XVsZ_primVertex_Ks = new TH2F("primVertex_XVsZ_Ks", "all primary vertices (reco);PV z [mm];PV x [mm]",200, -200.,200, 300, -1.0, 0.0);
     RegisterHisto(al_kshort_mon,m_XVsZ_primVertex_Ks) ;
 
-    m_YVsZ_primVertex_Ks = new TH2F("primVertex_YVsZ_Ks", "all primary vertices (reco);PV z [mm];PV y [mm]",200, -350.,350., 100, -1.5, 1.5);
+    m_YVsZ_primVertex_Ks = new TH2F("primVertex_YVsZ_Ks", "all primary vertices (reco);PV z [mm];PV y [mm]",200, -200.,200., 100, -1.0, 0.0);
     RegisterHisto(al_kshort_mon,m_YVsZ_primVertex_Ks) ;
 
     m_radius = new TH1F("ks_radius", "Decay radius of K^{0}_{S} candidate", 100, 0., 300.);
@@ -231,146 +177,63 @@ StatusCode IDPerfMonKshort::bookHistograms()
     m_radius->SetMarkerStyle(20);
     RegisterHisto(al_kshort_mon,m_radius) ;
 
-
-    m_eta = new TH1F("ks_eta", "#eta of K^{0}_{S} candidate", 10, -2.5, 2.5);
+    m_eta = new TH1F("ks_eta", "#eta of K^{0}_{S} candidate", 50, -2.5, 2.5);
     m_eta->SetYTitle("K^{0}_{S} Candidates");
     m_eta->SetXTitle("#eta");
     m_eta->SetMarkerStyle(20);
     RegisterHisto(al_kshort_mon,m_eta) ;
-    m_phi = new TH1F("ks_phi", "#phi of K^{0}_{S} candidate", 10, (-1.0* myPi), myPi);
+
+    m_phi = new TH1F("ks_phi", "#phi of K^{0}_{S} candidate", 50, (-1.0* TMath::Pi()), TMath::Pi());
     m_phi->SetYTitle("K^{0}_{S} Candidates");
     m_phi->SetXTitle("#phi");
     m_phi->SetMarkerStyle(20);
     RegisterHisto(al_kshort_mon,m_phi) ;
-//     TH1F* tempHisto[m_nBinsPt];
-//     m_massVPtBinHistos = tempHisto;
-    for(int quickInit=0;quickInit<m_nBinsPt;quickInit++) {
-      TString tempName = "MassVptBin";
-      TString tempTitle = "Mass, p_{T} = ";
-      tempName += quickInit;
-      tempTitle += ((Double_t)((quickInit*100)+500))/1000;
-      tempTitle += " GeV";
-      m_massVPtBinHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVPtBinHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVPtBinHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVPtBinHistos[quickInit]->SetMarkerStyle(20);
-      m_massVPtBinHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVPtBinHistos[quickInit]) ;
-    }
-     for(int quickInit=0;quickInit<m_nFittedBinsPt;quickInit++) {
-      TString tempName = "MassVptBinFitted";
-      TString tempTitle = "Fitted Mass, p_{T} = ";
-      tempName += quickInit;
-      tempTitle += ptBins[quickInit];
-      tempTitle += " GeV";
-      m_massVPtBinFittedHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVPtBinFittedHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVPtBinFittedHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVPtBinFittedHistos[quickInit]->SetMarkerStyle(20);
-      m_massVPtBinFittedHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVPtBinFittedHistos[quickInit]) ;
-    }
-   for(int quickInit=0;quickInit<m_nBinsRadius;quickInit++) {
-      TString tempName = "MassVradiusBin";
-      TString tempTitle = "Mass, Decay Radius = ";
-      tempName += quickInit;
-      tempTitle += quickInit*10;
-      tempTitle += " mm";
-      m_massVRadiusBinHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVRadiusBinHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVRadiusBinHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVRadiusBinHistos[quickInit]->SetMarkerStyle(20);
-      m_massVRadiusBinHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVRadiusBinHistos[quickInit]) ;
-    }
-   for(int quickInit=0;quickInit<m_nFittedBinsRadius;quickInit++) {
-      TString tempName = "MassVradiusBinFitted";
-      TString tempTitle = "Fitted Mass, Decay Radius = ";
-      tempName += quickInit;
-      tempTitle += radiusBins[quickInit];
-      tempTitle += " mm";
-      m_massVRadiusBinFittedHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVRadiusBinFittedHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVRadiusBinFittedHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVRadiusBinFittedHistos[quickInit]->SetMarkerStyle(20);
-      m_massVRadiusBinFittedHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVRadiusBinFittedHistos[quickInit]) ;
-    }
-    for(int quickInit=0;quickInit<10;quickInit++) {
-      TString tempName = "MassVEtaBin";
-      TString tempTitle = "Mass, #eta =  ";
-      tempName += quickInit;
-      tempTitle += etaBins[quickInit];
-      m_massVEtaBinHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVEtaBinHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVEtaBinHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVEtaBinHistos[quickInit]->SetMarkerStyle(20);
-      m_massVEtaBinHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVEtaBinHistos[quickInit]) ;
-
-      tempName = "MassVPhiBin";
-      tempTitle = "Mass, #phi = ";
-      tempName += quickInit;
-      tempTitle += ((Double_t)((Int_t)(phiBins[quickInit]*100)))/100;
-      m_massVPhiBinHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVPhiBinHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVPhiBinHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVPhiBinHistos[quickInit]->SetMarkerStyle(20);
-      m_massVPhiBinHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVPhiBinHistos[quickInit]) ;
-    }
-
-   for(int quickInit=0;quickInit<6;quickInit++) {
-      TString tempName = "MassVCurvatureDiffBin";
-      TString tempTitle = "Mass, CurvatureDiff =  ";
-      tempName += quickInit;
-      tempTitle += curvatureDiffBins[quickInit];
-      m_massVCurvatureDiffBinHistos[quickInit] = new TH1F(tempName.Data(),tempTitle.Data(),50,0.445,0.555);
-      m_massVCurvatureDiffBinHistos[quickInit]->SetXTitle("Mass (Gev / c^{2})");
-      m_massVCurvatureDiffBinHistos[quickInit]->SetYTitle("K^{0}_{S} Candidates");
-      m_massVCurvatureDiffBinHistos[quickInit]->SetMarkerStyle(20);
-      m_massVCurvatureDiffBinHistos[quickInit]->SetMinimum(0.);
-      RegisterHisto(al_kshort_mon,m_massVCurvatureDiffBinHistos[quickInit]) ;
-    }
-
-    m_massVersusPt_merged = new TH1F("KsMassVersusPt_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_widthVersusPt_merged = new TH1F("KsWidthVersusPt_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_massVersusRadius_merged = new TH1F("KsMassVersusRadius_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_widthVersusRadius_merged = new TH1F("KsWidthVersusRadius_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_massVersusEta_merged = new TH1F("KsMassVersusEta_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_widthVersusEta_merged = new TH1F("KsWidthVersusEta_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_massVersusPhi_merged = new TH1F("KsMassVersusPhi_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_widthVersusPhi_merged = new TH1F("KsWidthVersusPhi_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_massVersusCurvatureDiff_merged = new TH1F("KsMassVersusCurvatureDiff_Merged","Dummy TH1F Before Merging",10,-1,1);
-    m_widthVersusCurvatureDiff_merged = new TH1F("KsWidthVersusCurvatureDiff_Merged","Dummy TH1F Before Merging",10,-1,1);
-
-    RegisterHisto(al_kshort_mon_average,m_massVersusPt_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_widthVersusPt_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_massVersusRadius_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_widthVersusRadius_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_massVersusEta_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_widthVersusEta_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_massVersusPhi_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_widthVersusPhi_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_massVersusCurvatureDiff_merged) ;
-    RegisterHisto(al_kshort_mon_average,m_widthVersusCurvatureDiff_merged) ;
 
     m_Nevents = new TH1F("Nevents","Number of events processed",1,-.5,.5);
     RegisterHisto(al_kshort_mon,m_Nevents);
 
+    m_Nevents_sel = new TH1F("NeventsSel","Number of events selected",1,-.5,.5);
+    RegisterHisto(al_kshort_mon,m_Nevents_sel);
+
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "IDPerfMonKshort bookHistograms done"<< endreq;
 
     m_histosBooked++;
 
-  }
+    m_defaultTree = new TTree(m_defaultTreeName.c_str(), m_ValidationTreeDescription.c_str());
+
+    m_defaultTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_defaultTree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
+    m_defaultTree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
 
-//   if (m_Ntuple) {
-//   StatusCode sc = al_kshort_mon.regTree(NtupleMaker.makeTree());
-//   if (sc.isFailure()){
-//    msg(MSG::WARNING) << "Cannot book TTree" << endreq;
-//    m_Ntuple=false;
-//   }
-//   }
+    m_defaultTree->Branch("Ks_x"     ,  &m_Ks_x,  "Ks_x/D");
+    m_defaultTree->Branch("Ks_y"     ,  &m_Ks_y,  "Ks_y/D");
+    m_defaultTree->Branch("Ks_z"     ,  &m_Ks_z,  "Ks_z/D");
+
+    m_defaultTree->Branch("pv_x"     ,  &m_pv_x,  "pv_x/D");
+    m_defaultTree->Branch("pv_y"     ,  &m_pv_y,  "pv_y/D");
+    m_defaultTree->Branch("pv_z"     ,  &m_pv_z,  "pv_z/D");
+
+    m_defaultTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_defaultTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_defaultTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_defaultTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_defaultTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_defaultTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_defaultTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+    m_defaultTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_defaultTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_defaultTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_defaultTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_defaultTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_defaultTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_defaultTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+
+    RegisterTree(al_kshort_mon,m_defaultTree);
+
+    m_defaultTree->TTree::SetAutoFlush(-30000000);
+
+  }
 
   return StatusCode::SUCCESS;
 }
@@ -403,12 +266,20 @@ void IDPerfMonKshort::RegisterHisto(MonGroup& mon, TGraph* graph) {
   }
 }
 
+void IDPerfMonKshort::RegisterTree(MonGroup& mon, TTree* tree) {
+  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "IDPerfMonKshort RegisterTree() started"<< endreq;
+
+  StatusCode sc = mon.regTree(tree);
+  if (sc.isFailure() ) {
+    if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Cannot book TTree:" << endreq;
+  }
+}
+
 
 StatusCode IDPerfMonKshort::fillHistograms()
 {
   if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "IDPerfMonKshort fillHistogram() started"<< endreq;
 
-  Double_t myPi = TMath::Pi();
   const xAOD::TrackParticleContainer* tracks(0);
   StatusCode sc = evtStore()->retrieve(tracks,m_tracksName);
   if (sc.isFailure()) {
@@ -433,126 +304,115 @@ StatusCode IDPerfMonKshort::fillHistograms()
   }
   xAOD::Vertex *primaryVertex= std::begin(*PrimVxContainer)[0];
 
-const xAOD::VertexContainer* SecVxContainer(0);
- if(evtStore()->contains<xAOD::VertexContainer>(m_VxContainerName)){
-   if (evtStore()->retrieve(SecVxContainer,m_VxContainerName).isFailure()) {
-     ATH_MSG_DEBUG("Could not retrieve collection with name "<<m_VxContainerName<<" found in StoreGate");
-     return false;
-   }
-   else
-     ATH_MSG_DEBUG("Successfully retrieved collection with name "<<m_VxContainerName);
- }
- else {
-   ATH_MSG_DEBUG("No collection with name "<<m_VxContainerName<<" found in StoreGate");
-   return StatusCode::SUCCESS;
- }
-
- m_Nevents->Fill(0.);
-
-
- // ToolHandle <Trk::V0Tools> myV0Tools("Trk::V0Tools");
- // = new Trk::V0Tools("V0Tools","myV0Tools",m_parent);
- //const xAOD::Vertex* theVxCandidate;
- // double piMass = 139.57018;
-  double ksMassPDG = 497.648;
-  ATH_MSG_DEBUG("@todo : masspdf" <<ksMassPDG );
-  ATH_MSG_DEBUG("@todo Looping over SecVxContainer name : "<< m_VxContainerName);
-  ATH_MSG_DEBUG("@todo >> V0UnconstrVerices container size >> " << SecVxContainer->size());
-  //    const xAOD::VertexContainer::const_iterator* secVx_elem = SecVxContainer->begin();
-  //    for ( *secVx_elem=SecVxContainer->begin(); *secVx_elem!=SecVxContainer->end(); ++(*secVx_elem) ) {
+
+  const xAOD::VertexContainer* SecVxContainer(0);
+    if(evtStore()->contains<xAOD::VertexContainer>(m_VxContainerName)){
+      if (evtStore()->retrieve(SecVxContainer,m_VxContainerName).isFailure()) {
+        ATH_MSG_DEBUG("Could not retrieve collection with name "<<m_VxContainerName<<" found in StoreGate");
+        return false;
+      }
+      else ATH_MSG_DEBUG("Successfully retrieved collection with name "<<m_VxContainerName);
+    }
+    else {
+      ATH_MSG_DEBUG("No collection with name "<<m_VxContainerName<<" found in StoreGate");
+      return StatusCode::SUCCESS;
+    }
+  
+  m_Nevents->Fill(0.);
+
+  if(primaryVertex->nTrackParticles() > 3){
+    ATH_MSG_DEBUG("NTrk of primary vertices : "<< primaryVertex->nTrackParticles());
+    m_YVsX_primVertex->Fill(primaryVertex->position().x(),primaryVertex->position().y());
+    m_XVsZ_primVertex->Fill(primaryVertex->position().z(),primaryVertex->position().x());
+    m_YVsZ_primVertex->Fill(primaryVertex->position().z(),primaryVertex->position().y());
+  }
+
+  double ksMassPDG = 497.611;
+  ATH_MSG_DEBUG("Looping over SecVxContainer name : "<< m_VxContainerName);
+  ATH_MSG_DEBUG("V0UnconstrVerices container size >> " << SecVxContainer->size());
+
   for (const auto* secVx_elem : *SecVxContainer) {
-   ATH_MSG_DEBUG("Looping over SecVxContainer name : "<< m_VxContainerName);
-   double ksMass = secVx_elem->auxdata< float >("Kshort_mass");
-   double ksPt = secVx_elem->auxdata< float >("pT");
-   double ksPx = secVx_elem->auxdata< float >("px");
-   double ksPy = secVx_elem->auxdata< float >("py");
-   double ksPz = secVx_elem->auxdata< float >("pz");
-   ATH_MSG_DEBUG( " mass : "<<ksMass << " pt : "<< ksPt << " px : "<< ksPx <<  " py : "<< ksPy << " pz : "<< ksPz);
-   CLHEP::Hep3Vector ksMomentumVector = CLHEP::Hep3Vector(ksPx,ksPy,ksPz);
-   double ksMomentum = ksMomentumVector.mag();
-   double transverseFlightDistance, totalFlightDistance;
-   Amg::Vector3D flightVector;
-   if(primaryVertex!=NULL) {
-     if(primaryVertex->nTrackParticles() > 3){
-       ATH_MSG_DEBUG("NTrk of primary vertices : "<< primaryVertex->nTrackParticles());
-       m_YVsX_primVertex->Fill(primaryVertex->position().x(),primaryVertex->position().y());
-       m_XVsZ_primVertex->Fill(primaryVertex->position().z(),primaryVertex->position().x());
-       m_YVsZ_primVertex->Fill(primaryVertex->position().z(),primaryVertex->position().y());
-     }
-     auto vert = secVx_elem->position()-primaryVertex->position();
-     double dx = vert.x();
-     double dy = vert.y();
-     Amg::Vector3D mom(ksPx,ksPy,ksPz);
-     double dxy = (mom.x()*dx + mom.y()*dy)/mom.perp();
-     transverseFlightDistance =dxy;
-     //     transverseFlightDistance = myV0Tools->lxy(theVxCandidate,primaryVertex);
-     Amg::Vector3D vertex(secVx_elem->position().x(),secVx_elem->position().y(),secVx_elem->position().z());
-     totalFlightDistance = (vertex-primaryVertex->position()).mag();
-     //     totalFlightDistance = (myV0Tools->vtx(theVxCandidate)-primaryVertex->position()).mag();
-     flightVector = vertex-primaryVertex->position();
-     //     flightVector = myV0Tools->vtx(theVxCandidate)-primaryVertex->position();
-     ATH_MSG_DEBUG("dx : "<<dx<<" dy: "<<dy<<" dxy: "<<dxy<< "flight distance (total): "<<totalFlightDistance);
-   }
-   else {
-     transverseFlightDistance = secVx_elem->position().perp();
-     //transverseFlightDistance = myV0Tools->rxy(theVxCandidate);
-     Amg::Vector3D vertex(secVx_elem->position().x(),secVx_elem->position().y(),secVx_elem->position().z());
-     totalFlightDistance = vertex.mag();
-     //     totalFlightDistance = (myV0Tools->vtx(theVxCandidate)).mag();
-     flightVector = vertex;
-     //     flightVector = myV0Tools->vtx(theVxCandidate);
-   }
-   double properDecayTime = 1./Gaudi::Units::c_light*ksMassPDG/ksMomentum*totalFlightDistance;
-
-   //   double ksPx = ksMomentumVector.x();
-   //   double ksPy = ksMomentumVector.y();
-   double flightX = flightVector.x();
-   double flightY = flightVector.y();
-   double cosThetaPointing = (ksPx*flightX+ksPy*flightY)/sqrt(ksPx*ksPx+ksPy*ksPy)/sqrt(flightX*flightX+flightY*flightY);
-   int trackPos_nSVTHits = 0;
-   int trackNeg_nSVTHits = 0;
-   double trackPos_d0 = 0;
-   double trackPos_d0_wrtPV = 0;
-   double trackNeg_d0 = 0;
-   double trackNeg_d0_wrtPV = 0;
-   const xAOD::TrackParticle* trackPos(0);
-   const xAOD::TrackParticle* trackNeg(0);
-
-   int ntrk(-1);
-   ntrk = secVx_elem->nTrackParticles();
-   ATH_MSG_DEBUG("track particles associated to vertex : "<<ntrk );
-   if(ntrk>0){
-     auto tpLinks = secVx_elem->trackParticleLinks();
-     for (auto link: tpLinks){
-       Info("execute()", "V0: TP link = %d %s ", link.isValid(), link.dataID().c_str() );
-       //const xAOD::TrackParticle* TP = *link;
-       //if (TP) Info("execute()", "V0: TP pt = %f ", TP->pt());
-       if(ntrk == 2){
-	 ATH_MSG_DEBUG("Exactly two track particles!");
-	 if( (*link)->charge() > 0. ) {
-	   trackPos = *link;
-	   ATH_MSG_DEBUG("Track with positive charge!");
-	 }
-	 else if( (*link)->charge() < 0. ){
-	   trackNeg = *link;
-	   ATH_MSG_DEBUG("Track with negative charge!");	   }
-       }
-     }//trackparticles
-   }//ntrk
-
-
-   if(trackPos!=0) {
+
+    double ksMass = secVx_elem->auxdata< float >("Kshort_mass");
+    double ksPt = secVx_elem->auxdata< float >("pT");
+    double ksPx = secVx_elem->auxdata< float >("px");
+    double ksPy = secVx_elem->auxdata< float >("py");
+    double ksPz = secVx_elem->auxdata< float >("pz");
+
+    CLHEP::Hep3Vector ksMomentumVector = CLHEP::Hep3Vector(ksPx,ksPy,ksPz);
+
+    double ksMomentum = ksMomentumVector.mag();
+    double transverseFlightDistance, totalFlightDistance;
+
+    Amg::Vector3D flightVector;
+
+    if(primaryVertex!=NULL) {
+      auto vert = secVx_elem->position()-primaryVertex->position();
+      double dx = vert.x();
+      double dy = vert.y();
+      Amg::Vector3D mom(ksPx,ksPy,ksPz);
+      double dxy = (mom.x()*dx + mom.y()*dy)/mom.perp();
+      transverseFlightDistance =dxy;
+
+      Amg::Vector3D vertex(secVx_elem->position().x(),secVx_elem->position().y(),secVx_elem->position().z());
+      totalFlightDistance = (vertex-primaryVertex->position()).mag();
+
+      flightVector = vertex-primaryVertex->position();
+    }
+
+    else {
+      transverseFlightDistance = secVx_elem->position().perp();
+      Amg::Vector3D vertex(secVx_elem->position().x(),secVx_elem->position().y(),secVx_elem->position().z());
+      totalFlightDistance = vertex.mag();
+      flightVector = vertex;
+    }
+
+    double properDecayTime = 1./Gaudi::Units::c_light*ksMassPDG/ksMomentum*totalFlightDistance;
+
+    double flightX = flightVector.x();
+    double flightY = flightVector.y();
+    double cosThetaPointing = (ksPx*flightX+ksPy*flightY)/sqrt(ksPx*ksPx+ksPy*ksPy)/sqrt(flightX*flightX+flightY*flightY);
+    int trackPos_nSVTHits = 0;
+    int trackNeg_nSVTHits = 0;
+    double trackPos_d0 = 0;
+    double trackPos_d0_wrtPV = 0;
+    double trackNeg_d0 = 0;
+    double trackNeg_d0_wrtPV = 0;
+    const xAOD::TrackParticle* trackPos(0);
+    const xAOD::TrackParticle* trackNeg(0);
+
+    int ntrk(-1);
+    ntrk = secVx_elem->nTrackParticles();
+    ATH_MSG_DEBUG("track particles associated to vertex : "<<ntrk );
+
+
+    if(ntrk>0){
+      auto tpLinks = secVx_elem->trackParticleLinks();
+      for (auto link: tpLinks){
+        if (link.isValid()) {
+          if(ntrk == 2){
+            ATH_MSG_DEBUG("Exactly two track particles!");
+            if( (*link)->charge() > 0. ) {
+              trackPos = *link;
+              ATH_MSG_DEBUG("Track with positive charge!");
+            } else if( (*link)->charge() < 0. ){
+              trackNeg = *link;
+              ATH_MSG_DEBUG("Track with negative charge!");
+            }
+          }
+        } else ATH_MSG_ERROR("Could not retrieve track particle.");
+      }
+    }
+
+
+    if(trackPos!=0) {
       uint8_t dummy(-1);
       trackPos_nSVTHits = trackPos->summaryValue(  dummy , xAOD::numberOfSCTHits  )? dummy :-1;
       trackPos_d0 = trackPos->d0();
       trackPos_d0_wrtPV = trackPos->d0() - (primaryVertex->position().y()*cos(trackPos->phi0()) - primaryVertex->position().x()*sin(trackPos->phi0()));
-
     }
 
-    std::cout <<"@todo : check (2) " << std::endl;
 
-    //   const xAOD::TrackParticle* trackNeg = myV0Tools->negativeOrigTrack(secVx_elem);
-    //      const xAOD::TrackParticle* trackNeg = myV0Tools->negativeOrigTrack(theVxCandidate);
     if(trackNeg!=0) {
       uint8_t dummy(-1);
       trackNeg_nSVTHits = trackNeg->summaryValue(  dummy , xAOD::numberOfSCTHits  )? dummy :-1;
@@ -564,47 +424,50 @@ const xAOD::VertexContainer* SecVxContainer(0);
 
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ksTau = " << properDecayTime << " Lxy = " <<transverseFlightDistance<< " cosTheta = " << cosThetaPointing <<endreq;
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "trackPos nSVThits = " << trackPos_nSVTHits << " trackNeg nSVThits = " << trackNeg_nSVTHits <<endreq;
-    // if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ksMass = " << ksMass<< " ksMassConstrained = " << ksMassConstrained << endreq;
-
     if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ksPt = " << ksPt <<endreq;
 
 
     double secVertex_radius = secVx_elem->auxdata< float >("Rxy");
     ATH_MSG_DEBUG("secondary vertex radius : " << secVertex_radius);
-    //    if(secVertex_radius > 20. && abs(secVx_elem->position().z()) < 300.){
-      m_radius_secVertices->Fill(secVertex_radius);
-      m_radiusVsZ_secVertex->Fill(secVx_elem->position().z(),secVertex_radius);
-      m_YVsX_secVertex->Fill(secVx_elem->position().x(),secVx_elem->position().y());
-      //    }
-
-      ATH_MSG_DEBUG("trackneg d0 : " << trackNeg_d0 << " trackpos d0 : "<< trackPos_d0);
-      ATH_MSG_DEBUG("trackneg d0 (PV): " << trackNeg_d0_wrtPV << " trackpos d0 (PV) : "<< trackPos_d0_wrtPV);
-
-      if(secVx_elem->chiSquared()/secVx_elem->numberDoF() < 4.5
-	 && ksPt > 300.
-	 && abs(trackNeg_d0_wrtPV) > 5.
-	 && abs(trackPos_d0_wrtPV) > 5.
-	 && trackPos_nSVTHits > 2
-	 && trackNeg_nSVTHits > 2
-	 && secVertex_radius > 20.
-	 ){
-	m_radius_secVertices_sel->Fill(secVertex_radius);
-	m_radiusVsZ_secVertex_sel->Fill(secVx_elem->position().z(),secVertex_radius);
-	m_YVsX_secVertex_sel->Fill(secVx_elem->position().x(),secVx_elem->position().y());
-      }
+    m_radius_secVertices->Fill(secVertex_radius);
+    m_radiusVsZ_secVertex->Fill(secVx_elem->position().z(),secVertex_radius);
+    m_YVsX_secVertex->Fill(secVx_elem->position().x(),secVx_elem->position().y());
+
+
+    ATH_MSG_DEBUG("trackneg d0 : " << trackNeg_d0 << " trackpos d0 : "<< trackPos_d0);
+    ATH_MSG_DEBUG("trackneg d0 (PV): " << trackNeg_d0_wrtPV << " trackpos d0 (PV) : "<< trackPos_d0_wrtPV);
+
+    if(secVx_elem->chiSquared()/secVx_elem->numberDoF() < 4.5
+      && ksPt > 300.
+      && abs(trackNeg_d0_wrtPV) > 5.
+      && abs(trackPos_d0_wrtPV) > 5.
+      && trackPos_nSVTHits > 2
+      && trackNeg_nSVTHits > 2
+      && secVertex_radius > 20.
+    ){
+      m_radius_secVertices_sel->Fill(secVertex_radius);
+      m_radiusVsZ_secVertex_sel->Fill(secVx_elem->position().z(),secVertex_radius);
+      m_YVsX_secVertex_sel->Fill(secVx_elem->position().x(),secVx_elem->position().y());
+    }
 
 
 
+    // if( 1
+    //   && properDecayTime > 0.004
+    //   && transverseFlightDistance > 12.
+    //   && cosThetaPointing > 0.998
+    //   && ksMass>400.&&ksMass<600.
+    //   && trackPos_nSVTHits > 2 && trackNeg_nSVTHits > 2
+    // ) selectorValue = 1;
+
     if( 1
-	&& properDecayTime > 0.004
-	&& transverseFlightDistance > 12.
-	&& cosThetaPointing > 0.998
-	&& ksMass>400.&&ksMass<600.
-	&& trackPos_nSVTHits > 2 && trackNeg_nSVTHits > 2
-	) selectorValue = 1;
-    if(selectorValue != 1) continue;
-    std::cout <<"@todo : check (3) " << std::endl;
+      && transverseFlightDistance > 4.
+      && cosThetaPointing > 0.999
+      && ksMass>300.&&ksMass<700.
+      && trackPos_nSVTHits > 2 && trackNeg_nSVTHits > 2
+    ) selectorValue = 1;
 
+    if(selectorValue != 1) continue;
 
     m_radiusVsZ_secVertex_Ks->Fill(secVx_elem->position().z(),secVertex_radius);
     m_YVsX_secVertex_Ks->Fill(secVx_elem->position().x(),secVx_elem->position().y());
@@ -613,463 +476,90 @@ const xAOD::VertexContainer* SecVxContainer(0);
     m_XVsZ_primVertex_Ks->Fill(primaryVertex->position().z(),primaryVertex->position().x());
     m_YVsZ_primVertex_Ks->Fill(primaryVertex->position().z(),primaryVertex->position().y());
 
-    m_mass->Fill(ksMass/1000.);
+    m_Ks_x = secVx_elem->position().x();
+    m_Ks_y = secVx_elem->position().y();
+    m_Ks_z = secVx_elem->position().z();
+
+    m_pv_x = primaryVertex->position().x();
+    m_pv_y = primaryVertex->position().y();
+    m_pv_z = primaryVertex->position().z();
 
 
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ksMass = " << ksMass<< " ksMassConstrained = " << ksMassConstrained <<endreq;
+    m_mass->Fill(ksMass/1000.);
 
-    //   if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ksPt = " << ksPt <<endreq;
     double ksEta = ksMomentumVector.pseudoRapidity();
-    //    double ksEta = myV0Tools->V04Momentum(theVxCandidate,ksMassPDG).PseudoRapidity();
     double ksPhi = ksMomentumVector.phi();
-    //    double ksPhi = myV0Tools->V04Momentum(theVxCandidate,ksMassPDG).Phi();
-    std::cout <<"@todo : check (4) " << std::endl;
-    double piPlusPt = trackPos->p4().Perp();
-    std::cout <<"@todo : check (5) " << std::endl;
-    //    double piPlusPt = myV0Tools->positiveTrack4Momentum(theVxCandidate,piMass).Perp();
-    //    double piPlusEta = myV0Tools->positiveTrack4Momentum((const Trk::ExtendedVxCandidate*)theVxCandidate,piMass).pseudoRapidity();
-    //    double piPlusPhi = myV0Tools->positiveTrack4Momentum((const Trk::ExtendedVxCandidate*)myV0Hypothesis,piMass).phi();
-    double piMinusPt = trackNeg->p4().Perp();
-    //    double piMinusPt = myV0Tools->negativeTrack4Momentum(theVxCandidate,piMass).Perp();
-    //    double piMinusEta = myV0Tools->negativeTrack4Momentum((const Trk::ExtendedVxCandidate*)theVxCandidate,piMass).pseudoRapidity();
-    //    double piMinusPhi = myV0Tools->negativeTrack4Momentum((const Trk::ExtendedVxCandidate*)myV0Hypothesis,piMass).phi();
-    std::cout <<"@todo : check (6) " << std::endl;
-
-
-    m_massVsPhi->Fill(ksPhi,ksMass-ksMassPDG);
+
+    // double piPlusPt = trackPos->p4().Perp();
+    // double piMinusPt = trackNeg->p4().Perp();
+
     m_pt->Fill(ksPt/1000.);
     m_eta->Fill(ksEta);
     m_phi->Fill(ksPhi);
 
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "piEta = " << piEta <<endreq;
-    Float_t curvatureDiff = (1./(piPlusPt)) - (1./(piMinusPt));
-    //    if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "curvatureDiff = " << curvatureDiff <<endreq;
-
-    if( curvatureDiff <= -0.0008) m_massVCurvatureDiffBinHistos[0]->Fill(ksMass/1000.);
-    if( curvatureDiff >  -0.0008 && curvatureDiff <= -0.0004) m_massVCurvatureDiffBinHistos[1]->Fill(ksMass/1000.);
-    if( curvatureDiff >  -0.0004 && curvatureDiff <=  0.0000) m_massVCurvatureDiffBinHistos[2]->Fill(ksMass/1000.);
-    if( curvatureDiff >   0.0000 && curvatureDiff <=  0.0004) m_massVCurvatureDiffBinHistos[3]->Fill(ksMass/1000.);
-    if( curvatureDiff >   0.0004 && curvatureDiff <=  0.0008) m_massVCurvatureDiffBinHistos[4]->Fill(ksMass/1000.);
-    if( curvatureDiff >   0.0008 ) m_massVCurvatureDiffBinHistos[5]->Fill(ksMass/1000.);
-
-    if( ksPhi>=(-5.0*myPi / 5)&&ksPhi<(-4.0*myPi / 5) ) m_massVPhiBinHistos[0]->Fill(ksMass/1000.);
-    if( ksPhi>=(-4.0*myPi / 5)&&ksPhi<(-3.0*myPi / 5) ) m_massVPhiBinHistos[1]->Fill(ksMass/1000.);
-    if( ksPhi>=(-3.0*myPi / 5)&&ksPhi<(-2.0*myPi / 5) ) m_massVPhiBinHistos[2]->Fill(ksMass/1000.);
-    if( ksPhi>=(-2.0*myPi / 5)&&ksPhi<(-1.0*myPi / 5) ) m_massVPhiBinHistos[3]->Fill(ksMass/1000.);
-    if( ksPhi>=(-1.0*myPi / 5)&&ksPhi<(0.0*myPi / 5) ) m_massVPhiBinHistos[4]->Fill(ksMass/1000.);
-    if( ksPhi>=(0.0*myPi / 5)&&ksPhi<(1.0*myPi / 5) ) m_massVPhiBinHistos[5]->Fill(ksMass/1000.);
-    if( ksPhi>=(1.0*myPi / 5)&&ksPhi<(2.0*myPi / 5) ) m_massVPhiBinHistos[6]->Fill(ksMass/1000.);
-    if( ksPhi>=(2.0*myPi / 5)&&ksPhi<(3.0*myPi / 5) ) m_massVPhiBinHistos[7]->Fill(ksMass/1000.);
-    if( ksPhi>=(3.0*myPi / 5)&&ksPhi<(4.0*myPi / 5) ) m_massVPhiBinHistos[8]->Fill(ksMass/1000.);
-    if( ksPhi>=(4.0*myPi / 5)&&ksPhi<(5.0*myPi / 5) ) m_massVPhiBinHistos[9]->Fill(ksMass/1000.);
-    if(ksEta>=-2.5&&ksEta<-2.0) m_massVEtaBinHistos[0]->Fill(ksMass/1000.);
-    if(ksEta>=-2.0&&ksEta<-1.5) m_massVEtaBinHistos[1]->Fill(ksMass/1000.);
-    if(ksEta>=-1.5&&ksEta<-1.0) m_massVEtaBinHistos[2]->Fill(ksMass/1000.);
-    if(ksEta>=-1.0&&ksEta<-0.5) m_massVEtaBinHistos[3]->Fill(ksMass/1000.);
-    if(ksEta>=-0.5&&ksEta<0.0) m_massVEtaBinHistos[4]->Fill(ksMass/1000.);
-    if(ksEta>=0.0&&ksEta<0.5) m_massVEtaBinHistos[5]->Fill(ksMass/1000.);
-    if(ksEta>=0.5&&ksEta<1.0) m_massVEtaBinHistos[6]->Fill(ksMass/1000.);
-    if(ksEta>=1.0&&ksEta<1.5) m_massVEtaBinHistos[7]->Fill(ksMass/1000.);
-    if(ksEta>=1.5&&ksEta<2.0) m_massVEtaBinHistos[8]->Fill(ksMass/1000.);
-    if(ksEta>=2.0&&ksEta<2.5) m_massVEtaBinHistos[9]->Fill(ksMass/1000.);
-
-    if(ksPt>=0 && ksPt<1600) m_massVPtBinFittedHistos[0]->Fill(ksMass/1000.);
-    if(ksPt>=1600 && ksPt<2100) m_massVPtBinFittedHistos[1]->Fill(ksMass/1000.);
-    if(ksPt>=2100 && ksPt<2800) m_massVPtBinFittedHistos[2]->Fill(ksMass/1000.);
-    if(ksPt>=2800 && ksPt<3900) m_massVPtBinFittedHistos[3]->Fill(ksMass/1000.);
-    if(ksPt>=3900) m_massVPtBinFittedHistos[4]->Fill(ksMass/1000.);
-
-    if (ksPt > 5000) ksPt = 5000;
-    if(ksPt < 500) ksPt = 500;
-    Int_t quickBin = (Int_t)ksPt;
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "quickBin = " << quickBin <<endreq;
-    quickBin -= quickBin%100;
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "quickBin = " << quickBin <<endreq;
-    quickBin -= 500;
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "quickBin = " << quickBin <<endreq;
-    quickBin /= 100;
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "quickBin = " << quickBin <<endreq;
-    m_massVPtBinHistos[quickBin]->Fill(ksMass/1000.);
-    //    if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "histo[" << quickBin << "]->GetEntries() = " << m_massVPtBinHistos[quickBin]->GetEntries() << endreq;
-
     double radius = secVx_elem->auxdata< float >("Rxy");;
 
     m_radius->Fill(radius);
 
-    if(radius>=0 && radius<30) m_massVRadiusBinFittedHistos[0]->Fill(ksMass/1000.);
-    if(radius>=30 && radius<40) m_massVRadiusBinFittedHistos[1]->Fill(ksMass/1000.);
-    if(radius>=40 && radius<60) m_massVRadiusBinFittedHistos[2]->Fill(ksMass/1000.);
-    if(radius>=60 && radius<80) m_massVRadiusBinFittedHistos[3]->Fill(ksMass/1000.);
-    if(radius>=80 && radius<100) m_massVRadiusBinFittedHistos[4]->Fill(ksMass/1000.);
-    if(radius>=100 && radius<140) m_massVRadiusBinFittedHistos[5]->Fill(ksMass/1000.);
-    if(radius>=140) m_massVRadiusBinFittedHistos[6]->Fill(ksMass/1000.);
-
-    if(radius>700) radius = 700;
-    Int_t radiusTemp = (Int_t)radius;
-    radiusTemp -= radiusTemp%10;
-    m_massVRadiusBinHistos[(Int_t)radiusTemp/10]->Fill(ksMass/1000.);
-
-//     const std::vector<Trk::VxTrackAtVertex*>& trackAtVertexVec = *(myV0Hypothesis->vxTrackAtVertex());
-//     for (unsigned int i = 0; i < trackAtVertexVec.size(); i++) {
-//       Trk::LinkToTrackParticleBase* newLinkToTrackPB = new Trk::LinkToTrackParticleBase();
-//       if(charge1 > 0.) {
-// 	if(i == 0) newLinkToTrackPB->setElement((*tpIt1));
-// 	if(i == 1) newLinkToTrackPB->setElement((*tpIt2));
-//       } else {
-// 	if(i == 0) newLinkToTrackPB->setElement((*tpIt2));
-// 	if(i == 1) newLinkToTrackPB->setElement((*tpIt1));
-//       }
-//       newLinkToTrackPB->setStorableObject(*TPC);
-//       trackAtVertexVec[i]->setOrigTrack(newLinkToTrackPB);
-//     }
-  }
-
-  //******************
-  //NtupleMaker
-  //******************
-//   if (m_Ntuple)
-//     {
-//       int evtNum=0;
-//       int runNum=0;
-//       int LBNum=0;
-//       const EventInfo* eventInfo; // EventInfo
-//       StatusCode sc = evtStore()->retrieve(eventInfo);
-//       if (sc.isSuccess()) {
-// 	EventID* eventID = eventInfo->event_ID(); // Get EventInfo
-// 	evtNum = eventID->event_number();
-// 	runNum = eventID->run_number();
-// 	LBNum = eventID->lumi_block();
-//       }
-//       NtupleMaker.setPrimaryVertex(primaryVertex);
-//       NtupleMaker.setTrackMass(piMass);
-//       NtupleMaker.setResonancePDGMass(ksMassPDG);
-//       NtupleMaker.fill(evtNum,runNum,LBNum,theVxContainer);
-//       //tmp fix after switching to secVtxFinder
-//       NtupleMaker.calculateError(false);
-//     }
-
-  return StatusCode::SUCCESS;
-}
-
-
-StatusCode IDPerfMonKshort::procHistograms()
-{
-  if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "IDPerfMonKshort procHistograms() started"<< endreq;
-
-  Double_t myPi = TMath::Pi();
-
-  if( endOfLowStat || endOfLumiBlock ) {
-
+    m_Nevents_sel->Fill(0.);
 
-  }
-
-  if( endOfRun ) {
-
-    MonGroup al_kshort_mon ( this, "IDPerfMon/Kshort/" + m_triggerChainName, run);
-    //CHECK ATTRIB MANAGED
-    MonGroup al_kshort_mon_average ( this, "IDPerfMon/Kshort/" + m_triggerChainName, run, ATTRIB_MANAGED, "", "weightedAverage" );
-    //    TF1 *func1 = new TF1("func1","gaus",0.450,0.550);
-    //    TF1 *func3 = new TF1("func3","gaus",405,595);
-    //    TF1 *func2 = new TF1("func2","expo",0.450,0.550);
-    TF1 *func = new TF1("func","gaus(0)+expo(3)",0.450,0.550);
-    //    TF1 *func = new TF1("func","func1+func2",0.450,0.550);
-    //    TF1 *doubleGauss = new TF1("doubleGauss","func1+func3",405,595);
-
-    func->SetLineColor(4);
-    func->SetParameters(10.,0.500,0.010,2.,-.001);
-    func->SetParLimits(0,0.,10000.);
-    func->SetParLimits(1,0.450,0.550);
-    func->SetParLimits(2,0.,0.100);
-    func->SetParLimits(3,0.,10000.);
-    func->SetParLimits(4,-1000.,0.);
-    func->SetParNames("Constant","Mean","Width","Constant","Slope");
-
-//     doubleGauss->SetParameters(50.,497.,0.,8.,496.,0.);
-//     doubleGauss->SetParLimits(0,0.,10000.);
-//     doubleGauss->SetParLimits(1,450.,550.);
-//     doubleGauss->SetParLimits(2,0.,50.);
-//     doubleGauss->SetParLimits(3,0.,1000.);
-//     doubleGauss->SetParLimits(4,450.,550.);
-//     doubleGauss->SetParLimits(5,0.,50.);
-//     doubleGauss->SetParNames("C_{core}","#mu_{core}","#sigma_{core}","C_{tail}","#mu_{tail}","#sigma_{tail}");
-
-//     Int_t BinCounter=0;
-//     Double_t ptBins[m_nBinsPt], ptBinsErrors[m_nBinsPt], massBins[m_nBinsPt], massErrorBins[m_nBinsPt];
-//     for(int binFill=0;binFill<m_nBinsPt;binFill++) {
-//       ptBins[BinCounter] = (binFill*100)+500;
-//       m_massVPtBinFittedHistos[BinCounter] = (TH1F*)m_massVPtBinHistos[binFill]->Clone();
-//       while(m_massVPtBinFittedHistos[BinCounter]->GetEntries()<50) {
-// 	binFill++;
-// 	if(binFill==m_nBinsPt) break;
-// 	m_massVPtBinFittedHistos[BinCounter]->Add(m_massVPtBinHistos[binFill]);
-//       }
-//       if(binFill==m_nBinsPt) {
-// 	ptBinsErrors[BinCounter] = (5000 - ptBins[BinCounter])/2;
-// 	ptBins[BinCounter] = (ptBins[BinCounter]+5000)/2;
-//       } else {
-// 	ptBinsErrors[BinCounter] = (((binFill+1)*100)+500 - ptBins[BinCounter])/2;
-// 	ptBins[BinCounter] = (ptBins[BinCounter]+((binFill+1)*100)+500)/2;
-//       }
-//       ptBinsErrors[BinCounter] /= 1000.;
-//       ptBins[BinCounter] /= 1000.;
-//       m_massVPtBinFittedHistos[BinCounter]->Fit(func,"lmhq");
-//       massBins[BinCounter] = func->GetParameter(1);
-//       massErrorBins[BinCounter] = func->GetParError(1);
-//       //      cout<<binFill<<" "<<ptBins[BinCounter]<<" "<<massBins[BinCounter]<<" "<<massErrorBins[BinCounter]<<endl;
-//       BinCounter++;
-//     }
-    // int MinStat=100;
-    //    if (m_mass->GetEntries()>=MinStat) m_mass->Fit(func,"lhqn");
-
-    Double_t massBins[m_nFittedBinsPt], massErrorBins[m_nFittedBinsPt], widthBins[m_nFittedBinsPt], widthErrorBins[m_nFittedBinsPt];
-    const Int_t nPtBinsHisto = m_nFittedBinsPt+1;
-    Double_t ptBins[nPtBinsHisto] = {0.5,1.6,2.1,2.8,3.9,5.1};
-    //    Double_t ptBins[m_nFittedBinsPt] = {1.05,1.85,2.45,3.35,4.5};
-    //    Double_t ptBinsErrors[m_nFittedBinsPt] = {0.55,0.25,0.35,0.55,0.6};
-    for(int binFill=0;binFill<m_nFittedBinsPt;binFill++) {
-      //   if (m_massVPtBinFittedHistos[binFill]->GetEntries()>=MinStat) m_massVPtBinFittedHistos[binFill]->Fit(func,"lmhqn");
-      massBins[binFill] = func->GetParameter(1);
-      massErrorBins[binFill] = func->GetParError(1);
-      widthBins[binFill] = func->GetParameter(2);
-      widthErrorBins[binFill] = func->GetParError(2);
+    ATH_MSG_DEBUG("Retrieving event info.");
+    const EventInfo * eventInfo;
+    if (evtStore()->retrieve(eventInfo).isFailure())
+      ATH_MSG_ERROR("Could not retrieve event info.");
+    else
+    {
+      m_runNumber = eventInfo->event_ID()->run_number();
+      m_evtNumber = eventInfo->event_ID()->event_number();
+      m_lumi_block = eventInfo->event_ID()->lumi_block();
+      ATH_MSG_DEBUG(" Execute() starting on --> Run: " << m_runNumber << "  event: " << m_evtNumber);
     }
 
-    const Double_t* ptBinsFinal = ptBins;
-    //    const Double_t* ptBinsErrorsFinal = ptBinsErrors;
-    const Double_t* massBinsFinal = massBins;
-    const Double_t* massErrorBinsFinal = massErrorBins;
-    const Double_t* widthBinsFinal = widthBins;
-    const Double_t* widthErrorBinsFinal = widthErrorBins;
-
-    if(m_nFittedBinsPt) {
-      //      m_massVersusPt = new TGraphErrors(m_nFittedBinsPt,ptBinsFinal,massBinsFinal,ptBinsErrorsFinal,massErrorBinsFinal);
-      m_massVersusPt = new TH1F("KsMassVersusPt","",m_nFittedBinsPt,ptBinsFinal);
-      RegisterHisto(al_kshort_mon_average,m_massVersusPt);
-      //      m_massVersusPt->SetErrorOption("s");
-      m_massVersusPt->SetXTitle("p_{T} (Gev / c)");
-      m_massVersusPt->SetYTitle("Mass (Gev / c^{2})");
-      m_massVersusPt->SetMarkerStyle(20);
-      for(int binFill=0;binFill<m_nFittedBinsPt;binFill++) {
-	Double_t binContent = massBinsFinal[binFill];
-	Double_t binError = massErrorBinsFinal[binFill];
-	m_massVersusPt->SetBinContent(binFill+1,binContent);
-	m_massVersusPt->SetBinError(binFill+1,binError);
-      }
+    const Trk::TrackParameters* bPer1;
+    const Trk::TrackParameters* bPer2;
 
-      //      m_widthVersusPt = new TGraphErrors(m_nFittedBinsPt,ptBinsFinal,widthBinsFinal,ptBinsErrorsFinal,widthErrorBinsFinal);
-      m_widthVersusPt = new TH1F("KsWidthVersusPt","",m_nFittedBinsPt,ptBinsFinal);
-      RegisterHisto(al_kshort_mon_average,m_widthVersusPt);
-      //      m_widthVersusPt->SetErrorOption("s");
-      m_widthVersusPt->SetXTitle("p_{T} (Gev / c)");
-      m_widthVersusPt->SetYTitle("Width (Gev / c^{2})");
-      m_widthVersusPt->SetMarkerStyle(20);
-      for(int binFill=0;binFill<m_nFittedBinsPt;binFill++) {
-	Double_t binContent = widthBinsFinal[binFill];
-	Double_t binError = widthErrorBinsFinal[binFill];
-	m_widthVersusPt->SetBinContent(binFill+1,binContent);
-	m_widthVersusPt->SetBinError(binFill+1,binError);
-      }
-
-//       RegisterHisto(al_kshort_mon_average,m_massVersusPt);
-//       RegisterHisto(al_kshort_mon_average,m_widthVersusPt);
+    if (  secVx_elem->vxTrackAtVertexAvailable() ) // This will run in the reco from raw
+    {
+      ATH_MSG_DEBUG("Using vxTrackAtVertex");
+      bPer1 = secVx_elem->vxTrackAtVertex()[0].perigeeAtVertex();                                                                                                                    
+      bPer2 = secVx_elem->vxTrackAtVertex()[1].perigeeAtVertex();
+    }
+    else // This from ESD, for now
+    {
+      ATH_MSG_DEBUG("Using trackToVertexTool");
+      bPer1 = m_trackToVertexTool->perigeeAtVertex( *trackPos, secVx_elem->position() );
+      bPer2 = m_trackToVertexTool->perigeeAtVertex( *trackNeg, secVx_elem->position() );
     }
 
-    Double_t massVradiusBins[m_nFittedBinsRadius], massVradiusErrorBins[m_nFittedBinsRadius], widthVradiusBins[m_nFittedBinsRadius], widthVradiusErrorBins[m_nFittedBinsRadius];
-    const Int_t nRadiusBinsHisto = m_nFittedBinsRadius+1;
-    Double_t radiusBins[nRadiusBinsHisto] = {0.,30.,40.,60.,80.,100.,140.,230};
-    //    Double_t radiusBins[m_nFittedBinsRadius] = {15.,35.,50.,70.,90.,120.,185.};
-    //    Double_t radiusBinsErrors[m_nFittedBinsRadius] = {15.,5.,10.,10.,10.,20.,45.};
-    for(int binFill=0;binFill<m_nFittedBinsRadius;binFill++) {
-      //  if (m_massVRadiusBinFittedHistos[binFill]->GetEntries()>=MinStat) m_massVRadiusBinFittedHistos[binFill]->Fit(func,"lmhqn");
-      massVradiusBins[binFill] = func->GetParameter(1);
-      massVradiusErrorBins[binFill] = func->GetParError(1);
-      widthVradiusBins[binFill] = func->GetParameter(2);
-      widthVradiusErrorBins[binFill] = func->GetParError(2);
+    
+    m_positive_px = bPer1->momentum().x();
+    m_positive_py = bPer1->momentum().y();
+    m_positive_pz = bPer1->momentum().z();
+    m_positive_d0 = bPer1->parameters()[Trk::d0];
+    m_positive_z0 = bPer1->parameters()[Trk::z0];
+
+    const AmgSymMatrix(5)* matrix_positive = bPer1->covariance();
+    if (matrix_positive){
+      m_positive_d0_err = sqrt( (*matrix_positive)(Trk::d0,Trk::d0) );
+      m_positive_z0_err = sqrt( (*matrix_positive)(Trk::z0,Trk::z0) );
     }
 
-    const Double_t* radiusBinsFinal = radiusBins;
-    //    const Double_t* radiusBinsErrorsFinal = radiusBinsErrors;
-    const Double_t* massVradiusBinsFinal = massVradiusBins;
-    const Double_t* massVradiusErrorBinsFinal = massVradiusErrorBins;
-    const Double_t* widthVradiusBinsFinal = widthVradiusBins;
-    const Double_t* widthVradiusErrorBinsFinal = widthVradiusErrorBins;
-
-    if(m_nFittedBinsRadius) {
-      //      m_massVersusRadius = new TGraphErrors(m_nFittedBinsRadius,radiusBinsFinal,massVradiusBinsFinal,radiusBinsErrorsFinal,massVradiusErrorBinsFinal);
-      m_massVersusRadius = new TH1F("KsMassVersusRadius","",m_nFittedBinsRadius,radiusBinsFinal);
-      RegisterHisto(al_kshort_mon_average,m_massVersusRadius);
-      //      m_massVersusRadius->SetErrorOption("s");
-      m_massVersusRadius->SetXTitle("Decay Radius (mm)");
-      m_massVersusRadius->SetYTitle("Mass (Gev / c^{2})");
-      m_massVersusRadius->SetMarkerStyle(20);
-      for(int binFill=0;binFill<m_nFittedBinsRadius;binFill++) {
-	Double_t binContent = massVradiusBinsFinal[binFill];
-	Double_t binError = massVradiusErrorBinsFinal[binFill];
-	m_massVersusRadius->SetBinContent(binFill+1,binContent);
-	m_massVersusRadius->SetBinError(binFill+1,binError);
-      }
-      //      m_widthVersusRadius = new TGraphErrors(m_nFittedBinsRadius,radiusBinsFinal,widthVradiusBinsFinal,radiusBinsErrorsFinal,widthVradiusErrorBinsFinal);
-      m_widthVersusRadius = new TH1F("KsWidthVersusRadius","",m_nFittedBinsRadius,radiusBinsFinal);
-      RegisterHisto(al_kshort_mon_average,m_widthVersusRadius);
-      //      m_widthVersusRadius->SetErrorOption("s");
-      m_widthVersusRadius->SetXTitle("Decay Radius (mm)");
-      m_widthVersusRadius->SetYTitle("Width (Gev / c^{2})");
-      m_widthVersusRadius->SetMarkerStyle(20);
-      for(int binFill=0;binFill<m_nFittedBinsRadius;binFill++) {
-	Double_t binContent = widthVradiusBinsFinal[binFill];
-	Double_t binError = widthVradiusErrorBinsFinal[binFill];
-	m_widthVersusRadius->SetBinContent(binFill+1,binContent);
-	m_widthVersusRadius->SetBinError(binFill+1,binError);
-      }
+    m_negative_px = bPer2->momentum().x();
+    m_negative_py = bPer2->momentum().y();
+    m_negative_pz = bPer2->momentum().z();
+    m_negative_d0 = bPer2->parameters()[Trk::d0];
+    m_negative_z0 = bPer2->parameters()[Trk::z0];
 
-//       RegisterHisto(al_kshort_mon_average,m_massVersusRadius);
-//       RegisterHisto(al_kshort_mon_average,m_widthVersusRadius);
+    const AmgSymMatrix(5)* matrix_negative = bPer2->covariance();
+    if (matrix_negative){
+      m_negative_d0_err = sqrt( (*matrix_negative)(Trk::d0,Trk::d0) );
+      m_negative_z0_err = sqrt( (*matrix_negative)(Trk::z0,Trk::z0) );
     }
 
-    Double_t etaBins[11] = {-2.5,-2.0,-1.5,-1.0,-0.5,0.0,0.5,1.0,1.5,2.0,2.5};
-    //    Double_t etaBins[10] = {-2.25,-1.75,-1.25,-0.75,-0.25,0.25,0.75,1.25,1.75,2.25};
-    //    Double_t etaErrorBins[10] = {0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25};
-    Double_t massVetaBins[10], massVetaErrorBins[10], widthVetaBins[10], widthVetaErrorBins[10];
-    for(int binFill=0;binFill<10;binFill++) {
-      // if (m_massVEtaBinHistos[binFill]->GetEntries()>=MinStat) m_massVEtaBinHistos[binFill]->Fit(func,"lmhqn");
-      massVetaBins[binFill] = func->GetParameter(1);
-      massVetaErrorBins[binFill] = func->GetParError(1);
-      widthVetaBins[binFill] = func->GetParameter(2);
-      widthVetaErrorBins[binFill] = func->GetParError(2);
-    }
-    m_massVersusEta = new TH1F("KsMassVersusEta","",10,etaBins);
-    RegisterHisto(al_kshort_mon_average,m_massVersusEta);
-    //    m_massVersusEta->SetErrorOption("s");
-    m_massVersusEta->SetXTitle("#eta");
-    m_massVersusEta->SetYTitle("Mass (Gev / c^{2})");
-    m_massVersusEta->SetMarkerStyle(20);
-    for(int binFill=0;binFill<10;binFill++) {
-      Double_t binContent = massVetaBins[binFill];
-      Double_t binError = massVetaErrorBins[binFill];
-      m_massVersusEta->SetBinContent(binFill+1,binContent);
-      m_massVersusEta->SetBinError(binFill+1,binError);
-    }
-    m_widthVersusEta = new TH1F("KsWidthVersusEta","",10,etaBins);
-    RegisterHisto(al_kshort_mon_average,m_widthVersusEta);
-    //    m_widthVersusEta->SetErrorOption("s");
-    m_widthVersusEta->SetXTitle("#eta");
-    m_widthVersusEta->SetYTitle("Width (Gev / c^{2})");
-    m_widthVersusEta->SetMarkerStyle(20);
-    for(int binFill=0;binFill<10;binFill++) {
-      Double_t binContent = widthVetaBins[binFill];
-      Double_t binError = widthVetaErrorBins[binFill];
-      m_widthVersusEta->SetBinContent(binFill+1,binContent);
-      m_widthVersusEta->SetBinError(binFill+1,binError);
-    }
-    //    m_widthVersusEta = new TGraphErrors(10,etaBins,widthVetaBins,etaErrorBins,widthVetaErrorBins);
-
-//     RegisterHisto(al_kshort_mon_average,m_massVersusEta);
-//     RegisterHisto(al_kshort_mon_average,m_widthVersusEta);
-
-    Double_t phiBins[11] = { (-5.0*myPi / 5) ,
-			     (-4.0*myPi / 5) ,
-			     (-3.0*myPi / 5) ,
-			     (-2.0*myPi / 5) ,
-			     (-1.0*myPi / 5) ,
-			     (0.0*myPi / 5) ,
-			     (1.0*myPi / 5) ,
-			     (2.0*myPi / 5) ,
-			     (3.0*myPi / 5) ,
-			     (4.0*myPi / 5) ,
-			     (5.0*myPi / 5) };
-//     Double_t phiBins[10] = { (-4.5*myPi / 5) ,
-// 			     (-3.5*myPi / 5) ,
-// 			     (-2.5*myPi / 5) ,
-// 			     (-1.5*myPi / 5) ,
-// 			     (-0.5*myPi / 5) ,
-// 			     (0.5*myPi / 5) ,
-// 			     (1.5*myPi / 5) ,
-// 			     (2.5*myPi / 5) ,
-// 			     (3.5*myPi / 5) ,
-// 			     (4.5*myPi / 5) };
-//     Double_t phiErrorBins[10] = {0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5,
-// 				 0.5*myPi/5 };
-    Double_t massVphiBins[10], massVphiErrorBins[10], widthVphiBins[10], widthVphiErrorBins[10];
-    for(int binFill=0;binFill<10;binFill++) {
-      // if (m_massVPhiBinHistos[binFill]->GetEntries()>=MinStat) m_massVPhiBinHistos[binFill]->Fit(func,"lmhqn");
-      massVphiBins[binFill] = func->GetParameter(1);
-      massVphiErrorBins[binFill] = func->GetParError(1);
-      widthVphiBins[binFill] = func->GetParameter(2);
-      widthVphiErrorBins[binFill] = func->GetParError(2);
-    }
-    m_massVersusPhi = new TH1F("KsMassVersusPhi","",10,phiBins);
-    RegisterHisto(al_kshort_mon_average,m_massVersusPhi);
-    //    m_massVersusPhi->SetErrorOption("s");
-    m_massVersusPhi->SetXTitle("#phi");
-    m_massVersusPhi->SetYTitle("Mass (Gev / c^{2})");
-    m_massVersusPhi->SetMarkerStyle(20);
-    for(int binFill=0;binFill<10;binFill++) {
-      Double_t binContent = massVphiBins[binFill];
-      Double_t binError = massVphiErrorBins[binFill];
-      m_massVersusPhi->SetBinContent(binFill+1,binContent);
-      m_massVersusPhi->SetBinError(binFill+1,binError);
-    }
-    //    m_massVersusPhi = new TGraphErrors(10,phiBins,massVphiBins,phiErrorBins,massVphiErrorBins);
-    m_widthVersusPhi = new TH1F("KsWidthVersusPhi","",10,phiBins);
-    RegisterHisto(al_kshort_mon_average,m_widthVersusPhi);
-    //    m_widthVersusPhi->SetErrorOption("s");
-    m_widthVersusPhi->SetXTitle("#phi");
-    m_widthVersusPhi->SetYTitle("Width (Gev / c^{2})");
-    m_widthVersusPhi->SetMarkerStyle(20);
-    for(int binFill=0;binFill<10;binFill++) {
-      Double_t binContent = widthVphiBins[binFill];
-      Double_t binError = widthVphiErrorBins[binFill];
-      m_widthVersusPhi->SetBinContent(binFill+1,binContent);
-      m_widthVersusPhi->SetBinError(binFill+1,binError);
-    }
+    m_defaultTree->Fill();
 
-//     RegisterHisto(al_kshort_mon_average,m_massVersusPhi);
-//     RegisterHisto(al_kshort_mon_average,m_widthVersusPhi);
-
-    Double_t curvatureDiffBins[7] = {-0.0012,-0.0008,-0.0004,0.0000,0.0004,0.0008,0.0012};
-    Double_t massVcurvatureDiffBins[6], massVcurvatureDiffErrorBins[6], widthVcurvatureDiffBins[6], widthVcurvatureDiffErrorBins[6];
-    for(int binFill=0;binFill<6;binFill++) {
-      // if (m_massVCurvatureDiffBinHistos[binFill]->GetEntries()>=MinStat) m_massVCurvatureDiffBinHistos[binFill]->Fit(func,"lmhqn");
-      massVcurvatureDiffBins[binFill] = func->GetParameter(1);
-      massVcurvatureDiffErrorBins[binFill] = func->GetParError(1);
-      widthVcurvatureDiffBins[binFill] = func->GetParameter(2);
-      widthVcurvatureDiffErrorBins[binFill] = func->GetParError(2);
-    }
-    m_massVersusCurvatureDiff = new TH1F("KsMassVersusCurvatureDiff","",6,curvatureDiffBins);
-    RegisterHisto(al_kshort_mon_average,m_massVersusCurvatureDiff);
-    //    m_massVersusCurvatureDiff->SetErrorOption("s");
-    m_massVersusCurvatureDiff->SetXTitle("1/p_{T}(#pi^{+}) - 1/p_{T}(#pi^{-}) [GeV^{-1}]");
-    m_massVersusCurvatureDiff->SetYTitle("Mass (Gev / c^{2})");
-    m_massVersusCurvatureDiff->SetMarkerStyle(20);
-    for(int binFill=0;binFill<6;binFill++) {
-      Double_t binContent = massVcurvatureDiffBins[binFill];
-      Double_t binError = massVcurvatureDiffErrorBins[binFill];
-      m_massVersusCurvatureDiff->SetBinContent(binFill+1,binContent);
-      m_massVersusCurvatureDiff->SetBinError(binFill+1,binError);
-    }
-    m_widthVersusCurvatureDiff = new TH1F("KsWidthVersusCurvatureDiff","",6,curvatureDiffBins);
-    RegisterHisto(al_kshort_mon_average,m_widthVersusCurvatureDiff);
-    //    m_widthVersusCurvatureDiff->SetErrorOption("s");
-    m_widthVersusCurvatureDiff->SetXTitle("1/p_{T}(#pi^{+}) - 1/p_{T}(#pi^{-}) [GeV^{-1}]");
-    m_widthVersusCurvatureDiff->SetYTitle("Width (Gev / c^{2})");
-    m_widthVersusCurvatureDiff->SetMarkerStyle(20);
-    for(int binFill=0;binFill<6;binFill++) {
-      Double_t binContent = widthVcurvatureDiffBins[binFill];
-      Double_t binError = widthVcurvatureDiffErrorBins[binFill];
-      m_widthVersusCurvatureDiff->SetBinContent(binFill+1,binContent);
-      m_widthVersusCurvatureDiff->SetBinError(binFill+1,binError);
-    }
-    //    m_widthVersusCurvatureDiff = new TGraphErrors(10,curvatureDiffBins,widthVcurvatureDiffBins,curvatureDiffErrorBins,widthVcurvatureDiffErrorBins);
   }
-
+  
   return StatusCode::SUCCESS;
-
 }
+
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx
index d844852e09b57c86e66f389716bf5bcffec4152e..b1285cf1686e01bc0fa5a1694842d1bd73ea56a9 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonWenu.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 // **********************************************************************
 // IDPerfMonWenu.cxx
 // AUTHORS: Beate Heinemann, Tobias Golling, Sara Strandberg
@@ -142,10 +138,10 @@ StatusCode IDPerfMonWenu::bookHistograms()
 
 
 
-  if ( newLowStat || newLumiBlock ) {
+  if ( newLowStatFlag() || newLumiBlockFlag() ) {
   }
 
-  if( newRun ) {
+  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
@@ -573,11 +569,11 @@ void IDPerfMonWenu::makeEffHisto(TH1F* h_num, TH1F* h_denom, TH1F* h_eff) {
 StatusCode IDPerfMonWenu::procHistograms()
 {
 
-  if( endOfLowStat || endOfLumiBlock ) {
+  if( endOfLowStatFlag() || endOfLumiBlockFlag() ) {
 
   }
 
-  if( endOfRun ) {
+  if( endOfRunFlag() ) {
 
     // PostProcess Wenu histograms
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx
index 82d5da53ae60f9f3232d2c182775ab0cb55de15e..2c67c6ac86ab4e575267a2757e3c9a3dd81c53a8 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZee.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 // **********************************************************************
 // IDPerfMonZee.cxx
 // AUTHORS: Beate Heinemann, Tobias Golling, Sara Strandberg
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
index 3847be6732864c15db5d2e7f3658e7136e933c99..5c20c7dee9fddb1ecbf71d7d91fa523e9e5d487c 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
@@ -1,6 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
 
 //==================================================================================
 
@@ -38,6 +35,14 @@
 #include "TrkTruthData/TrackTruthCollection.h"
 #include "TrkTruthData/TrackTruthKey.h"
 
+/** needed for IP resolution studies **/
+#include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h"
+#include "InDetBeamSpotService/IBeamCondSvc.h"
+
+#include "TrigDecisionTool/TrigDecisionTool.h"
+#include "TrigDecisionTool/ChainGroup.h"
+
+#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
 
 //==================================================================================
 // Public Methods
@@ -46,55 +51,90 @@ IDPerfMonZmumu::IDPerfMonZmumu(const std::string& name,
   ISvcLocator* pSvcLocator):
   AthAlgorithm(name, pSvcLocator),
   m_isMC(false),
+  m_doRefit(false),
   m_TrackRefitter1(""),
   m_TrackRefitter2(""),
-    m_trackToVertexTool("Reco::TrackToVertex"),
+  m_trackToVertexTool("Reco::TrackToVertex"),
+  m_triggerDecision("Trig::TrigDecisionTool/TrigDecisionTool"),
+  m_selTool( "InDet::InDetTrackSelectionTool/TrackSelectionTool"),
+  m_trackToVertexIPEstimator("Trk::TrackToVertexIPEstimator"),
+  m_beamSpotSvc("BeamCondSvc",name),
+  m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"),
   m_validationMode(true),
-  m_defaultTreeName("DefaultParams"),
-  m_refit1TreeName("Refit1Params"),
-  m_refit2TreeName("Refit2Params"),
+  m_defaultTreeName("Default_InDetTrackParticle"),
+  m_IDTreeName("ID_InDetTrackParticle"),
+  m_refit1TreeName("Refit1_SiAndTRT"),
+  m_refit2TreeName("Refit2_SiOnly"),
   m_truthTreeName("TruthParams"),
   //  m_meStacoTreeName("MEStacoParams"),  //not existent in xAOD anymore
-  m_combStacoTreeName("CombStacoParams"),
+  m_combTreeName("CombinedTrackParticle"),
   m_combMuidTreeName("CombMuidParams"),
   m_ValidationTreeDescription("Small Tree for Zmumu fits"),
   m_defaultTreeFolder("/ZmumuValidation/default"),
+  m_IDTreeFolder("/ZmumuValidation/ID"),
   m_refit1TreeFolder("/ZmumuValidation/refit1"),
   m_refit2TreeFolder("/ZmumuValidation/refit2"),
   m_truthTreeFolder("/ZmumuValidation/truth"),
   //  m_meStacoTreeFolder("/ZmumuValidation/mestaco"),
-  m_combStacoTreeFolder("/ZmumuValidation/combstaco"),
+  m_combTreeFolder("/ZmumuValidation/comb"),
   m_defaultTree(0),
+  m_IDTree(0),
   m_refit1Tree(0),
   m_refit2Tree(0),
   m_truthTree(0),
   //  m_meStacoTree(0),   // not existent in xAOD anymore
-  m_combStacoTree(0),
-  m_combMuidTree(0)
+  m_combTree(0),
+  m_combMuidTree(0),
+  m_doRemoval(true),
+  m_doDebug(false)
 
 {
   // Properties that are set from the python scripts.
 
-
-  declareProperty("triggerChainName", m_sTriggerChainName               );
-  declareProperty("OutputTracksName", m_outputTracksName = "ZmumuTracks");
-  declareProperty("doIsoSelection",   m_doIsoSelection = true           );
-
-  declareProperty("ReFitterTool1",    m_TrackRefitter1, "ToolHandle for track fitter implementation");
-  declareProperty("ReFitterTool2",    m_TrackRefitter2, "ToolHandle for track fitter implementation");
-
-  declareProperty ("TrackToVertexTool", m_trackToVertexTool);
-
-  declareProperty("ValidationMode",   m_validationMode);
-
-  declareProperty("TrackTruthName",     m_truthName="TrackTruthCollection");
-  declareProperty("TrackParticleName",  m_trackParticleName="InDetTrackParticles");
-  //    declareProperty("TrackParticleName",  m_trackParticleName="TruthParticles");
-  //  declareProperty("TrackParticleName",  m_trackParticleName="CombinedMuonTrackParticles");
-
+  declareProperty("UseTrigger"    ,    m_UseTrigger     = false);
+  declareProperty("doIsoSelection",    m_doIsoSelection = true );
+  declareProperty("doIPSelection",     m_doIPSelection = true );
+  declareProperty("isMC",              m_isMC = false);
+  declareProperty("doRefit",           m_doRefit = false);
+  declareProperty("doIPextrToPV"       , m_doIP = false);
+  declareProperty("BeamCondSvc", m_beamSpotSvc);
+  declareProperty ( "Extrapolator", m_extrapolator );
+  declareProperty("MassWindowLow",     m_MassWindowLow = 60.0, "Lower cut in mu+mu- invariant mass" );
+  declareProperty("MassWindowHigh",    m_MassWindowHigh = 120.0, "Upper cut in mu+mu- invariant mass" );
+  declareProperty("OpeningAngle",      m_OpeningAngleCut = 0.2, "Opening angle between the two muons (in radians)");
+  declareProperty("OutputTracksName",  m_outputTracksName = "ZmumuTracks");
+  declareProperty("PtLeadingMuon",     m_LeadingMuonPtCut = 20., "Pt cut on the leading muon");
+  declareProperty("PtSecondMuon",      m_SecondMuonPtCut = 15., "Pt cut on the second muon");
+  declareProperty("ReFitterTool1",     m_TrackRefitter1, "ToolHandle for track fitter implementation");
+  declareProperty("ReFitterTool2",     m_TrackRefitter2, "ToolHandle for track fitter implementation");
+  declareProperty("TrackToVertexTool", m_trackToVertexTool);
+  declareProperty("TrackTruthName",    m_truthName="TrackTruthCollection");
+  declareProperty("TrackParticleName", m_trackParticleName="InDetTrackParticles");
+  declareProperty("triggerChainName",  m_sTriggerChainName               );
+  declareProperty("ValidationMode",    m_validationMode);
   declareProperty("xAODTruthLinkVector",m_truthLinkVecName="xAODTruthLinks");
-
-  declareProperty("isMC",   m_isMC = false);
+  declareProperty("Z0Gap",             m_Z0GapCut = 5.0, "maximum gap between the z0 of both muons (in mm)");
+  declareProperty( "TrackSelectionTool", m_selTool );
+  declareProperty("UseTrackSelectionTool",   m_useTrackSelectionTool = false);
+  declareProperty("TrackToVertexIPEstimator", m_trackToVertexIPEstimator);
+
+
+  declareProperty("defaultTreeFolder", m_defaultTreeFolder );
+  declareProperty("IDTreeFolder", m_IDTreeFolder );
+  
+  declareProperty("refit1TreeFolder", m_refit1TreeFolder );
+  declareProperty("refit2TreeFolder", m_refit2TreeFolder );
+  declareProperty("truthTreeFolder", m_truthTreeFolder );
+  declareProperty("combTreeFolder", m_combTreeFolder );
+  declareProperty("UnbiasVertex", m_doRemoval);
+  
+  declareProperty("DefaultTree", m_defaultTreeName );
+  declareProperty("IDTree", m_IDTreeName );
+  declareProperty("RefitTree",   m_combTreeName );
+  declareProperty("Refit1Tree",  m_refit1TreeName );
+  declareProperty("Refit2Tree",  m_refit2TreeName );
+  
+  return;
 }
 
 
@@ -104,9 +144,11 @@ IDPerfMonZmumu::~IDPerfMonZmumu()
 
 
 
+//==================================================================================
 StatusCode IDPerfMonZmumu::initialize()
 {
 
+
   // Setup the services
   ISvcLocator* pxServiceLocator = serviceLocator();
   if ( pxServiceLocator != NULL ) {
@@ -142,11 +184,27 @@ StatusCode IDPerfMonZmumu::initialize()
     ATH_MSG_INFO("Retrieved tool" << m_trackToVertexTool );
   }
 
+  if(m_useTrackSelectionTool){
+    ATH_CHECK( m_selTool.retrieve() );
+  }
+
+  if (m_doIP) {
+    ATH_MSG_DEBUG("Retrieving tool (trackToVertexIPEstimator)");
+    ATH_CHECK (m_trackToVertexIPEstimator.retrieve());
+  }
 
+  ATH_CHECK( m_beamSpotSvc.retrieve());
+  ATH_CHECK( m_extrapolator.retrieve());
+  
+  m_xZmm.setDebugMode(false);
+
+  m_LooseT2VAssociationTool = std::make_unique<CP::LooseTrackVertexAssociationTool>("Loose");
+  
 
   if( m_defaultTree == 0){
 
-    m_defaultTree = new TTree(m_defaultTreeName.c_str(), m_ValidationTreeDescription.c_str());
+    //m_defaultTree = new TTree((m_trackParticleName+m_defaultTreeName).c_str(), m_ValidationTreeDescription.c_str());
+    m_defaultTree = new TTree((m_defaultTreeName).c_str(), m_ValidationTreeDescription.c_str());
 
     m_defaultTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
     m_defaultTree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
@@ -159,7 +217,6 @@ StatusCode IDPerfMonZmumu::initialize()
     m_defaultTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
     m_defaultTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
     m_defaultTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
-
     m_defaultTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
     m_defaultTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
     m_defaultTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
@@ -167,15 +224,71 @@ StatusCode IDPerfMonZmumu::initialize()
     m_defaultTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
     m_defaultTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
     m_defaultTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+    
+    if(m_doIP){
+
+      m_defaultTree->Branch("Negative_d0_PV",      &m_negative_d0_PV   ,  "Negative_d0_PV/D");
+      m_defaultTree->Branch("Negative_z0_PV",      &m_negative_z0_PV   ,  "Negative_z0_PV/D");
+      m_defaultTree->Branch("Positive_z0_PV",      &m_positive_z0_PV,  "Positive_z0_PV/D");
+      m_defaultTree->Branch("Positive_d0_PV",      &m_positive_d0_PV,  "Positive_d0_PV/D");
+
+      m_defaultTree->Branch("Negative_d0_PVerr",   &m_negative_d0_PVerr,  "Negative_d0_PVerr/D");
+      m_defaultTree->Branch("Negative_z0_PVerr",   &m_negative_z0_PVerr,  "Negative_z0_PVerr/D");
+      m_defaultTree->Branch("Positive_z0_PVerr",   &m_positive_z0_PVerr,  "Positive_z0_PVerr/D");
+      m_defaultTree->Branch("Positive_d0_PVerr",   &m_positive_d0_PVerr,  "Positive_d0_PVerr/D");
+    }
   }
+  
+  
+  if( m_IDTree == 0){
+      
+    m_IDTree = new TTree((m_IDTreeName).c_str(), m_ValidationTreeDescription.c_str());
+    
+    m_IDTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_IDTree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
+    m_IDTree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+
+    m_IDTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_IDTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_IDTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_IDTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_IDTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_IDTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_IDTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+    m_IDTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_IDTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_IDTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_IDTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_IDTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_IDTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_IDTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+    
+    if(m_doIP){
+      
+      m_IDTree->Branch("Negative_d0_PV",      &m_negative_d0_PV   ,  "Negative_d0_PV/D");
+      m_IDTree->Branch("Negative_z0_PV",      &m_negative_z0_PV   ,  "Negative_z0_PV/D");
+      m_IDTree->Branch("Positive_z0_PV",      &m_positive_z0_PV,  "Positive_z0_PV/D");
+      m_IDTree->Branch("Positive_d0_PV",      &m_positive_d0_PV,  "Positive_d0_PV/D");
+      
+      m_IDTree->Branch("Negative_d0_PVerr",   &m_negative_d0_PVerr,  "Negative_d0_PVerr/D");
+      m_IDTree->Branch("Negative_z0_PVerr",   &m_negative_z0_PVerr,  "Negative_z0_PVerr/D");
+      m_IDTree->Branch("Positive_z0_PVerr",   &m_positive_z0_PVerr,  "Positive_z0_PVerr/D");
+      m_IDTree->Branch("Positive_d0_PVerr",   &m_positive_d0_PVerr,  "Positive_d0_PVerr/D");
+    }
+    
 
-  if( m_refit1Tree == 0){
-
-    m_refit1Tree = new TTree(m_refit1TreeName.c_str(), m_ValidationTreeDescription.c_str());
-
+    
+  }
+  
+  if( m_doRefit && m_refit1Tree == 0){
+    
+    // m_refit1Tree = new TTree((m_trackParticleName+m_refit1TreeName).c_str(), m_ValidationTreeDescription.c_str());
+    m_refit1Tree = new TTree((m_refit1TreeName).c_str(), m_ValidationTreeDescription.c_str()); // Salva --> attempt to remove the lon InDetTrackParticles from the tree name 
+    
     m_refit1Tree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
     m_refit1Tree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
     m_refit1Tree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+    m_refit1Tree->Branch("preScale"       ,  &m_triggerPrescale, "preScale/I");
 
     m_refit1Tree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
     m_refit1Tree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
@@ -193,15 +306,32 @@ StatusCode IDPerfMonZmumu::initialize()
     m_refit1Tree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
     m_refit1Tree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
     m_refit1Tree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+
+    if(m_doIP){
+
+      m_refit1Tree->Branch("Negative_d0_PV",      &m_negative_d0_PV   ,  "Negative_d0_PV/D");
+      m_refit1Tree->Branch("Negative_z0_PV",      &m_negative_z0_PV   ,  "Negative_z0_PV/D");
+      m_refit1Tree->Branch("Positive_z0_PV",      &m_positive_z0_PV,     "Positive_z0_PV/D");
+      m_refit1Tree->Branch("Positive_d0_PV",      &m_positive_d0_PV,     "Positive_d0_PV/D");
+      
+      m_refit1Tree->Branch("Negative_d0_PVerr",      &m_negative_d0_PVerr   ,  "Negative_d0_PVerr/D");
+      m_refit1Tree->Branch("Negative_z0_PVerr",      &m_negative_z0_PVerr   ,  "Negative_z0_PVerr/D");
+      m_refit1Tree->Branch("Positive_z0_PVerr",     &m_positive_z0_PVerr,     "Positive_z0_PVerr/D");
+      m_refit1Tree->Branch("Positive_d0_PVerr",     &m_positive_d0_PVerr,     "Positive_d0_PVerr/D");
+    }
+    
+
   }
 
-  if( m_refit2Tree == 0){
+  if( m_doRefit && m_refit2Tree == 0){
 
-    m_refit2Tree = new TTree(m_refit2TreeName.c_str(), m_ValidationTreeDescription.c_str());
+    //m_refit2Tree = new TTree((m_trackParticleName+m_refit2TreeName).c_str(), m_ValidationTreeDescription.c_str());
+    m_refit2Tree = new TTree((m_refit2TreeName).c_str(), m_ValidationTreeDescription.c_str());
 
     m_refit2Tree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
     m_refit2Tree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
     m_refit2Tree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+    m_refit2Tree->Branch("preScale"       ,  &m_triggerPrescale, "preScale/I");
 
     m_refit2Tree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
     m_refit2Tree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
@@ -220,8 +350,26 @@ StatusCode IDPerfMonZmumu::initialize()
     m_refit2Tree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
     m_refit2Tree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
     m_refit2Tree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
-   }
 
+
+    if(m_doIP){
+      m_refit2Tree->Branch("Negative_d0_PV",      &m_negative_d0_PV   ,  "Negative_d0_PV/D");
+      m_refit2Tree->Branch("Negative_z0_PV",      &m_negative_z0_PV   ,  "Negative_z0_PV/D");
+      m_refit2Tree->Branch("Positive_d0_PV",      &m_positive_d0_PV   ,  "Positive_d0_PV/D");
+      m_refit2Tree->Branch("Positive_z0_PV",      &m_positive_z0_PV   ,  "Positive_z0_PV/D");
+      
+      
+      m_refit2Tree->Branch("Negative_z0_PVerr",  &m_negative_z0_PVerr,  "Negative_z0_PVerr/D");
+      m_refit2Tree->Branch("Negative_d0_PVerr",  &m_negative_d0_PVerr,  "Negative_d0_PVerr/D");
+      m_refit2Tree->Branch("Positive_z0_PVerr",  &m_positive_z0_PVerr,  "Positive_z0_PVerr/D");
+      m_refit2Tree->Branch("Positive_d0_PVerr",  &m_positive_d0_PVerr,  "Positive_d0_PVerr/D");
+    }
+
+
+
+    
+  }
+  
   //  if( m_meStacoTree == 0){
 
   //m_meStacoTree = new TTree(m_meStacoTreeName.c_str(), m_ValidationTreeDescription.c_str());
@@ -229,6 +377,7 @@ StatusCode IDPerfMonZmumu::initialize()
   //m_meStacoTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
   //m_meStacoTree->Branch("eventNumber"    ,  &m_evtNumber,  "eventNumber/I");
   //m_meStacoTree->Branch("lumi_block"     ,  &m_lumi_block,  "lumi_block/I");
+  //m_meStacoTree->Branch("preScale"       ,  &m_triggerPrescale, "preScale/I");
 
   //m_meStacoTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
   //m_meStacoTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
@@ -243,41 +392,57 @@ StatusCode IDPerfMonZmumu::initialize()
   //m_meStacoTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
   //}
 
-  if( m_combStacoTree == 0){
-
-    m_combStacoTree = new TTree(m_combStacoTreeName.c_str(), m_ValidationTreeDescription.c_str());
-
-    m_combStacoTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
-    m_combStacoTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
-    m_combStacoTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
-
-    m_combStacoTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
-    m_combStacoTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
-    m_combStacoTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
-    m_combStacoTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
-    m_combStacoTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
-    m_combStacoTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
-    m_combStacoTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
-
-
-    m_combStacoTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
-    m_combStacoTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
-    m_combStacoTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
-    m_combStacoTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
-    m_combStacoTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
-    m_combStacoTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
-    m_combStacoTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+  if( m_combTree == 0){
+
+    //m_combTree = new TTree((m_trackParticleName+m_combTreeName).c_str(), m_ValidationTreeDescription.c_str());
+    m_combTree = new TTree((m_combTreeName).c_str(), m_ValidationTreeDescription.c_str());
+
+    m_combTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
+    m_combTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
+    m_combTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
+    m_combTree->Branch("preScale"       ,  &m_triggerPrescale, "preScale/I");
+
+    m_combTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
+    m_combTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
+    m_combTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
+    m_combTree->Branch("Negative_z0",  &m_negative_z0,  "Negative_z0/D");
+    m_combTree->Branch("Negative_d0",  &m_negative_d0,  "Negative_d0/D");
+    m_combTree->Branch("Negative_z0_err",  &m_negative_z0_err,  "Negative_z0_err/D");
+    m_combTree->Branch("Negative_d0_err",  &m_negative_d0_err,  "Negative_d0_err/D");
+
+
+    m_combTree->Branch("Positive_Px",  &m_positive_px,  "Positive_Px/D");
+    m_combTree->Branch("Positive_Py",  &m_positive_py,  "Positive_Py/D");
+    m_combTree->Branch("Positive_Pz",  &m_positive_pz,  "Positive_Pz/D");
+    m_combTree->Branch("Positive_z0",  &m_positive_z0,  "Positive_z0/D");
+    m_combTree->Branch("Positive_d0",  &m_positive_d0,  "Positive_d0/D");
+    m_combTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
+    m_combTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
+    
+    if(m_doIP){
+
+      m_combTree->Branch("Negative_z0_PV",  &m_negative_z0_PV,  "Negative_z0_PV/D");
+      m_combTree->Branch("Negative_d0_PV",  &m_negative_d0_PV,  "Negative_d0_PV/D");
+      m_combTree->Branch("Positive_z0_PV",  &m_positive_z0_PV,  "Positive_z0_PV/D");
+      m_combTree->Branch("Positive_d0_PV",  &m_positive_d0_PV,  "Positive_d0_PV/D");
+
+      m_combTree->Branch("Negative_z0_PVerr",  &m_negative_z0_PVerr,  "Negative_z0_PVerr/D");
+      m_combTree->Branch("Negative_d0_PVerr",  &m_negative_d0_PVerr,  "Negative_d0_PVerr/D");
+      m_combTree->Branch("Positive_z0_PVerr",  &m_positive_z0_PVerr,  "Positive_z0_PVerr/D");
+      m_combTree->Branch("Positive_d0_PVerr",  &m_positive_d0_PVerr,  "Positive_d0_PVerr/D");
+    }
   }
 
-
-  if( m_combMuidTree == 0){
+  
+  if( m_doRefit && m_combMuidTree == 0){
 
     m_combMuidTree = new TTree(m_combMuidTreeName.c_str(), m_ValidationTreeDescription.c_str());
 
     m_combMuidTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
     m_combMuidTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
     m_combMuidTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
-
+    m_combMuidTree->Branch("preScale"       ,  &m_triggerPrescale, "preScale/I");
+    
     m_combMuidTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
     m_combMuidTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
     m_combMuidTree->Branch("Negative_Pz",  &m_negative_pz,  "Negative_Pz/D");
@@ -304,6 +469,7 @@ StatusCode IDPerfMonZmumu::initialize()
     m_truthTree->Branch("runNumber"      ,  &m_runNumber,  "runNumber/I");
     m_truthTree->Branch("eventNumber"      ,  &m_evtNumber,  "eventNumber/I");
     m_truthTree->Branch("lumi_block"      ,  &m_lumi_block,  "lumi_block/I");
+    m_truthTree->Branch("preScale"       ,  &m_triggerPrescale, "preScale/I");
 
     m_truthTree->Branch("Negative_Px",  &m_negative_px,  "Negative_Px/D");
     m_truthTree->Branch("Negative_Py",  &m_negative_py,  "Negative_Py/D");
@@ -321,49 +487,52 @@ StatusCode IDPerfMonZmumu::initialize()
     m_truthTree->Branch("Positive_z0_err",  &m_positive_z0_err,  "Positive_z0_err/D");
     m_truthTree->Branch("Positive_d0_err",  &m_positive_d0_err,  "Positive_d0_err/D");
   }
-
-    // now register the Trees
+  
+  // now register the Trees
   ITHistSvc* tHistSvc = 0;
   if (service("THistSvc",tHistSvc).isFailure()){
     ATH_MSG_ERROR("initialize() Could not find Hist Service -> Switching ValidationMode Off !");
     m_validationMode = false;
   }
-
+  
   if ((tHistSvc->regTree(m_defaultTreeFolder, m_defaultTree)).isFailure() ) {
     ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
     delete m_defaultTree; m_defaultTree = 0;
     m_validationMode = false;
   }
-
-  if ((tHistSvc->regTree(m_refit1TreeFolder, m_refit1Tree)).isFailure() ) {
+  
+  if ((tHistSvc->regTree(m_IDTreeFolder, m_IDTree)).isFailure() ) {
     ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
-    delete m_refit1Tree; m_refit1Tree = 0;
+    delete m_IDTree; m_IDTree = 0;
     m_validationMode = false;
   }
-  if ((tHistSvc->regTree(m_refit2TreeFolder, m_refit2Tree)).isFailure() ) {
+
+  if ((tHistSvc->regTree(m_combTreeFolder, m_combTree)).isFailure() ) {
     ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
-    delete m_refit2Tree; m_refit2Tree = 0;
+    delete m_combTree; m_combTree = 0;
     m_validationMode = false;
   }
 
-  //  if ((tHistSvc->regTree(m_meStacoTreeFolder, m_meStacoTree)).isFailure() ) {
-  //ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
-  //delete m_meStacoTree; m_meStacoTree = 0;
-  //m_validationMode = false;
-  //}
+  if( m_doRefit ){
 
-  if ((tHistSvc->regTree(m_combStacoTreeFolder, m_combStacoTree)).isFailure() ) {
-    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
-    delete m_combStacoTree; m_combStacoTree = 0;
-    m_validationMode = false;
-  }
+    if ((tHistSvc->regTree(m_refit1TreeFolder, m_refit1Tree)).isFailure() ) {
+      ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+      delete m_refit1Tree; m_refit1Tree = 0;
+      m_validationMode = false;
+    }
+    if ((tHistSvc->regTree(m_refit2TreeFolder, m_refit2Tree)).isFailure() ) {
+      ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+      delete m_refit2Tree; m_refit2Tree = 0;
+      m_validationMode = false;
+    }
 
-  if ((tHistSvc->regTree(m_combMuidTreeFolder, m_combMuidTree)).isFailure() ) {
-    ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
-    delete m_combMuidTree; m_combMuidTree = 0;
-    m_validationMode = false;
-  }
+    if ((tHistSvc->regTree(m_combMuidTreeFolder, m_combMuidTree)).isFailure() ) {
+      ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
+      delete m_combMuidTree; m_combMuidTree = 0;
+      m_validationMode = false;
+    }
 
+  }
   if (m_isMC) {
   if ((tHistSvc->regTree(m_truthTreeFolder, m_truthTree)).isFailure() ) {
     ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
@@ -376,12 +545,14 @@ StatusCode IDPerfMonZmumu::initialize()
 }
 
 
+//==================================================================================
 void IDPerfMonZmumu::RegisterHistograms()
 {
   return;
 }
 
 
+//==================================================================================
 StatusCode IDPerfMonZmumu::execute()
 {
 
@@ -394,251 +565,499 @@ StatusCode IDPerfMonZmumu::execute()
     m_runNumber = eventInfo->event_ID()->run_number();
     m_evtNumber = eventInfo->event_ID()->event_number();
     m_lumi_block = eventInfo->event_ID()->lumi_block();
+    ATH_MSG_DEBUG(" Execute() starting on --> Run: " << m_runNumber << "  event: " << m_evtNumber);
   }
 
+  //
   //Fill Staco muon parameters only
   m_xZmm.setContainer(PerfMonServices::MUON_COLLECTION);
-  //  m_xZmm.Reco();
+  m_xZmm.doIsoSelection(m_doIsoSelection);
+  m_xZmm.doIPSelection(m_doIPSelection);
+  m_xZmm.SetMassWindowLow(m_MassWindowLow);
+  m_xZmm.SetMassWindowHigh(m_MassWindowHigh);
+  m_xZmm.SetLeadingMuonPtCut(m_LeadingMuonPtCut);
+  m_xZmm.SetSecondMuonPtCut(m_SecondMuonPtCut);
+  m_xZmm.SetOpeningAngleCut(m_OpeningAngleCut);
+  m_xZmm.SetZ0GapCut(m_Z0GapCut);
+
+  // check if the muon-pair passed the resonance selection cuts:
   if(!m_xZmm.Reco()){
     //failed reconstruction
+    ATH_MSG_DEBUG("Failed dimuon reconstruction. m_xZmm.Reco() returned FALSE (actually returning SUCCESS)");
+    return StatusCode::SUCCESS;
+  }
+  ATH_MSG_INFO("Sucessfull dimuon reconstruction. Invariant mass = " << m_xZmm.GetInvMass() << " GeV ");
+
+  // reached this point there is a good mu+mu- pair that stisfies all selection cuts
+
+
+  if (m_UseTrigger)
+    {
+      bool isTriggerPassed = CheckTriggerStatusAndPrescale ();
+      if (isTriggerPassed) {
+	ATH_MSG_INFO("Trigger passed -> accept event");
+      }
+      else{
+	ATH_MSG_INFO("Trigger Failed -> reject event --> leave event");
+	return StatusCode::SUCCESS;
+      }
+    }
+
+
+  // std::cout << " ** IDPerfMonZmumu ** extracting muon_pos and muon_neg... " << std::endl;
+  const xAOD::Muon* muon_pos = m_xZmm.getCombMuon(m_xZmm.getPosMuon(ZmumuEvent::CB));
+  const xAOD::Muon* muon_neg = m_xZmm.getCombMuon(m_xZmm.getNegMuon(ZmumuEvent::CB));
+
+  //std::cout << "  ** IDPerfMonZmumu ** muon_pos(CB) = " << muon_pos << std::endl;
+  //std::cout << "                       muon_neg(CB) = " << muon_neg << std::endl;
+  const xAOD::TrackParticle* p1_comb; const xAOD::Vertex* p1_comb_v;
+  const xAOD::TrackParticle* p2_comb; const xAOD::Vertex* p2_comb_v;
+  
+  
+  //To protect against failures of the estimation
+  bool success_pos =false;
+  bool success_neg =false;
+
+  
+  if (muon_pos && muon_neg) { // if both combined muons exist and were retrieved
+    
+    if (m_trackParticleName.find("InDetTrackParticles") != std::string::npos)
+      {
+	ATH_MSG_INFO("Selecting InDetTrackParticles");
+	p1_comb = muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+	p1_comb_v = p1_comb->vertex();
+	p2_comb = muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+	p2_comb_v = p2_comb->vertex();
+	
+	if (!p1_comb || !p2_comb)
+	  {
+	    ATH_MSG_WARNING("Requested InnerDetectorTrackParticles but not present in the input file. Exiting event..");
+	    return StatusCode::SUCCESS;
+	  }
+      }
+    else {
+      ATH_MSG_INFO("Selecting CombinedTrackParticles");
+      // std::cout << "  ** IDPerfMonZmumu ** retrieving combined muons from  muon_pos and muon_neg (ZmumuEvent::CB) " << std::endl;
+      p1_comb = muon_pos->trackParticle(xAOD::Muon::CombinedTrackParticle);
+      p1_comb_v = muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle) ? (muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle))->vertex() : p1_comb->vertex();  // I'm afraid CB track has always NULL vertex
+      p2_comb = muon_neg->trackParticle(xAOD::Muon::CombinedTrackParticle);
+      p2_comb_v = muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle) ? (muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle))->vertex() : p2_comb->vertex();  // I'm afraid CB track has always NULL vertex
+      
+      if (!p1_comb || !p2_comb){
+	ATH_MSG_WARNING("Requested CombinedTrackParticles but not present in the input file. Exiting event");
+	return StatusCode::SUCCESS;
+      }
+      if (m_doDebug) std::cout << " -- Salva (start) -- p1_comb and p2_comb not null :)" << std::endl; 
+
+      
+      //This is hiding things under the rug
+      // in case the combined muons couldn't be retrieved try with the ID part
+      // std::cout << "  ** IDPerfMonZmumu ** retrieving ID muons with (ZmumuEvent::ID) " << std::endl;
+      //p1_comb = m_xZmm.getIDTrack(m_xZmm.getPosMuon(ZmumuEvent::ID));
+      //p1_comb_v = p1_comb->vertex();
+      //p2_comb = m_xZmm.getIDTrack(m_xZmm.getNegMuon(ZmumuEvent::ID));
+      //p2_comb_v = p2_comb->vertex();
+      
+    }
+  }
+  else {
+    ATH_MSG_WARNING("Could not find pos/neg muons");
     return StatusCode::SUCCESS;
   }
-    const xAOD::Muon* muon_pos = m_xZmm.getCombMuon(m_xZmm.getPosMuon(ZmumuEvent::CB));
-    const xAOD::Muon* muon_neg = m_xZmm.getCombMuon(m_xZmm.getNegMuon(ZmumuEvent::CB));
-    const xAOD::TrackParticle* p1_comb = muon_pos->trackParticle(xAOD::Muon::CombinedTrackParticle);
-    const xAOD::TrackParticle* p2_comb = muon_neg->trackParticle(xAOD::Muon::CombinedTrackParticle);
   if ( m_xZmm.EventPassed() ) {
+    ATH_MSG_DEBUG("Accepted muon pair. Going to fill combined Staco parameters ");
     //fill Combined Staco parameters
     if (!muon_pos || !muon_neg) {
       ATH_MSG_WARNING("CB Staco Muons missing!");
-    } else {
+    } 
+    else {
       //       FillRecParameters(muon_pos->combinedMuonTrackParticle()->originalTrack(), muon_pos->combinedMuonTrackParticle()->charge());
       //       FillRecParameters(muon_neg->combinedMuonTrackParticle()->originalTrack(), muon_neg->combinedMuonTrackParticle()->charge());
-      FillRecParameters(p1_comb->track(), p1_comb->charge());
-      FillRecParameters(p2_comb->track(), p2_comb->charge());
-      m_combStacoTree->Fill();
+      
+      if (m_useTrackSelectionTool) {
+	if ( !m_selTool->accept(muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)) ||
+	     !m_selTool->accept(muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)) ) {
+	  ATH_MSG_DEBUG("Exiting because the muons don't pass the TrackSelection");
+	  return StatusCode::SUCCESS;
+	}	
+      }
+      
+      
+      ATH_MSG_DEBUG("######### >> before fill rec with default << #########");
+      
+      //success_pos = FillRecParametersTP(muon_pos->trackParticle(xAOD::Muon::CombinedTrackParticle), muon_pos->trackParticle(xAOD::Muon::CombinedTrackParticle)->charge());
+      //success_neg = FillRecParametersTP(muon_neg->trackParticle(xAOD::Muon::CombinedTrackParticle), muon_neg->trackParticle(xAOD::Muon::CombinedTrackParticle)->charge());
+      
+      success_pos = FillRecParametersTP(muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->charge(),muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->vertex());
+      success_neg = FillRecParametersTP(muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->charge(),muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->vertex());
+      if (success_pos && success_neg) m_IDTree->Fill();
+
+      
+      success_pos = FillRecParametersTP(p1_comb, muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p1_comb->charge(),p1_comb_v);
+      success_neg = FillRecParametersTP(p2_comb, muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p2_comb->charge(),p2_comb_v);
+      if (success_pos && success_neg) m_defaultTree->Fill();
+      
+      // combined muons
+      success_pos = FillRecParameters(p1_comb->track(),muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p1_comb->charge(),p1_comb_v);
+      success_neg = FillRecParameters(p2_comb->track(),muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p2_comb->charge(),p2_comb_v);
+      
+      if (success_pos && success_neg) m_combTree->Fill();
     }
-
   }
 
-
-  //Now use MUID collection to find ID tracks
-  //m_xZmm.setContainer(PerfMonServices::MUID_COLLECTION);
-  //m_xZmm.Reco();
-
+  // no good muon pair found, leave and continue
   if ( !m_xZmm.EventPassed() ) {
     //failed cuts, continue to next event
+    ATH_MSG_DEBUG ("No good muon pair found. Leaving Execute(). Run: " << m_runNumber << "  event: " << m_evtNumber);
     return StatusCode::SUCCESS;
   }
-  //const std::string region = m_xZmm.getRegion();
-  //  const xAOD::TrackParticle* p1 = m_xZmm.getIDTrack(m_xZmm.getPosMuon(ZmumuEvent::ID));
-  //  const xAOD::TrackParticle* p2 = m_xZmm.getIDTrack(m_xZmm.getNegMuon(ZmumuEvent::ID));
-  TrackCollection* muonTrks  = new TrackCollection(SG::OWN_ELEMENTS);
-  TrackCollection* muonTrksRefit1  = new TrackCollection(SG::OWN_ELEMENTS);
-  TrackCollection* muonTrksRefit2  = new TrackCollection(SG::OWN_ELEMENTS);
+
+  
+  //fill truth first in case no truth match found
+  if (m_isMC) {
+    if (FillTruthParameters(p1_comb).isFailure()){
+      ATH_MSG_WARNING("Failed to fill truth parameters - skipping event");
+      return StatusCode::SUCCESS;
+    }
+    if (FillTruthParameters(p2_comb).isFailure()){
+      ATH_MSG_WARNING("Failed to fill truth parameters - skipping event");
+      return StatusCode::SUCCESS;
+    }
+    ATH_MSG_DEBUG("fill truthTree with parameters : ");
+    ATH_MSG_DEBUG("######   (negative)   ########## ");
+    ATH_MSG_DEBUG("Negative px: " << m_negative_px << "\n"
+		  << "Negative py: " << m_negative_py << "\n"
+		  << "Negative pz: " << m_negative_pz << "\n"
+		  << "Negative d0: " << m_negative_d0 << "\n"
+		  << "Negative z0: " << m_negative_z0 << "\n");
+    
+    
+    ATH_MSG_DEBUG("######   (positive)   ########## ");
+    ATH_MSG_DEBUG( "Positive px: " << m_positive_px << "\n"
+		   << "Positive py: " << m_positive_py << "\n"
+		   << "Positive pz: " << m_positive_pz << "\n"
+		   << "Positive d0: " << m_positive_d0 << "\n"
+		   << "Positive z0: " << m_positive_z0 << "\n");
+    
+    m_truthTree->Fill();
+  } // if (m_isMC)
+
 
   // changed refitting to combinedparticles since run II DESDM_ZMUMU did not store InDetTrackParticles
   if (!p1_comb->track() || !p2_comb->track()) {
-     ATH_MSG_WARNING("Track missing!  Skipping Event");
+     ATH_MSG_WARNING("Track missing!  p1_comb->track() or p2_comb->track()  ** Skipping Event Run: " << m_runNumber << "  event: " << m_evtNumber);
      return StatusCode::SUCCESS;
   }
 
 
-  Trk::Track* defaultMuonTrk1 = 0;
-  Trk::Track* defaultMuonTrk2 = 0;
-  Trk::Track* refit1MuonTrk1 = 0;
-  Trk::Track* refit2MuonTrk1 = 0;
-  Trk::Track* refit1MuonTrk2 = 0;
-  Trk::Track* refit2MuonTrk2 = 0;
+  if( m_doRefit ){
+    ATH_MSG_DEBUG("Going to build TrackCollections: muonTrks, muonTrksRefit1 and muonTrksRefit2");
+    TrackCollection* muonTrks  = new TrackCollection(SG::OWN_ELEMENTS);
+    TrackCollection* muonTrksRefit1  = new TrackCollection(SG::OWN_ELEMENTS);
+    TrackCollection* muonTrksRefit2  = new TrackCollection(SG::OWN_ELEMENTS);
+
+
+    ATH_MSG_DEBUG(" Going to refit and store the track parameters ");
+    Trk::Track* defaultMuonTrk1 = 0;
+    Trk::Track* defaultMuonTrk2 = 0;
+    Trk::Track* refit1MuonTrk1 = 0;
+    Trk::Track* refit2MuonTrk1 = 0;
+    Trk::Track* refit1MuonTrk2 = 0;
+    Trk::Track* refit2MuonTrk2 = 0;
+
+    const xAOD::Electron* egam = 0;
+
+    StatusCode fitStatus;
+    //save default and refit track parameters
+    if( p1_comb->track() ) {
+      defaultMuonTrk1 = new Trk::Track(*p1_comb->track());
+
+      fitStatus = m_TrackRefitter1->refitTrack( p1_comb->track(),egam );
+      if (fitStatus.isFailure()) {
+	ATH_MSG_DEBUG("Track Refit1 Failed. Skipping Event");
+	return StatusCode::SUCCESS;
+      } else {
+	refit1MuonTrk1 = m_TrackRefitter1->refittedTrack();
+	muonTrksRefit1->push_back(refit1MuonTrk1);
+	ATH_MSG_DEBUG("Successfully refitted (1) track");
+      }
 
-  const xAOD::Electron* egam = 0;
 
-  StatusCode fitStatus;
-  //save default and refit track parameters
-  if( p1_comb->track() ) {
-    defaultMuonTrk1 = new Trk::Track(*p1_comb->track());
+      fitStatus = m_TrackRefitter2->refitTrack( p1_comb->track(),egam );
+      if (fitStatus.isFailure()) {
+	ATH_MSG_DEBUG("Track Refit2 Failed. Skipping Event");
+	return StatusCode::SUCCESS;
+      } else {
+	refit2MuonTrk1 = m_TrackRefitter2->refittedTrack();
+	muonTrksRefit2->push_back(refit2MuonTrk1);
+	ATH_MSG_DEBUG("Successfully refitted (2) track");
+      }
 
-    fitStatus = m_TrackRefitter1->refitTrack( p1_comb->track(),egam );
-    if (fitStatus.isFailure()) {
-       ATH_MSG_DEBUG("Track Refit1 Failed. Skipping Event");
-       return StatusCode::SUCCESS;
-    } else {
-      refit1MuonTrk1 = m_TrackRefitter1->refittedTrack();
-      muonTrksRefit1->push_back(refit1MuonTrk1);
-      ATH_MSG_DEBUG("Successfully refitted (1) track");
     }
 
+    if( p2_comb->track() ) {
+      defaultMuonTrk2 = new Trk::Track(*p2_comb->track());
+
+      fitStatus = m_TrackRefitter1->refitTrack( p2_comb->track(),egam );
+      if (fitStatus.isFailure()) {
+	ATH_MSG_DEBUG("Track Refit1 Failed. Skipping Event");
+	return StatusCode::SUCCESS;
+      } else {
+	refit1MuonTrk2 = m_TrackRefitter1->refittedTrack();
+	muonTrksRefit1->push_back(refit1MuonTrk2);
+	ATH_MSG_DEBUG("Successfully refitted (1) track");
+      }
+
 
-    fitStatus = m_TrackRefitter2->refitTrack( p1_comb->track(),egam );
-    if (fitStatus.isFailure()) {
-      ATH_MSG_DEBUG("Track Refit2 Failed. Skipping Event");
-      return StatusCode::SUCCESS;
-    } else {
-      refit2MuonTrk1 = m_TrackRefitter2->refittedTrack();
-      muonTrksRefit2->push_back(refit2MuonTrk1);
-      ATH_MSG_DEBUG("Successfully refitted (2) track");
+      fitStatus = m_TrackRefitter2->refitTrack( p2_comb->track(),egam );
+      if (fitStatus.isFailure()) {
+	ATH_MSG_DEBUG("Track Refit2 Failed. Skipping Event");
+	return StatusCode::SUCCESS;
+      } else {
+	refit2MuonTrk2 = m_TrackRefitter2->refittedTrack();
+	muonTrksRefit2->push_back(refit2MuonTrk2);
+	ATH_MSG_DEBUG("Successfully refitted (2) track");
+      }
     }
 
-  }
+    //save tracks to storegrate	/
+    muonTrks->push_back(defaultMuonTrk1);
+    muonTrks->push_back(defaultMuonTrk2);
 
-  if( p2_comb->track() ) {
-    defaultMuonTrk2 = new Trk::Track(*p2_comb->track());
+    StatusCode sc = evtStore()->record(muonTrks, m_outputTracksName);
+    if (sc.isFailure()) {
+      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName << endreq;
+    }
+    else{
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrks->size() << " " << m_outputTracksName <<" into StoreGate" << endreq;
+    }
 
-    fitStatus = m_TrackRefitter1->refitTrack( p2_comb->track(),egam );
-    if (fitStatus.isFailure()) {
-      ATH_MSG_DEBUG("Track Refit1 Failed. Skipping Event");
-      return StatusCode::SUCCESS;
+    sc = evtStore()->record(muonTrksRefit1, m_outputTracksName + "Refit1");
+    if (sc.isFailure()) {
+      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName + "Refit1" << endreq;
     } else {
-      refit1MuonTrk2 = m_TrackRefitter1->refittedTrack();
-      muonTrksRefit1->push_back(refit1MuonTrk2);
-      ATH_MSG_DEBUG("Successfully refitted (1) track");
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrksRefit1->size() << " " << m_outputTracksName  + "Refit1" <<" into StoreGate" << endreq;
     }
 
-
-    fitStatus = m_TrackRefitter2->refitTrack( p2_comb->track(),egam );
-    if (fitStatus.isFailure()) {
-      ATH_MSG_DEBUG("Track Refit2 Failed. Skipping Event");
-      return StatusCode::SUCCESS;
+    sc = evtStore()->record(muonTrksRefit2, m_outputTracksName + "Refit2");
+    if (sc.isFailure()) {
+      if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName +"Refit2" << endreq;
     } else {
-      refit2MuonTrk2 = m_TrackRefitter2->refittedTrack();
-      muonTrksRefit2->push_back(refit2MuonTrk2);
-      ATH_MSG_DEBUG("Successfully refitted (2) track");
+      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrksRefit2->size() << " " << m_outputTracksName + "Refit2" <<" into StoreGate" << endreq;
     }
-  }
 
-  //save tracks to storegrate	/
-  muonTrks->push_back(defaultMuonTrk1);
-  muonTrks->push_back(defaultMuonTrk2);
 
-  StatusCode sc = evtStore()->record(muonTrks, m_outputTracksName, false);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName << endreq;
-  }
-  else{
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrks->size() << " " << m_outputTracksName <<" into StoreGate" << endreq;
-  }
 
-  sc = evtStore()->record(muonTrksRefit1, m_outputTracksName + "Refit1", false);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName + "Refit1" << endreq;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrksRefit1->size() << " " << m_outputTracksName  + "Refit1" <<" into StoreGate" << endreq;
-	}
-
-  sc = evtStore()->record(muonTrksRefit2, m_outputTracksName + "Refit2", false);
-  if (sc.isFailure()) {
-    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed storing " << m_outputTracksName +"Refit2" << endreq;
-  } else {
-    if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Stored "<< muonTrksRefit2->size() << " " << m_outputTracksName + "Refit2" <<" into StoreGate" << endreq;
-  }
-
-  //fill truth first in case no truth match found
-  if (m_isMC) {
-
-     if (FillTruthParameters(p1_comb).isFailure()){
-	ATH_MSG_WARNING("Failed to fill truth parameters - skipping event");
-  	return StatusCode::SUCCESS;
-     }
-     if (FillTruthParameters(p2_comb).isFailure()){
-	ATH_MSG_WARNING("Failed to fill truth parameters - skipping event");
-  	return StatusCode::SUCCESS;
-     }
-     ATH_MSG_DEBUG("fill truthTree with parameters : ");
-     ATH_MSG_DEBUG("######   (negative)   ########## ");
-     ATH_MSG_DEBUG("Negative px: " << m_negative_px << "\n"
-	       << "Negative py: " << m_negative_py << "\n"
-	       << "Negative pz: " << m_negative_pz << "\n"
-	       << "Negative d0: " << m_negative_d0 << "\n"
-	       << "Negative z0: " << m_negative_z0 << "\n");
-
-
-     ATH_MSG_DEBUG("######   (positive)   ########## ");
-     ATH_MSG_DEBUG( "Positive px: " << m_positive_px << "\n"
-		    << "Positive py: " << m_positive_py << "\n"
-		    << "Positive pz: " << m_positive_pz << "\n"
-		    << "Positive d0: " << m_positive_d0 << "\n"
-		    << "Positive z0: " << m_positive_z0 << "\n");
-
-     m_truthTree->Fill();
-  }
-
-  //fill default ID parameters
-  if (muonTrks->size()<2){
+    /* (SH) always fill the InDetTrackParticles on the default tree using the trackparticles directly
+    //fill default ID parameters
+    if (muonTrks->size()<2){
     ATH_MSG_WARNING("Default muon tracks are missing!");
-  }else{
+    }else{
+    ATH_MSG_INFO("-- >> going to fill default ");
     FillRecParameters(defaultMuonTrk1, p1_comb->charge());
     FillRecParameters(defaultMuonTrk2, p2_comb->charge());
     m_defaultTree->Fill();
-  }
-  //fill refit1 ID parameters
-  if (muonTrksRefit1->size()<2) {
-    ATH_MSG_WARNING("Refit1 muon tracks are missing!");
-  }else{
-    FillRecParameters(refit1MuonTrk1, p1_comb->charge());
-    FillRecParameters(refit1MuonTrk2, p2_comb->charge());
+    }
+
+    */
+
+    
+    //fill refit1 ID parameters
+    if (muonTrksRefit1->size()<2) {
+      ATH_MSG_WARNING("Refit1 muon tracks are missing!");
+    }
+    else{
+  
+      ATH_MSG_DEBUG("-- >> going to fill refit1params << -- ");
+      success_pos = FillRecParameters(refit1MuonTrk1, muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p1_comb->charge(),p1_comb_v);
+      success_neg = FillRecParameters(refit1MuonTrk2, muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p2_comb->charge(),p2_comb_v);
+
+
+      ATH_MSG_DEBUG("fill refit1Tree with parameters : ");
+      ATH_MSG_DEBUG("######   (negative)   ########## ");
+      ATH_MSG_DEBUG("Negative px: " << m_negative_px << "\n"
+		    << "Negative py: " << m_negative_py << "\n"
+		    << "Negative pz: " << m_negative_pz << "\n"
+		    << "Negative d0: " << m_negative_d0 << "\n"
+		    << "Negative z0: " << m_negative_z0 << "\n");
+
+      ATH_MSG_DEBUG("######   (positive)   ########## ");
+      ATH_MSG_DEBUG( "Positive px: " << m_positive_px << "\n"
+		     << "Positive py: " << m_positive_py << "\n"
+		     << "Positive pz: " << m_positive_pz << "\n"
+		     << "Positive d0: " << m_positive_d0 << "\n"
+		     << "Positive z0: " << m_positive_z0 << "\n");
+      if (success_pos && success_neg)
+	m_refit1Tree->Fill();
+    }
+    //fill refit2 ID parameters
 
-  ATH_MSG_DEBUG("fill refit1Tree with parameters : ");
-  ATH_MSG_DEBUG("######   (negative)   ########## ");
-  ATH_MSG_DEBUG("Negative px: " << m_negative_px << "\n"
-		<< "Negative py: " << m_negative_py << "\n"
-		<< "Negative pz: " << m_negative_pz << "\n"
-		<< "Negative d0: " << m_negative_d0 << "\n"
-		<< "Negative z0: " << m_negative_z0 << "\n");
+    if (muonTrksRefit2->size()<2) {
+      ATH_MSG_WARNING("Refit2 muon tracks are missing!");
+    }else{
 
+      ATH_MSG_DEBUG("-- >> going to fill refit2params << --");
+      success_pos = FillRecParameters(refit2MuonTrk1, muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p1_comb->charge(),p1_comb_v);
+      success_neg = FillRecParameters(refit2MuonTrk2, muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p2_comb->charge(),p2_comb_v);
+      
+      if (success_pos && success_neg)
+	m_refit2Tree->Fill();
 
-  ATH_MSG_DEBUG("######   (positive)   ########## ");
-  ATH_MSG_DEBUG( "Positive px: " << m_positive_px << "\n"
-		 << "Positive py: " << m_positive_py << "\n"
-		 << "Positive pz: " << m_positive_pz << "\n"
-		 << "Positive d0: " << m_positive_d0 << "\n"
-		 << "Positive z0: " << m_positive_z0 << "\n");
+    }
+
+    if (!muon_pos || !muon_neg) {
+      ATH_MSG_WARNING("CB Muons missing!");
+    } 
+    else {
+
+      ATH_MSG_DEBUG("-- >> going to fill combined muons params << --");
+      success_pos = FillRecParameters(p1_comb->track(), muon_pos->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p1_comb->charge(),p1_comb_v);
+      success_neg = FillRecParameters(p2_comb->track(), muon_neg->trackParticle(xAOD::Muon::InnerDetectorTrackParticle), p2_comb->charge(),p2_comb_v);
+      if (success_pos && success_neg) m_combMuidTree->Fill();
+    }
 
+    ATH_MSG_DEBUG(" Execute() completed for Run: " << m_runNumber << "  event: " << m_evtNumber);
+  }
 
+  if (m_doDebug) std::cout<< " -- Salva --  event completed -- Run: " << m_runNumber << "  event: " << m_evtNumber << std::endl;
+  return StatusCode::SUCCESS;
+}
 
-  m_refit1Tree->Fill();
+//==================================================================================
+bool IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp, const xAOD::TrackParticle* trackp_for_unbias,double charge, const xAOD::Vertex* vertex)
+{
+  if (!trackp){
+    //ATH_MSG_WARNING("Empty Trackparticle. Skipping.");
+    return false;
   }
-  //fill refit2 ID parameters
 
-  if (muonTrksRefit2->size()<2) {
-    ATH_MSG_WARNING("Refit2 muon tracks are missing!");
-  }else{
-    FillRecParameters(refit2MuonTrk1, p1_comb->charge());
-    FillRecParameters(refit2MuonTrk2, p2_comb->charge());
-    m_refit2Tree->Fill();
+  if (m_doRemoval && !trackp_for_unbias){
+    return false;
+  }
+    
+  
+  //   auto trkPerigee = &trackp->perigeeParameters();
+  //  if(m_CorrectMaps) {
+   //xAOD::TrackParticle* newTrack = nullptr;
+   //if ( m_trackBiasingTool->correctedCopy( *trackp, newTrack ) == CP::CorrectionCode::Error) {
+   //    }
+   //    auto trkPerigee = &newTrack->perigeeParameters();
+   //  }
+  double px = 0;
+  double py = 0;
+  double pz = 0;
+  double d0 = 0;
+  double z0 = 0;
+  double d0res = 0;
+  double z0res = 0;
+  double PVd0res = 0;
+  double PVz0res = 0;
+  double PVd0 = 0;
+  double PVz0 = 0;
+
+  px = trackp->p4().Px();
+  py = trackp->p4().Py();
+  pz = trackp->p4().Pz();
+  d0 = trackp->d0();
+  z0 = trackp->z0();
+  //d0res = -99;   //Absolutely need to get the covariance matrix
+  d0res = trackp->definingParametersCovMatrix()(0,0);
+  //z0res = -99;   //Absolutely need to get the covariance matrix
+  z0res = trackp->definingParametersCovMatrix()(1,1);
+  
+  
+  if(m_doIP){
+    const Trk::ImpactParametersAndSigma* iPandSigma(NULL);
+    ATH_MSG_INFO("using the trackToVertexIPEstimator");
+    
+    //Calling the estimate(trackp,newtrackp,vertex,doRemoval)
+    //The first track is used to unbias the vertex, the second to get the estrapolation
+    iPandSigma = m_trackToVertexIPEstimator->estimate(trackp_for_unbias,trackp,vertex,m_doRemoval);
+    
+    if( iPandSigma==0 ){
+      ATH_MSG_WARNING ("FillRecParametersTP::trackToVertexIPEstimator failed !");
+      return false;
+    }
+    else{
+      ATH_MSG_DEBUG("FillRecParametersTP::trackToVertexIPEstimator success !");
+      PVd0 = iPandSigma->IPd0;
+      PVd0res = iPandSigma->PVsigmad0;
+      d0res = iPandSigma->sigmad0;
+      PVz0 = iPandSigma->IPz0;
+      PVz0res = iPandSigma->PVsigmaz0;
+      z0res = iPandSigma->sigmaz0;
+    }
   }
 
-  if (!muon_pos || !muon_neg) {
-    ATH_MSG_WARNING("CB Muons missing!");
-  } else {
-    FillRecParameters(p1_comb->track(), p1_comb->charge());
-    FillRecParameters(p2_comb->track(), p2_comb->charge());
-    m_combMuidTree->Fill();
+  if (charge == 1) {
+    m_positive_px = px;
+    m_positive_py = py;
+    m_positive_pz = pz;
+    m_positive_z0 = z0;
+    m_positive_z0_err = z0res;
+    m_positive_d0 = d0;
+    m_positive_d0_err = d0res;
+    if(m_doIP){
+      m_positive_z0_PV = PVz0;
+      m_positive_d0_PV = PVd0;
+      m_positive_z0_PVerr = PVz0res;
+      m_positive_d0_PVerr = PVd0res;
+      ATH_MSG_DEBUG("(Filled charge == 1 ) (reco)-> px : "<< px <<" py: "<<py <<" pz: "<<pz <<" d0: "<<m_positive_d0 << " d0res : "<< d0res << " PVd0res : "<< PVd0res <<" z0: "<< m_positive_z0 << " z0res : " << z0res <<  " PVz0res : "<< PVz0res );
+    }
+
+  } else  if (charge == -1) {
+    m_negative_px = px;
+    m_negative_py = py;
+    m_negative_pz = pz;
+    m_negative_z0 = z0;
+    m_negative_z0_err = z0res;
+    m_negative_d0 = d0;
+    m_negative_d0_err = d0res;
+    if(m_doIP){
+      m_negative_z0_PV = PVz0;
+      m_negative_d0_PV = PVd0;
+      m_negative_z0_PVerr = PVz0res;
+      m_negative_d0_PVerr = PVd0res;
+      ATH_MSG_DEBUG("(Filled charge == -1 ) (reco)-> px : "<< px <<" py: "<<py <<" pz: "<<pz <<" d0: "<<m_negative_d0 << " d0res : "<< d0res << " PVd0res : "<< PVd0res <<" z0: "<< m_negative_z0 << " z0res : " << z0res <<  " PVz0res : "<< PVz0res );
+    }
+
   }
 
-  return StatusCode::SUCCESS;
+  return true;
 }
 
 
-void IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, double charge)
+//==================================================================================
+bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::TrackParticle* trackp_for_unbias, double charge,const xAOD::Vertex* vertex)
 {
 
   if (!track){
-    ATH_MSG_WARNING("Empty Track. Skipping.");
-    return;
+    //ATH_MSG_WARNING("Empty Track. Skipping.");
+    return false;
   }
+
+  if (m_doRemoval && !trackp_for_unbias) {
+    return false;
+  }
+
   const Trk::Perigee* trkPerigee = track->perigeeParameters();
-  //  const AmgSymMatrix(5)* covariance = trkPerigee ? trkPerigee->covariance() : NULL;
-  //  if (covariance == NULL) {
-  //    if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq;
-  //  }
+  const Trk::Perigee* trk_for_unbiasPerigee = &(trackp_for_unbias->perigeeParameters());
 
   double px = 0;
   double py = 0;
   double pz = 0;
   double d0 = 0;
   double z0 = 0;
-  //  double d0_err = 0;
-  //  double z0_err = 0;
+  
+  double d0_err = 999.;
+  double z0_err = 999.;
+  
+  double PVd0 = 0;
+  double PVz0 = 0;
+  double PVd0res = 0;
+  double PVz0res = 0;
+  
+  
 
   if(trkPerigee){
     double qOverP   = trkPerigee->parameters()[Trk::qOverP];
@@ -648,13 +1067,18 @@ void IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, double charge)
       pz = trkPerigee->momentum().z();
       d0 = trkPerigee->parameters()[Trk::d0];
       z0 = trkPerigee->parameters()[Trk::z0];
+      d0_err = Amg::error(*trkPerigee->covariance(),Trk::d0);
+      z0_err = Amg::error(*trkPerigee->covariance(),Trk::z0);
     }
+    //    std::cout << " -- trkPerigee -- q: " << (int) charge << "  px: " << px << "  py: " << py << "  pz: " << pz << "  d0: "<< d0 << "   z0: "<< z0 << " d0_err: " << d0_err << std::endl;
+    //    delete trkPerigee;
   }
 
-  const Trk::AtaStraightLine*  atBL =
-       dynamic_cast<const Trk::AtaStraightLine*>(m_trackToVertexTool->trackAtBeamline( *track ));
+  //const Trk::AtaStraightLine*  atBL =   dynamic_cast<const Trk::AtaStraightLine*>(m_trackToVertexTool->trackAtBeamline( *track ));
+  auto atBL = m_trackToVertexTool->trackAtBeamline( *track );
 
   if (atBL){
+    // std::cout << "################## >>> does not fail atBL extrapolation" << std::endl;
     double qOverP   = atBL->parameters()[Trk::qOverP];
     if(qOverP){
       px = atBL->momentum().x();
@@ -662,101 +1086,205 @@ void IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, double charge)
       pz = atBL->momentum().z();
       d0 = atBL->parameters()[Trk::d0];
       z0 = atBL->parameters()[Trk::z0];
-      //      z0_err = Amg::error(*trkPerigee->covariance(),Trk::z0);
-      //      d0_err = Amg::error(*trkPerigee->covariance(),Trk::d0);
+      //      z0_err = Amg::error(*trkPerigee->covariance(),Trk::z0);  //->Why not?
+      //      d0_err = Amg::error(*trkPerigee->covariance(),Trk::d0);  //->Why not?
+    } 
+    //    std::cout << " -- atBL -- px: " << px << "  py: " << py << "  pz: " << pz << "  d0: "<< d0 << "   z0: "<< z0 << std::endl;
+    delete atBL;
+  }
+  else 
+    {
+      ATH_MSG_WARNING("FillRecParameters::Failed extrapolation to the BeamLine");
+    }
+  
+  if(m_doIP && vertex && track->perigeeParameters()){ //I assume that the vertex is the same of the original track
+    const Trk::ImpactParametersAndSigma* iPandSigma(NULL);
+    iPandSigma = m_trackToVertexIPEstimator->estimate(trk_for_unbiasPerigee,trkPerigee,vertex,m_doRemoval);
+    if( iPandSigma==0 ){
+      ATH_MSG_WARNING ("FillRecParameters::trackToVertexIPEstimator failed !");
+      return false;
+    }
+    else{
+      ATH_MSG_DEBUG("FillRecParameters::trackToVertexIPEstimator success !");
+      PVd0 = iPandSigma->IPd0;
+      PVd0res = iPandSigma->PVsigmad0;
+      PVz0 = iPandSigma->IPz0;
+      PVz0res = iPandSigma->PVsigmaz0;
     }
   }
-
-
+    
   if (charge == 1) {
     m_positive_px = px;
     m_positive_py = py;
     m_positive_pz = pz;
     m_positive_z0 = z0;
     m_positive_d0 = d0;
+    m_positive_d0_err = d0_err;
+    m_positive_z0_err = z0_err;
+    if(m_doIP){
+      m_positive_z0_PV    = PVz0;
+      m_positive_d0_PV    = PVd0;
+      m_positive_z0_PVerr = PVz0res;
+      m_positive_d0_PVerr = PVd0res;
+    }
     ATH_MSG_DEBUG("(Filled charge == 1 ) (reco)-> px : "<< px <<" py: "<<py <<" pz: "<<pz <<" d0: "<<d0<<" z0: "<< z0);
-    //    m_positive_z0_err = z0_err;
-    //    m_positive_d0_err = d0_err;
-  } else  if (charge == -1) {
+  }
+  if (charge == -1) {
     m_negative_px = px;
     m_negative_py = py;
     m_negative_pz = pz;
     m_negative_z0 = z0;
     m_negative_d0 = d0;
+    m_negative_d0_err = d0_err;
+    m_negative_z0_err = z0_err;
+    if(m_doIP){
+      m_negative_z0_PV = PVz0;
+      m_negative_d0_PV = PVd0;
+      m_negative_z0_PVerr = PVz0res;
+      m_negative_d0_PVerr = PVd0res;
+    }
     ATH_MSG_DEBUG("(Filled charge == -1 ) (reco)-> px : "<< px <<" py: "<<py <<" pz: "<<pz <<" d0: "<<d0<<" z0: "<<z0 );
-    //    m_negative_z0_err = z0_err;
-    //    m_negative_d0_err = d0_err;
   }
 
-  return;
+  return true;
 }
 
+//==================================================================================
 StatusCode IDPerfMonZmumu::FillTruthParameters(const xAOD::TrackParticle* trackParticle)
 {
-  double momX(0),momY(0),momZ(0), vtxX(0),vtxY(0),vtxZ(0);
-  //  const xAOD::TruthParticle* truthParticle = xAOD::TruthHelpers::getTruthParticle( *trackParticle );
-  //  const xAOD::TruthParticle* truthParticle = xAOD::EgammaHelpers::getTruthParticle( trackParticle );
-  const xAOD::TruthParticle* truthParticle = getTruthParticle( *trackParticle );
-        if(truthParticle->hasProdVtx()){
-	  vtxX = truthParticle->prodVtx()->x();
-	  vtxY = truthParticle->prodVtx()->y();
-	  vtxZ = truthParticle->prodVtx()->z();
-	  momX = truthParticle->px();
-	  momY = truthParticle->py();
-	  momZ = truthParticle->pz();
-        }
-    Amg::Vector3D pos(vtxX,vtxY,vtxZ);
-    Amg::Vector3D mom(momX,momY,momZ);
-    double charge = 0;
-    if(truthParticle->pdgId() == 13) charge = -1.;
-    else if(truthParticle->pdgId() == -13) charge = 1.;
-    //    Trk::Perigee* candidatePerigee  = new Trk::Perigee(pos,mom,charge,pos);
-    Trk::TrackParameters* parameters  = new Trk::Perigee(pos,mom,charge,pos);
-
-    const Trk::AtaStraightLine*  atBLi =
-      dynamic_cast<const Trk::AtaStraightLine*>(m_trackToVertexTool->trackAtBeamline( *parameters ));
-
-    if(atBLi){
-      if (charge == 1) {
-	double qOverP   = atBLi->parameters()[Trk::qOverP];
-	if (qOverP) {
-	  m_positive_px = atBLi->momentum().x();
-	  m_positive_py = atBLi->momentum().y();
-	  m_positive_pz = atBLi->momentum().z();
-	  m_positive_z0 = atBLi->parameters()[Trk::z0];
-	  m_positive_d0 = atBLi->parameters()[Trk::d0];
-
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) px : "<< atBLi->momentum().x());
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) py : "<< atBLi->momentum().y());
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) pz : "<< atBLi->momentum().z());
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) d0 : "<< atBLi->parameters()[Trk::d0]);
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) z0 : "<< atBLi->parameters()[Trk::z0]);
-	  ATH_MSG_DEBUG("(Filled charge == 1 ) (truth)-> px : "<< m_positive_px <<" py: "<<m_positive_py <<" pz: "<<m_positive_pz <<" d0: "<<m_positive_d0<<" z0: "<<m_positive_z0);
-	}
-      } else  if (charge == -1) {
-	double qOverP   = atBLi->parameters()[Trk::qOverP];
-	if (qOverP) {
-	  m_negative_px = atBLi->momentum().x();
-	  m_negative_py = atBLi->momentum().y();
-	  m_negative_pz = atBLi->momentum().z();
-	  m_negative_z0 = atBLi->parameters()[Trk::z0];
-	  m_negative_d0 = atBLi->parameters()[Trk::d0];
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) px : "<< atBLi->momentum().x());
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) py : "<< atBLi->momentum().y());
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) pz : "<< atBLi->momentum().z());
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) d0 : "<< atBLi->parameters()[Trk::d0]);
-	  ATH_MSG_DEBUG("cand perig HEP particle (truth) z0 : "<< atBLi->parameters()[Trk::z0]);
-	  ATH_MSG_DEBUG("(Filled charge == -1 ) (truth)-> px : "<< m_negative_px <<" py: "<<m_negative_py <<" pz: "<<m_negative_pz <<" d0: "<<m_negative_d0<<" z0: "<<m_negative_z0);
-	}
-      }
-    }//atBL
+  if (!trackParticle ){//|| !trackParticle->vertex()){
+    ATH_MSG_WARNING("Empty Trackparticle. Skipping.");
+    return StatusCode::FAILURE;
+  }
+  float result(std::numeric_limits<float>::quiet_NaN());
+  if (trackParticle->isAvailable<float>("truthMatchProbability")){
+    result = trackParticle->auxdata<float>("truthMatchProbability" );
+    std::cout <<"DEBUG :: TruthMatchProbablity of trackpartile : > " << result<< std::endl;
+  }
+
+  const xAOD::TruthParticle* particle = getTruthParticle( *trackParticle );
+  double charge = 0;
+  if (!particle) {
+    ATH_MSG_DEBUG(" Failure while retrieving the truth particle");
+    return StatusCode::FAILURE;
+  }
+  if(particle->pdgId() == 13) charge = -1.;
+  else if(particle->pdgId() == -13) charge = 1.;
+  if( particle->isNeutral() ) return StatusCode::FAILURE;
+  const Amg::Vector3D momentum(particle->px(), particle->py(), particle->pz());
+  
+  const xAOD::TruthVertex * ptruthVertex(0);
+  ptruthVertex=particle->prodVtx();
+  if (!ptruthVertex){
+    ATH_MSG_DEBUG("A production vertex pointer was retrieved, but it is NULL");
+    return StatusCode::FAILURE;
+  }
 
+  const auto xPos=ptruthVertex->x();
+  const auto yPos=ptruthVertex->y();
+  const auto z_truth=ptruthVertex->z();
 
+  const Amg::Vector3D position(xPos, yPos, z_truth);
+  //  const float prodR_truth = std::sqrt(xPos*xPos+ yPos*yPos);
+  //delete ptruthVertex;ptruthVertex=0;
+  const Trk::CurvilinearParameters cParameters(position, momentum, charge);
 
-    return StatusCode::SUCCESS;
+  Trk::PerigeeSurface persf( m_beamSpotSvc->beamPos() );
+
+  const Trk::TrackParameters* tP = m_extrapolator->extrapolate(cParameters,persf, Trk::anyDirection, false);
+
+
+  double px = 0;
+  double py = 0;
+  double pz = 0;
+  double d0 = 0;
+  double d0res = 0;
+  double PVd0res = 0;
+  double z0 = 0;
+  double z0res = 0;
+  double PVz0res = 0;
+
+
+  double d0recoPos =  m_positive_d0;
+  double z0recoPos =  m_positive_z0;
+  double d0recoNeg =  m_negative_d0;
+  double z0recoNeg =  m_negative_z0;
+
+  ATH_MSG_DEBUG("reco IPs (pos): > d0 : "<<d0recoPos << " z0: " << z0recoPos << " trackp z0 : " << trackParticle->z0() << " trackp d0 : " << trackParticle->d0());
+  ATH_MSG_DEBUG("reco IPs (neg): > d0 : "<<d0recoNeg << " z0: " << z0recoNeg << " trackp z0 : " << trackParticle->z0() <<" trackp d0 : " << trackParticle->d0() );
+
+  if (tP){
+    double qOverP_truth = tP->parameters()[Trk::qOverP];
+    if( qOverP_truth ){
+
+      px = tP->momentum().x();
+      py = tP->momentum().y();
+      pz = tP->momentum().z();
+      d0 = tP->parameters()[Trk::d0];
+      z0 = tP->parameters()[Trk::z0];
+
+      ATH_MSG_DEBUG("cand perig HEP particle (truth) px : "<< tP->momentum().x());
+      ATH_MSG_DEBUG("cand perig HEP particle (truth) py : "<< tP->momentum().y());
+      ATH_MSG_DEBUG("cand perig HEP particle (truth) pz : "<< tP->momentum().z());
+      ATH_MSG_DEBUG("cand perig HEP particle (truth) d0 : "<< tP->parameters()[Trk::d0]);
+      ATH_MSG_DEBUG("cand perig HEP particle (truth) z0 : "<< tP->parameters()[Trk::z0]);
+      delete tP;tP=0;
+    }
+  }
+
+
+  if (charge == 1) {
+    m_positive_px = px;
+    m_positive_py = py;
+    m_positive_pz = pz;
+    m_positive_z0 = z0recoPos -z0;
+    //    m_positive_z0 = z0;
+
+    m_positive_z0_err = z0res;
+    m_positive_z0_PVerr = PVz0res;
+    m_positive_d0 = d0recoPos -d0;
+    //    m_positive_d0 = d0;
+
+    m_positive_d0_err = d0res;
+    m_positive_d0_PVerr = PVd0res;
+    //    m_px = px;
+    //    m_py = py;
+    //    m_pz = pz;
+    //    m_z0 = z0;
+    //    m_d0 = d0;
+    //    m_d0_rec_truth = d0recoPos -d0;
+    //    m_z0_rec_truth = z0recoPos -z0;
+    ATH_MSG_DEBUG("(Filled charge == 1 ) (truth)-> px : "<< m_positive_px <<" py: "<<m_positive_py <<" pz: "<<m_positive_pz <<" d0: "<<m_positive_d0 << " z0: "<< m_positive_z0);
+
+  } else  if (charge == -1) {
+    m_negative_px = px;
+    m_negative_py = py;
+    m_negative_pz = pz;
+    m_negative_z0 = z0recoNeg-z0;
+    //    m_negative_z0 = z0;
+
+    m_negative_z0_err = z0res;
+    m_negative_z0_PVerr = PVz0res;
+    m_negative_d0 = d0recoNeg-d0;
+    //    m_negative_d0 = d0;
+
+    m_negative_d0_err = d0res;
+    m_negative_d0_PVerr = PVd0res;
+
+    //    m_px = px;
+    //    m_py = py;
+    //    m_pz = pz;
+    //    m_z0 = z0;
+    //    m_d0 = d0;
+    //    m_d0_rec_truth = d0recoNeg -d0;
+    //    m_z0_rec_truth = z0recoNeg -z0;
+    ATH_MSG_DEBUG("(Filled charge == -1 ) (truth)-> px : "<< m_negative_px <<" py: "<<m_negative_py <<" pz: "<<m_negative_pz <<" d0: "<<m_negative_d0 << " z0: "<< m_negative_z0);
+  }
+  return StatusCode::SUCCESS;
 }
 
 
+//==================================================================================
 const xAOD::TruthParticle* IDPerfMonZmumu::getTruthParticle( const xAOD::IParticle& p ) {
 
 
@@ -783,7 +1311,84 @@ const xAOD::TruthParticle* IDPerfMonZmumu::getTruthParticle( const xAOD::IPartic
   return *link;
 }
 
+//==================================================================================
 StatusCode IDPerfMonZmumu::finalize()
 {
   return StatusCode::SUCCESS;
 }
+
+//==================================================================================
+StatusCode IDPerfMonZmumu::CheckTriggerStatusAndPrescale ()
+{
+  m_triggerPrescale = 1; // default value
+
+  // check trigger status
+  if(m_triggerDecision.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Unable to retrieve " << m_triggerDecision << " turn it off");
+    return StatusCode::FAILURE;
+  }
+  else {
+    ATH_MSG_DEBUG("retrieved tool: " << m_triggerDecision );
+  }
+
+  float thisEventTriggerPrescale = 999999.9;
+  float thisHLTTriggerPrescale = 999999.9;
+  bool thisHLTIsPassed = false;
+
+  // HLT triggers
+  const std::vector<std::string> myHLTtriglist = m_triggerDecision->getChainGroup("HLT_mu.*, HLT_2mu.*")->getListOfTriggers();
+  for (int i=0; i < (int) myHLTtriglist.size(); i++) {
+    if ( m_triggerDecision->isPassed(myHLTtriglist.at(i)) ) {
+      // std::cout << "HLT trigger = " << i << " out of " << myHLTtriglist.size() << " --> " << myHLTtriglist.at(i) <<  "  isPassed? " << m_triggerDecision->isPassed(myHLTtriglist.at(i)) << "  prescale: " << m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale() << std::endl;
+      ATH_MSG_DEBUG("HLT trigger = " << i << " out of " << myHLTtriglist.size() << " --> " << myHLTtriglist.at(i) <<  "  isPassed? " << m_triggerDecision->isPassed(myHLTtriglist.at(i)) << "  prescale: " << m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale() );
+      if (m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale() - (int) m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale() >0.1) std::cout << " -- SALVA -- fractional " << std::endl;
+    }
+    if ( m_triggerDecision->isPassed(myHLTtriglist.at(i)) ) { // trigger is passed
+      thisHLTIsPassed = true;
+      float thisprescale = m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale();
+      if (thisprescale < thisHLTTriggerPrescale) {
+	thisHLTTriggerPrescale = thisprescale;
+      }
+    }
+  }
+  if (thisHLTTriggerPrescale < 1) thisHLTTriggerPrescale = 1;
+  ATH_MSG_DEBUG("Event HLT trigger prescale = " << thisHLTTriggerPrescale);
+
+  //if (thisL1IsPassed && thisHLTIsPassed) {
+  if (thisHLTIsPassed) {
+    ATH_MSG_DEBUG("Trigger passed -> accept event");
+  }
+  else{
+    ATH_MSG_DEBUG("Trigger Failed -> reject event");
+    return StatusCode::FAILURE;
+  }
+
+  // event prescale
+  thisEventTriggerPrescale = thisHLTTriggerPrescale;
+  ATH_MSG_INFO("Event trigger prescale = " << thisEventTriggerPrescale);
+
+  m_triggerPrescale = thisEventTriggerPrescale;
+
+  return StatusCode::SUCCESS;
+}
+
+
+//==================================================================================
+const xAOD::Vertex* IDPerfMonZmumu::GetDiMuonVertex(const xAOD::TrackParticle* muon1, const xAOD::TrackParticle* muon2) {
+  
+  const xAOD::VertexContainer* vxContainer(0);
+  const xAOD::Vertex* myVtx(0);
+  vxContainer = PerfMonServices::getContainer<xAOD::VertexContainer> (PerfMonServices::VTX_COLLECTION);
+  if (!vxContainer) { 
+    return myVtx;
+  }
+  
+  for (int ivtx=0; ivtx< (int) vxContainer->size();ivtx++)  {
+    myVtx = (*vxContainer)[ivtx];
+    if ((myVtx->vertexType() == xAOD::VxType::PriVtx)) {
+      if (m_LooseT2VAssociationTool->isCompatible(*muon1,*myVtx) && (m_LooseT2VAssociationTool->isCompatible(*muon2,*myVtx)))
+	return myVtx;
+    }
+  }
+  return myVtx;
+}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx
index e6eaff7b43bb13f4727098d20516bae45f1126f0..ff325877f326cb9d3add114bbbd52d4e6f289a48 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 
 //==================================================================================
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/JpsimumuEvent.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/JpsimumuEvent.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..a7a64cd49d101ddb55454adb281094bd13318005
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/JpsimumuEvent.cxx
@@ -0,0 +1,359 @@
+//==================================================================================
+
+//==================================================================================
+// Include files...
+//==================================================================================
+
+// This files header
+#include "InDetPerformanceMonitoring/JpsimumuEvent.h"
+
+// Standard headers
+
+// Package Headers
+#include "InDetPerformanceMonitoring/PerfMonServices.h"
+
+// ATLAS headers
+#include "StoreGate/StoreGateSvc.h"
+
+//#include "muonEvent/MuonParamDefs.h"
+
+#include "CLHEP/Random/RandFlat.h"
+
+#include "xAODMuon/Muon.h"
+#include "xAODMuon/MuonContainer.h"
+//==================================================================================
+// Public Methods
+//==================================================================================
+
+JpsimumuEvent::JpsimumuEvent()
+{
+  m_xSampleName = "ZMM";
+
+  m_container = PerfMonServices::MUID_COLLECTION;
+
+  m_doDebug = false;
+
+  // Setup the muon tags
+  m_uMuonTags   = 2;
+  m_uTrackMatch = 0;
+  m_bLooseMatch = true;  // will use combined fit otherwise.
+  m_etaCut      = 1.05;
+}
+
+JpsimumuEvent::~JpsimumuEvent()
+{
+}
+
+void JpsimumuEvent::Init()
+{
+  m_xMuonID.Init();
+  PARENT::Init();
+}
+
+
+
+const std::string JpsimumuEvent::getRegion() const{
+
+  const double eta1 = fabs(m_pxRecMuon[MUON1]->eta());
+  const double eta2 = fabs(m_pxRecMuon[MUON2]->eta());
+  //std::cout << "  eta1: " << eta1 << std::endl;
+  //std::cout << "  eta2: " << eta2 << std::endl;
+
+  if ( eta1 < m_etaCut && eta2 < m_etaCut )
+    return "BB";
+
+  else if( (eta1 < m_etaCut && eta2 > m_etaCut) || (eta1 > m_etaCut && eta2 < m_etaCut) )
+    return "BE";
+
+  else return "EE";
+}
+
+
+
+bool JpsimumuEvent::Reco()
+{
+  // Clear out the previous events record.
+  Clear();
+  //  const Analysis::MuonContainer* pxMuonContainer = PerfMonServices::getContainer<Analysis::MuonContainer>( m_container );
+  const xAOD::MuonContainer* pxMuonContainer = PerfMonServices::getContainer<xAOD::MuonContainer>( m_container );
+  if (!pxMuonContainer){
+    //     std::cout << "Can't retrieve combined muon collection" << std::endl;
+    return false;
+  }
+  else{
+    if(m_doDebug){     std::cout << pxMuonContainer->size() << " combined muon "<<std::endl; }
+    xAOD::MuonContainer::const_iterator xMuonItr  = pxMuonContainer->begin();
+    xAOD::MuonContainer::const_iterator xMuonItrE  = pxMuonContainer->end();
+      while ( xMuonItr != xMuonItrE )
+	{
+	  const xAOD::Muon* pxCMuon = *xMuonItr;
+	  // Apply muon cuts
+	  if ( m_xMuonID.passSelection( pxCMuon ) ) {
+	       RecordMuon( pxCMuon );
+	  }
+	  xMuonItr++;
+	}
+  }
+
+
+  // Reconstruct the invariant mass ( based on mu-sys pt ).
+  ReconstructKinematics();
+
+  m_passedSelectionCuts = EventSelection();
+  return m_passedSelectionCuts;
+}
+
+
+
+//==================================================================================
+// Protected Methods
+//==================================================================================
+void JpsimumuEvent::BookHistograms()
+{
+}
+
+//==================================================================================
+// Private Methods
+//==================================================================================
+bool JpsimumuEvent::EventSelection()
+{
+
+  if(m_doDebug){  std::cout <<" m_uNumberOfFullPassMuons: " << m_numberOfFullPassMuons << std::endl;}
+  // First require two muon-id's with cuts pre-applied.
+  if ( m_numberOfFullPassMuons != 2 )    return false;
+
+  if ( !((m_pxRecMuon[MUON1]->pt() > 10.0*CLHEP::GeV &&  m_pxRecMuon[MUON2]->pt() > 5.0*CLHEP::GeV ) ||
+         (m_pxRecMuon[MUON1]->pt() > 5.0*CLHEP::GeV &&  m_pxRecMuon[MUON2]->pt() > 10.0*CLHEP::GeV )) )
+    return false;
+
+  if(m_doDebug){   std::cout <<" m_fInvariantMass[ID]:  "<< m_fInvariantMass[ID] << std::endl;}
+
+  if ( -1 != (m_pxRecMuon[MUON1]->charge() * m_pxRecMuon[MUON2]->charge()) ){
+        std::cout << "same sign event!!!" << std::endl;
+       return false;
+  }
+
+
+
+  if ( m_fInvariantMass[ID]  < 2.5f  )         return false;
+  if ( m_fInvariantMass[ID]  > 4.3f )         return false;
+  //if ( m_fMuonDispersion[ID] <  0.2f  )         return false;
+  if ( getZCharge(ID) != 0            )         return false;
+
+  return true;
+}
+
+void JpsimumuEvent::Clear()
+{
+  m_numberOfFullPassMuons = 0;
+  m_passedSelectionCuts   = false;
+
+  for ( unsigned int u = 0; u < NUM_MUONS; ++u )
+    {
+      m_pxRecMuon[u]      = NULL;
+      m_pxMSTrack[u]     = NULL;
+      m_pxMETrack[u] = NULL;
+      m_pxIDTrack[u]      = NULL;
+    }
+  for ( unsigned int v = 0; v < NUM_TYPES; ++v )
+    {
+      m_fZPt[v]            = -999.9f;
+      m_fZEtaDir[v]        = -999.9f;
+      m_fZPhiDir[v]        = -999.9f;
+      m_fInvariantMass[v]  = -999.9f;
+      m_fMuonDispersion[v] = -999.9f;
+    }
+}
+
+void JpsimumuEvent::RecordMuon( const xAOD::Muon* pxMuon )
+{
+  // This shouldn't really ever happen but just in case.
+  if ( !pxMuon ) return;
+
+  if ( m_numberOfFullPassMuons < NUM_MUONS )
+    {
+      // The main Muon
+      m_pxRecMuon[m_numberOfFullPassMuons] = pxMuon;
+      // Tracking Muon Spectrometer ( raw )
+      const xAOD::TrackParticle* pxMSTrack   = pxMuon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
+      m_pxMSTrack[m_numberOfFullPassMuons] = pxMSTrack;
+
+      // Tracking ID ( fix later to include loose match track conditions )
+      const xAOD::TrackParticle*  pxIDTrack  = pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+      m_pxIDTrack[m_numberOfFullPassMuons] = pxIDTrack;
+    }
+  ++m_numberOfFullPassMuons;
+}
+
+
+
+
+void JpsimumuEvent::ReconstructKinematics()
+{
+  // Three ways. No checks here so make sure the pointers are ok before this.
+  if ( m_numberOfFullPassMuons == 2 )
+    {
+
+      // Note that all the util. functions will check the pointers & return -999.9f on failure.
+      m_fInvariantMass[MS]      = EvalDiMuInvMass( m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+      m_fMuonDispersion[MS]     = EvaluateAngle(   m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+      m_fZPt[MS]                = EvalPt(          m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+      m_fZEtaDir[MS]            = EvalEta(         m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+      m_fZPhiDir[MS]            = EvalPhi(         m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+
+      m_fInvariantMass[CB]      = EvalDiMuInvMass( m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+      m_fMuonDispersion[CB]     = EvaluateAngle(   m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+      m_fZPt[CB]                = EvalPt(          m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+      m_fZEtaDir[CB]            = EvalEta(         m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+      m_fZPhiDir[CB]            = EvalPhi(         m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+
+      m_fInvariantMass[ID]      = EvalDiMuInvMass( m_pxIDTrack[MUON1], m_pxIDTrack[MUON2]);
+      m_fMuonDispersion[ID]     = EvaluateAngle(   m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+      m_fZPt[ID]                = EvalPt(          m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+      m_fZEtaDir[ID]            = EvalEta(         m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+      m_fZPhiDir[ID]            = EvalPhi(         m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+    }
+}
+
+float JpsimumuEvent::getPtImbalance( ZTYPE eType )
+{
+  // First determine what's positive
+  if ( m_numberOfFullPassMuons == 2 )
+    {
+      switch ( eType )
+	{
+	case MS :
+	  {
+	    return EvalPtDiff( m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+	  }
+	case ME:
+	  {
+	    return EvalPtDiff( m_pxMETrack[MUON1], m_pxMETrack[MUON2] );
+	  }
+	case CB:
+	  {
+	    return EvalPtDiff( m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+	  }
+	case ID:
+	  {
+	    return EvalPtDiff( m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+	  }
+	default:
+	  return -999.0;
+	}
+    }
+  else
+    {
+      return -999.0;
+    }
+}
+
+int JpsimumuEvent::getZCharge( ZTYPE eType )
+{
+  switch ( eType )
+    {
+    case MS :
+      {
+	return ( static_cast<int>( EvalCharge( m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] ) ) );
+      }
+    case ME:
+      {
+	return ( static_cast<int>( EvalCharge( m_pxMETrack[MUON1], m_pxMETrack[MUON2] ) ) );
+      }
+    case CB:
+      {
+	return ( static_cast<int>( EvalCharge( m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] ) ) );
+      }
+    case ID:
+      {
+	return ( static_cast<int>( EvalCharge( m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] ) ) );
+      }
+    default:
+      return -999;
+    }
+}
+
+unsigned int JpsimumuEvent::getPosMuon( ZTYPE eType )
+{
+  if ( getNumberOfTaggedMuons() != 2 ) return 999;
+  if ( getZCharge(eType) != 0        ) return 999;
+
+  switch ( eType )
+    {
+    case MS :
+      {
+	if ( !m_pxMSTrack[MUON1] || !m_pxMSTrack[MUON2] ) return 999;
+	return ( static_cast<int>( m_pxMSTrack[MUON1]->charge() ) == 1  ? MUON1 : MUON2 );
+      }
+    case ME:
+      {
+	if ( !m_pxMETrack[MUON1] || !m_pxMETrack[MUON2] ) return 999;
+	return ( static_cast<int>( m_pxMETrack[MUON1]->charge() ) == 1  ? MUON1 : MUON2 );
+      }
+    case CB:
+      {
+	if ( !m_pxRecMuon[MUON1] || !m_pxRecMuon[MUON2] ) return 999;
+	return ( static_cast<int>( m_pxRecMuon[MUON1]->charge() ) == 1  ? MUON1 : MUON2 );
+      }
+    case ID:
+      {
+	if ( !m_pxIDTrack[MUON1] || !m_pxIDTrack[MUON2] ) return 999;
+	return ( static_cast<int>( m_pxIDTrack[MUON1]->charge() ) == 1 ? MUON1 : MUON2 );
+      }
+    default:
+      return 999;
+    }
+}
+
+unsigned int JpsimumuEvent::getNegMuon( ZTYPE eType )
+{
+  unsigned int uTmp = getPosMuon( eType );
+  if ( uTmp == 999 )
+    {
+      return 999;
+    }
+  else
+    {
+      return ( ( uTmp == MUON1 ) ? MUON2 : MUON1 );
+    }
+}
+
+const xAOD::TrackParticle*  JpsimumuEvent::getLooseIDTk( unsigned int /*uPart*/ )
+{
+  const xAOD::TrackParticleContainer*  pxTrackContainer =
+    PerfMonServices::getContainer<xAOD::TrackParticleContainer>( PerfMonServices::TRK_COLLECTION );
+
+  if ( pxTrackContainer )
+    {
+      xAOD::TrackParticleContainer::const_iterator xTrkItr  = pxTrackContainer->begin();
+      xAOD::TrackParticleContainer::const_iterator xTrkItrE  = pxTrackContainer->end();
+      while ( xTrkItr != xTrkItrE )
+	{
+	  const xAOD::TrackParticle* pxTrack = *xTrkItr;
+	  if(!(pxTrack->track())) continue;
+	  const Trk::Track* pxTrkTrack = pxTrack->track();
+	  if ( !pxTrack ) continue;
+	  const Trk::Perigee* pxPerigee = pxTrkTrack->perigeeParameters() ;
+	  if ( !pxPerigee ) continue;
+
+	  // const float fTrkPt    = pxPerigee->pT()*1.0e-3;
+	  // const float fTrkPtErr = fabs( pxPerigee->localErrorMatrix().error(Trk::qOverP) );
+	  // const float fPtSig    = ( 1.0f / pxPerigee->pT() ) /  fTrkPtErr;  // Potential problem.
+	  const float fTrkPhi   = pxPerigee->parameters()[Trk::phi];
+	  const float fTrkEta   = pxPerigee->eta();
+
+	  float fDPhi = fabs( fTrkPhi -  m_pxMETrack[MUON1]->phi() );
+	  float fDEta = fabs( fTrkEta -  m_pxMETrack[MUON2]->eta() );
+	  float fDR = sqrt( fDPhi*fDPhi + fDEta*fDEta );
+
+	  if ( fDR < 0.3f )
+	    {
+	      return pxTrack;
+	    }
+
+	  xTrkItr++;
+	}
+    }
+  // if ()
+  return NULL;
+}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx
index 70a30ed32f2efd86d13861d2bd7399e82f14a4bf..b9317c359b3e6abd933a209dc4cb0f1fb3503bb1 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelector.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 //==================================================================================
 //
 //  ZMM_Event.cxx :       Class designed to reconstruct di-boson events
@@ -63,12 +59,12 @@ MuonSelector::MuonSelector()
   m_bCutOnCombKine  = false; //not used
   m_fEtaCut         = 2.5;
   //m_fEtaCut         = 1.9;
-      m_combPtCut       = 15.0*CLHEP::GeV; // GeV/c
+  m_combPtCut       = 15.0*CLHEP::GeV; // GeV/c
   //    m_combPtCut       = .01*CLHEP::GeV; // GeV/c
 
   //m_ptMSCut         = 10.0*CLHEP::GeV;
   m_ptMSCut         = 0.0*CLHEP::GeV;
-  m_diffZCut        = 10.0*CLHEP::mm;  // mm
+  m_diffZCut        = 1.5*CLHEP::mm;  // mm --> used to be 10.0*CLHEP::mm // Changed by Salva 26/january/2016
   m_diffPtCut       = 15.0*CLHEP::GeV;  // not used
   m_pVZCut          = 150.0*CLHEP::mm; // mm
 
@@ -80,7 +76,7 @@ MuonSelector::MuonSelector()
   m_ucID_TRTCut     = 0;        // Hits
 
   m_doDebug     = false;
-  m_doQualSelection = true;
+  m_doQualSelection = false;
   m_doIsoSelection  = false;
   m_doPtSelection   = true;
   m_doIPSelection   = true;
@@ -98,8 +94,9 @@ MuonSelector::~MuonSelector()
 }
 
 //bool MuonSelector::passSelection( const Analysis::Muon* pxMuon )
-bool MuonSelector::passSelection( const xAOD::Muon* pxMuon )
+bool MuonSelector::passSelection( const xAOD::Muon* pxMuon)
 {
+  if(m_doDebug){ std::cout << "  * MuonSelector * passSelection() * starting on new muon " << pxMuon << std::endl; }
 
   std::vector<bool> passes;
   bool pass = true;
@@ -111,30 +108,39 @@ bool MuonSelector::passSelection( const xAOD::Muon* pxMuon )
       if(m_doQualSelection){
 	pass = passQualCuts();
 	passes.push_back(pass);
+	if (m_doDebug && !pass)			
+	  std::cout<<"Muon Fails QualSelection"<<std::endl;
       }
 
       if (m_doIsoSelection){
         pass = passIsolCuts();
         passes.push_back(pass);
+	if (m_doDebug && !pass)			
+	  std::cout<<"Muon Fails Iso Selection"<<std::endl;
       }
 
       if (m_doPtSelection){
         pass = passPtCuts();
 	passes.push_back(pass);
+	if (m_doDebug && !pass)			
+	  std::cout<<"Muon Fails pT Selection"<<std::endl;
       }
 
       if (m_doIPSelection){
         pass = passIPCuts();
         passes.push_back(pass);
+	if (m_doDebug && !pass)			
+	  std::cout<<"Muon Fails IP Selection"<<std::endl;
       }
 
       for (int i=0; i < int(passes.size()); i++)
 	if (false == passes[i]){
-	  if(m_doDebug) std::cout << " haven't passed the " << i <<"th selection " << std::endl;
+	  if(m_doDebug) std::cout << "  * MuonSelector * passSelection() * BAD MUON * muon haven't passed the " << i+1 <<"th selection " << std::endl;
 	  return false;
 	}
 
     }
+  if(m_doDebug){ std::cout << "  * MuonSelector * passSelection() * completed. GOOD MUON " << std::endl; }
   return true;
 }
 
@@ -147,7 +153,7 @@ void MuonSelector::Init()
   StatusCode sc = serviceLocator->service("ToolSvc", toolSvc, true);
 
   if ( sc.isFailure() || toolSvc == 0 ) {
-    (*m_msgStream) << MSG::ERROR << "Unable to retrieve ToolSvc " << endreq;
+    (*m_msgStream) << MSG::ERROR << "  * MuonSelector * Init() * Unable to retrieve ToolSvc " << endreq;
     return;
   }
   PARENT::Init();
@@ -175,11 +181,15 @@ bool MuonSelector::passQualCuts()
 {
   // Apply muon hit criteria
   // First get the muon track, then the summarys
-  const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+  
+  //const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);  // Always use combined track
+  const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::CombinedTrackParticle);
 
   //    if ( !m_pxMuon->isCombinedMuon()) return false;
   //  if ( m_pxMuon->trackParticle(xAOD::Muon::CombinedTrackParticle) ) return false;
-  if( xAOD::Muon::Combined ) return false;
+  //???? if( xAOD::Muon::Combined ) return false;  //PF: ??
+  
+  
   if (IDTrk) {
     uint8_t dummy(-1);
     bool eBLhits = IDTrk->summaryValue( dummy, xAOD::expectBLayerHit )? dummy :-1;
@@ -194,18 +204,24 @@ bool MuonSelector::passQualCuts()
     int nPIXH = IDTrk->summaryValue( dummy, xAOD::numberOfPixelHoles )? dummy :-1;
     int nSCTH = IDTrk->summaryValue( dummy, xAOD::numberOfSCTHoles )? dummy :-1;
 
-    if(m_doDebug) std::cout << " eBLhits: " << eBLhits << " nBLhits:  " << nBLhits  << " nhitsPIX: " << nhitsPIX << std::endl;
-
-    if (   ((!eBLhits) || (nBLhits > 0))
-	   &&   (nhitsPIX + nPIXDS > 1 )
-	   &&   (nhitsSCT + nSCTDS >=6 )
-	   &&   (nPIXH    + nSCTH  < 2 ) )
+    if(m_doDebug) std::cout << "   * MuonSelector * passQualCuts() * eBLhits: " << eBLhits
+			    << "  nBLhits:  " << nBLhits
+			    << "  nhitsPIX: " << nhitsPIX
+			    << "  nhitsSCT: " << nhitsSCT
+			    << "  holes: " << nPIXH + nSCTH
+			    << std::endl;
+
+    if (((!eBLhits) || (nBLhits > 0))
+	&&   (nhitsPIX + nPIXDS > 1 )
+	&&   (nhitsSCT + nSCTDS >=6 )
+	&&   (nPIXH    + nSCTH  < 2 ) ) {
+      if (m_doDebug) std::cout << "   * MuonSelector * passQualCuts() * this muon satisfies the hits number QualCuts  "  << std::endl;
       return true;
+    }
   }
 
-
-if(m_doDebug) std::cout << "this muon not pass the hits number QualCuts:  "  << std::endl;
-return false;
+  if(m_doDebug) std::cout << "   * MuonSelector * passQualCuts() * this muon did not pass the hits number QualCuts  "  << std::endl;
+  return false;
 }
 
 bool MuonSelector::passPtCuts()
@@ -213,55 +229,59 @@ bool MuonSelector::passPtCuts()
 
   const xAOD::TrackParticle* pxMuonID = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
   const xAOD::TrackParticle* pxMuonMS = m_pxMuon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
-  if ( !(pxMuonID && pxMuonMS)){
-         if(m_doDebug) std::cout << "NO inDetTrackParticle && muonSpectrometerTrackParticle: " << std::endl;
+  const xAOD::TrackParticle* pxMuonCB = m_pxMuon->trackParticle(xAOD::Muon::CombinedTrackParticle);
+
+  double pt, ptID, ptMS,ptCB;
+
+  if ( !(pxMuonID || pxMuonMS || pxMuonCB)){
+         if(m_doDebug) std::cout << "   * MuonSelector * passPtCuts() * NO inDetTrackParticle && muonSpectrometerTrackParticle && CombinedTrackParticle: " << std::endl;
   }
 
   else {
 
-    double pt    = m_pxMuon->pt();
-    double ptID  = pxMuonID->pt();
-    double ptMS  = pxMuonMS->pt();
+    pt    = m_pxMuon->pt();
+    ptID  = pxMuonID ? pxMuonID->pt() : 0.0 ;
+    ptMS  = pxMuonMS ? pxMuonMS->pt() : 0.0 ;
+    ptMS  = pxMuonCB ? pxMuonCB->pt() : 0.0 ;
     double fMEta = fabs( m_pxMuon->eta() );
 
-    if(m_doDebug) std::cout <<" in passPtCuts: "<< " pt: "  << pt << " ptID: " << ptID <<" ptMS:  " << ptMS << " fMEta: "<< fMEta << std::endl;
-
+    if(m_doDebug) std::cout <<"   * MuonSelector * passPtCuts() * pt of segments "  << pt << " ptID: " << ptID <<" ptMS:  " << ptMS << " ptCB:" << ptCB << " fMEta: "<< fMEta << std::endl;
 
+    
     if (  fMEta < m_fEtaCut    &&
-    pt    > m_combPtCut  &&
-    ptMS  > m_ptMSCut
-    //fabs(ptMS - ptID) < m_diffPtCut
-    ){
-             if(m_doDebug) std::cout << " this muon passed the PtCuts:" << std::endl;
+	  pt    > m_combPtCut  &&
+	  (ptMS  > m_ptMSCut || !pxMuonMS) //PF: This is kinda silly as m_ptMSCut is 0.0 by default and not changed anywhere at setup. Anyway kept the logic for future proper implementation
+	  //fabs(ptMS - ptID) < m_diffPtCut
+	  ){
+      if(m_doDebug) std::cout << "   * MuonSelector * passPtCuts() * this muon passed the PtCuts (" << m_combPtCut <<") "<< std::endl;
              return true;
     }
   }
-
-  (*m_msgStream) << MSG::DEBUG << " this muon did not pass the PtCuts:" << endreq;
+  if(m_doDebug) std::cout << "   * MuonSelector * passPtCuts() * this muon did not pass the PtCuts (reco pt=" << pt << ") " << std::endl;
   return false;
 }
 
 bool MuonSelector::passIsolCuts()
 {
-  const  xAOD::TrackParticle* pxMuonID = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
-  if (pxMuonID) {
-    float iso_pt40(0);
-    if( !m_pxMuon->isolation(iso_pt40, xAOD::Iso::ptcone40) ) {
-      std::cout << "No isolation variable stored on the muon" << std::endl;
-      if(m_doDebug) std::cout << " this muon did not pass the IsoCuts:" << std::endl;
-      return false;
-    }
-    else {
-      double pt = m_pxMuon->pt();
-      double ptSum = xAOD::Iso::ptcone40;
-      if(m_doDebug) std::cout <<" in passIsolCuts , pt :" << pt <<" ptSum: "<< ptSum << std::endl;
-        if (ptSum/pt < m_IsoCut ){
-         if(m_doDebug) std::cout << " this muon passed the IsoCuts:" << std::endl;
-       return true;
-     }
+  float iso_pt40(0);
+  if( !m_pxMuon->isolation(iso_pt40, xAOD::Iso::ptcone40) ) {
+    std::cout << " * MuonSelector * WARNING * No isolation variable stored on the muon" << std::endl;
+    if(m_doDebug) std::cout << "   * MuonSelector * passIsolCuts() * this muon did not pass the IsoCuts " << endmsg;
+    return false;
+  }
+  
+  else {
+    double pt = m_pxMuon->pt();
+    double ptSum = xAOD::Iso::ptcone40;
+    if(m_doDebug) std::cout <<" in passIsolCuts , pt :" << pt <<" ptSum: "<< ptSum << std::endl;
+    if (ptSum/pt < m_IsoCut ){
+      if(m_doDebug) std::cout << "   * MuonSelector * passIsolCuts() * this muon passed the IsoCuts:" << std::endl;
+      return true;
+      
     }
   }
-  if(m_doDebug) std::cout << " this muon did not pass the IsoCuts:" << std::endl;
+  
+  if(m_doDebug) std::cout << "   * MuonSelector * passIsolCuts() * this muon did not pass the IsoCuts:" << std::endl;
   return false;
 }
 
@@ -269,65 +289,86 @@ bool MuonSelector::passIsolCuts()
 bool MuonSelector::passIPCuts()
 {
   float extd0 = 0.0 ;
-  float extz0 = 0.0 ;
+  float extz0 = 0.0 ;  
 
+  //I'm not really sure of this logic. 
   if (m_pxMuon->inDetTrackParticleLink().isValid()) {
-    const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+    const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);  //Always use combined track
+    if (!IDTrk) 
+      {
+	return false;
+      }
     extd0 = IDTrk->d0();
     extz0 = IDTrk->z0()+IDTrk->vz();
     if(m_doDebug){
-      std::cout << " the IDTrack muon d0:  " << extd0 << std::endl;
-      std::cout << " the IDTrack muon z0:  " << extz0 << std::endl;
+      std::cout << "   * MuonSelector * passIPCuts() *"
+		<< " the IDTrack muon d0:  " << extd0
+		<< " the IDTrack muon z0:  " << extz0 << std::endl;
     }
-    //if( IDTrk->track() ) {
-    //      const Trk::Track* IDTrkTrack = IDTrk->track();
-    //      if(IDTrkTrack) {
-    //	const Trk::Perigee* measPerigee = IDTrkTrack->perigeeParameters();
-    //	if( measPerigee==0 ){
-    //	  std::cout << "Could not get Trk::MeasuredPerigee " << std::endl;
-    //	}
-    //	  else{
-    //	    extd0 = measPerigee->parameters()[Trk::d0];
-    //	    extz0 = measPerigee->parameters()[Trk::z0];
-    //	    if(m_doDebug){
-    //	      std::cout << " the IDTrack muon d0:  " << extd0 << std::endl;
-    //	      std::cout << " the IDTrack muon z0:  " << extz0 << std::endl;
-    //
-    //	  }
-    //	}
-    //      }
-    //    }
-
-    //    else
-    //      return false;
   }
-  else
-    return false;
-
-  //      const VxContainer *  vxContainer(0);
+  else {
+    if(m_doDebug) std::cout << "   * MuonSelector * passIPCuts() * no valid inDetTrackParticleLink(). Will use the combined muon IPs" << std::endl;
+    
+    const xAOD::TrackParticle* CBTrk = m_pxMuon->trackParticle(xAOD::Muon::CombinedTrackParticle);
+    if (!CBTrk) {
+      if(m_doDebug) std::cout << "   * MuonSelector * passIPCuts() * no valid CombinedTrackParticle. Giving up." << std::endl;
+      return false;
+    }
+    else { 
+      extd0 = CBTrk->d0();
+      extz0 = CBTrk->z0()+CBTrk->vz();
+      if(m_doDebug){
+	std::cout << " * MuonSelector * passIPCuts() *"
+		  << " the CBTrack muon d0:  " << extd0
+		  << " the CBTrack muon z0:  " << extz0 << std::endl;
+      }
+    }
+  }
+  
   const xAOD::VertexContainer *  vxContainer(0);
-  //vxContainer = PerfMonServices::getContainer<VxContainer>( PerfMonServices::VTX_COLLECTION );
   vxContainer = PerfMonServices::getContainer<xAOD::VertexContainer>( PerfMonServices::VTX_COLLECTION );
   if (!vxContainer){
-    if(m_doDebug) std::cout << " NO vertex collection "<< std::endl;
+    if(m_doDebug) std::cout << "   * MuonSelector * passIPCuts() ** fails because NO vertex collection "<< std::endl;
     return false;
   }
 
   if ( vxContainer->size()>1 ) {
-    //    const Trk::VxCandidate* PV  = (*vxContainer)[0];
-    const xAOD::Vertex* PV  = (*vxContainer)[0];
-    //Amg::Vector3D newPos = PV->recVertex().position();
-    Amg::Vector3D newPos = PV->position();
-    if(m_doDebug) std::cout << " the PV of this event: " << newPos << std::endl;
-
-    if ( PV->nTrackParticles() > 2         &&
-	 //If- ( PV->vxTrackAtVertex()->size() > 2         &&
-	 fabs(newPos.z())              < m_pVZCut   &&
-    	 fabs(extz0 - newPos.z())      < m_diffZCut    ){
-      if(m_doDebug) std::cout <<" this muon passed the IPCuts: " << std::endl;
-      return true;
+    if(m_doDebug) {
+      std::cout << "   * MuonSelector * passIPCuts() ** vertex container is filled with " << vxContainer->size() << " vertices" <<  std::endl;
+
+      // loop on vertices to check their coordinates:
+      for (int ivtx=0; ivtx < (int) vxContainer->size(); ivtx++) {
+	const xAOD::Vertex* thisVtx  = (*vxContainer)[ivtx];
+	std::cout << "                                   vertex " << ivtx+1 << " (x,y,z) = (" << thisVtx->position().x()
+		  << ", " << thisVtx->position().y()
+		  << ", " << thisVtx->position().z()
+		  << ")  type= " << thisVtx->vertexType()
+		  << "  Npart= " << thisVtx->nTrackParticles()
+		  <<  std::endl;
+      }
+    }
+        
+    // new method
+    if (true) {
+      bool goodmuonIP = false; // by default think the IP is not good
+      // loop on vertices and check the muon may come from one of them
+      for (int ivtx=0; ivtx < (int) vxContainer->size(); ivtx++) {
+	const xAOD::Vertex* thisVtx  = (*vxContainer)[ivtx];
+	if ( (thisVtx->vertexType() == 1) && thisVtx->nTrackParticles()>2 ) {
+	  // check the vertex is in range and the muon is not far from the vertex
+	  if (fabs(thisVtx->position().z()) < m_pVZCut && fabs(extz0 - thisVtx->position().z()) < m_diffZCut){
+	    goodmuonIP = true;
+	    if(m_doDebug) std::cout <<"   * MuonSelector * passIPCuts() * this muon has passed the IPCuts for vertex " << ivtx+1
+				    << "  pVZcut= " << fabs(extz0 - thisVtx->position().z()) << " < " << m_diffZCut << std::endl;
+	  }
+	}
+      }
+      if (goodmuonIP) {
+	if(m_doDebug) std::cout <<"   * MuonSelector * passIPCuts() * this muon has passed the IPCuts. Zcut: "<<  m_pVZCut << "  m_diffZCut " << m_diffZCut << std::endl;
+	return true;
+      }
     }
   }
-  if(m_doDebug) std::cout <<" this muon not passed the IPCuts: " << std::endl;
+  if(m_doDebug) std::cout <<"   * MuonSelector * passIPCuts() * this muon has not passed the IPCuts: " << std::endl;
   return false;
 }
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelectorForJpsi.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelectorForJpsi.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..9417551004b13f790d6e6cb63f1f8c694b812038
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/MuonSelectorForJpsi.cxx
@@ -0,0 +1,300 @@
+//==================================================================================
+//
+//  ZMM_Event.cxx :       Class designed to reconstruct di-boson events
+//                        in particular Z0 -> mu+ mu- events.
+//  Author :              Kyle Stevenson, QMUL
+//  Date :                7th December 2007
+//
+//==================================================================================
+
+//==================================================================================
+// Include files...
+//==================================================================================
+
+// This files header
+#include "InDetPerformanceMonitoring/MuonSelectorForJpsi.h"
+// Package Headers
+#include "InDetPerformanceMonitoring/PerfMonServices.h"
+#include <sstream>
+// ATLAS headers
+#include "StoreGate/StoreGateSvc.h"
+//#include "muonEvent/MuonParamDefs.h"
+#include "CLHEP/Random/RandFlat.h"
+
+#include "GaudiKernel/IToolSvc.h"
+
+#include "xAODMuon/Muon.h"
+#include "xAODMuon/MuonContainer.h"
+
+
+
+
+// Local debug variables. Global scope, but only accessible by this file.
+static const float CGeV              =  1.0e-3;  // Conversion factor to remove evil MeV
+                                                 // nonsense.
+
+// Static declarations
+unsigned int MuonSelectorForJpsi::s_uNumInstances;
+
+//==================================================================================
+// Public Methods
+//==================================================================================
+
+MuonSelectorForJpsi::MuonSelectorForJpsi()
+{
+  ++s_uNumInstances;
+
+  std::stringstream xTmp;  xTmp << s_uNumInstances;
+  m_xSampleName     = "MuID_" + xTmp.str();
+
+  m_pxMuon = NULL;
+  m_bLock  = false;
+
+  m_coneSize        = 0.4;
+  m_ucJMuon_Cut     = 0; //not used
+  m_IsoCut          = 0.2;
+
+  m_bCutOnCombKine  = false; //not used
+  m_fEtaCut         = 2.5;
+  //m_fEtaCut         = 1.9;
+  m_combPtCut       = 1.0*CLHEP::GeV; // GeV/c //Lower than for the Zmumu case
+
+  //m_ptMSCut         = 10.0*CLHEP::GeV;
+  m_ptMSCut         = 0.0*CLHEP::GeV;
+  m_diffZCut        = 10.0*CLHEP::mm;  // mm
+  m_diffPtCut       = 15.0*CLHEP::GeV;  // not used
+  m_pVZCut          = 150.0*CLHEP::mm; // mm
+
+  m_fIDPtCut        = 0.0;     // GeV/c
+  m_fIDChiPerDofCut = 4.0;
+  m_IDSiHitsCut     = 8;
+  m_ucID_PIXCut     = 1;        // Hits
+  m_ucID_SCTCut     = 4;        // Hits
+  m_ucID_TRTCut     = 0;        // Hits
+
+  m_doDebug         = false;
+  m_doQualSelection = true;
+  m_doIsoSelection  = false;
+  m_doPtSelection   = true;
+  m_doIPSelection   = true;
+
+  m_msgStream =  new MsgStream(PerfMonServices::getMessagingService(), "InDetPerformanceMonitoring" );
+
+}
+
+
+
+
+MuonSelectorForJpsi::~MuonSelectorForJpsi()
+{
+  --s_uNumInstances;
+  delete m_msgStream;
+}
+
+bool MuonSelectorForJpsi::passSelection( const xAOD::Muon* pxMuon )
+{
+
+  std::vector<bool> passes;
+  bool pass = true;
+  if ( pxMuon )
+    {
+      // Save local copy of muon address if it's ok.
+      m_pxMuon = pxMuon;
+      // Test muon pass conditions in turn
+      if(m_doQualSelection){
+	pass = passQualCuts();
+	passes.push_back(pass);
+      }
+
+      if (m_doIsoSelection){
+        pass = passIsolCuts();
+        passes.push_back(pass);
+      }
+
+      if (m_doPtSelection){
+        pass = passPtCuts();
+	passes.push_back(pass);
+      }
+
+      if (m_doIPSelection){
+        pass = passIPCuts();
+        passes.push_back(pass);
+      }
+
+      for (int i=0; i < int(passes.size()); i++)
+	if (false == passes[i]){
+	  if(m_doDebug) std::cout << " haven't passed the " << i <<"th selection " << std::endl;
+	  return false;
+	}
+
+    }
+  return true;
+}
+
+
+
+void MuonSelectorForJpsi::Init()
+{
+  ISvcLocator* serviceLocator = Gaudi::svcLocator();
+  IToolSvc* toolSvc;
+  StatusCode sc = serviceLocator->service("ToolSvc", toolSvc, true);
+
+  if ( sc.isFailure() || toolSvc == 0 ) {
+    (*m_msgStream) << MSG::ERROR << "Unable to retrieve ToolSvc " << endreq;
+    return;
+  }
+  PARENT::Init();
+}
+
+
+
+bool MuonSelectorForJpsi::Reco()
+{
+  return true;
+}
+
+//==================================================================================
+// Protected Methods
+//==================================================================================
+void MuonSelectorForJpsi::BookHistograms( )
+{
+}
+
+
+//==================================================================================
+// Private Methods
+//==================================================================================
+bool MuonSelectorForJpsi::passQualCuts()
+{
+  // Apply muon hit criteria
+  // First get the muon track, then the summarys
+  const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+
+  //    if ( !m_pxMuon->isCombinedMuon()) return false;
+  //  if ( m_pxMuon->trackParticle(xAOD::Muon::CombinedTrackParticle) ) return false;
+  if( xAOD::Muon::Combined ) return false;
+  if (IDTrk) {
+    uint8_t dummy(-1);
+    bool eBLhits = IDTrk->summaryValue( dummy, xAOD::expectBLayerHit )? dummy :-1;
+    int  nBLhits = IDTrk->summaryValue( dummy, xAOD::numberOfBLayerHits )? dummy :-1;
+
+    int nhitsPIX = IDTrk->summaryValue( dummy, xAOD::numberOfPixelHits )? dummy :-1;
+    int nhitsSCT = IDTrk->summaryValue( dummy, xAOD::numberOfSCTHits )? dummy :-1;
+
+    int nPIXDS = IDTrk->summaryValue( dummy, xAOD::numberOfPixelDeadSensors )? dummy :-1;
+    int nSCTDS = IDTrk->summaryValue( dummy, xAOD::numberOfSCTDeadSensors )? dummy :-1;
+
+    int nPIXH = IDTrk->summaryValue( dummy, xAOD::numberOfPixelHoles )? dummy :-1;
+    int nSCTH = IDTrk->summaryValue( dummy, xAOD::numberOfSCTHoles )? dummy :-1;
+
+    if(m_doDebug) std::cout << " eBLhits: " << eBLhits << " nBLhits:  " << nBLhits  << " nhitsPIX: " << nhitsPIX << std::endl;
+
+    if (   ((!eBLhits) || (nBLhits > 0))
+	   &&   (nhitsPIX + nPIXDS > 1 )
+	   &&   (nhitsSCT + nSCTDS >=6 )
+	   &&   (nPIXH    + nSCTH  < 2 ) )
+      return true;
+  }
+
+
+if(m_doDebug) std::cout << "this muon not pass the hits number QualCuts:  "  << std::endl;
+return false;
+}
+
+bool MuonSelectorForJpsi::passPtCuts()
+{
+
+  const xAOD::TrackParticle* pxMuonID = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+  const xAOD::TrackParticle* pxMuonMS = m_pxMuon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
+  if ( !(pxMuonID && pxMuonMS)){
+         if(m_doDebug) std::cout << "NO inDetTrackParticle && muonSpectrometerTrackParticle: " << std::endl;
+  }
+
+  else {
+
+    double pt    = m_pxMuon->pt();
+    double ptID  = pxMuonID->pt();
+    double ptMS  = pxMuonMS->pt();
+    double fMEta = fabs( m_pxMuon->eta() );
+
+    if(m_doDebug) std::cout <<" in passPtCuts: "<< " pt: "  << pt << " ptID: " << ptID <<" ptMS:  " << ptMS << " fMEta: "<< fMEta << std::endl;
+
+
+    if (  fMEta < m_fEtaCut    &&
+    	  pt    > m_combPtCut  &&
+    	  ptMS  > m_ptMSCut
+    	  //fabs(ptMS - ptID) < m_diffPtCut
+    	  ){
+             if(m_doDebug) std::cout << " this muon passed the PtCuts:" << std::endl;
+             return true;
+    }
+  }
+
+  (*m_msgStream) << MSG::DEBUG << " this muon did not pass the PtCuts:" << endreq;
+  return false;
+}
+
+bool MuonSelectorForJpsi::passIsolCuts()
+{
+  const  xAOD::TrackParticle* pxMuonID = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+  if (pxMuonID) {
+    float iso_pt40(0);
+    if( !m_pxMuon->isolation(iso_pt40, xAOD::Iso::ptcone40) ) {
+      std::cout << "No isolation variable stored on the muon" << std::endl;
+      if(m_doDebug) std::cout << " this muon did not pass the IsoCuts:" << std::endl;
+      return false;
+    }
+    else {
+      double pt = m_pxMuon->pt();
+      double ptSum = xAOD::Iso::ptcone40;
+      if(m_doDebug) std::cout <<" in passIsolCuts , pt :" << pt <<" ptSum: "<< ptSum << std::endl;
+        if (ptSum/pt < m_IsoCut ){
+         if(m_doDebug) std::cout << " this muon passed the IsoCuts:" << std::endl;
+       return true;
+     }
+    }
+  }
+  if(m_doDebug) std::cout << " this muon did not pass the IsoCuts:" << std::endl;
+  return false;
+}
+
+
+bool MuonSelectorForJpsi::passIPCuts()
+{
+  float extd0 = 0.0 ;
+  float extz0 = 0.0 ;
+
+  if (m_pxMuon->inDetTrackParticleLink().isValid()) {
+    const xAOD::TrackParticle* IDTrk = m_pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+    extd0 = IDTrk->d0();
+    extz0 = IDTrk->z0()+IDTrk->vz();
+    if(m_doDebug){
+      std::cout << " the IDTrack muon d0:  " << extd0 << std::endl;
+      std::cout << " the IDTrack muon z0:  " << extz0 << std::endl;
+    }
+  }
+  else
+    return false;
+
+  const xAOD::VertexContainer *  vxContainer(0);
+  vxContainer = PerfMonServices::getContainer<xAOD::VertexContainer>( PerfMonServices::VTX_COLLECTION );
+  if (!vxContainer){
+    if(m_doDebug) std::cout << " NO vertex collection "<< std::endl;
+    return false;
+  }
+
+  if ( vxContainer->size()>1 ) {
+    const xAOD::Vertex* PV  = (*vxContainer)[0];
+    Amg::Vector3D newPos = PV->position();
+    if(m_doDebug) std::cout << " the PV of this event: " << newPos << std::endl;
+
+    if ( PV->nTrackParticles() > 2         &&
+	 fabs(newPos.z())              < m_pVZCut   &&
+    	 fabs(extz0 - newPos.z())      < m_diffZCut    ){
+      if(m_doDebug) std::cout <<" this muon passed the IPCuts: " << std::endl;
+      return true;
+    }
+  }
+  if(m_doDebug) std::cout <<" this muon not passed the IPCuts: " << std::endl;
+  return false;
+}
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/PerfMonServices.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/PerfMonServices.cxx
index b9d33d9549510d07c23b37e9d1f80c9088cb6e7a..3764e79c5f44c1911f5cc4120cda5e4e02fdd7d2 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/PerfMonServices.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/PerfMonServices.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 #include "InDetPerformanceMonitoring/PerfMonServices.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/StatusCode.h"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx
index cde22219fac62c1a30127fe8e98ec3e7e0ee6a20..e7e220e77a9ea5f5c9c0db5a5dc83ea736ee0541 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/TRT_Electron_Monitoring_Tool.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 // **********************************************************************
 // Class to monitoring TRT HL threshold monitoring by looking at electrons
 // Created by Benjamin Kaplan (kaplan) 2009-10-14
@@ -169,11 +165,11 @@ bookHistograms()
     return StatusCode::FAILURE;
   }
 
-  if( newLumiBlock ) { }
+  if( newLumiBlockFlag() ) { }
 
-  if( newLowStat ) { }
+  if( newLowStatFlag() ) { }
 
-  if( newRun ) { }
+  if( newRunFlag() ) { }
 
   return StatusCode::SUCCESS;
 }
@@ -201,11 +197,11 @@ bookGeoHistograms( lw_geo_hists_t &hists, const std::string& name)
   MonGroup hl_monGroup_shift	( this, "TRT//HTMonitoring/"+name,  run,ATTRIB_MANAGED,"", "");
   //MonGroup hl_monGroup_expert	( this, "TRT//HTMonitoring/"+name, expert, run, "",""); //not yet used but will be
 
-  if( newLumiBlock ) { }
+  if( newLumiBlockFlag() ) { }
 
-  if( newLowStat ) { }
+  if( newLowStatFlag() ) { }
 
-  if( newRun )
+  if( newRunFlag() )
   {
 
     hists.hNTracks		= trtBookHistoLW(hl_monGroup_shift, "hNTracks"		,"Number of Tracks per Event in "+name	, 150 , 0, 150 , profile_x_label_size, profile_y_label_size, "Number of Tracks", "Frequency");
@@ -253,11 +249,11 @@ TRT_Electron_Monitoring_Tool::
 bookPCandHistograms( MonGroup& monGroup, lw_partcand_hists_t &hists, const std::string& name )
 {
 
-  if( newLumiBlock ) { }
+  if( newLumiBlockFlag() ) { }
 
-  if( newLowStat ) { }
+  if( newLowStatFlag() ) { }
 
-  if( newRun )
+  if( newRunFlag() )
   {
     hists.hNCand		= trtBookHistoLW(monGroup, "hNCand"+name	,"Number of "+name+" Candidates per Event"		, 150 , 0, 150 , profile_x_label_size, profile_y_label_size, "Number of "+name+" Candidates", "Frequency");
     hists.hPIDProb		= trtBookHistoLW(monGroup, "hPIDProb"+name	,"PID Likelihood per "+name+" Candidate"		, 50 , 0, 1 , profile_x_label_size, profile_y_label_size, "PID Likelihood", "Frequency");
@@ -841,9 +837,9 @@ StatusCode
 TRT_Electron_Monitoring_Tool::
 procHistograms()
 {
-  if( endOfRun ) { }
-  if( endOfLowStat ) { }
-  if( endOfLumiBlock ) { }
+  if( endOfRunFlag() ) { }
+  if( endOfLowStatFlag() ) { }
+  if( endOfLumiBlockFlag() ) { }
   return StatusCode::SUCCESS;
 }//procHistograms
 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx
index 5c439eac0bb4aa10d89f809c958be8b23c1fe841..7db4b7f77d336b1d13a21bc078d9b5cb9d368164 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx
@@ -1,7 +1,3 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
 //==================================================================================
 
 //==================================================================================
@@ -42,24 +38,36 @@ ZmumuEvent::ZmumuEvent()
   m_uTrackMatch = 0;
   m_bLooseMatch = true;  // will use combined fit otherwise.
   m_etaCut      = 1.05;
+  m_LeadingMuonPtCut = 20.;   
+  m_SecondMuonPtCut = 15.;
+  m_MassWindowLow = 60.0;
+  m_MassWindowHigh = 120.0;
+  m_OpeningAngleCut = 0.2; // in radians
+  m_Z0GapCut = 5.0; // in mm
+  m_SelectMuonByIso = true;
+  m_SelectMuonByIP = true;
 }
 
+//==================================================================================
 ZmumuEvent::~ZmumuEvent()
 {
 }
 
+//==================================================================================
 void ZmumuEvent::Init()
 {
   m_xMuonID.Init();
+
   PARENT::Init();
 }
 
 
 
+//==================================================================================
 const std::string ZmumuEvent::getRegion() const{
 
-  const double eta1 = fabs(m_pxRecMuon[MUON1]->eta());
-  const double eta2 = fabs(m_pxRecMuon[MUON2]->eta());
+  const double eta1 = fabs(m_pxRecMuon[m_muon1]->eta());
+  const double eta2 = fabs(m_pxRecMuon[m_muon2]->eta());
   //std::cout << "  eta1: " << eta1 << std::endl;
   //std::cout << "  eta2: " << eta2 << std::endl;
 
@@ -73,42 +81,53 @@ const std::string ZmumuEvent::getRegion() const{
 }
 
 
-
+//==================================================================================
 bool ZmumuEvent::Reco()
 {
+
+  if(m_doDebug){ std::cout << " * ZmumuEvent * ZmumuEvent::Reco() starting " << std::endl; }
   // Clear out the previous events record.
-  Clear();
+  this->Clear();
   //  const Analysis::MuonContainer* pxMuonContainer = PerfMonServices::getContainer<Analysis::MuonContainer>( m_container );
   const xAOD::MuonContainer* pxMuonContainer = PerfMonServices::getContainer<xAOD::MuonContainer>( m_container );
   if (!pxMuonContainer){
-    //     std::cout << "Can't retrieve combined muon collection" << std::endl;
+    std::cout << " * ZmumuEvent * Can't retrieve combined muon collection (container: " << m_container <<") " << std::endl;
     return false;
   }
   else{
-    if(m_doDebug){     std::cout << pxMuonContainer->size() << " combined muon "<<std::endl; }
+    if(m_doDebug) {std::cout << " * ZmumuEvent * track list has "<< pxMuonContainer->size() << " combined muon "<<std::endl; }
     xAOD::MuonContainer::const_iterator xMuonItr  = pxMuonContainer->begin();
     xAOD::MuonContainer::const_iterator xMuonItrE  = pxMuonContainer->end();
-      while ( xMuonItr != xMuonItrE )
-	{
-	  const xAOD::Muon* pxCMuon = *xMuonItr;
-	  // Apply muon cuts
-	  if ( m_xMuonID.passSelection( pxCMuon ) ) {
-	       RecordMuon( pxCMuon );
-	  }
-	  xMuonItr++;
-	}
+    while ( xMuonItr != xMuonItrE ){ // start loop on muons
+      const xAOD::Muon* pxCMuon = *xMuonItr;
+      if(m_doDebug){std::cout << " * ZmumuEvent * Reco() ** attempt on xMuonItr "<< *xMuonItr << std::endl; }
+      // Apply muon cuts
+      if ( m_xMuonID.passSelection( pxCMuon) ) {
+	RecordMuon( pxCMuon );
+      }
+      xMuonItr++;
+    } // end loop on muons
   }
-
-
+  
+  // ordering of muons
+  this->OrderMuonList();
+  
   // Reconstruct the invariant mass ( based on mu-sys pt ).
   ReconstructKinematics();
+  
+  m_passedSelectionCuts = EventSelection(ID);
+  m_DiMuonPairInvMass =  m_fInvariantMass[ID];
+  
+  
+  if(m_doDebug) {
+    if ( m_passedSelectionCuts) std::cout << " * ZmumuEvent * Reco() * Selected event :) " << std::endl;
+    if (!m_passedSelectionCuts) std::cout << " * ZmumuEvent * Reco() * Rejected event :) " << std::endl;
+  }
 
-  m_passedSelectionCuts = EventSelection();
   return m_passedSelectionCuts;
 }
 
 
-
 //==================================================================================
 // Protected Methods
 //==================================================================================
@@ -119,106 +138,224 @@ void ZmumuEvent::BookHistograms()
 //==================================================================================
 // Private Methods
 //==================================================================================
-bool ZmumuEvent::EventSelection()
+bool ZmumuEvent::EventSelection(ZTYPE eType)
 {
+  if(m_doDebug){  std::cout <<" * ZmumuEvent * Event selection ** START ** m_NumberOfFullPassMuons: " << m_numberOfFullPassMuons << std::endl;}
 
-  if(m_doDebug){  std::cout <<" m_uNumberOfFullPassMuons: " << m_numberOfFullPassMuons << std::endl;}
   // First require two muon-id's with cuts pre-applied.
-  if ( m_numberOfFullPassMuons != 2 )    return false;
-
-  if ( !((m_pxRecMuon[MUON1]->pt() > 20.0*CLHEP::GeV &&  m_pxRecMuon[MUON2]->pt() > 15.0*CLHEP::GeV ) ||
-         (m_pxRecMuon[MUON1]->pt() > 15.0*CLHEP::GeV &&  m_pxRecMuon[MUON2]->pt() > 20.0*CLHEP::GeV )) )
+  if ( m_numberOfFullPassMuons < 2 ) {
+    if(m_doDebug) {std::cout <<" * ZmumuEvent * Failing number of good muons == 2 :( " <<  m_numberOfFullPassMuons << std::endl;}
+    return false;
+  }
+  
+  // crosscheck all muons have been properly filled
+  bool allMuonsGood = true;
+  for (unsigned int muonid=0; muonid < m_numberOfFullPassMuons; muonid++) {
+    if (!m_pxMSTrack[muonid]) {
+      allMuonsGood = false;
+    } 
+  }
+  if (!allMuonsGood){
+    return false;
+  } 
+   
+  if ( m_numberOfFullPassMuons > 2 ) {
+    if(m_doDebug) {std::cout <<" * ZmumuEvent * Failing number of good muons == 2 :( " <<  m_numberOfFullPassMuons << std::endl;}
+    return false;
+  }
+  
+  // momentum of the muons
+  double leadingMuonPt, secondMuonPt;
+  switch ( eType )
+    {
+    case MS :
+      {
+	leadingMuonPt = m_pxMSTrack[m_muon1]->pt();
+	secondMuonPt = m_pxMSTrack[m_muon2]->pt();
+	break;
+      }
+    case ME:
+      {
+	leadingMuonPt = m_pxMETrack[m_muon1]->pt();
+	secondMuonPt = m_pxMETrack[m_muon2]->pt();
+	break;
+      }
+    case CB:
+      {
+	leadingMuonPt = m_pxRecMuon[m_muon1]->pt();
+	secondMuonPt = m_pxRecMuon[m_muon2]->pt();
+	break;
+      }
+    case ID:
+      {
+	leadingMuonPt = m_pxIDTrack[m_muon1]->pt();
+	secondMuonPt = m_pxIDTrack[m_muon2]->pt();
+	break;
+      }
+          
+    default:
+      leadingMuonPt = m_pxRecMuon[m_muon1]->pt();
+      secondMuonPt = m_pxRecMuon[m_muon2]->pt();
+    }
+  // up to here the leading and second pt are not really in the right order.
+  // order the muon pt:
+  if (secondMuonPt > leadingMuonPt) {
+    double tempPt = leadingMuonPt;
+    leadingMuonPt = secondMuonPt;
+    secondMuonPt = tempPt;
+  }
+ 
+  // muon pt cut
+  if ( !(leadingMuonPt > m_LeadingMuonPtCut*CLHEP::GeV &&  secondMuonPt >  m_SecondMuonPtCut*CLHEP::GeV ) ) {
+    if(m_doDebug){  std::cout <<" * ZmumuEvent * Failing pt cut * Reco Pt:  " << leadingMuonPt << " " << secondMuonPt << std::endl;}
+    return false;
+  }
+  
+  // Invariant mass window
+  if ( m_fInvariantMass[eType]  < m_MassWindowLow  ) {
+    if(m_doDebug) {std::cout <<" * ZmumuEvent * Failing mass window low cut:  reco m= " << m_fInvariantMass[eType] << " > " <<  m_MassWindowLow << std::endl;}
+    return false;
+  }
+  if ( m_fInvariantMass[eType]  > m_MassWindowHigh ) {
+    if(m_doDebug) {std::cout <<" * ZmumuEvent * Failing mass window high cut:  reco m= " << m_fInvariantMass[eType] << " > " <<  m_MassWindowHigh << std::endl;}
     return false;
-
-  if(m_doDebug){   std::cout <<" m_fInvariantMass[ID]:  "<< m_fInvariantMass[ID] << std::endl;}
-
-  if ( -1 != (m_pxRecMuon[MUON1]->charge() * m_pxRecMuon[MUON2]->charge()) ){
-        std::cout << "same sign event!!!" << std::endl;
-       return false;
   }
 
+  // opening angle
+  if ( m_fMuonDispersion[eType] <  m_OpeningAngleCut  ) {        
+    if(m_doDebug) {std::cout <<" * ZmumuEvent * Failing opening angle cut. Opening angle " << m_fMuonDispersion[eType] << " < " <<  m_OpeningAngleCut << std::endl;}
+    return false;
+  }
 
+  // opposite charge
+  if ( getZCharge(eType) != 0  ) {
+    if(m_doDebug) {
+      std::cout <<" * ZmumuEvent * Failing get ZCharge != 0 cut * Reco q1= " << m_pxRecMuon[m_muon1]->charge()*m_pxRecMuon[m_muon1]->pt() <<std::endl;
+	//<< "  q2= " <<  m_pxRecMuon[m_muon2]->charge()*m_pxRecMuon[m_muon2]->pt() << std::endl; //This might not exist!
+      std::cout <<"                                             * ID   q1= " << m_pxIDTrack[m_muon1]->charge()*m_pxIDTrack[m_muon1]->pt() << std::endl;
+	//	<< "  q2= " <<  m_pxIDTrack[m_muon2]->charge()*m_pxIDTrack[m_muon2]->pt() << std::endl; //This might not exist!
+    }
+    return false;
+  }
 
-  if ( m_fInvariantMass[ID]  < 60.0f  )         return false;
-  if ( m_fInvariantMass[ID]  > 120.0f )         return false;
-  if ( m_fMuonDispersion[ID] <  0.2f  )         return false;
-  if ( getZCharge(ID) != 0            )         return false;
+  //
+  // both muons should come from the same vertex
+  // if the vertex information is used, that is already guaranteed, but if not, one has to check the z0
+  if (eType == ID) {
+    double z0_muon1 = m_pxIDTrack[m_muon1]->vz() +  m_pxIDTrack[m_muon1]->z0();
+    double z0_muon2 = m_pxIDTrack[m_muon2]->vz() +  m_pxIDTrack[m_muon2]->z0();
+    if(m_doDebug) {
+      std::cout << " * ZmumuEvent *  z0_muon1= " << z0_muon1 << "  z0_muon2= " << z0_muon2 << "  delta= " << z0_muon1-z0_muon2 << std::endl;
+    }
+    if ( fabs(z0_muon1 - z0_muon2) > m_Z0GapCut) {
+      if(m_doDebug || true) {
+	std::cout << " * ZmumuEvent * Failing common vertex cut. z.vtx1= " << m_pxIDTrack[m_muon1]->vz() << "  z.vtx2= " << m_pxIDTrack[m_muon2]->vz() << std::endl;
+	std::cout << " * ZmumuEvent * Failing common vertex cut. IDTrk.z0_1= " << m_pxIDTrack[m_muon1]->z0() << "  IDTrk.z0_2= " << m_pxIDTrack[m_muon2]->z0() << std::endl;
+	std::cout << " * ZmumuEvent * z0_muon1= " << z0_muon1 << "  z0_muon2= " << z0_muon2 << "  delta= " << z0_muon1-z0_muon2 << " > " << m_Z0GapCut << " (cut)" << std::endl;
+      } 
+      return false;
+    }
+  }
+  
 
+  if(m_doDebug) {
+    std::cout <<" * ZmumuEvent * Good muon pair: pt= " <<  leadingMuonPt/1000 
+	      << " & " << secondMuonPt/1000 
+	      << " GeV   dimuon invariant mass = " << m_fInvariantMass[eType] << " GeV " << std::endl;
+  }
   return true;
 }
 
+//==================================================================================
 void ZmumuEvent::Clear()
 {
   m_numberOfFullPassMuons = 0;
   m_passedSelectionCuts   = false;
+  m_DiMuonPairInvMass = -1.; // flag as no reconstructed inv mass yet
+  m_muon1 = MUON1; // point to the first two
+  m_muon2 = MUON2;
 
-  for ( unsigned int u = 0; u < NUM_MUONS; ++u )
-    {
-      m_pxRecMuon[u]      = NULL;
-      m_pxMSTrack[u]     = NULL;
+  for ( unsigned int u = 0; u < NUM_MUONS; ++u ) {
+      m_pxRecMuon[u] = NULL;
+      m_pxMSTrack[u] = NULL;
       m_pxMETrack[u] = NULL;
-      m_pxIDTrack[u]      = NULL;
-    }
-  for ( unsigned int v = 0; v < NUM_TYPES; ++v )
-    {
-      m_fZPt[v]            = -999.9f;
-      m_fZEtaDir[v]        = -999.9f;
-      m_fZPhiDir[v]        = -999.9f;
-      m_fInvariantMass[v]  = -999.9f;
-      m_fMuonDispersion[v] = -999.9f;
-    }
+      m_pxIDTrack[u] = NULL;
+  }
+  for ( unsigned int v = 0; v < NUM_TYPES; ++v ) {
+    m_fZPt[v]            = -999.9f;
+    m_fZEtaDir[v]        = -999.9f;
+    m_fZPhiDir[v]        = -999.9f;
+    m_fInvariantMass[v]  = -999.9f;
+    m_fMuonDispersion[v] = -999.9f;
+  }
+  return;
 }
 
+//==================================================================================
 void ZmumuEvent::RecordMuon( const xAOD::Muon* pxMuon )
 {
+  if(m_doDebug){  std::cout <<" * ZmumuEvent * RecordMuon * START "<< std::endl;}
   // This shouldn't really ever happen but just in case.
-  if ( !pxMuon ) return;
+  if ( !pxMuon ) {
+    if(m_doDebug){  std::cout <<" * ZmumuEvent * RecordMuon * bad pxMuon --> EXIT "<< std::endl;}
+    return;
+  }
 
-  if ( m_numberOfFullPassMuons < NUM_MUONS )
-    {
+  if ( m_numberOfFullPassMuons < NUM_MUONS ) {
       // The main Muon
       m_pxRecMuon[m_numberOfFullPassMuons] = pxMuon;
       // Tracking Muon Spectrometer ( raw )
       const xAOD::TrackParticle* pxMSTrack   = pxMuon->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
+      if (!pxMSTrack) {
+	if(m_doDebug){  std::cout <<" * ZmumuEvent * RecordMuon * bad pxMSmuon --> EXIT "<< std::endl;}
+	return;
+      } 
       m_pxMSTrack[m_numberOfFullPassMuons] = pxMSTrack;
 
       // Tracking ID ( fix later to include loose match track conditions )
       const xAOD::TrackParticle*  pxIDTrack  = pxMuon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+      if (!pxIDTrack) {
+	return;
+      }      
       m_pxIDTrack[m_numberOfFullPassMuons] = pxIDTrack;
-    }
-  ++m_numberOfFullPassMuons;
+      //
+      ++m_numberOfFullPassMuons;
+  }
+  if(m_doDebug){  std::cout <<" * ZmumuEvent * RecordMuon * return with a total of " << m_numberOfFullPassMuons << std::endl;}
+  return;
 }
 
 
 
 
+//==================================================================================
 void ZmumuEvent::ReconstructKinematics()
 {
-  // Three ways. No checks here so make sure the pointers are ok before this.
+  // Three ways. No checks here. Thus make sure the pointers are ok before this.
   if ( m_numberOfFullPassMuons == 2 )
     {
-
       // Note that all the util. functions will check the pointers & return -999.9f on failure.
-      m_fInvariantMass[MS]      = EvalDiMuInvMass( m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
-      m_fMuonDispersion[MS]     = EvaluateAngle(   m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
-      m_fZPt[MS]                = EvalPt(          m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
-      m_fZEtaDir[MS]            = EvalEta(         m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
-      m_fZPhiDir[MS]            = EvalPhi(         m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
-
-      m_fInvariantMass[CB]      = EvalDiMuInvMass( m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
-      m_fMuonDispersion[CB]     = EvaluateAngle(   m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
-      m_fZPt[CB]                = EvalPt(          m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
-      m_fZEtaDir[CB]            = EvalEta(         m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
-      m_fZPhiDir[CB]            = EvalPhi(         m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
-
-      m_fInvariantMass[ID]      = EvalDiMuInvMass( m_pxIDTrack[MUON1], m_pxIDTrack[MUON2]);
-      m_fMuonDispersion[ID]     = EvaluateAngle(   m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
-      m_fZPt[ID]                = EvalPt(          m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
-      m_fZEtaDir[ID]            = EvalEta(         m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
-      m_fZPhiDir[ID]            = EvalPhi(         m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+      m_fInvariantMass[MS]      = EvalDiMuInvMass( m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] );
+      m_fMuonDispersion[MS]     = EvaluateAngle(   m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] );
+      m_fZPt[MS]                = EvalPt(          m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] );
+      m_fZEtaDir[MS]            = EvalEta(         m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] );
+      m_fZPhiDir[MS]            = EvalPhi(         m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] );
+
+      m_fInvariantMass[CB]      = EvalDiMuInvMass( m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] );
+      m_fMuonDispersion[CB]     = EvaluateAngle(   m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] );
+      m_fZPt[CB]                = EvalPt(          m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] );
+      m_fZEtaDir[CB]            = EvalEta(         m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] );
+      m_fZPhiDir[CB]            = EvalPhi(         m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] );
+
+      m_fInvariantMass[ID]      = EvalDiMuInvMass( m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2]);
+      m_fMuonDispersion[ID]     = EvaluateAngle(   m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2] );
+      m_fZPt[ID]                = EvalPt(          m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2] );
+      m_fZEtaDir[ID]            = EvalEta(         m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2] );
+      m_fZPhiDir[ID]            = EvalPhi(         m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2] );
     }
 }
 
+//==================================================================================
 float ZmumuEvent::getPtImbalance( ZTYPE eType )
 {
   // First determine what's positive
@@ -228,19 +365,19 @@ float ZmumuEvent::getPtImbalance( ZTYPE eType )
 	{
 	case MS :
 	  {
-	    return EvalPtDiff( m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] );
+	    return EvalPtDiff( m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] );
 	  }
 	case ME:
 	  {
-	    return EvalPtDiff( m_pxMETrack[MUON1], m_pxMETrack[MUON2] );
+	    return EvalPtDiff( m_pxMETrack[m_muon1], m_pxMETrack[m_muon2] );
 	  }
 	case CB:
 	  {
-	    return EvalPtDiff( m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] );
+	    return EvalPtDiff( m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] );
 	  }
 	case ID:
 	  {
-	    return EvalPtDiff( m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] );
+	    return EvalPtDiff( m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2] );
 	  }
 	default:
 	  return -999.0;
@@ -252,31 +389,33 @@ float ZmumuEvent::getPtImbalance( ZTYPE eType )
     }
 }
 
+//==================================================================================
 int ZmumuEvent::getZCharge( ZTYPE eType )
 {
   switch ( eType )
     {
     case MS :
       {
-	return ( static_cast<int>( EvalCharge( m_pxMSTrack[MUON1], m_pxMSTrack[MUON2] ) ) );
+	return ( static_cast<int>( EvalCharge( m_pxMSTrack[m_muon1], m_pxMSTrack[m_muon2] ) ) );
       }
     case ME:
       {
-	return ( static_cast<int>( EvalCharge( m_pxMETrack[MUON1], m_pxMETrack[MUON2] ) ) );
+	return ( static_cast<int>( EvalCharge( m_pxMETrack[m_muon1], m_pxMETrack[m_muon2] ) ) );
       }
     case CB:
       {
-	return ( static_cast<int>( EvalCharge( m_pxRecMuon[MUON1], m_pxRecMuon[MUON2] ) ) );
+	return ( static_cast<int>( EvalCharge( m_pxRecMuon[m_muon1], m_pxRecMuon[m_muon2] ) ) );
       }
     case ID:
       {
-	return ( static_cast<int>( EvalCharge( m_pxIDTrack[MUON1], m_pxIDTrack[MUON2] ) ) );
+	return ( static_cast<int>( EvalCharge( m_pxIDTrack[m_muon1], m_pxIDTrack[m_muon2] ) ) );
       }
     default:
       return -999;
     }
 }
 
+//==================================================================================
 unsigned int ZmumuEvent::getPosMuon( ZTYPE eType )
 {
   if ( getNumberOfTaggedMuons() != 2 ) return 999;
@@ -286,42 +425,44 @@ unsigned int ZmumuEvent::getPosMuon( ZTYPE eType )
     {
     case MS :
       {
-	if ( !m_pxMSTrack[MUON1] || !m_pxMSTrack[MUON2] ) return 999;
-	return ( static_cast<int>( m_pxMSTrack[MUON1]->charge() ) == 1  ? MUON1 : MUON2 );
+	if ( !m_pxMSTrack[m_muon1] || !m_pxMSTrack[m_muon2] ) return 999;
+	return ( static_cast<int>( m_pxMSTrack[m_muon1]->charge() ) == 1  ? m_muon1 : m_muon2 );
       }
     case ME:
       {
-	if ( !m_pxMETrack[MUON1] || !m_pxMETrack[MUON2] ) return 999;
-	return ( static_cast<int>( m_pxMETrack[MUON1]->charge() ) == 1  ? MUON1 : MUON2 );
+	if ( !m_pxMETrack[m_muon1] || !m_pxMETrack[m_muon2] ) return 999;
+	return ( static_cast<int>( m_pxMETrack[m_muon1]->charge() ) == 1  ? m_muon1 : m_muon2 );
       }
     case CB:
       {
-	if ( !m_pxRecMuon[MUON1] || !m_pxRecMuon[MUON2] ) return 999;
-	return ( static_cast<int>( m_pxRecMuon[MUON1]->charge() ) == 1  ? MUON1 : MUON2 );
+	if ( !m_pxRecMuon[m_muon1] || !m_pxRecMuon[m_muon2] ) return 999;
+	return ( static_cast<int>( m_pxRecMuon[m_muon1]->charge() ) == 1  ? m_muon1 : m_muon2 );
       }
     case ID:
       {
-	if ( !m_pxIDTrack[MUON1] || !m_pxIDTrack[MUON2] ) return 999;
-	return ( static_cast<int>( m_pxIDTrack[MUON1]->charge() ) == 1 ? MUON1 : MUON2 );
+	if ( !m_pxIDTrack[m_muon1] || !m_pxIDTrack[m_muon2] ) return 999;
+	return ( static_cast<int>( m_pxIDTrack[m_muon1]->charge() ) == 1 ? m_muon1 : m_muon2 );
       }
     default:
       return 999;
     }
 }
 
+//==================================================================================
 unsigned int ZmumuEvent::getNegMuon( ZTYPE eType )
 {
-  unsigned int uTmp = getPosMuon( eType );
+  int uTmp = getPosMuon( eType );
   if ( uTmp == 999 )
     {
       return 999;
     }
   else
     {
-      return ( ( uTmp == MUON1 ) ? MUON2 : MUON1 );
+      return ( ( uTmp == m_muon1 ) ? m_muon2 : m_muon1 );
     }
 }
 
+//==================================================================================
 const xAOD::TrackParticle*  ZmumuEvent::getLooseIDTk( unsigned int /*uPart*/ )
 {
   const xAOD::TrackParticleContainer*  pxTrackContainer =
@@ -346,8 +487,8 @@ const xAOD::TrackParticle*  ZmumuEvent::getLooseIDTk( unsigned int /*uPart*/ )
 	  const float fTrkPhi   = pxPerigee->parameters()[Trk::phi];
 	  const float fTrkEta   = pxPerigee->eta();
 
-	  float fDPhi = fabs( fTrkPhi -  m_pxMETrack[MUON1]->phi() );
-	  float fDEta = fabs( fTrkEta -  m_pxMETrack[MUON2]->eta() );
+	  float fDPhi = fabs( fTrkPhi -  m_pxMETrack[m_muon1]->phi() );
+	  float fDEta = fabs( fTrkEta -  m_pxMETrack[m_muon2]->eta() );
 	  float fDR = sqrt( fDPhi*fDPhi + fDEta*fDEta );
 
 	  if ( fDR < 0.3f )
@@ -361,3 +502,67 @@ const xAOD::TrackParticle*  ZmumuEvent::getLooseIDTk( unsigned int /*uPart*/ )
   // if ()
   return NULL;
 }
+
+//==================================================================================
+void ZmumuEvent::SetLeadingMuonPtCut (double newvalue)
+{
+  // first set the new pt cut value
+  m_LeadingMuonPtCut = newvalue;
+  
+
+  // the second muon pt cut can not be higher than the leading muon pt cut:
+  if (m_LeadingMuonPtCut < m_SecondMuonPtCut) this->SetSecondMuonPtCut(m_LeadingMuonPtCut);
+
+  // this has to be translated to the MuonSelector
+  // but there one has to use the minimum momentum --> second muon
+  //this->SetMuonPtCut(m_SecondMuonPtCut);
+  if(m_doDebug && false){std::cout <<" * ZmumuEvent * SetLeadingMuonPtCut * new Pt cuts:  " << m_LeadingMuonPtCut << " & " << m_SecondMuonPtCut << "  MuonSelector: " << m_xMuonID.GetPtCut() << std::endl;}
+  return;
+}
+
+//==================================================================================
+void ZmumuEvent::SetSecondMuonPtCut (double newvalue) 
+{
+  m_SecondMuonPtCut = newvalue;
+
+  // second muon pt shouldn't be higher than the leading muon pt
+  if (m_LeadingMuonPtCut < m_SecondMuonPtCut) this->SetLeadingMuonPtCut(m_LeadingMuonPtCut);
+
+  // this has to be translated to the MuonSelector
+  this->SetMuonPtCut(m_SecondMuonPtCut);
+
+  if(m_doDebug && false){std::cout <<" * ZmumuEvent * SetSecondMuonPtCut * new Pt cuts:  " << m_LeadingMuonPtCut << " & " << m_SecondMuonPtCut << "  MuonSelector: " << m_xMuonID.GetPtCut() << std::endl;}
+
+  return;
+}
+
+//==================================================================================
+void ZmumuEvent::OrderMuonList()
+{
+  int muPlusId = -9;
+  int muMinusId = -9;
+  double muPlusPt = 0.;
+  double muMinusPt = 0.;
+
+  if (m_numberOfFullPassMuons > 2) {
+    for (int imuon=0; imuon < (int) m_numberOfFullPassMuons; imuon++) {
+      if (m_pxRecMuon[imuon] != NULL) {
+	
+	if (m_pxRecMuon[imuon]->charge()== 1 && m_pxRecMuon[imuon]->pt()> muPlusPt) {
+	  muPlusPt = m_pxRecMuon[imuon]->pt();
+	  muPlusId = imuon;
+	} 
+	if (m_pxRecMuon[imuon]->charge()==-1 && m_pxRecMuon[imuon]->pt()> muMinusPt) {
+	  muMinusPt = m_pxRecMuon[imuon]->pt();
+	  muMinusId = imuon;
+	} 
+      } // muon exist
+    } // for (int imuon
+  } // if (m_numberOfFullPassMuons > 2)
+  if (muPlusId>=0 && muMinusId>0) {
+    m_muon1 = muPlusId;
+    m_muon2 = muMinusId;
+    m_numberOfFullPassMuons = 2; // the two muons have been selected. Let's pretend we have only two muons then.
+  }
+  return;
+}
diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx
index 3ecf3c488d687b2a7825c9f8ba16c65d7a305a14..65069064d7245e2d92b4a39fdb05f16432dbbd73 100644
--- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx
+++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx
@@ -30,6 +30,7 @@
 #include "egammaInterfaces/ICaloCluster_OnTrackBuilder.h"
 
 #include "AtlasDetDescr/AtlasDetectorID.h"
+#include "InDetIdentifier/PixelID.h"
 #include "IdDictDetDescr/IdDictManager.h"
 #include "TrkRIO_OnTrack/RIO_OnTrack.h"
 
@@ -61,8 +62,9 @@ egammaTrkRefitterTool::egammaTrkRefitterTool(const std::string& type, const std:
   m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"),
   m_linFactory("Trk::FullLinearizedTrackFactory"),
   m_beamCondSvc("BeamCondSvc",name),
-  m_CCOTBuilder("CaloCluster_OnTrackBuilder"),
-  m_idHelper(0) 
+  m_idHelper(0),
+  m_pixelID(0)
+
 {
   // declare interface
   declareInterface< IegammaTrkRefitterTool >(this) ;
@@ -107,10 +109,17 @@ egammaTrkRefitterTool::egammaTrkRefitterTool(const std::string& type, const std:
                   m_useClusterPosition = false, 
                   "Switch to control use of Cluster position measurement");
 
-  declareProperty("CCOTBuilder", 
-                   m_CCOTBuilder);
-                   
-  declareProperty("RemoveTRTHits",m_RemoveTRT  = false,"RemoveTRT Hits");	  
+  declareProperty("RemoveTRTHits",m_RemoveTRT  = false,"RemoveTRT Hits");
+  
+  declareProperty("RemoveIBLHits",m_removeIBL = false, "RemoveIBL Hits");
+  
+  declareProperty("RemoveBLHits", m_removeBL  = false, "RemoveBL Hits");
+  
+  declareProperty("doHitSmearing"  ,m_doHitSmearing=false, "Do Hit randomization - Only IBL for the moment");
+  declareProperty("SmearingX", m_smearingX=0, "Randomisation size in X");
+  declareProperty("SmearingY", m_smearingY=0, "Randomisation size in Y");
+  
+
 }
 
   
@@ -149,7 +158,7 @@ StatusCode egammaTrkRefitterTool::initialize()
   ATH_MSG_INFO("Retrieved " << m_extrapolator);
 
   // configure Atlas extrapolator
-  if (m_CCOTBuilder.retrieve().isFailure()) {
+  if (m_useClusterPosition && m_CCOTBuilder.retrieve().isFailure()) {
     ATH_MSG_FATAL( "Failed to retrieve tool " << m_CCOTBuilder );
     return StatusCode::FAILURE;
   }
@@ -172,6 +181,15 @@ StatusCode egammaTrkRefitterTool::initialize()
   } 
   ATH_MSG_INFO("Retrieved ID helpers");
 
+  if (detStore()->retrieve(m_pixelID, "PixelID").isFailure()) {
+    ATH_MSG_FATAL( "Could not get PixelID helper" );
+    return StatusCode::FAILURE;
+  }
+  ATH_MSG_INFO("Retrieved Pixel ID helper");
+
+
+  
+
 
   // Set the particle hypothesis to match the material effects
   Trk::ParticleSwitcher particleSwitch;
@@ -330,6 +348,12 @@ StatusCode  egammaTrkRefitterTool::refitTrack(const Trk::Track* track, const xAO
     ATH_MSG_DEBUG("Refit Failed");
     return StatusCode::FAILURE;
   }
+  //Clear the pseudo measurements vector
+  for (std::vector<const Trk::MeasurementBase*>::iterator psIt = PseudoMeasurements.begin(); psIt!=PseudoMeasurements.end(); ++psIt) {
+    delete (*psIt);
+  }
+  PseudoMeasurements.clear();
+  
 }
 
 // ================================================================
@@ -585,10 +609,39 @@ const Trk::VertexOnTrack* egammaTrkRefitterTool::provideVotFromBeamspot(const Tr
 }
 
 
-std::vector<const Trk::MeasurementBase*> egammaTrkRefitterTool::getIDHits(const Trk::Track* track) 
-{ 
+
+const Trk::PseudoMeasurementOnTrack* egammaTrkRefitterTool::SmearHit(const Trk::TrackStateOnSurface* trackStateOnSurface) { 
+  
+  TRandom random((int) std::time(0));
+
+  const Trk::RIO_OnTrack* rio = dynamic_cast <const Trk::RIO_OnTrack*>( trackStateOnSurface->measurementOnTrack() );
+  double localPositionX = rio->localParameters()[Trk::loc1];
+  double localPositionY = rio->localParameters()[Trk::loc2];
+    
+  double newlocalPositionX = random.Gaus(localPositionX,m_smearingX);
+  double newlocalPositionY = random.Gaus(localPositionY,m_smearingY);
+   
+    
+  Amg::Vector2D locp(newlocalPositionX,newlocalPositionY);
+  
+  //New Local Parameters:
+  Trk::LocalParameters smearedLocalParameters(locp);
+  
+  //New RIO on Track: I need: LocalParameters,LocalCovariance and Identifier
+  const Trk::PseudoMeasurementOnTrack* SmearedPseudoMeasurement = new Trk::PseudoMeasurementOnTrack(smearedLocalParameters,rio->localCovariance(),rio->associatedSurface());
+  return SmearedPseudoMeasurement;
+  
+}
+
+
+std::vector<const Trk::MeasurementBase*> egammaTrkRefitterTool::getIDHits(const Trk::Track* track)
+{
+  
+  std::unique_ptr<Trk::RIO_OnTrack> smearedTrackStateOnSurface;
   std::vector<const Trk::MeasurementBase*> measurementSet;
   //store all silicon measurements into the measurementset
+
+  
   DataVector<const Trk::TrackStateOnSurface>::const_iterator trackStateOnSurface = track->trackStateOnSurfaces()->begin();
   for ( ; trackStateOnSurface != track->trackStateOnSurfaces()->end(); ++trackStateOnSurface ) {
     
@@ -602,10 +655,34 @@ std::vector<const Trk::MeasurementBase*> egammaTrkRefitterTool::getIDHits(const
         const Trk::RIO_OnTrack* rio = dynamic_cast <const Trk::RIO_OnTrack*>( (*trackStateOnSurface)->measurementOnTrack() );
         if (rio != 0) {
           const Identifier& surfaceID = (rio->identify()) ;
+	  
           if( m_idHelper->is_sct(surfaceID) || m_idHelper->is_pixel(surfaceID) ) {
-            measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() );
+	    //Only do this if we want to remove the IBL or BL hits 
+	    if (m_removeIBL || m_removeBL || m_doHitSmearing) {
+	      if (m_idHelper->is_pixel(surfaceID)) { //Pixel hit 
+		const Identifier& id = m_pixelID->wafer_id(surfaceID);
+		int barrelEC  = m_pixelID -> barrel_ec(id);
+		int layerDisk = m_pixelID -> layer_disk(id);
+		if (m_removeIBL && barrelEC ==0 && layerDisk ==0) {
+		  continue;
+		}
+		if (m_removeBL && barrelEC ==0 && layerDisk == 1) {
+		  continue;
+		}
+		
+		if (m_doHitSmearing && barrelEC == 0 && layerDisk == 0) { 
+		  
+		  const Trk::PseudoMeasurementOnTrack* pseudoMeas = SmearHit((*trackStateOnSurface));
+		  measurementSet.push_back(pseudoMeas);
+		  PseudoMeasurements.push_back(pseudoMeas);
+		  continue; //Skip this hit and put the smeared one in the PseudoMeasurements container.
+		}
+
+	      }
+	    }
+	    measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() );
           } else if( !m_RemoveTRT && m_idHelper->is_trt(surfaceID) ) {
-            measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() );
+	    measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() );
           }
         }        				
       }
@@ -614,14 +691,34 @@ std::vector<const Trk::MeasurementBase*> egammaTrkRefitterTool::getIDHits(const
         if (rio != 0) {
           const Identifier& surfaceID = (rio->identify()) ;
           if( m_idHelper->is_sct(surfaceID) || m_idHelper->is_pixel(surfaceID) ) {
+	    
+	    //Only do this if we want to remove the IBL or BL hits   - todo, make it a function
+	    if (m_removeIBL || m_removeBL) {
+	      if (m_idHelper->is_pixel(surfaceID)) { //Pixel hit 
+		const Identifier& id = m_pixelID->wafer_id(surfaceID);
+		int barrelEC  = m_pixelID -> barrel_ec(id);
+		int layerDisk = m_pixelID -> layer_disk(id);
+		if (m_removeIBL && barrelEC ==0 && layerDisk ==0) {
+		  continue;
+		}
+		if (m_removeBL && barrelEC ==0 && layerDisk == 1) {
+		  continue;
+		}
+	      }
+	    }
+	    
+
             measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() );
           } else if( !m_RemoveTRT && m_idHelper->is_trt(surfaceID) ) {
+	    
             measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() );
           }
         }
       } 
     }
   }
+  
+
   return measurementSet;
 }
 
diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.h b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.h
index 15b1222c32d3c98181d7128cead1432ffabe92d6..4209839513f3bd6e7343eb90dadbb9a54ed81587 100644
--- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.h
+++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.h
@@ -34,12 +34,15 @@ MODIFIED:
 #include "TrkTrack/Track.h"
 #include "TrkParameters/TrackParameters.h"
 #include "TrkMeasurementBase/MeasurementBase.h"
+#include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h"
 #include "xAODEgamma/ElectronFwd.h"
 #include "xAODTracking/TrackParticleFwd.h"
+#include "TRandom.h"
 
 class IBeamCondSvc;
 class ICaloCluster_OnTrackBuilder;
 class AtlasDetectorID ;
+class PixelID;
 
 #include "VxVertex/RecVertex.h"
 #include "TrkVertexFitterInterfaces/IVertexLinearizedTrackFactory.h"
@@ -107,6 +110,7 @@ class egammaTrkRefitterTool : virtual public IegammaTrkRefitterTool, public AthA
  private:
  
   std::vector<const Trk::MeasurementBase*> getIDHits(const Trk::Track* track) ;
+  std::vector<const Trk::MeasurementBase*> PseudoMeasurements;
 
   /** @brief Pointer to the refitted track*/  
   Trk::Track                  *m_refittedTrack; 
@@ -150,9 +154,13 @@ class egammaTrkRefitterTool : virtual public IegammaTrkRefitterTool, public AthA
   /** @brief Returns the amount of material transversed by the track (using X0)*/
   double getMaterialTraversed(Trk::Track* track);
 
-  /** @brief Adds a beam spot to the Measurements passed to the track refitter*/  
-  std::vector<const Trk::MeasurementBase*> addPointsToTrack(const Trk::Track* track, const xAOD::Electron* eg = 0 ); 
-  
+  /** @brief Smears an IBL hit */
+  const Trk::PseudoMeasurementOnTrack* SmearHit(const Trk::TrackStateOnSurface* trackStateOnSurface);
+
+  /** @brief Adds a beam spot to the Measurements passed to the track refitter*/
+  std::vector<const Trk::MeasurementBase*> addPointsToTrack(const Trk::Track* track, const xAOD::Electron* eg = 0 );
+
+
   const Trk::VertexOnTrack*   provideVotFromBeamspot(const Trk::Track* track) const;
   const xAOD::TrackParticle*  getTrackParticle(Trk::VxTrackAtVertex*) const;
 
@@ -168,7 +176,19 @@ class egammaTrkRefitterTool : virtual public IegammaTrkRefitterTool, public AthA
   
   /** @brief Option to remove TRT hits from track*/
   bool m_RemoveTRT;
+  
+  
+  /** @brief Option to remove the hits on track */
+  bool m_removeIBL;
+  bool m_removeBL;
+  
+  /** @brief Option to randomize hits around their original position */
+  bool m_doHitSmearing;
+  float m_smearingX;
+  float m_smearingY;
+  
   const AtlasDetectorID*  m_idHelper  ;
+  const PixelID*          m_pixelID;
 
   std::vector<const Trk::MeasurementBase*>  m_trash;
 };