diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Accumulate_trf.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Accumulate_trf.py
new file mode 100644
index 0000000000000000000000000000000000000000..55038967f29c775df972375a61e4978c8a0c1d6e
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Accumulate_trf.py
@@ -0,0 +1,490 @@
+#!/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 RAW dataset + file names)
+##     2) 'inputAlignmentConstants':  string 'datasetname#alignmentconstants.root'
+##        (input alignment constants, can be empty)
+##     3) 'alignmentLevel' : integer 
+##        (alignment level to run)
+##	   4) 'iteration' : integer
+##		  number of current iteration
+##     5) 'outputTFile': string 'datasetname#AlignmentTFile.root'
+##        (output TFile containing the matrix, vector...)
+##     6) 'outputMonitoringFile': string 'name#monitoring.root'
+##        (output root file with plots)
+##  - 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 Processiong run options:\n"
+  for key in parmap.keys() :
+    print key, '=', parmap[key] 
+    print "#####################"
+    
+ 
+  inputRAWFileList = []
+  for val in parmap['inputRAWFiles']:
+      #inputRAWFileList.append(val.split('#')[1])
+      inputRAWFileList.append(val['pfn'])
+  #alignmentLevel = int(parmap['alignmentLevel']) 
+   
+  events = int(parmap['events'])
+  iteration = int(parmap['iteration'])   
+  #runnr = int(inputRAWFileList[0].split('.')[-8])
+  runnr = int(inputRAWFileList[0].split('.')[-8]) 
+  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/data14_cosmics/tmpconstants/%d_AlignmentConstants_Iter%d.root" % (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	= 	'data14_cos'
+PtCut		=	100
+
+#Alignment Method is GX2
+runLocal	=	False
+solveLocal	=	False
+solvingOption	=	1
+
+ModCut	=	0
+
+# Temp configuration
+ModCut = 0
+detectorDescription = "ATLAS-R2-2015-02-00-00"
+globalTag         = "CONDBR2-ES1PA-2014-01"
+#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
+
+
+alignTRT	=	False
+trtAlignmentLevel	=	1
+
+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(inputRAWFileList), inputAlignmentConstants,events)
+
+  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	= 	'data14_cos'
+PtCut		=	5000
+
+#Alignment Method is GX2
+runLocal	=	False
+solveLocal	=	False
+solvingOption	=	1
+
+ModCut	=	0
+
+# Temp configuration
+ModCut = 0
+detectorDescription = "ATLAS-R2-2015-02-00-00"
+globalTag         = "CONDBR2-ES1PA-2014-01"
+#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
+
+
+alignTRT	=	False
+trtAlignmentLevel	=	1
+
+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(inputRAWFileList), inputAlignmentConstants,events)
+
+  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" % monfile)
+  os.system("mv AlignmentTFile.root %s" % tfile)
+  # 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
+
+    tfilemap = getFileMap(tfile, tfiledsname)
+    monmap = getFileMap(monfile, mondsname)   
+    outfiles.append(tfilemap)
+    outfiles.append(monmap)
+    infiles = inputRAWFileList
+  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) 'inputRAWFiles': python list ['datasetname#filename1','datasetname#filename2',...] "
+    print "        (input RAW dataset + file names) "
+    print "     2) 'inputAlignmentConstants':  string 'datasetname#alignmentconstants.root' "
+    print "        (input alignment constants, can be empty)"
+    print "     3) 'alignmentLevel': integer "
+    print "        (alignment level to run)"
+    print "     4) 'outputTFile': string 'datasetname#AlignmentTFile.root' "
+    print "        (output TFile containing the matrix, vector...) "
+    print "     5) 'level': integer "
+    print "        (level to run the alignment)"
+    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
new file mode 100644
index 0000000000000000000000000000000000000000..8005109451919e5a570a74e527e866d6754abaa7
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/MergeMon_trf.py
@@ -0,0 +1,167 @@
+#!/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)
+      #inflist.append(val['pfn'])
+   
+  
+	# 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/CalibrationLoopScripts/Solve_trf.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Solve_trf.py
new file mode 100644
index 0000000000000000000000000000000000000000..6ebccc5c5b3054da7b6c7ed6cac6b6c4482f4b28
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/Solve_trf.py
@@ -0,0 +1,528 @@
+#!/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'
+##	   5) 'outputAlignFiles': string, output alignment files
+##  - 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', ...]	
+    inputTFiles = []
+    inputRAWFileList = []
+    for val in parmap['inputTFiles']:
+      #inputRAWFileList.append(val.split('#')[1])
+      inputTFiles.append(val['pfn'])
+    for val in parmap['inputRAWFiles']:
+      #inputRAWFileList.append(val.split('#')[1])
+      inputRAWFileList.append(val['pfn'])
+    runnr = int(inputRAWFileList[0].split('.')[-8])
+    print "runnr = ", runnr 
+    #runnr = int(inputTFiles[0].split('.')[-8])
+    
+    # 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/data14_cosmics/tmpconstants/%d_AlignmentConstants_Iter%d.root" % (runnr,iteration-1)
+    # output file
+    ouputAlignmentConstantsds = (parmap['outputAlignmentConstants']).split('#')[0]
+    ouputAlignmentConstants = (parmap['outputAlignmentConstants']).split('#')[1]
+  
+    
+    # output db file
+    ouputAlignmentConstantsdbds = (parmap['outputAlignmentConstantsdb']).split('#')[0]
+    ouputAlignmentConstantsdb = (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	= 	'data14_cos'
+PtCut		=	100
+
+#Alignment Method is GX2
+runLocal	=	False
+solveLocal	=	False
+solvingOption	=	1
+
+## solving option
+##   0 - No global solving
+##   1 - Lapack
+##   2 - ***REMOVED***
+##   6 - ROOT
+##   7 - CLHEP
+
+
+ModCut	=	0
+
+# Temp configuration
+ModCut = 0
+detectorDescription = "ATLAS-R2-2015-02-00-00"
+globalTag         = "CONDBR2-ES1PA-2014-01"
+#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
+
+
+alignTRT	=	False
+trtAlignmentLevel	=	1
+
+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
+
+##-------- Load Reconstruction --------------------
+include("InDetAlignExample/jobOption_RecExCommon.py") 
+include("InDetAlignExample/jobOption_ConditionsOverrider.py") 
+
+##-------- Load Alignment --------------------
+include("InDetAlignExample/NewInDetAlignAlgSetup.py") 
+
+###############################################################
+  	''' % (str(inputRAWFileList), str(inputTFiles), inputAlignmentConstants, ouputAlignmentConstants)#,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	= 	'data14_cos'
+PtCut		=	100
+
+#Alignment Method is GX2
+runLocal	=	False
+solveLocal	=	False
+solvingOption	=	1
+
+## solving option
+##   0 - No global solving
+##   1 - Lapack
+##   2 - ***REMOVED***
+##   6 - ROOT
+##   7 - CLHEP
+
+
+ModCut	=	0
+
+# Temp configuration
+ModCut = 0
+detectorDescription = "ATLAS-R2-2015-02-00-00"
+globalTag         = "CONDBR2-ES1PA-2014-01"
+#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
+
+
+alignTRT	=	False
+trtAlignmentLevel	=	1
+
+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
+
+##-------- Load Reconstruction --------------------
+include("InDetAlignExample/jobOption_RecExCommon.py") 
+include("InDetAlignExample/jobOption_ConditionsOverrider.py") 
+
+##-------- Load Alignment --------------------
+include("InDetAlignExample/NewInDetAlignAlgSetup.py") 
+
+###############################################################
+  	''' % (str(inputRAWFileList), str(inputTFiles), inputAlignmentConstants, ouputAlignmentConstants)#,beamspottag)
+    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)
+    if iteration>=0:
+        os.system("cp %s /afs/cern.ch/user/a/atlidali/w0/calibLoop/data14_cosmics/tmpconstants/%d_AlignmentConstants_Iter%d.root" %(ouputAlignmentConstants,runnr,iteration))
+        dataset = "data14_cosmics.%08d.calibration_IDTracks.daq.RAW" % runnr
+        if os.path.isfile("/afs/cern.ch/atlas/project/tzero/id/run/idTOM.msg"):
+          os.system("echo \"call pdb updateDatasetPState %s aligned Iter%d\" >> /afs/cern.ch/atlas/project/tzero/id/run/idTOM.msg" % (dataset,iteration))
+        else:
+          os.system("echo \"call pdb updateDatasetPState %s aligned Iter%d\" > /afs/cern.ch/atlas/project/tzero/id/run/idTOM.msg" % (dataset,iteration))
+    
+    os.system("tar -cf %s *.txt *.root %s %s" % (outputAlignFiles,ouputAlignmentConstantsdb,ouputAlignmentConstants)) 
+        #os.system("./makeRootFile.py alignlogfile.txt %s\n" % outputCorrectionsTree)
+    # 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
+      constantsmap = getFileMap(ouputAlignmentConstants, ouputAlignmentConstantsds, nevts=nevts)
+      outfiles.append(constantsmap)
+      constantsdbmap = getFileMap(ouputAlignmentConstantsdb, ouputAlignmentConstantsdbds, nevts=nevts)
+      outfiles.append(constantsdbmap)
+      outputAlignFilesmap = getFileMap(outputAlignFiles, outputAlignFilesds, nevts=nevts)
+      outfiles.append(outputAlignFilesmap)
+    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()
+
+  # move TFile
+  os.system("mv AlignmentTFile.root TotalAlignmentTFile.root")
+
+  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/CalibrationLoopScripts/create_pickle.py b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/create_pickle.py
new file mode 100644
index 0000000000000000000000000000000000000000..3714ebcb85cae558d391d20adf26397a8bd930fb
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/create_pickle.py
@@ -0,0 +1,68 @@
+#!/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': 'data14_cos.00247688.physics_IDCosmic.merge.RAW','lfn': 'data14_cos.00247688.physics_IDCosmic.merge.RAW._lb0013._SFO-ALL._0001.1','pfn': '/castor/cern.ch/grid/atlas/tzero/prod1/perm/data14_cos/physics_IDCosmic/00247688/data14_cos.00247688.physics_IDCosmic.merge.RAW/data14_cos.00247688.physics_IDCosmic.merge.RAW._lb0013._SFO-ALL._0001.1'} ], # has to be a list,
+'inputAlignmentConstants': "inputAlignmentConstants#",
+'events':5000,
+'outputTFile': "OutputTFileNumber1#./matrixTFile1.root",
+'outputMonitoringFile': "outputMonitoringFile1#./monitoringFile1.root",
+'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={
+'inputRAWFiles': [{'dsn': 'data14_cos.00247688.physics_IDCosmic.merge.RAW','lfn': 'data14_cos.00247688.physics_IDCosmic.merge.RAW._lb0013._SFO-ALL._0001.1','pfn': '/castor/cern.ch/grid/atlas/tzero/prod1/perm/data14_cos/physics_IDCosmic/00247688/data14_cos.00247688.physics_IDCosmic.merge.RAW/data14_cos.00247688.physics_IDCosmic.merge.RAW._lb0013._SFO-ALL._0001.1'} ], # has to be a list,
+'inputAlignmentConstants': "inputAlignmentConstants#",
+'iteration':0,
+'inputTFiles': [{'pfn':"matrixTFile1.root"}],#, {'pfn':"matrixTFile2.root"}], 
+'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': [ "OutputTFileNumber1#monitoringFile1.root"],#, "OutputTFileNumber2#monitoringFile2.root" ], 
+'outputMonitoringMergedFile': "monitoringname#TotalMonitoring.root"
+}
+pickle.dump(dict,f)
+f.close()
+
diff --git a/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/info.txt b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/info.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e29a74be25a77a6091f647284bf6b602370ffdcd
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/info.txt
@@ -0,0 +1,8 @@
+#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
new file mode 100755
index 0000000000000000000000000000000000000000..3f6900c726eda969c42187ed543686842facd0db
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/CalibrationLoopScripts/setupRel.sh
@@ -0,0 +1,6 @@
+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/TrkErrorScalingDB.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/TrkErrorScalingDB.py
index aed103b6ab99af645cc284407f2dc602ddc11010..d46acbc416568379411652fdd03b018278277b3a 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/TrkErrorScalingDB.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/TrkErrorScalingDB.py
@@ -10,20 +10,24 @@
 # 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),
-#          ("SCT Barrel",1.0,0.0),
-#          ("SCT Endcap",1.0,0.0),
-#          ("TRT Barrel",1.0,0.0),
-#          ("TRT Endcap",1.0,0.0)
-#          ]
+tag = "IndetTrkErrorScaling_nominal"
+dataset=[ ("PixPhi Barrel",1.0,0.2),
+          ("PixEta Barrel",1.0,0.2),
+          ("PixPhi Endcap",1.0,0.2),
+          ("PixEta Endcap",1.0,0.2),
+          ("PixPhi IBL",1.0,1.0),
+          ("PixEta IBL",1.0,1.0), 
+          ("SCT Barrel",1.0,0.1),
+          ("SCT Endcap",1.0,0.2),
+          ("TRT Barrel",1.0,1.0),
+          ("TRT Endcap",1.0,1.0)
+          ]
 
 # 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"
 
@@ -85,3 +89,9 @@ def make(dataset, tag, foldername, connect = default_connect):
         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/cmt/requirements b/InnerDetector/InDetExample/InDetAlignExample/cmt/requirements
index 1552087f112dc1403c2c4428a55ba0490ba0d85e..d0e3bdc065da96a4af03700d2ec2860f269b6415 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/cmt/requirements
+++ b/InnerDetector/InDetExample/InDetAlignExample/cmt/requirements
@@ -9,7 +9,7 @@ use AtlasReconstructionRunTime AtlasReconstructionRunTime-* -no_auto_imports
 
 include_path none
 
-apply_pattern declare_scripts        files = "RunIterator.py"
+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"
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py
index 6229e21d5020e647a74d227faf1804a62c2c38fe..b7ccc4a60b8ae203c855b9ce53255dbd373b55a6 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses.py
@@ -8,8 +8,6 @@
 from threading import Thread
 import os
 import time
-import multiprocessing
-
 
 class getAthenaConfig:
 	def __init__(self, options):
@@ -74,6 +72,7 @@ class manageJob:
 		     extraOptions={},
 		     AlignmentOptions={},
 		     RecoScript="InDetAlignExample/NewTopOptions.py",
+		     ConditionsScript="InDetAlignExample/jobOption_ConditionsOverrider.py",
 		     AlignmentScript="InDetAlignExample/NewInDetAlignAlgSetup.py",
 		     AlignmentLevels = "InDetAlignExample/NewInDetAlignLevels.py",
 		     #MonitoringScript = "InDetRecExample/InDetMonitoringAlignment.py", 
@@ -91,6 +90,7 @@ class manageJob:
 		self.inputPoolFiles = inputPoolFiles
 		self.JOBNAME=JOBNAME
 		self.RecoOptions = RecoOptions
+		self.ConditionsScript = ConditionsScript
 		self.extraOptions = extraOptions
 		self.RecoScript = RecoScript
 		self.AlignmentOptions = AlignmentOptions
@@ -163,7 +163,9 @@ class manageJob:
 		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')
@@ -183,13 +185,16 @@ class manageJob:
 			script.write("#BSUB -e %s/Iter%d/logs/Iter%dSolve.err \n" % (self.OutputPath,self.i,self.i))
 			
 		script.write("#BSUB -q %s \n" % self.QUEUE)
-		script.write("#BSUB -C 200 \n")
 		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()))
 		for file in self.inputPoolFiles:
@@ -238,8 +243,7 @@ class manageJob:
 		elif runmode == "local":
 			if self.j!=-1:
 				print "  Running %s_Iter%d_%s_Part%02d job" % (self.preName,self.i,self.dataName,self.j)
-				#os.system("sh %s | tee %s/Iter%d/logs/Iter%d_%s_Part%02d.log & \n" % (self.SCRIPTNAME, self.OutputPath,self.i,self.i,self.dataName,self.j))
-				os.system("sh %s > %s/Iter%d/logs/Iter%d_%s_Part%02d.log & \n" % (self.SCRIPTNAME, self.OutputPath,self.i,self.i,self.dataName,self.j))
+				os.system("sh %s | tee %s/Iter%d/logs/Iter%d_%s_Part%02d.log \n" % (self.SCRIPTNAME, self.OutputPath,self.i,self.i,self.dataName,self.j))
 			else:
 				print "  Running %s_Iter%dSolve job" % (self.preName,self.i)
 				os.system("sh %s | tee %s/Iter%d/logs/Iter%dSolve.log \n" % (self.SCRIPTNAME, self.OutputPath,self.i,self.i))
@@ -252,68 +256,7 @@ class manageJob:
 		time.sleep(30)
 		while os.popen('bjobs -w').read().find(self.preName)!=-1:
 			time.sleep(30)
-
-	def wait_local(self, thisjob, nusedcpus):
-		print "Processing in local... job: %d " % thisjob
-		nprocessors = multiprocessing.cpu_count()
-		print " ** wait_local ** NProcessors = %d " % nprocessors
-		print " ** wait_local ** NUsedCPUs = %d " % nusedcpus
-		print " ** wait_local ** subJob= %d %% %d = %d" % ( thisjob, nprocessors, (thisjob+1) % nprocessors)
-		if (((thisjob+1) % nprocessors) == 0):
-			print " ** wait_local ** %d jobs already sent is the same as number of available processors (%d). WAIT ! " % (thisjob+1, nprocessors)
-		else:                   
-			print " ** wait_local ** %d jobs already sent. Still processors (%d) available. KEEP GOING ! " % (thisjob+1, nprocessors-thisjob-1)
-		if ((thisjob+1) == nusedcpus):
-			print " ** wait_local ** %d jobs already sent is the same as number of available cpus (%d). WAIT ! " % (thisjob+1, nusedcpus)
-		else:                   
-			print " ** wait_local ** %d jobs already sent. Still cpus (%d) available. KEEP GOING ! " % (thisjob+1, nusedcpus-thisjob-1)
-
-		time.sleep(2) #wait 2 second between jobs
-            
-		#if ( ((thisjob+1) % nprocessors == 0) or ((thisjob+1) == nusedcpus) ):
-		if ((thisjob+1) >= nprocessors) :
-			print " ** wait_local ** %d jobs sent >= as available CPUs (%d) ==>  WAIT ! " % ((thisjob+1), nprocessors)		           # fisrt time sleep 60 seconds to allow all jobs to start
-			os.system("sleep 60")
-			loopcount = 0
-			njobspending = int(os.popen("ps -f | grep _Part | wc -l").read())
-			print " ** wait_local ** N jobs pending= %d (available CPUS %d)" % (njobspending, nprocessors) 
-			#while njobspending > 0: # loop to check there are jobs running
-			while njobspending >= nprocessors: # loop to check if there are free slots
-				#print " Sleeping 60 seconds..... "
-				os.system("sleep 60")
-				#os.system("ps -f | grep _Part ")
-				njobspending = (int(os.popen("ps -f | grep _Part | wc -l").read())/2)
-				# discount the ps process, which increments +1 the number of jobs running 
-				njobspending -= 1 
-				loopcount += 1
-				print " ** wait_local ** Loop: %d  --> N jobs pending= %d" % (loopcount, njobspending)
-			# print " ** wait_local ** Jobs completed --> exiting wait loop"
-			print " ** wait_local ** some jobs already completed --> free slot --> exiting wait loop"
-		else:   
-			print " ** wait_local ** Free CPUS --> submit another job"
-
-		if ( (thisjob+1) == nusedcpus ):
-			print " ** wait_local ** all jobs already submited. Wait for completion"
-			# fisrt time sleep 60 seconds to allow all jobs to start
-			os.system("sleep 60")
-			loopcount = 0
-			njobspending = int(os.popen("ps -f | grep _Part | wc -l").read())
-			print " ** wait_local ** N jobs pending= %d" % njobspending
-			while njobspending > 0: # loop to check if there are jobs running
-				#print " Sleeping 60 seconds..... "
-				os.system("sleep 60")
-				#os.system("ps -f | grep _Part ")
-				njobspending = (int(os.popen("ps -f | grep _Part | wc -l").read())/2)
-				# discount the ps process, which increments +1 the number of jobs running 
-				njobspending -= 1 
-				loopcount += 1
-				print " ** wait_local ** Loop: %d  --> N jobs pending= %d" % (loopcount, njobspending)
-			# print " ** wait_local ** Jobs completed --> exiting wait loop"
-			print " ** wait_local ** some jobs still running  -->  keep waiting "
-		else:   
-			print " ** wait_local ** ALL JOBS COMPLETED ** proceed to next step "
-
-
+			
 import os
 class SortCpus:
 	def __init__(self, TOTALCPUS, LOCALDIR, FILELIST, OutputLevel,doDetailedSplitting = False, nEventsPerFile=-1):
@@ -704,10 +647,10 @@ class mergeScript:
 		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/ \n" % (self.OutputPath,self.i))
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py
index bc3a59c7806871a9177fef052fe7721d4508aacd..834540f6466123b577a7625a201520c9ab984942 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_IteratorClasses_EoverPMaps.py
@@ -180,15 +180,13 @@ class mergeScriptEoverPMaps:
 		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("DQHistogramMerge.py %s ./ZmumuValidationMerge.root True\n" %(mergeFilesName))
+		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()
-		files = os.popen("find -name 'ZmumuValidationOut.root'").readlines()
+		files = os.popen("find -name 'eoverpValidationOut.root'").readlines()
 		for line in files:
 			mergeFiles.write("%s" % line)
 		mergeFiles.close()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py
index 792583e34f35259702303c78b03d213b8bb51e76..6838986d1816760d0cf95575b047d59cf11277b7 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/python/NewInDet_SetupData.py
@@ -111,7 +111,7 @@ class setupData:
 			if "castor" in path:
 				inputfiles = os.popen("rfdir "+ path).read().splitlines()
 			elif "eos" in path:
-				inputfiles = os.popen("/afs/cern.ch/project/eos/installation/atlas/bin/eos.select ls " + path).read().splitlines()
+				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
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py b/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py
index ea89d362e7bd3397defaf1394df324d4720c64a0..4089e5b019abebf503829123f8466864cfabeb47 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/ElectronEoverPTracking.py
@@ -339,24 +339,6 @@ ElectronRefitterTool2 = egammaTrkRefitterTool(name = 'ElectronRefitterTool2',
                                               OutputLevel =4)
 ToolSvc += ElectronRefitterTool2
 
-MuonRefitterTool = egammaTrkRefitterTool(name = 'MuonRefitterTool',
-                                            FitterTool = GX2TrackFitter,
-                                            matEffects = 2,
-                                            minNoSiHits = -1,
-																						useBeamSpot = False,
-                                            OutputLevel =4)
-ToolSvc += MuonRefitterTool
-
-
-MuonRefitterTool2 = egammaTrkRefitterTool(name = 'MuonRefitterTool2',
-                                            FitterTool = GX2TrackFitter,
-                                            matEffects = 2,
-                                            minNoSiHits = -1,
-					    RemoveTRTHits = True,
-																						useBeamSpot = False,
-                                            OutputLevel =4)
-ToolSvc += MuonRefitterTool2
-
 
 GSFTrackCollection = "GSFTracks"
 DNATrackCollection = "DNATracks"
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignAlgSetup_DBM.py b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignAlgSetup_DBM.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a9ba8861b2ebddc3eed186744314ca9627a9e78
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/InDetAlignAlgSetup_DBM.py
@@ -0,0 +1,620 @@
+##############################################################################
+#
+#  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-***REMOVED***, 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 ***REMOVED*** 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/L1-RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/L1-RunIterator.py
index 30d82028a5d8b73d54d2d87b5dc2f2149c173acc..fded81b7e05e5ae4ebcea6c3c57815c57a145915 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/L1-RunIterator.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/L1-RunIterator.py
@@ -12,7 +12,7 @@ import sys
 # Number of Iterations
 # ===============================
 FirstIteration = 0 
-Iterations     = 2 
+Iterations     = 4 
 
 # ===============================
 # Basic running options
@@ -51,14 +51,14 @@ 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.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("") # Use custom Global Tag, if not given it will use the data default one
-Data1.setDetDescrVersion("") # Use custom DetDescrVersion Tag, if not given it will use the data default one
+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
 
@@ -96,11 +96,11 @@ extraOptions = {}
 extraOptions["doMonitoring"] = True
 extraOptions["doTrkNtuple"] = False
 
-extraOptions["PtCut"]               = 10000 #Pt in MeV, comment the line to use default value (10000)
-extraOptions["lorentzAngleTag"]     = ""#"PIXELLorentzAngleScale-Data-001"
-extraOptions["siAlignmentTag"]      = ""
-extraOptions["trtAlignmentTag"]     = ""
-extraOptions["trtAlignmentTagL3"]   = ""
+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
@@ -130,12 +130,13 @@ extraOptions["pixelAlignBarrelRotX"] = False
 extraOptions["pixelAlignBarrelRotY"] = False
 extraOptions["pixelAlignBarrelRotZ"] = False
 ## alignment parameters Endcap
-extraOptions["pixelAlignEndcapX"] = False
-extraOptions["pixelAlignEndcapY"] = False
+extraOptions["pixelAlignEndcapX"] = True
+extraOptions["pixelAlignEndcapY"] = True
 extraOptions["pixelAlignEndcapZ"] = False
 extraOptions["pixelAlignEndcapRotX"] = False
 extraOptions["pixelAlignEndcapRotY"] = False
-extraOptions["pixelAlignEndcapRotZ"] = False
+extraOptions["pixelAlignEndcapRotZ"] = True
+
 ## SCT
 extraOptions["sctAlignBarrelX"] = True
 extraOptions["sctAlignBarrelY"] = True
@@ -145,7 +146,7 @@ extraOptions["sctAlignBarrelRotY"] = True
 extraOptions["sctAlignBarrelRotZ"] = True
 ## alignment parameters Endcap
 extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctAlignEndcapY"] = True
+extraOptions["sctlAlignEndcapY"] = True
 extraOptions["sctAlignEndcapZ"] = True
 extraOptions["sctAlignEndcapRotX"] = True
 extraOptions["sctAlignEndcapRotY"] = True
@@ -165,7 +166,7 @@ AlignPixelBarrel           = [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        = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] # see InDetAlignGeometryLevel wiki for more info
+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
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py
index 69153f90b9f8b29682ab098e8e3c581e9df722de..e8e9673b37d8d8e9426e492a6937868eec259cba 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/L2-RunIterator.py
@@ -169,7 +169,7 @@ extraOptions["sctAlignBarrelRotY"] = True
 extraOptions["sctAlignBarrelRotZ"] = True
 ## alignment parameters Endcap
 extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctAlignEndcapY"] = True
+extraOptions["sctlAlignEndcapY"] = True
 extraOptions["sctAlignEndcapZ"] = True
 extraOptions["sctAlignEndcapRotX"] = True
 extraOptions["sctAlignEndcapRotY"] = True
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py
index c07978b6af893a12e6c96910d431f47dbe7edb91..07bab70a8e121e37b5abe258ecd3ab92b7213908 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/L3-RunIterator.py
@@ -202,7 +202,7 @@ extraOptions["sctAlignBarrelRotY"] = True
 extraOptions["sctAlignBarrelRotZ"] = True
 ## alignment parameters Endcap
 extraOptions["sctAlignEndcapX"] = True
-extraOptions["sctAlignEndcapY"] = True
+extraOptions["sctlAlignEndcapY"] = True
 extraOptions["sctAlignEndcapZ"] = False
 extraOptions["sctAlignEndcapRotX"] = False
 extraOptions["sctAlignEndcapRotY"] = False
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/MisalignmentSet1.pool.root b/InnerDetector/InDetExample/InDetAlignExample/share/MisalignmentSet1.pool.root
new file mode 100644
index 0000000000000000000000000000000000000000..97a1fb999f5cd2938cc6e8b116658204d20b5d59
Binary files /dev/null and b/InnerDetector/InDetExample/InDetAlignExample/share/MisalignmentSet1.pool.root differ
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py
index 5c46e9634b6caddf1ef14114eeb6aa15c07cb9e9..8d6a0149d627e8fe25f1ff9abdb6f47ca2ad1be7 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignAlgSetup.py
@@ -11,92 +11,94 @@
 #
 # 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-***REMOVED***, 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
+    "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-***REMOVED***, 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
+    ,"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"               : False                      #  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]
+    ,"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]
+    ,"BField_AlgSetup"      : True                   #  Used to solve problem reading Bfield with MC cosmics
+    ,"doSiHitQualSel"       : False                   #  perform Si hit (pix+sct) quality selection with InDetAlinHitQualSelTool
 }
 
 ##############################################################################
 ## 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 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
+    newInDetAlignAlg_Options["doBSConstraint"] = False
+    newInDetAlignAlg_Options["doPVConstraint"] = False
+    newInDetAlignAlg_Options["doFullVertex"] = False
+    newInDetAlignAlg_Options["doBSTrackSelection"] = False
+    newInDetAlignAlg_Options["doBSAssociatedToPVSelection"] = False
 
 ## ===================================================================
 ## ===================================================================
@@ -104,33 +106,33 @@ if newInDetAlignAlg_Options["Cosmics"]:
 ## ==               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)
+    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
+    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
+    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
+    # 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
+    newInDetAlignAlg_Options["writeDerivatives"] = False
 
 ## ===================================================================
 ## ===================================================================
@@ -150,15 +152,15 @@ ToolSvc = Service('ToolSvc')
 # it is a Global Chi2 fitter and only needed when run accumulation
 if newInDetAlignAlg_Options["runAccumulate"]:
 
-	if not newInDetAlignAlg_Options["runLocal"]:
-		InDetTrackFitter.FillDerivativeMatrix = True
+    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
+    trackFitter = InDetTrackFitter
+    if newInDetAlignAlg_Options["refitTracks"]:
+        if newInDetAlignAlg_Options["particleNumber"] == 0:
+            trackFitter.GetMaterialFromTrack = False
+        else:
+            trackFitter.GetMaterialFromTrack = True
 
 ################################
 # create AlignModuleTool
@@ -166,9 +168,9 @@ if newInDetAlignAlg_Options["runAccumulate"]:
 # during geometry setup but it is a reasonable default
 from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignModuleTool
 alignModuleTool = Trk__AlignModuleTool(
-	name = "AlignModuleTool",
-	OutputLevel = newInDetAlignAlg_Options["outputLevel"]
-	
+    name = "AlignModuleTool",
+    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
+    
 )
 ToolSvc += alignModuleTool
 print alignModuleTool
@@ -180,401 +182,427 @@ print alignModuleTool
 include("InDetAlignExample/NewInDetAlignGeometrySetup.py")
 
 ################################
-# Read in constants from Pool file
-if newInDetAlignAlg_Options["readConstantsFromPool"]:
-	from IOVDbSvc.CondDB import conddb
+#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["readSilicon"]:
+        conddb.blockFolder("/Indet/Align")
 
-	if newInDetAlignAlg_Options["readTRT"]:
-		conddb.blockFolder("/TRT/Align")
+    if newInDetAlignAlg_Options["readTRT"]:
+        conddb.blockFolder("/TRT/Align")
 
-	if newInDetAlignAlg_Options["readTRTL3"]:
-		conddb.blockFolder("/TRT/Calib/DX")
+    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
+    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
+    # 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"]
+    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.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"]
+    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 ***REMOVED*** 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"]
+    # 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 ***REMOVED*** 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 = False
+    )
+ToolSvc += myHitQualSelTool
+print myHitQualSelTool
+
 ##################################################
 ##
-##	Setup all tools needed for event processing
+##  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 = newInDetAlignAlg_Options["PtCut"],
-				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
-			)
-			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
+    ################################
+    # 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 = newInDetAlignAlg_Options["PtCut"],
+                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
+            )
+            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 = DEBUG,
+                TrackSummaryTool = InDetTrackSummaryTool,
+                minPt = newInDetAlignAlg_Options["PtCut"],
+                numberOfPixelHits = 1,
+                numberOfSCTHits = 10,
+                numberOfSiliconHits = 12,
+                numberOfSiliconHitsTop = 4,
+                numberOfSiliconHitsBottom = 4,
+                numberOfTRTHits = 25,
+                maxD0 = 9999.,
+                maxZ0 = 9999.,
+                #BField = newInDetAlignAlg_Options["BField_AlgSetup"]
+            )
+        ToolSvc += trackSelector
+        print trackSelector
+        
+    ###############################
+    # 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"],
+            SelectHits = newInDetAlignAlg_Options["doSiHitQualSel"], 
+            HitQualityTool = myHitQualSelTool
+        )
+
+        # 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
+##  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
+    ################################
+    # 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
 
 
 ################################
@@ -583,29 +611,30 @@ else:
 # 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
+    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
+print " <NewInDetAlignAlgSetup> Setting up the AlignTrackCollSplitter "
 from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignTrackCollSplitter
 AlignTrackCollSplitter = Trk__AlignTrackCollSplitter(
-	"AlignTrackCollSplitter",
-	OutputLevel = newInDetAlignAlg_Options["outputLevel"]
+    "AlignTrackCollSplitter",
+    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
 )
 
 topSequence += AlignTrackCollSplitter
@@ -614,15 +643,7 @@ print AlignTrackCollSplitter
 
 ################################ 
 
-if newInDetAlignAlg_Options["doMonitoring"] and not newInDetAlignAlg_Options["runSolving"]:
-	include("InDetAlignExample/NewInDetAlignMonitoring.py")
-	
-##################################  code given by Juerg Beringer to select lumiblocks
-if (False):
-    print " ** Filtering events according to LumiBlock ** "
-    lbList = [190,191,192,193,194,195,196,197,198,199]   # The list of LBs you want to select
-    import InDetBeamSpotExample.FilterUtils as FilterUtils
-    FilterUtils.filterSeq += FilterUtils.LBFilter(lbList)
-    print FilterUtils
-else:
-    print " ** No LumiBlock Filtering ** Accepting all LumiBlocks ** "  
+
+if newInDetAlignAlg_Options["doMonitoring"] and newInDetAlignAlg_Options["runAccumulate"]:
+    include("InDetAlignExample/NewInDetAlignMonitoring.py")
+    
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py
index 666b6f2cd36904a3a29155023cd70889eb823451..7e2eab61f75b80bb5dca05a68dc1fb1613d900b9 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignGeometrySetup.py
@@ -27,6 +27,7 @@ newInDetAlignGeo_Options = {
 	,"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
@@ -122,7 +123,8 @@ pixelAlignment_Options = {
 	"pixelAlignmentLevelBarrel" : -1
 	,"pixelAlignmentLevelEndcaps": -1
 	,"pixelAlignmentLevel" : -1
-	,"pixelAlignBarrel" : True
+#	,"pixelAlignDBM" :  False            #  whether to align DBM instead of actual Pixel detector  
+        ,"pixelAlignBarrel" : True
 	,"pixelAlignEndcaps" : True
 	,"pixelAlignBarrelX" : True
 	,"pixelAlignBarrelY" : True
@@ -326,6 +328,7 @@ if newInDetAlignGeo_Options["alignPixel"]:
 	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"]
@@ -625,7 +628,8 @@ if (newInDetAlignGeo_Options["alignInDet"] or newInDetAlignGeo_Options["alignSil
 	siTrkDBTool.WriteTextFile = newInDetAlignGeo_Options["writeTextFiles"]
 	siTrkDBTool.OutputTextFile = newInDetAlignGeo_Options["siliconTextFile"]
 	siTrkDBTool.WriteOldConstants = newInDetAlignGeo_Options["writeOldConstants"]
-
+	siTrkDBTool.AlignmentDBM = newInDetAlignGeo_Options["pixelAlignDBM"]
+	
 	ToolSvc += siTrkDBTool
 	print      siTrkDBTool
 
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py
index 344f807acbfb5eb76fc679dd577037e08473a70b..29eaf1c0d7a1f24491b9886957742b96c5443ad5 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignMonitoring.py
@@ -15,14 +15,18 @@ InDetAlignMonManager = AthenaMonManager( name                = "InDetAlignMonMan
 # 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","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:
@@ -38,6 +42,24 @@ allSelection = InDetAlignMon__TrackSelectionTool(
 )
 ToolSvc += allSelection
 
+#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(
@@ -52,31 +74,30 @@ from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonResi
 from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks
 from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonEfficiencies
 
+print " <NewInDetAlignMonitoring> setting up " 
 for trackCollection in trackCollections:
 	# Selected tracks
-	print "Loading monitoring"
+	print " <NewInDetAlignMonitoring> Loading monitor 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.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 = 4,
-		RangeOfPullHistos  =   5
-
+        minPIXResXFillRange = -0.6,
+		maxPIXResXFillRange =  0.6,
+		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
 	
@@ -89,6 +110,9 @@ for trackCollection in trackCollections:
 		tracksName = trackCollection,
 		useExtendedPlots = True,
 		triggerChainName = "all",
+        d0Range = 1000,
+        z0Range = 1000,
+        #NTracksRange = 10,
 		VxPrimContainerName = InDetKeys.PrimaryVertices()
 	)
 	ToolSvc += InDetAlignMonGenericTracks
@@ -104,9 +128,11 @@ for trackCollection in trackCollections:
 		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"]:
 	InDetAlignMonResiduals = IDAlignMonResiduals(
@@ -114,22 +140,11 @@ if newInDetAlignAlg_Options["useTrackSelector"]:
 		trackSelection = alignTrackSelection,
 		tracksName = tracks,
 		useExtendedPlots = True,
-		triggerChainName = "alignSelection",
+		doClusterSizeHistos = True,
+		triggerChainName = "alignSelection",  
 		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 = 4,
-		RangeOfPullHistos  =   5
 	)
 	ToolSvc += InDetAlignMonResiduals
 	InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonResiduals ]
@@ -167,26 +182,126 @@ if not Cosmics:
 	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)
+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		  = ["InDetAlignCosmicTrackSelectorTool","InDetAlignCosmicTrackSelector_Half","PixTrackSelectorTool",
-										"PixUpLowTrackSelectorTool","SCTTrackSelectorTool","SCTUpLowTrackSelectorTool","SiTrackSelectorTool",
-										"SiUpSiLowTrackSelectorTool","TRTonlyTrackSelectorTool","TRTUpTRTLowTrackSelectorTool"]
-	m_nHitBLayer					 = [ 0, 1,2,1, 0,0, 2,1, 0, 0]
-	m_nHitPix						= [ 3, 3,5,3, 0,0, 5,3, 0, 0]
-	m_nHitSct						= [ 8, 8,0,0,14,8,14,8, 0, 0]
-	m_nHitTrt						= [30,25,0,0, 0,0, 0,0,30,30]
-
-	m_alignMonTrackSelectionToolName = ["InDetAlignMonCosmicsTrackSelectionTool","InDetAlignMonTrackSelectionTool_Half","PixTrackSelectionTool",
-										"PixUpLowTrackSelectionTool","SCTTrackSelectionTool","SCTUpLowTrackSelectionTool","SiTrackSelectionTool",
-										"SiUpSiLowTrackSelectionTool","TRTonlyTrackSelectionTool","TRTUpTRTLowTrackSelectionTool" ]
+	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						= [24, 24, 24, 24,  0,  0,  0,  0,  0,  0, 24, 24]
+
+	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(10):	   
+	for i in range(len(m_alignMonTrackSelectionToolName)):	   
 		m_alignMonTrackSelectorTool.append(InDet__InDetDetailedTrackSelectorTool(name			 = m_trackSelectorToolName[i],
 																				pTMin			= 0,#1 GeV
 																				IPd0Max		  = 1000.0,#no cut on d0 yet
@@ -203,7 +318,7 @@ if Cosmics:
 		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,
@@ -212,33 +327,34 @@ if Cosmics:
 
 		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_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_trackSplitterName	  = ["TrackSplitterTool_AlignTracks","TrackSplitterTool_Combined","TrackSplitterTool_Pixel","TrackSplitterTool_SCT","TrackSplitterTool_Si","TrackSplitterTool_TRT"]
+	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 = ["InDetAlignMonTrackSegments_Combined","InDetAlignMonTrackSegments_PixUpLow","InDetAlignMonTrackSegments_SCTUpLow",
-								"InDetAlignMonTrackSegments_SiUpLow","InDetAlignMonTrackSegments_TRTUpLow"]
+	m_trackSegmentsUpLowName = ["InDetAlignMonTrackSegments_AlignTracks", "InDetAlignMonTrackSegments_Combined","InDetAlignMonTrackSegments_PixUpLow",
+								"InDetAlignMonTrackSegments_SCTUpLow", "InDetAlignMonTrackSegments_SiUpLow","InDetAlignMonTrackSegments_TRTUpLow"]
 	
-	m_inputTracksUpLow	   = [InDetKeys.Tracks(),InDetKeys.PixelTracks(),InDetKeys.SCTTracks(),"ResolvedTracks",InDetKeys.TRTTracks()]
+	m_inputTracksUpLow	   = ["AlignTracks", "CombinedInDetTracks",InDetKeys.Tracks(),InDetKeys.PixelTracks(),InDetKeys.SCTTracks(),"ResolvedTracks",InDetKeys.TRTTracks()]
 
-	m_d0Range				= [   100,   100,   100,   100, 800]
-	m_deltaD0				= [  0.2,  0.8,  0.8,  0.2,   8]
-	m_deltaD02D			  = [	5,	5,	5,	5,  10]
-	m_deltaPhi			   = [0.002,0.005,0.005,0.002,0.01]
-	m_deltaPhi2D			 = [ 0.02, 0.02, 0.02, 0.02,0.05]
-	m_deltaQoverPt		   = [ 0.02,  0.2, 0.05, 0.02, 0.1]
-	m_deltaQoverPt2D		 = [ 0.05,  0.2, 0.05, 0.04, 0.1]
+	m_d0Range				= [  1000,   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.01,   0.01,   0.002,  0.005, 0.005, 0.002, 0.01]
+	m_deltaPhi2D			= [     0.05,   0.05,   0.02,   0.02,  0.02,  0.02,  0.05]
+	m_deltaQoverPt		    = [     0.1,    0.1,    0.02,   0.2,   0.05,  0.02,  0.1]
+	m_deltaQoverPt2D		= [     0.1,    0.1,    0.05,   0.2,   0.05,  0.04,  0.1]
 
-	for i in range(5):
+	for i in range(len(m_trackSplitterName)):
 		m_trackSplitter.append(InDet__InDetTrackSplitterTool(name				  = m_trackSplitterName[i],
 															 TrackFitter		   = InDetTrackFitter,
 															 OutputUpperTracksName = m_upperTracksName[i],
@@ -248,6 +364,7 @@ if Cosmics:
 		if (InDetFlags.doPrintConfigurables()):
 			print m_trackSplitter[i]
 
+		print " <NewInDetAlignMonitoring> step ",i," -> define 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],
@@ -317,7 +434,8 @@ if not hasattr(ServiceMgr, 'THistSvc'):
 
 THistSvc         = Service( "THistSvc" )
 
-histOutput       = DQMonFlags.monManFileKey()+" DATAFILE='monitoring.root' OPT='RECREATE'" 
+histOutput       = DQMonFlags.monManFileKey()+" DATAFILE='monitoring.root' OPT='RECREATE'"
+#histOutput       = "CUSTOM"+" DATAFILE='NewInDetMonitoring.root' OPT='RECREATE'"
 THistSvc.Output += [histOutput]
 #InDetAlignMonManager.FileKey = "IDAlignMon"
 topSequence += InDetAlignMonManager
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_DBMRel17.py
similarity index 64%
rename from InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment.py
rename to InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_DBMRel17.py
index 3dcabe9d6796d7cb2032fc7acc15f8df267464bd..ec431f65f8f8dd7b6a61b9ed1dc65670231de2ff 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_DBMRel17.py
@@ -19,7 +19,7 @@
 ## ==                                                               ==
 ## message level for the alignment
 ## INFO, DEBUG, ...
-outputLevel=INFO
+outputLevel=DEBUG
 #
 ## track collection to process
 trackCollection = "Tracks"
@@ -32,16 +32,15 @@ trackCollection = "Tracks"
 ##
 readConstantsFromPool = False
 readSilicon = True
-readTRT = True
-#inputPoolFiles = [ "alignment_input.pool.root" ]
-#inputPoolFiles = [ "IDalignment_nominal.pool.root" ]
+readTRT = False
+#inputPoolFiles = [ "NewRun2Si_pool.root" ]
 ErrorScaling = False
 #
 ##
 ## write final alignment constants to pool file
 writeConstantsToPool = True
 writeSilicon = True
-writeTRT = True
+writeTRT = False
 outputPoolFile = "alignment_output.pool.root"
 tagSi = "IndetAlign_test"
 tagTRT = "TRTAlign_test"
@@ -57,135 +56,39 @@ writeOldConstants = True
 alignInDet = True
 alignSilicon = True
 alignPixel = True
-alignSCT = True
-alignTRT = True
+alignSCT = False
+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 = 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
+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
-#
-## 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
+pixelAlignEndcapZ = False
 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
@@ -222,8 +125,9 @@ moduleSelection = []
 ##
 ## Accumulate and Solving
 ##
-runAccumulate = True
+runAccumulate = False
 runSolving = True
+
 #
 ## if we only run solving we need the list of files from
 ## which to accumulate
@@ -235,7 +139,7 @@ inputVectorFiles = [ "vector.bin" ]
 # by default the global method is run
 # if you want to include the full local method
 # set runLocal to True
-runLocal = False
+runLocal = True
 #
 # for full local method one can also setup different kinds of residuals
 # (will be ignored if runLocal==False)
@@ -260,13 +164,14 @@ solvingOption = 1
 ####
 ## run local solving
 ## this option is automatically set to True if runLocal is selected
-solveLocal = True
+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 = 7
+ModCut = 0
+#softModeCut = 1
 ## cut on eigenvalue for diagonalization
 eigenvalueCut = 0.
 #
@@ -286,11 +191,11 @@ runOutlier     = True
 particleNumber = 0
 #
 ## write special alignment ntuple
-#writeAlignNtuple = True
+writeAlignNtuple = False
 ##
 ## store derivatives of residuals wrt. alignment parameters
 ## in the ntuple
-#writeDerivatives = True
+writeDerivatives = False
 ##
 ## ==                                                               ==
 ## ==            End of settings for the alignment                  ==
@@ -310,33 +215,35 @@ particleNumber = 0
 
 # ID Reconstruction  Options
 # ==========================
-detectorDescription = "ATLAS-GEO-16-00-00"
+
+detectorDescription = "ATLAS-IBL3D25-04-00-01"
 realData = False
-globalTag = "OFLCOND-SDR-BS7T-04-02"
+#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 = False
+#doMonitoring = True
 #siPoolFile = ""
-#siAlignmentTag = "InDet_Cosmic_2008_6"
+siAlignmentTag = "InDetAlign_R2_Nominal"
 #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.197117._000005.pool.root.1" ]
-
-# Run cosmic reconstruction
-# =============================
-# (Cosmic Specific Options)
-#BField = True
-#Cosmics = True
-#include("InDetAlignExample/loadInDetRec_cosmics.py")
+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("InDetAlignExample/loadInDetRec_new.py")
+include("RecJobTransforms/UseFrontier.py")
+
+include("InDetAlignExample/loadInDetRec_DBMRel17.py")
 
 # Run Alignment
 # ========================
-include("InDetAlignExample/NewInDetAlignAlgSetup.py")
+include("InDetAlignExample/InDetAlignAlgSetup_DBM.py")
 
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel17.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel17.py
new file mode 100644
index 0000000000000000000000000000000000000000..99c1b14041ede80ce48bcc7c477bb6df7cbd1a9b
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel17.py
@@ -0,0 +1,431 @@
+#
+# 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 - ***REMOVED***
+##   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
new file mode 100644
index 0000000000000000000000000000000000000000..1d6d95783e0871c6a97679e2e584d00d52d47f3a
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetAlignment_Run2Rel19.py
@@ -0,0 +1,451 @@
+#
+# 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 - ***REMOVED***
+##   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
index 41731aa4fd4ecf46a156e39afd38422f1d793729..ae088afd7a70db92b811a360a13712a811e881a3 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator.py
@@ -11,10 +11,10 @@ import sys
 #  End of User Options
 # ==============================================================
 
-# ====================================================================
-# ====================================================================
-# ====================================================================
-# ====================================================================
+# =====================================================================
+# =====================================================================
+# =====================================================================
+# =====================================================================
 #
 # Don not edit the lines below unless you know what you're doing!
 #
@@ -46,6 +46,7 @@ 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':
@@ -96,27 +97,43 @@ for iteration in range(FirstIteration,Iterations+FirstIteration):
 		countdir=0
 		while os.path.isdir("%s/Iter%d-%s-%d" % (OutputPath, iteration, datetime.date.today(), countdir)):
 			countdir += 1
-			print " countdir = %s" %countdir
-		mytempname = "%s/Iter%d" % (OutputPath, iteration)            
-		print " mytempname = " + mytempname
-		mynewdate = time.ctime(os.path.getctime(mytempname))
-		print " mynewdate = %s" %mynewdate
 		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)
 
-        #exit(0)
-        
 	# Make OutputPaths
-	os.mkdir(OutputPath+'/Iter'+repr(iteration))
-	os.mkdir(OutputPath+'/Iter'+repr(iteration)+'/logs/')
+	#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"
+	#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 "----------------------------------------------"
@@ -130,7 +147,7 @@ for iteration in range(FirstIteration,Iterations+FirstIteration):
 		else:
 			print "Number of events per CPU: All" 
 			info.write("Number of events per CPU: All" )
-		os.mkdir(OutputPath+'/Iter'+repr(iteration)+'/'+data.getName()+'/')
+		os.mkdir(OutputPaths+'/Iter'+repr(iteration)+'/'+data.getName()+'/')
 
 		print "Processing..."
 
@@ -149,7 +166,7 @@ for iteration in range(FirstIteration,Iterations+FirstIteration):
 				RecoOptions["errorScalingTag"] = errorScalingTag
 
 			JOBNAME="%s_Iter%d_%s_Part%02d.py" % (preName,iteration,data.getName(),subJob)
-			RecoScript = "InDetAlignExample/loadInDetRec_new.py"
+			RecoScript = "InDetAlignExample/loadInDetRec_Run2Rel17.py"
 			if not doDetailedSplitting:
 				RecoOptions["inputFiles"] = dataFiles.getCPU(subJob)
 				RecoOptions["numberOfEvents"] = data.getEventsPerCPU(iteration)
@@ -189,7 +206,7 @@ for iteration in range(FirstIteration,Iterations+FirstIteration):
 					constantsFile = inputAlignmentPoolFile 
 					AlignmentOptions["inputPoolFiles"] = [constantsFile]
 				else:
-					constantsFile = str(OutputPath)+"/Iter"+str(iteration-1)+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
+					constantsFile = str(OutputPaths)+"/Iter"+str(iteration-1)+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
 					AlignmentOptions["inputPoolFiles"] = [constantsFile]
 	
 			AlignmentOptions["alignTRT"] = AlignTRT[iteration]
@@ -230,7 +247,7 @@ for iteration in range(FirstIteration,Iterations+FirstIteration):
 			poolfiles.append(constantsFile)
 		
 	
-			currentjob = manageJob(OutputPath = OutputPath,
+			currentjob = manageJob(OutputPath = OutputPaths,
 					      dataName = data.getName(),
 					      iter = iteration,
 					      part = subJob,
@@ -254,159 +271,170 @@ for iteration in range(FirstIteration,Iterations+FirstIteration):
 			currentjob.writeScript()
 			
 			currentjob.send(runMode)
-
-			if runMode == "local":
-			    currentjob.wait_local(subJob, data.getCPUs(iteration))
-	
 	#  End j loop
-	if runMode == "batch":
+	#if runMode == "batch":
 		# Wait for signal
-		currentjob.wait()
+	#	currentjob.wait()
 
 
 	#  Solving the system
 	if doSolve:
-		print "----------------------------------------------"
-		print "  Solving Iter"+repr(iteration)
-		print "----------------------------------------------"
-
-		info.write('\n')
-		info.write("----------------------------------------------\n")
-		info.write("  Solving Iter %d\n" % iteration)
-		info.write("----------------------------------------------\n")
-
-		PrefixName="Iter%d_" % iteration
-		JOBNAME="%s_Iter%d_Solve.py" % (preName,iteration)
-		SCRIPTNAME="%s_Iter%dSolve.lsf" % (preName,iteration)
-
-		print "Logs stored in %s/Iter%d/logs/Iter%d_Solve.log" % (OutputPath, iteration, iteration)
-
-		# Get the aligment options
-		AlignmentOptions = {}
-
-		if AlignmentMethod == "GX2":
-			AlignmentOptions["runLocal"] = False
-			AlignmentOptions["solveLocal"] = False
-		else:
-			AlignmentOptions["runLocal"] = True
-			AlignmentOptions["solvingOption"] = 0
+		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)
 
-		AlignmentOptions["readConstantsFromPool"] = ReadAlignmentConstants
+				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["inputPoolFiles"] = [constantsFile]
+				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:
-			matrices, vectors, hitmaps = mergeMatrix(OutputPath, iteration, DataToRun)
-			AlignmentOptions["inputMatrixFiles"] =  matrices
-			AlignmentOptions["inputVectorFiles"] = vectors
-			AlignmentOptions["inputHitmapFiles"] = hitmaps
-			AlignmentOptions["WriteTFile"] = False
-			if len(hitmaps) == 0:
-				AlignmentOptions["readHitmaps"] = False
-		else:
-			tfiles = mergeTFiles(OutputPath, iteration, DataToRun)
-			AlignmentOptions["inputTFiles"] = tfiles
-			AlignmentOptions["WriteTFile"] = True			
+				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(DataToRun[0].getGlobalTag()) != 0:
- 			RecoOptions["globalTag"] = DataToRun[0].getGlobalTag()
-
-		if len(DataToRun[0].getDetDescrVersion()) != 0:
-			RecoOptions["detectorDescription"] = DataToRun[0].getDetDescrVersion()
-
-		RecoScript = "InDetAlignExample/loadInDetRec_new.py"
-		constantsFile = ""
-		if ReadAlignmentConstants:	
-			if iteration == 0:
-				constantsFile = inputAlignmentPoolFile 
-				AlignmentOptions["inputPoolFiles"] = [inputAlignmentPoolFile]
-			else:
-				constantsFile = str(OutputPath)+"/Iter"+str(iteration-1)+"/Iter"+str(iteration-1)+"_AlignmentConstants.root"
-				AlignmentOptions["inputPoolFiles"] = [constantsFile]
+				AlignmentOptions["runSolving"] = True
+				AlignmentOptions["runAccumulate"] = False
 
-		poolfiles = [RecoOptions["inputFiles"][0],constantsFile]
-		
-		currentjob = manageJob(OutputPath = OutputPath,
-			  dataName = DataToRun[0].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()
+				# 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.send(runMode)
+				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 = OutputPath
+			monitoringMerge = mergeScript(OutputPath = OutputPaths
 					      ,iter = iteration
 					      ,preName = preName
 					      ,dataName = data.getName()
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_Rel19.py
new file mode 100755
index 0000000000000000000000000000000000000000..1a5949e0860c50c65126fd429eea8c9d1cfb0657
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/NewInDetIterator_Rel19.py
@@ -0,0 +1,497 @@
+#################################################################
+#    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
+			RecoOptions["ClusteringAlgo"] = ClusteringAlgo
+			if ErrorScaling[iteration]:
+				RecoOptions["errorScalingTag"] = errorScalingTag
+
+			JOBNAME="%s_Iter%d_%s_Part%02d.py" % (preName,iteration,data.getName(),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 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,
+					      ConditionsScript = ConditionsScript,
+					      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/jobOption_RecExCommon.py"
+				ConditionsScript = "InDetAlignExample/jobOption_ConditionsOverrider.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,
+				  ConditionsScript = ConditionsScript,
+				  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 because the flag doSolve is OFF\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/RunIteratorOnGrid.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIteratorOnGrid.py
index 11a00a448d1f7415538708d6943ba02e2b494f74..539fafb87643c0e2c70afcbe7d6c9d217605ddc1 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIteratorOnGrid.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/RunIteratorOnGrid.py
@@ -16,32 +16,32 @@ import sys
 # ===============================
 FirstIteration = 0
 #Iterations = 11
-Iterations = 1 1 
+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"          ] = "spedraza"
+GridOptions["userIDname"          ] = "jwang"
 # Unless you really know how to select a Site by yourself, you would better leave here to be empty
-GridOptions["siteName"            ] = ""
+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/spedraza"
+GridOptions["TmpWorkDir"          ] = "/tmp/jwang"
 GridOptions["dbRelease"           ] = "LATEST"
-GridOptions["excludedSite"        ] = ""
+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"        ] = "Local"
-GridOptions["runSolveInTmpDir"    ] = True
-GridOptions["debugLevel"          ] = 1
+GridOptions["runSolveMode"        ] = "Prun"
+GridOptions["runSolveInTmpDir"    ] = False
+GridOptions["debugLevel"          ] = 0
 GridOptions["nEventsPerJob"       ] = 100
 GridOptions["submitOnlyOneJobset" ] = True
 GridOptions['autoRetry'		  ] = True
@@ -67,8 +67,8 @@ GridOptions["successRatioCut"     ] = 0.95
 
 # athena paths
 HOME        = os.environ['HOME']
-ATHENAREL   = '17.8.0'
-TAGS        = 'opt,slc6,AtlasProduction'
+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/"
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel17.py
similarity index 55%
rename from InnerDetector/InDetExample/InDetAlignExample/share/RunIterator.py
rename to InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel17.py
index 8ac1e82cbcd5d5a6e184644bfcf6cfb1dd8a320d..275c929f42641b685a0ca33a5312d5434fdf86cc 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel17.py
@@ -36,9 +36,40 @@ CMTDIR 	       = HOME+"/athena/cmthome/"
 ASetupOptions  = "single"  
 
 # OutputLevel (DEBUG, INFO, VERBOSE)
-OutputLevel    = 'DEBUG'
+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
 ##########################################################
@@ -46,24 +77,39 @@ OutputLevel    = 'DEBUG'
 from InDetAlignExample.NewInDet_SetupData import setupData
 DataToRun = []
 
-
-Data1 = setupData('MC10_Singlemuons') # 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("MC10_Singlemuons") # Type of data: IDTracks, MinBias, IDCosmics or MC09_Multimuons by now
+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]) # Number of CPUs per iteration to process this data
-Data1.setEvents([200,5000]) # 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("OFLCOND-SIM-00-00-07") # Use custom Global Tag, if not given it will use the data default one
-##Data1.setDetDescrVersion("ATLAS-GEO-16-00-00") # Use custom DetDescrVersion Tag, if not given it will use the data default one
+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
 
-from InDetAlignExample.NewInDet_IteratorClasses import HandleRunOptions
-if len(sys.argv) > 1 or 'rtt' in os.environ["USER"]:
-	DataToRun = [HandleRunOptions()]
+### 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()
@@ -75,7 +121,13 @@ for data in DataToRun:
 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)
@@ -92,29 +144,75 @@ useTFiles = True
 
 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["siAlignmentTag"] = "InDetAlign_CSC_00 "
-extraOptions["trtAlignmentTag"] = "TRTAlign_CSC_00 "
-#extraOptions["siAlignmentTag"] = "InDetAlign_nominal"
+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"] = 5
-extraOptions["doBSConstraint"] = False
-extraOptions["doPVConstraint"] = False
-extraOptions["useOldPreProcessor"] = False
+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"] = False
-#extraOptions["readTRT"] = False
-#extraOptions["writeTRT"] = False
+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
@@ -129,7 +227,7 @@ AlignPixelBarrel           = [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        = [ 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
+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
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel19.py
new file mode 100755
index 0000000000000000000000000000000000000000..0eb9bd485abeae10e29ebd0ff0527f8994952cfa
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/RunIterator_Run2Rel19.py
@@ -0,0 +1,319 @@
+#!/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 = 6
+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        = 'm7'
+
+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("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.setDetDescrVersion("ATLAS-R2-2015-02-00-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"] = 'data14_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"] = False
+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 = 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/RunReco_tf_onBatch.py b/InnerDetector/InDetExample/InDetAlignExample/share/RunReco_tf_onBatch.py
new file mode 100644
index 0000000000000000000000000000000000000000..3786ea6b67d99e286d9dab56304f6eecdd911762
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/RunReco_tf_onBatch.py
@@ -0,0 +1,168 @@
+##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/jobOption_ConditionsOverrider.py b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py
new file mode 100644
index 0000000000000000000000000000000000000000..1efb86604613e69a819af56d2d1a96ace33dbe3d
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_ConditionsOverrider.py
@@ -0,0 +1,158 @@
+loadInDetRec_Options = {"detectorDescription" : ""
+                        ,"globalTag" : ""
+                        ,"siPoolFile":""
+                        ,"siAlignmentTag":""
+                        ,"trtAlignmentTag":""
+                        ,"trtAlignmentTagL3":""
+                        ,"lorentzAngleTag":""
+                        ,"beamSpotTag":""
+                        ,"errorScalingTag":""
+                        ,"TRTCalibTextFile":""
+                        ,"TRTCalibT0TagCos":""
+                        ,"TRTCalibRtTagCos":""
+                        ,"Cosmics":False
+                        ,"BField":False
+                        ,"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
+                        }
+
+# If not defined the defaults given above are used
+for var in loadInDetRec_Options:
+  if var in dir():
+    loadInDetRec_Options[var] = eval(var)
+
+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")
+
+  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 = INFO
+  
+
+
+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 );
+    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"]
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_RecExCommon.py b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_RecExCommon.py
new file mode 100755
index 0000000000000000000000000000000000000000..02497adcf22cf736dbd0b795401f1c4de7d6965f
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/jobOption_RecExCommon.py
@@ -0,0 +1,264 @@
+## 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
+                        ,"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" : ""
+                        }
+
+# 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
+
+
+#--------------------------------------------------------------------------------
+#Setup jobProperties  - Override Autoconfiguration of the BField. Needed for MC -
+#--------------------------------------------------------------------------------
+from AthenaCommon.BeamFlags import jobproperties
+from AthenaCommon.BFieldFlags import jobproperties
+if not loadInDetRec_Options["realData"]:
+  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(True)
+  jobproperties.Beam.energy.set_Value_and_Lock(0)
+  jobproperties.Beam.bunchSpacing.set_Value_and_Lock(50)
+  
+
+#--------------------------------------------------------------
+# 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 not loadInDetRec_Options["realData"]:
+  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
+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 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 of 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)
+
+
+#--------------------------------------------------------------
+# 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
+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 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)
+
+# --- Options that we may change in the alignment
+InDetFlags.doPixelClusterSplitting.set_Value_and_Lock              (False)
+InDetFlags.doInnerDetectorCommissioning.set_Value_and_Lock         (True)
+InDetFlags.useBroadClusterErrors.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)
+
+InDetFlags.doTRTStandalone.set_Value_and_Lock                      (False)
+
+# --- if we are using ESD (make flag) // Revist later
+#InDetFlags.doPRDFormation = 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")
+
+#if (ErrorScaling or (".db" in errorScalingTag) ):
+#    print " <jobObtion_RecExCommon> Using Error Scaling " 
+#    from AthenaCommon.AppMgr import ToolSvc;
+#    from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackErrorScalingTool;
+#    tool = Trk__RIO_OnTrackErrorScalingTool(name = 'RIO_OnTrackErrorScalingTool',
+#                                            overrideDatabaseID = False,
+#                                            OutputLevel = 1);
+#    ToolSvc += tool 
+#else:
+#    print " <jobObtion_RecExCommon> NOT using Error Scaling " 
+    
+    
+
+if doVP1:
+  from VP1Algs.VP1AlgsConf import VP1Alg
+  topSequence += VP1Alg()
+
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_7TeV.py b/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_7TeV.py
deleted file mode 100644
index 1b9bf06d2c80e982d7f611d48ea1a9f240f6a4fa..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_7TeV.py
+++ /dev/null
@@ -1,237 +0,0 @@
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = 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
-	
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion = My_DetectorDescription
-#DetDescrVersion = "ATLAS-CSC-02-00-00"
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-import AthenaCommon.SystemOfUnits as Units
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-globalflags.ConditionsTag = My_ConditionsTag
-globalflags.DataSource = My_DataSource
-# --- BS default input uses this
-
-if 'doReadBS' in dir() and doReadBS:
-    globalflags.InputFormat   = 'bytestream'
-    #globalflags.ConditionsTag = 'OFLCOND-CSC-00-00-00'
-else:
-    globalflags.InputFormat = 'pool'
-    
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-	
-if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- in Tier0 reco these flags are set from outside
-#Let number of collisions default to 0.0 since input file doesn't include pileup
-#jobproperties.Beam.numberOfCollisions = 10.0 # arbitrary higher number for 7+ TeV, for 900 GeV it is 2.
-jobproperties.Beam.energy             = 7.*Units.TeV
-jobproperties.Beam.beamType           = 'collisions'
-if 'doReadBS' in dir() and doReadBS:
-    #  jobproperties.Beam.numberOfCollisions = 6.9
-    jobproperties.Beam.bunchSpacing       = 75
-	
-#--------------------------------------------------------------
-# Set 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()
-
-if not doTRT:
-  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 InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')
-InDetFlags.doCosmics = False
-
-# --- 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              = True
-InDetFlags.doiPatRec              = True
-#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)
-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
-	
-# --- activate (memory/cpu) monitoring
-InDetFlags.doPerfMon        = False
-# --- activate creation of standard plots
-InDetFlags.doStandardPlots  = False
-# --- active storegate delection
-InDetFlags.doSGDeletion  = False
-
-# --- produce various ntuples (all in one root file)
-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
-	
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkD3PD = True
-#InDetFlags.doPixelTrkD3PD = True
-#InDetFlags.doSctTrkD3PD = True
-#InDetFlags.doTrtTrkD3PD = True
-#InDetFlags.doVtxD3PD = True
-#InDetFlags.doConvVtxD3PD = True  # NOT implemented yet
-#InDetFlags.doV0VtxD3PD = True    # NOT implemented yet
-	
-#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")
-
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax =  theApp.EvtMax
-#ServiceMgr.EventSelector.SkipEvents = SkipEvents
-#ServiceMgr.StoreGateSvc.Dump = True
-	
-if not doReadBS:
-    ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-    ServiceMgr.EventSelector.InputCollections = InDetAlignExampleFlags.Files
-    # --- t tbar channel 5200 (DetDescrVersion = "ATLAS-DC3-07")
-    # ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d38/ID_ValidationData/testIdeal_07.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000201_tid002760._00002.pool.root.1"]
-    # --- TP split version (local) - (DetDescrVersion = "ATLAS-DC3-07")
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d89/InDetRecRDO.root"]
-    # --- Minbias (DetDescrVersion = "ATLAS-GEO-08-00-01")
-    #ServiceMgr.EventSelector.InputCollections = ["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_900GeV.105001.pythia_minbias.digit.RDO.e466_s604_s582_d224_tid097817/RDO.097817._000001.pool.root.1"]
-    # --- t tbar channel 5200 (DetDescrVersion = "ATLAS-CSC-02-00-00")
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d158/CSC.005200.T1_McAtNlo_Jimmy.RDO.pool.root" ]
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d89/InDetRecRDO.root"]
-    # --- gamma 20 (ATLAS-CSC-01-00-00)
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/datafiles/egamma/DC3.007040.singlepart_gamma_Et20/digit/120031/ideal0_mc12.007040.singlepart_gamma_Et20.digit.RDO.v12003108_tid005022._00001.pool.root"]
-    #ServiceMgr.EventSelector.InputCollections += ["castor:/castor/cern.ch/grid/atlas/datafiles/egamma/DC3.007040.singlepart_gamma_Et20/digit/120031/ideal0_mc12.007040.singlepart_gamma_Et20.digit.RDO.v12003108_tid005022._00002.pool.root"]
-    # --- black hole event
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/j/jgoncalo/valid12003108/misal1_mc12.006640.CharybdisJimmy.digit.RDO.v12003108_tid006066._00038.pool.root.4"]
-    # --- event with low lumi pile up (4.6 min bias, 2*10^33), should be ATLAS-CSC-01-02-00
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/k/kgrybel/pileup/CSC/005850.pyt_WH120_munubb/digits/misal1_csc11.005850.WH120bb_pythia.digit.RDOS.v12003103_lumi02._00001.pool.root"]
-    
-    if doReadBS:
-        ServiceMgr.ByteStreamInputSvc.FullFileName = InDetAlignExampleFlags.Files
-        # input used for FDR2b (run 8): low lumi (2.3 min bias, 10^33)/pile-up/shifted vertex run 8
-        # this file needs (as set by default): DetDescrVersion = "ATLAS-CSC-02-00-00" globalflags.ConditionsTag="OFLCOND-FDR-02-01-00", jobproperties.Beam.numberOfCollisions = 2.3
-        #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/afs/cern.ch/atlas/maxidisk/d158/CSC.005200.T1_McAtNlo_Jimmy.data" ]
-        # if you create the input BS file yourself with InDetWriteBS jobO the output will be this file
-        # and you have to set the detdescr and cond tag to what you used ...
-        #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "daq.csc13.0000000.Single.Stream.LB0000.Athena._0001.data" ]
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_900gev.py b/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_900gev.py
deleted file mode 100644
index fa972233873993000537b7a94b8c4b7ef92276f9..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_900gev.py
+++ /dev/null
@@ -1,243 +0,0 @@
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = Myoption_ReadBStream
-# --- 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
-	
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion = My_DetectorDescription
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-import AthenaCommon.SystemOfUnits as Units
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-globalflags.ConditionsTag = My_ConditionsTag
-
-globalflags.DataSource = My_DataSource
-# --- BS default input uses this
-
-if 'doReadBS' in dir() and doReadBS:
-    globalflags.InputFormat   = 'bytestream'
-    #globalflags.ConditionsTag = 'OFLCOND-FDR-02-01-00'
-    if globalflags.DataSource == 'geant4':
-        globalflags.ConditionsTag = My_ConditionsTag
-    else:
-        globalflags.ConditionsTag = My_ConditionsTag
-else:
-    globalflags.InputFormat = 'pool'
-	
-	
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-	
-if len(globalflags.ConditionsTag())!=0:
-    from IOVDbSvc.CondDB import conddb
-    conddb.setGlobalTag(globalflags.ConditionsTag())
-	   
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 2.0 # default in RecExCommon for 900 GeV
-jobproperties.Beam.energy             = 900.*Units.GeV
-jobproperties.Beam.beamType           = 'collisions'
-
-from AthenaCommon.BFieldFlags import jobproperties
-#jobproperties.BField.solenoidOn= BField_solenoidOn
-
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
-	
-from RecExConfig.RecFlags import rec
-rec.Commissioning=False
-rec.doMonitoring=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()
-
-if not doTRT:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-  
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#if globalflags.DataSource == 'data':
-#  DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-
-	
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-	
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.InputFormat() == 'pool' and globalflags.DataSource == 'geant4')
-InDetFlags.doCosmics = False
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking  = False
-#InDetFlags.doLowPt        = False
-#InDetFlags.doBeamGas      = True
-#InDetFlags.doBeamHalo     = True
-#InDetFlags.doxKalman      = False
-#InDetFlags.doiPatRec      = False
-#InDetFlags.doBackTracking = False
-#InDetFlags.doTRTStandalone = False
-#InDetFlags.doSingleSpBackTracking = True
-	
-# --- Turn off track slimming
-InDetFlags.doSlimming = False
-	
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doTrackSegmentsPixel = False
-#InDetFlags.doTrackSegmentsSCT   = False
-#InDetFlags.doTrackSegmentsTRT   = False
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-	
-# --- deactivate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-	
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = True
-
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-	
-# --- produce various ntuples (all in one root file)
-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.primaryVertexCutSetup = "StartUp"
-InDetFlags.useHVForSctDCS=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")
-	
-#-------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-	
-# Number of events to be processed (default is 10)
-theApp.EvtMax = theApp.EvtMax
-ServiceMgr.EventSelector.SkipEvents = SkipEvents
-#ServiceMgr.StoreGateSvc.Dump = True
-	
-if not doReadBS:
-    ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-	
-    # --- Minbias (DetDescrVersion = "ATLAS-GEO-08-00-01")
-    ServiceMgr.EventSelector.InputCollections = InDetAlignExampleFlags.Files
-    #ServiceMgr.EventSelector.InputCollections = ["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_900GeV.105001.pythia_minbias.digit.RDO.e466_s604_s582_d224_tid097817/RDO.097817._000001.pool.root.1"]
-	
-    # --- t tbar channel 5200 (DetDescrVersion = "ATLAS-DC3-07")
-    # ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d38/ID_ValidationData/testIdeal_07.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000201_tid002760._00002.pool.root.1"]
-    # --- TP split version (local) - (DetDescrVersion = "ATLAS-DC3-07")
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d89/InDetRecRDO.root"]
-    # --- Minbias (DetDescrVersion = "ATLAS-CSC-02-00-00")
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d158/CSC.005001.pythia_minbias.RDO.pool.root"]
-    # --- t tbar channel 5200 (DetDescrVersion = "ATLAS-CSC-02-00-00")
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d158/CSC.005200.T1_McAtNlo_Jimmy.RDO.pool.root" ]
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00001.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00002.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00003.pool.root.1",   
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00004.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00005.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00006.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00007.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00008.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._00009.pool.root.1",
-    #                                             "castor:/castor/cern.ch/user/i/ivivarel/900GeVminbias/RDO.024944._000010.pool.root.1"]
-    #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d89/InDetRecRDO.root"]
-    # --- gamma 20 (ATLAS-CSC-01-00-00)
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/datafiles/egamma/DC3.007040.singlepart_gamma_Et20/digit/120031/ideal0_mc12.007040.singlepart_gamma_Et20.digit.RDO.v12003108_tid005022._00001.pool.root"]
-    #ServiceMgr.EventSelector.InputCollections += ["castor:/castor/cern.ch/grid/atlas/datafiles/egamma/DC3.007040.singlepart_gamma_Et20/digit/120031/ideal0_mc12.007040.singlepart_gamma_Et20.digit.RDO.v12003108_tid005022._00002.pool.root"]
-    # --- black hole event
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/j/jgoncalo/valid12003108/misal1_mc12.006640.CharybdisJimmy.digit.RDO.v12003108_tid006066._00038.pool.root.4"]
-    # --- event with low lumi pile up (4.6 min bias, 2*10^33), should be ATLAS-CSC-01-02-00
-    #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/k/kgrybel/pileup/CSC/005850.pyt_WH120_munubb/digits/misal1_csc11.005850.WH120bb_pythia.digit.RDOS.v12003103_lumi02._00001.pool.root"]
-    
-if doReadBS:
-    # Collisions Data!
-    ServiceMgr.ByteStreamInputSvc.FullFileName = InDetAlignExampleFlags.Files
-    #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/afs/cern.ch/user/g/gencomm/w0/Collisions/MergeBS.run140541.LArAndMBTSInTime._0001.data"]
-    # input used for FDR2b (run 8): low lumi (2.3 min bias, 10^33)/pile-up/shifted vertex run 8
-    # this file needs (as set by default): DetDescrVersion = "ATLAS-CSC-02-00-00" globalflags.ConditionsTag="OFLCOND-FDR-02-01-00", jobproperties.Beam.numberOfCollisions = 2.3
-    #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/afs/cern.ch/atlas/maxidisk/d158/daq.fdr08_run2.0052300.physics.Express.LB0001._sfo02._0001.data" ]
-    # if you create the input BS file yourself with InDetWriteBS jobO the output will be this file
-    # and you have to set the detdescr and cond tag to what you used ...
-    #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "daq.csc13.0000000.Single.Stream.LB0000.Athena._0001.data" ]
-
-    
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_cosmic.py b/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_cosmic.py
deleted file mode 100755
index f7210dc42583fde548264e1c03b8ec1ffca99a3e..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/joboptions_cosmic.py
+++ /dev/null
@@ -1,233 +0,0 @@
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descand cond tag
-doReadBS        =  Myoption_ReadBStream
-# --- 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
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion = My_DetectorDescription
-	
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-# --- BS default input uses this
-
-if 'doReadBS' in dir() and doReadBS:
-  globalflags.DataSource = 'data'
-  globalflags.InputFormat   = 'bytestream'
-  globalflags.ConditionsTag = My_ConditionsTag #'COMCOND-ES1C-000-00'
-else:
-  globalflags.DataSource = 'data'
-  #globalflags.DataSource = 'geant4'
-  globalflags.InputFormat = 'pool'
-	
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-	
-if len(globalflags.ConditionsTag())!=0:
-  from IOVDbSvc.CondDB import conddb
-  conddb.setGlobalTag(globalflags.ConditionsTag())
-	   
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 0.0 
-jobproperties.Beam.beamType="cosmics"
-	
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
-	
-from AthenaCommon.DetFlags import DetFlags
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-	
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.readRIOPool.pixel_setOff()
-#DetFlags.readRIOBS.pixel_setOff()
-#DetFlags.readRDOBS.pixel_setOff()
-
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.readRIOPool.SCT_setOff()
-#DetFlags.readRIOBS.SCT_setOff()
-#DetFlags.readRDOBS.SCT_setOff()
-	
-#DetFlags.TRT_setOff()
-#DetFlags.detdescr.TRT_setOn()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-if not doTRT:
-  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()
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-	
-from RecExConfig.RecFlags import rec
-rec.Commissioning = True
-rec.doMonitoring = True
-from AthenaCommon.BFieldFlags import jobproperties
-jobproperties.BField.solenoidOn= Magnet
-	
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-	
-#InDetFlags.doCosmics=True
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking  = False
-InDetFlags.doCTBTracking = True
-##InDetFlags.preProcessing  = True
-#InDetFlags.doLowPt        = True
-#InDetFlags.doBeamGas      = True
-#InDetFlags.doBeamHalo     = True
-##InDetFlags.doxKalman      = False
-##InDetFlags.doiPatRec      = False
-#InDetFlags.doBackTracking = True
-
-if doTRTConstraint:
-  InDetFlags.doBackTracking       = False
-  InDetFlags.doTRTStandalone      = False
-  InDetFlags.doTrackSegmentsTRT   = False
-
-#InDetFlags.doTRTStandalone = True
-##InDetFlags.doVertexFinding=False
-##InDetFlags.doConversions=False
-#InDetFlags.doSingleSpBackTracking = True
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-	
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doCTBTrackSegmentsPixel = False
-#InDetFlags.doCTBTrackSegmentsSCT   = False
-#InDetFlags.doCTBTrackSegmentsTRT   = False
-#InDetFlags.doCTBTrackSegmentsPixel = True
-#InDetFlags.doCTBTrackSegmentsSCT   = True
-#InDetFlags.doCTBTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- deactivate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-	
-
-# --- Disable DCS usage
-#InDetFlags.useDCS=False
-	
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = True
-	
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-	
-# --- produce various ntuples (all in one root file)
-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
-	
-# 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")
-	
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-	
-# Number of events to be processed (default is 10)
-theApp.EvtMax = EvtMax
-ServiceMgr.EventSelector.SkipEvents = SkipEvents
-#ServiceMgr.StoreGateSvc.Dump = True
-	
-# hack for ATLANIS (rrashes in M8+ data)
-if doJiveXML:
-  ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"]
-	
-if not doReadBS:
-  ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-  ServiceMgr.EventSelector.InputCollections = InDetAlignExampleFlags.Files
-  # cosmic MC without field
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91900_lb3.root" ]
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data08_cosmag/physics_IDCosmic/0091890/data08_cosmag.00091890.physics_IDCosmic.recon.ESD.o4_f73/data08_cosmag.00091890.physics_IDCosmic.recon.ESD.o4_f73._lb0001._sfo01._0001.1"]
-  #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d17/dig.trtbarrel_ma_B100.root"]
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEO-03-00-00/dig/dig.pixelbarrel_B.400000.root"]
-  
-if doReadBS:
-  ServiceMgr.ByteStreamInputSvc.FullFileName = InDetAlignExampleFlags.Files
-  # Input file: ConditionsTag = 'COMCOND-ES1C-000-00'
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/90272/physics_IDCosmic/daq.ATLAS.0090272.physics.IDCosmic.LB0001.SFO-1._0001.data" ]
-  # Input file: real data from M6, ConditionsTag = 'COMCOND-ES1C-000-00'
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/M6/daq.NoTag.0043705.physics.HLT_Cosmic_AllTeIDSelected.LB0000.SFO-1._0001.data" ]
-  # Real data from M8 plus (nearly complete TRT) 
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/80725/physics_HLT_Cosmics_NIM4/daq.ATLAS.0080725.physics.HLT_Cosmics_NIM4.LB0000.SFO-5._0011.data" ]
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/91890/physics_IDCosmic/daq.ATLAS.0091890.physics.IDCosmic.LB0002.SFO-1._0001.data"]
-
-
-
-
-
-
-
-
-
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec.py
deleted file mode 100755
index 6826225a1e665886c4292539ee1143137a5a9f6c..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec.py
+++ /dev/null
@@ -1,290 +0,0 @@
-# The Following options can be specified seperately in a file that include this one
-#  The defaults are for MC collision
-loadInDetRec_Options = {"detectorDescription" : ""
-                        ,"doReadBS":False
-                        ,"realData" :False
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":False
-                        ,"doMonitoring":False
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"TRTCalibTextFile":""
-                        ,"numberOfEvents":30
-                        ,"useTRT": True
-                        ,"inputFiles":["/afs/cern.ch/atlas/maxidisk/d158/CSC.005200.T1_McAtNlo_Jimmy.RDO.pool.root" ]
-                        ,"CollisionGRL":""
-                        }
-
-# 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)
-
-# Good run list
-if loadInDetRec_Options["CollisionGRL"] != "":
-  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
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-# --- 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
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion = loadInDetRec_Options["detectorDescription"]
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-globalflags.DataSource = 'geant4'
-
-if loadInDetRec_Options["realData"]:
-  globalflags.DataSource = 'data'
-
-# --- BS default input uses this
-if loadInDetRec_Options["doReadBS"]:
-  globalflags.InputFormat   = 'bytestream'
-  globalflags.ConditionsTag = 'OFLCOND-CSC-00-00-00'
-else:
-  globalflags.InputFormat = 'pool'
-
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-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"]) 
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 0.0  
-if loadInDetRec_Options["doReadBS"]:
-  jobproperties.Beam.numberOfCollisions = 6.9
-  jobproperties.Beam.bunchSpacing       = 75
-
-#--------------------------------------------------------------
-# Set 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()
-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 InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.InputFormat() == 'pool')
-InDetFlags.doTruth = False
-if globalflags.InputFormat() == 'pool':
-  # ---- run over ESD files
-  #  InDetFlags.preProcessing=True
-  InDetFlags.doPRDFormation = False
-  #  InDetFlags.doSpacePointFormation = True
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False
-InDetFlags.doLowPt                = False
-#InDetFlags.doBeamGas              = True
-#InDetFlags.doBeamHalo             = True
-InDetFlags.doxKalman              = False
-InDetFlags.doiPatRec              = False
-#InDetFlags.doBackTracking         = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doTRTStandalone        = False
-
-# --- Turn off track slimming
-InDetFlags.doSlimming = False
-
-# --- 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.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = 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.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrtTrkNtuple   = True
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-InDetFlags.doRefit = True
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-
-ServiceMgr.StoreGateSvc.Dump = 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")
-
-from IOVDbSvc.CondDB import conddb
-
-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["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"]
-
-# --- dump MC truth into logfile
-#from TruthExamples.TruthExamplesConf import DumpMC
-#topSequence += DumpMC(McEventKey = "TruthEvent")
-
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax = int(loadInDetRec_Options["numberOfEvents"])
-#ServiceMgr.EventSelector.SkipEvents = 2
-
-if not loadInDetRec_Options["doReadBS"]:
-  svcMgr.PoolSvc.AttemptCatalogPatch = True
-  ServiceMgr.EventSelector.InputCollections = loadInDetRec_Options["inputFiles"]
-
-if loadInDetRec_Options["doReadBS"]:
-  ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_Options["inputFiles"]
-  # if you create the input BS file yourself with InDetWriteBS jobO the output will be this file
-  # and you have to set the detdescr and cond tag to what you used ...
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "daq.csc13.0000000.Single.Stream.LB0000.Athena._0001.data" ]
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec900GeV.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec900GeV.py
deleted file mode 100755
index 7eda432d4e86bc168024e51b2e951e8905f73417..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec900GeV.py
+++ /dev/null
@@ -1,292 +0,0 @@
-# The Following options can be specified seperately in a file that include this one
-#  The defaults are for MC collision
-loadInDetRec_Options = {"detectorDescription" : "ATLAS-GEO-08-00-02"
-                        ,"doReadBS":True
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":True
-                        ,"doMonitoring":True
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"beamSpotTag":""
-                        ,"errorScalingTag":""
-                        ,"TRTCalibTextFile":""
-                        ,"numberOfEvents":30
-                        ,"useTRT": True
-                        ,"inputFiles":["/afs/cern.ch/user/g/gencomm/w0/Collisions/MergeBS.run140541.LArAndMBTSInTime._0001.dat" ]
-                        ,"CollisionGRL":""
-                        }
-
-# 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)
-    
-# Good run list
-if loadInDetRec_Options["CollisionGRL"] != "":
-  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
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_Options["doReadBS"]
-# --- 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
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion =  loadInDetRec_Options["detectorDescription"]
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-import AthenaCommon.SystemOfUnits as Units
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-globalflags.DataSource = 'data'
-# --- BS default input uses this
-if loadInDetRec_Options["doReadBS"]:
-  globalflags.InputFormat   = 'bytestream'
-else:
-  globalflags.InputFormat = 'pool'
-
-if loadInDetRec_Options["globalTag"]:
-  globalflags.ConditionsTag = loadInDetRec_Options["globalTag"]
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-
-if len(globalflags.ConditionsTag())!=0:
-   from IOVDbSvc.CondDB import conddb
-   conddb.setGlobalTag(globalflags.ConditionsTag()) 
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 2.0 # default in RecExCommon for 900 GeV
-jobproperties.Beam.energy             = 900.*Units.GeV
-jobproperties.Beam.beamType           = 'collisions'
-from AthenaCommon.BFieldFlags import jobproperties
-jobproperties.BField.solenoidOn=True
-#jobproperties.BField.solenoidOn=False
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning=True
-rec.doMonitoring=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()
-#if globalflags.DataSource == 'data':
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.InputFormat() == 'pool' and globalflags.DataSource == 'geant4')
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking  = False
-InDetFlags.doLowPt        = False
-#InDetFlags.doBeamGas      = True
-#InDetFlags.doBeamHalo     = True
-#InDetFlags.doxKalman      = False
-#InDetFlags.doiPatRec      = False
-#InDetFlags.doBackTracking = False
-#InDetFlags.doTRTStandalone = False
-#InDetFlags.doSingleSpBackTracking = True
-#InDetFlags.doRefit = True
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doTrackSegmentsPixel = False
-#InDetFlags.doTrackSegmentsSCT   = False
-#InDetFlags.doTrackSegmentsTRT   = False
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- deactivate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = True
-
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-
-# --- produce various ntuples (all in one root file)
-InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrtTrkNtuple   = True
-InDetFlags.doPixelClusterNtuple = False
-InDetFlags.doSctClusterNtuple   = False
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-InDetFlags.primaryVertexCutSetup = "StartUp"
-
-# activate the print InDetXYZAlgorithm statements
-InDetFlags.doPrintConfigurables = True
-#InDetFlags.useHVForSctDCS=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")
-from IOVDbSvc.CondDB import conddb
-
-
-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["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"])
-  
-else:
-  conddb.addOverride('/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal')
-
-if loadInDetRec_Options["beamSpotTag"]:
-  conddb.addOverride('/Indet/Beampos',loadInDetRec_Options["beamSpotTag"])
-  
-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
-print InDetRotErrorScalingTool
-
-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"]
-
-# --- dump MC truth into logfile
-#from TruthExamples.TruthExamplesConf import DumpMC
-#topSequence += DumpMC(McEventKey = "TruthEvent")
-
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax = int(loadInDetRec_Options["numberOfEvents"])
-#ServiceMgr.EventSelector.SkipEvents = 48
-#ServiceMgr.StoreGateSvc.Dump = True
-
-if not  loadInDetRec_Options["doReadBS"]:
-  # --- Minbias (DetDescrVersion = "ATLAS-GEO-08-00-01")
-  ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-  ServiceMgr.EventSelector.InputCollections =  loadInDetRec_Options["inputFiles"]
-
-else:
-  ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_Options["inputFiles"]
-#InDetTrackFitter.OutputLevel=2
-#ToolSvc.InDetAmbiguityProcessor.OutputLevel=1
-#ToolSvc.InDetAmbiTrackSelectionTool.OutputLevel=1
-#ToolSvc.InDetAmbiScoringTool.OutputLevel=1
-#ToolSvc.InDetCosmicScoringTool.OutputLevel=1
-#ServiceMgr.InDetSCT_DCSConditionsSvc.OutputLevel=1
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRecSingleBeam.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRecSingleBeam.py
deleted file mode 100755
index f6fb95eb0bd61a9fff6d902497ef8258978659db..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRecSingleBeam.py
+++ /dev/null
@@ -1,257 +0,0 @@
-loadInDetRec_Options = {"detectorDescription" : "ATLAS-GEO-03-00-00"
-                        ,"doReadBS":True
-                        ,"globalTag" : ""
-                        ,"doTrkNtuple":True
-                        ,"doMonitoring":True
-                        ,"siPoolFile":""
-                        ,"siAlignmentTag":""
-                        ,"trtAlignmentTag":""
-                        ,"errorScalingTag":""
-                        ,"TRTCalibTextFile":""
-                        ,"numberOfEvents":30
-                        ,"useTRT": True
-                        ,"inputFiles":["/afs/cern.ch/user/g/gencomm/w0/Collisions/MergeBS.run140541.LArAndMBTSInTime._0001.dat" ]
-                        }
-                        
-# 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)
-    
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = True
-# --- 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
-
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion =  loadInDetRec_Options["detectorDescription"]
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-# --- BS default input uses this
-if loadInDetRec_Options["doReadBS"]:
-  globalflags.DataSource    = 'data'
-  globalflags.InputFormat   = 'bytestream'
-else:
-  globalflags.DataSource  = 'data'
-  globalflags.InputFormat = 'pool'
-
-if loadInDetRec_Options["globalTag"]:
-  globalflags.ConditionsTag = loadInDetRec_Options["globalTag"]
-  
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-
-if len(globalflags.ConditionsTag())!=0:
-   from IOVDbSvc.CondDB import conddb
-   conddb.setGlobalTag(globalflags.ConditionsTag()) 
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 0.0  
-jobproperties.Beam.beamType           = "singlebeam"
-
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.readRIOPool.pixel_setOff()
-#DetFlags.readRIOBS.pixel_setOff() 
-
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.readRIOPool.SCT_setOff()
-#DetFlags.readRIOBS.SCT_setOff() 
-DetFlags.dcs.SCT_setOff()
-if not loadInDetRec_Options["useTRT"]:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-  
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# --- printout
-DetFlags.Print()
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning = True
-rec.doMonitoring  = False
-from AthenaCommon.BFieldFlags import jobproperties
-jobproperties.BField.solenoidOn = True
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-
-# --- Disable DCS usage
-#InDetFlags.useDCS=False
-
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking = False
-#InDetFlags.doCTBTracking = False
-#InDetFlags.preProcessing = True
-#InDetFlags.doBeamGas     = True
-#InDetFlags.doBeamHalo    = True
-##InDetFlags.doxKalman    = False
-##InDetFlags.doiPatRec    = False
-InDetFlags.doRefit = True
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doTrackSegmentsPixel = False
-#InDetFlags.doTrackSegmentsSCT   = False
-#InDetFlags.doTrackSegmentsTRT   = False
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-# --- activate ntuple writing for IDRecStat (if it is on)
-#InDetFlags.doStatNtuple    = True
-
-# --- deactivate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-
-# --- produce various ntuples (all in one root file)
-InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-#InDetFlags.doTrtTrkNtuple   = True
-#InDetFlags.doPixelClusterNtuple = True
-#InDetFlags.doSctClusterNtuple   = True
-#InDetFlags.doTrtDriftCircleNtuple = True
-#InDetFlags.doVtxNtuple      = True
-#InDetFlags.doConvVtxNtuple  = True
-#InDetFlags.doV0VtxNtuple    = True
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = 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")
-from IOVDbSvc.CondDB import conddb
-
-
-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["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["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"]
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# Number of events to be processed (default is 10)
-#ServiceMgr.EventSelector.SkipEvents = 20
-#ServiceMgr.StoreGateSvc.Dump = True
-
-# hack for ATLANIS (rrashes in M8+ data)
-# Number of events to be processed (default is 10)
-theApp.EvtMax = int(loadInDetRec_Options["numberOfEvents"])
-#ServiceMgr.EventSelector.SkipEvents = 48
-#ServiceMgr.StoreGateSvc.Dump = True
-
-if not  loadInDetRec_Options["doReadBS"]:
-  ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-
-  # --- Minbias (DetDescrVersion = "ATLAS-GEO-08-00-01")
-  ServiceMgr.EventSelector.InputCollections =  loadInDetRec_Options["inputFiles"]
-else:
-  ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_Options["inputFiles"]
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_new.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py
similarity index 85%
rename from InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_new.py
rename to InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py
index 493fa1d0f7fdcdbd3e130684802731f9c776e18a..63b253b11b4d33e41b82aa9c44f4a4320852cfcc 100644
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_new.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_DBMRel17.py
@@ -19,10 +19,7 @@ loadInDetRec_Options = {"detectorDescription" : ""
                         ,"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"]
-                        }
-
+                       }
 # If the variables are defined use thier values.
 # If not defined the defaults given above are used
 for var in loadInDetRec_Options:
@@ -37,13 +34,11 @@ 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 *
@@ -79,13 +74,12 @@ 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"]
 
@@ -137,14 +131,13 @@ if Cosmics:
 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()
+DetFlags.makeRIO.SCT_setOff()
+DetFlags.makeRIO.TRT_setOff()
 
 # --- and switch off all the rest
 DetFlags.Calo_setOff()
@@ -153,22 +146,22 @@ 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()
+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()
+DetFlags.dcs.SCT_setOff()
+DetFlags.dcs.TRT_setOff()
 
 # --- printout
 DetFlags.Print()
 
 # --- output level
-#OutputLevel          = DEBUG
+OutputLevel          = DEBUG
 
   
 #--------------------------------------------------------------
@@ -180,15 +173,15 @@ 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':
+#if globalflags.InputFormat() == 'pool' and not globalflags.DataSource == 'geant4':
   # ---- run over ESD files
-  #  InDetFlags.preProcessing=True
-  InDetFlags.doPRDFormation = False
-else:
-  InDetFlags.doPRDFormation = True
+InDetFlags.preProcessing=True
+InDetFlags.doPRDFormation = True
+#else:
+#  InDetFlags.doPRDFormation = True
 
 # --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking          = False
+InDetFlags.doNewTracking          = True
 #InDetFlags.doLowPt                = True
 #InDetFlags.doBeamGas              = True
 #InDetFlags.doBeamHalo             = True
@@ -217,6 +210,7 @@ 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
@@ -226,10 +220,11 @@ InDetFlags.doMonitoringAlignment = False
 #InDetFlags.doSGDeletion  = True
 
 # --- produce various ntuples (all in one root file)
-InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doPixelTrkNtuple = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
-InDetFlags.doTrtTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
+#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
@@ -248,7 +243,30 @@ InDetFlags.doPrintConfigurables = True
 # 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" )
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py
index fd03d45bea2a1a23a24eaba223cc113ffe0b37b4..3ec848ba23b7dedbc1c607c061da26a5b2b3a282 100755
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_EoverPMaps.py
@@ -59,7 +59,7 @@ seq = AthSequencer("AthFilterSeq")
 
 from GoodRunsListsUser.GoodRunsListsUserConf import *
 seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']#'Eg_standard']        ## pick up correct name from inside xml file!
+seq.GRLTriggerAlg1.GoodRunsListArray = ['Eg_standard']        ## pick up correct name from inside xml file!
 
 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
 athenaCommonFlags.FilesInput=PoolInput
@@ -172,29 +172,12 @@ 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'"]
-ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
+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 IDPerfMonZmumu
-iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
-                                     ReFitterTool1 = MuonRefitterTool,
-                                     ReFitterTool2 = MuonRefitterTool2,
-				                             OutputTracksName =  "SelectedMuons", 
-							                       isMC = False,
-				                             doIsoSelection = False,
-                                     OutputLevel =3)
-
-
-#ToolSvc += funIDPerfMonZmumu
-job += iDPerfMonZmumu
-
-
-'''from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonEoverP
+from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonEoverP
 funIDPerfMonEoverP = IDPerfMonEoverP(name = 'IDPerfMonEoverP',
                                      ReFitterTool = ElectronRefitterTool,
                                      ReFitterTool2 = ElectronRefitterTool2,
@@ -206,7 +189,7 @@ funIDPerfMonEoverP = IDPerfMonEoverP(name = 'IDPerfMonEoverP',
                                      isDATA = True,
                                      OutputLevel =INFO)
 
-job += funIDPerfMonEoverP'''
+job += funIDPerfMonEoverP
 #from ElectronRefit.ElectronRefitConf import ElectronExtrapolation
 #ElectronRefitter = ElectronExtrapolation(name = 'ElectronRefitter',
 #                                    ReFitterTool = ElectronRefitterTool,
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_MC_Cosmics.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_MC_Cosmics.py
deleted file mode 100755
index 705c6a4400d07981399f2fc796f0cea949e0d90d..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_MC_Cosmics.py
+++ /dev/null
@@ -1,322 +0,0 @@
-# The Following options can be specified seperately in a file that include this one
-
-loadInDetRec_cosmics_Options = { "detectorDescription"  : "ATLAS-GEO-03-00-00"
-                                ,"doReadBS"		: False
-                                ,"realData" 		: False
-                                ,"globalTag" 		: ""
-                                ,"BField"		: True
-                                ,"doTrkNtuple"		: False
-                                ,"doMonitoring"		: True
-                                ,"siPoolFile"		: ""
-                                ,"siAlignmentTag"	: ""
-                                ,"trtAlignmentTag"	: ""
-                                ,"errorScalingTag"	: ""
-                                ,"TRTCalibTextFile"	: ""
-                                ,"TRTCalibT0TagCos"	: ""
-                                ,"TRTCalibRtTagCos"	: ""
-                                ,"numberOfEvents"	: 30
-                                ,"SkipEvents"		: 0
-                                ,"useTRT"		: True
-                                ,"inputFiles"		: ['/afs/cern.ch/atlas/maxidisk/d158/alignment/InDetESD_91361_1.root'] 
-                                ,"CosmicsGRL"		: ""
-                                }
-
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_cosmics_Options:
-  if var in dir():
-    loadInDetRec_cosmics_Options[var] = eval(var)
-
-# Good run list
-if loadInDetRec_cosmics_Options["CosmicsGRL"] != "":
-  from GoodRunsLists.GoodRunsListsConf import *
-  GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_cosmics_Options["CollisionGRL"] ]
-  GoodRunsTool.EventSelectorMode = True
-  GoodRunsTool.OutputLevel = DEBUG
-  print GoodRunsTool
-  AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
-  AthenaEventLoopMgr.PreSelectTools+=[GoodRunsTool]
-  AthenaEventLoopMgr.OutputLevel = DEBUG
-  print AthenaEventLoopMgr
-  
-  
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_cosmics_Options["doReadBS"] 
-# --- 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
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion = loadInDetRec_cosmics_Options["detectorDescription"]
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-# --- BS default input uses this
-if loadInDetRec_cosmics_Options["doReadBS"]:
-  globalflags.InputFormat   = 'bytestream'
-else:
-  #globalflags.DataSource = 'geant4'
-  globalflags.InputFormat = 'pool'
-if loadInDetRec_cosmics_Options["realData"]:
-  globalflags.DataSource = 'data'
-else:
-  globalflags.DataSource = 'geant4'
-
-globalflags.ConditionsTag = loadInDetRec_cosmics_Options["globalTag"]
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-
-if len(globalflags.ConditionsTag())!=0:
-   from IOVDbSvc.CondDB import conddb
-   conddb.setGlobalTag(globalflags.ConditionsTag()) 
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 0.0  
-jobproperties.Beam.beamType="cosmics"
-
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.readRIOPool.pixel_setOff()
-#DetFlags.readRIOBS.pixel_setOff() 
-#DetFlags.readRDOBS.pixel_setOff() 
-
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.readRIOPool.SCT_setOff()
-#DetFlags.readRIOBS.SCT_setOff() 
-#DetFlags.readRDOBS.SCT_setOff() 
-
-if not loadInDetRec_cosmics_Options["useTRT"]:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning = True
-rec.doMonitoring = True
-from AthenaCommon.BFieldFlags import jobproperties
-jobproperties.BField.solenoidOn=loadInDetRec_cosmics_Options["BField"]
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-
-#InDetFlags.doCosmics=True
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking  = False
-#InDetFlags.doCTBTracking = False
-##InDetFlags.preProcessing  = True
-#InDetFlags.doLowPt        = True
-#InDetFlags.doBeamGas      = True
-#InDetFlags.doBeamHalo     = True
-##InDetFlags.doxKalman      = False
-##InDetFlags.doiPatRec      = False
-#InDetFlags.doBackTracking = True
-#InDetFlags.doTRTStandalone = True
-##InDetFlags.doVertexFinding=False
-##InDetFlags.doConversions=False
-#InDetFlags.doSingleSpBackTracking = True
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doCTBTrackSegmentsPixel = False
-#InDetFlags.doCTBTrackSegmentsSCT   = False
-#InDetFlags.doCTBTrackSegmentsTRT   = False
-#InDetFlags.doCTBTrackSegmentsPixel = True
-#InDetFlags.doCTBTrackSegmentsSCT   = True
-#InDetFlags.doCTBTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- deactivate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-
-# --- Disable DCS usage
-#InDetFlags.useDCS=False
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = True
-
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-
-# --- produce various ntuples (all in one root file)
-InDetFlags.doTrkNtuple      = loadInDetRec_cosmics_Options["doTrkNtuple"]
-InDetFlags.doPixelTrkNtuple = loadInDetRec_cosmics_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_cosmics_Options["doTrkNtuple"]
-InDetFlags.doTrtTrkNtuple   = loadInDetRec_cosmics_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
-#--------------------------------------------------------------
-
-include("InDetRecExample/InDetRec_all.py")
-
-if not loadInDetRec_cosmics_Options["BField"]:
-  InDetTrackFitter.GetMaterialFromTrack = False
-  InDetTrackFitter.Momentum = 100000. *MeV
-
-from IOVDbSvc.CondDB import conddb
-
-if loadInDetRec_cosmics_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'
-  #filename = '%s%s%s' % ( AlignConstsPath, ReadPrefixName, 'AlignmentConstants.root')
-  ServiceMgr.CondProxyProvider.InputCollections = [ loadInDetRec_cosmics_Options["siPoolFile"] ]
-  ServiceMgr.CondProxyProvider.OutputLevel=INFO
-  print ServiceMgr.CondProxyProvider
-  IOVSvc = Service("IOVSvc")
-  IOVSvc.preLoadData = True
-
-  # With Global Chi2
-  #conddb.blockFolder("/Indet/Align")
-  #conddb.addFolder("","<dbConnection>sqlite://X;schema=mycool.db;dbname=OFLP200</dbConnection> /Indet/Align" + "<tag>cog_tag</tag>", force=True)
-else:
-  if loadInDetRec_cosmics_Options["siAlignmentTag"]:
-    conddb.addOverride('/Indet/Align',loadInDetRec_cosmics_Options["siAlignmentTag"])
-  if loadInDetRec_cosmics_Options["trtAlignmentTag"]:
-    conddb.addOverride('/TRT/Align',loadInDetRec_cosmics_Options["trtAlignmentTag"])  
-
- 
-if loadInDetRec_cosmics_Options["errorScalingTag"]:
-  if ".db" in loadInDetRec_cosmics_Options["errorScalingTag"]:
-    conddb.blockFolder("/Indet/TrkErrorScaling")
-    conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_cosmics_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_nominal</tag>", force=True)
-  else:
-    conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_cosmics_Options["errorScalingTag"])
-else:
-  conddb.addOverride('/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal')
-
-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
-print InDetRotErrorScalingTool
-if loadInDetRec_cosmics_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_cosmics_Options["TRTCalibTextFile"]
-  
-if loadInDetRec_cosmics_Options["TRTCalibT0TagCos"]:
-  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_cosmics_Options["TRTCalibT0TagCos"])
-if loadInDetRec_cosmics_Options["TRTCalibRtTagCos"]:
-  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_cosmics_Options["TRTCalibRtTagCos"])
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax = int(loadInDetRec_cosmics_Options["numberOfEvents"])
-ServiceMgr.EventSelector.SkipEvents = int(loadInDetRec_cosmics_Options["SkipEvents"])
-#ServiceMgr.StoreGateSvc.Dump = True
-
-# hack for ATLANIS (rrashes in M8+ data)
-if doJiveXML:
-  ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"]
-
-if not  loadInDetRec_cosmics_Options["doReadBS"]:
-  ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-  
-  # cosmic MC without field
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91900_lb3.root" ]
-  ServiceMgr.EventSelector.InputCollections =loadInDetRec_cosmics_Options["inputFiles"]
-  #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d17/dig.trtbarrel_ma_B100.root"]
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEO-03-00-00/dig/dig.pixelbarrel_B.400000.root"]
-
-if  loadInDetRec_cosmics_Options["doReadBS"]:
-  # Input file: ConditionsTag = 'COMCOND-ES1C-000-00'
-  ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_cosmics_Options["inputFiles"]
-  # Input file: real data from M6, ConditionsTag = 'COMCOND-ES1C-000-00'
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/M6/daq.NoTag.0043705.physics.HLT_Cosmic_AllTeIDSelected.LB0000.SFO-1._0001.data" ]
-  # Real data from M8 plus (nearly complete TRT)  
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/80725/physics_HLT_Cosmics_NIM4/daq.ATLAS.0080725.physics.HLT_Cosmics_NIM4.LB0000.SFO-5._0011.data" ]
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/91890/physics_IDCosmic/daq.ATLAS.0091890.physics.IDCosmic.LB0002.SFO-1._0001.data"]
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_7TeV.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py
old mode 100755
new mode 100644
similarity index 53%
rename from InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_7TeV.py
rename to InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py
index 874733fbf4a8de347d9faf37ff3a6b3e82a490f9..582db965065182a8af79acee1656fcc18142c299
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_7TeV.py
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel17.py
@@ -1,42 +1,94 @@
-# The Following options can be specified seperately in a file that include this one
-#  The defaults are for MC collision
-loadInDetRec_Options = {"detectorDescription" : "ATLAS-GEO-08-00-02"
-                        ,"doReadBS":True
+## 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
-                        ,"inputFiles":["/afs/cern.ch/user/g/gencomm/w0/Collisions/MergeBS.run140541.LArAndMBTSInTime._0001.dat" ]
-                        ,"CollisionGRL":""
+                        ,"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["CollisionGRL"] != "":
+if loadInDetRec_Options["GoodRunList"] != "":
   from GoodRunsLists.GoodRunsListsConf import *
   GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_Options["CollisionGRL"] ]
+  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
 #--------------------------------------------------------------
@@ -50,11 +102,10 @@ doVP1           = False
 # --- controls what is written out. ESD includes AOD, so it's normally enough
 doWriteESD      = False
 doWriteAOD      = False
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_Options["doReadBS"]
 # --- do auditors ?
 doAuditors      = True
 
+
 import os
 if os.environ['CMTCONFIG'].endswith('-dbg'):
   # --- do EDM monitor (debug mode only)
@@ -65,56 +116,52 @@ else:
   doEdmMonitor    = False
   doNameAuditor   = False
 
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion =  loadInDetRec_Options["detectorDescription"]
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-import AthenaCommon.SystemOfUnits as Units
+#-------------------------------------------------------
+#Load globalFlags and set Defaults
+#-------------------------------------------------------
 from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-globalflags.DataSource = 'data'
-# --- BS default input uses this
-if loadInDetRec_Options["doReadBS"]:
+##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["globalTag"]:
-  globalflags.ConditionsTag = loadInDetRec_Options["globalTag"]
-  
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
+if loadInDetRec_Options["realData"]:
+  globalflags.DataSource = 'data'
+else:
+  globalflags.DataSource = 'geant4'
 
-if len(globalflags.ConditionsTag())!=0:
-   from IOVDbSvc.CondDB import conddb
-   conddb.setGlobalTag(globalflags.ConditionsTag()) 
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- in Tier0 reco these flags are set from outside
-#Let number of collisions default to 0.0 since input file doesn't include pileup 
-#jobproperties.Beam.numberOfCollisions = 10.0 # arbitrary higher number for 7+ TeV, for 900 GeV it is 2.
-jobproperties.Beam.energy             = 7.*Units.TeV
-jobproperties.Beam.beamType           = 'collisions'
-if 'doReadBS' in dir() and doReadBS:
-#  jobproperties.Beam.numberOfCollisions = 6.9
-  jobproperties.Beam.bunchSpacing       = 75
+if len(loadInDetRec_Options["globalTag"])!=0:
+  #from AthenaCommon.GlobalFlags import globalflags
+  globalflags.ConditionsTag.set_Value_and_Lock(loadInDetRec_Options["globalTag"])
 
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
+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.Commissioning=False
+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()
@@ -149,17 +196,34 @@ DetFlags.Print()
 # Load InDet configuration
 #--------------------------------------------------------------
 
-# --- setup InDetJobProperties
+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
-InDetFlags.doxKalman              = True
-InDetFlags.doiPatRec              = True
+if not loadInDetRec_Options["Cosmics"]:
+  InDetFlags.doxKalman              = False
+  InDetFlags.doiPatRec              = False
 #InDetFlags.doBackTracking         = False
 #InDetFlags.doSingleSpBackTracking = True
 #InDetFlags.doTRTStandalone        = False
@@ -169,9 +233,10 @@ InDetFlags.doiPatRec              = True
 #InDetFlags.doSlimming = False
 
 # --- possibility to run tracking on subdetectors separately (and independent from each other)
-InDetFlags.doTrackSegmentsPixel = True
-InDetFlags.doTrackSegmentsSCT   = True
-InDetFlags.doTrackSegmentsTRT   = True
+#if not Cosmics:
+#    InDetFlags.doTrackSegmentsPixel = True
+#    InDetFlags.doTrackSegmentsSCT   = True
+ #   InDetFlags.doTrackSegmentsTRT   = True
 
 # --- possibility to change the trackfitter
 #InDetFlags.trackFitterType = 'KalmanFitter'
@@ -180,7 +245,18 @@ 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
@@ -190,7 +266,8 @@ InDetFlags.doMonitoringAlignment = False
 #InDetFlags.doSGDeletion  = True
 
 # --- produce various ntuples (all in one root file)
-InDetFlags.doTrkNtuple      = loadInDetRec_Options["doTrkNtuple"]
+#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"]
@@ -201,17 +278,6 @@ InDetFlags.doTrtTrkNtuple   = loadInDetRec_Options["doTrkNtuple"]
 #InDetFlags.doConvVtxNtuple  = True
 #InDetFlags.doV0VtxNtuple    = True
 
-# --- produce various ntuples (all in one root file)
-#InDetFlags.doTrkD3PD = True
-#InDetFlags.doPixelTrkD3PD = True
-#InDetFlags.doSctTrkD3PD = True
-#InDetFlags.doTrtTrkD3PD = True
-#InDetFlags.doVtxD3PD = True
-#InDetFlags.doConvVtxD3PD = True  # NOT implemented yet
-#InDetFlags.doV0VtxD3PD = True    # NOT implemented yet
-
-#InDetFlags.doMinBias   = True
-
 # activate the print InDetXYZAlgorithm statements
 InDetFlags.doPrintConfigurables = True
 
@@ -223,12 +289,45 @@ InDetFlags.doPrintConfigurables = True
 # 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
+    # block folders that you want to override
   conddb.blockFolder("/Indet/Align")
   conddb.blockFolder("/TRT/Align")
   from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
@@ -247,6 +346,8 @@ else:
     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"]:
@@ -255,20 +356,27 @@ if loadInDetRec_Options["errorScalingTag"]:
     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"]:
+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
+print InDetRotErrorScalingTool
 
-if loadInDetRec_Options["TRTCalibTextFile"]:
+  
+# 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()
@@ -277,44 +385,13 @@ if loadInDetRec_Options["TRTCalibTextFile"]:
   conddb.blockFolder("/TRT/Calib/RT" )
   conddb.blockFolder("/TRT/Calib/T0" )
   TRTCalibDBSvc.calibTextFile = loadInDetRec_Options["TRTCalibTextFile"]
-  
-# --- dump MC truth into logfile
-#from TruthExamples.TruthExamplesConf import DumpMC
-#topSequence += DumpMC(McEventKey = "TruthEvent")
 
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
+if loadInDetRec_Options["TRTCalibT0TagCos"]:
+  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_Options["TRTCalibT0TagCos"])
+if loadInDetRec_Options["TRTCalibRtTagCos"]:
+  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_Options["TRTCalibRtTagCos"])
 
-# Number of events to be processed (default is 10)
-theApp.EvtMax = int(loadInDetRec_Options["numberOfEvents"])
-#ServiceMgr.EventSelector.SkipEvents = 2
-#ServiceMgr.StoreGateSvc.Dump = True
-
-if not doReadBS:
-  ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-
-  # --- t tbar channel 5200 (DetDescrVersion = "ATLAS-DC3-07")
-  # ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d38/ID_ValidationData/testIdeal_07.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000201_tid002760._00002.pool.root.1"]
-  # --- TP split version (local) - (DetDescrVersion = "ATLAS-DC3-07")
-  #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d89/InDetRecRDO.root"]
-  # --- Minbias (DetDescrVersion = "ATLAS-GEO-08-00-01")
-  #ServiceMgr.EventSelector.InputCollections = ["root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/perf-idtracking/InDetRecExample/mc09_900GeV.105001.pythia_minbias.digit.RDO.e466_s604_s582_d224_tid097817/RDO.097817._000001.pool.root.1"]
-  # --- t tbar channel 5200 (DetDescrVersion = "ATLAS-CSC-02-00-00")
-  ServiceMgr.EventSelector.InputCollections = loadInDetRec_Options["inputFiles"]
-  #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d89/InDetRecRDO.root"]
-  # --- gamma 20 (ATLAS-CSC-01-00-00)
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/datafiles/egamma/DC3.007040.singlepart_gamma_Et20/digit/120031/ideal0_mc12.007040.singlepart_gamma_Et20.digit.RDO.v12003108_tid005022._00001.pool.root"]
-  #ServiceMgr.EventSelector.InputCollections += ["castor:/castor/cern.ch/grid/atlas/datafiles/egamma/DC3.007040.singlepart_gamma_Et20/digit/120031/ideal0_mc12.007040.singlepart_gamma_Et20.digit.RDO.v12003108_tid005022._00002.pool.root"]
-  # --- black hole event
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/j/jgoncalo/valid12003108/misal1_mc12.006640.CharybdisJimmy.digit.RDO.v12003108_tid006066._00038.pool.root.4"]
-  # --- event with low lumi pile up (4.6 min bias, 2*10^33), should be ATLAS-CSC-01-02-00
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/user/k/kgrybel/pileup/CSC/005850.pyt_WH120_munubb/digits/misal1_csc11.005850.WH120bb_pythia.digit.RDOS.v12003103_lumi02._00001.pool.root"]
+if doJiveXML:
+  ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"]
 
-if doReadBS:
-  # input used for FDR2b (run 8): low lumi (2.3 min bias, 10^33)/pile-up/shifted vertex run 8
-  # this file needs (as set by default): DetDescrVersion = "ATLAS-CSC-02-00-00" globalflags.ConditionsTag="OFLCOND-FDR-02-01-00", jobproperties.Beam.numberOfCollisions = 2.3
-  ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_Options["inputFiles"]
-  # if you create the input BS file yourself with InDetWriteBS jobO the output will be this file
-  # and you have to set the detdescr and cond tag to what you used ...
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "daq.csc13.0000000.Single.Stream.LB0000.Athena._0001.data" ]
+  
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py
new file mode 100644
index 0000000000000000000000000000000000000000..cab79fd7b1553219cd182f946bb9d788b95a2e5e
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_Run2Rel19.py
@@ -0,0 +1,343 @@
+## The Following options can be specified seperately in a file that include this one
+print "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_cosmics.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_cosmics.py
deleted file mode 100755
index 216b4dd5275ce42da2cfe3899e6840fa7735b7f3..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_cosmics.py
+++ /dev/null
@@ -1,324 +0,0 @@
-# The Following options can be specified seperately in a file that include this one
-#  The defaults are for M8Plus cosmics
-loadInDetRec_cosmics_Options = {"detectorDescription":"ATLAS-GEO-03-00-00"
-								,"doReadBS":True
-                                ,"realData" : True
-                                ,"doReadBS":  False
-                                ,"realData" :False
-                                ,"globalTag" : ""
-                                ,"BField":True
-                                ,"doTrkNtuple":False
-                                ,"doMonitoring":True
-                                ,"siPoolFile":""
-                                ,"siAlignmentTag":"InDet_Cosmic_2008_6"
-                                ,"trtAlignmentTag":""
-                                ,"errorScalingTag":""
-                                ,"TRTCalibTextFile":""
-                                ,"TRTCalibT0TagCos":""
-                                ,"TRTCalibRtTagCos":""
-                                ,"numberOfEvents":30
-                                ,"SkipEvents":0
-                                ,"useTRT":True
-                                ,"inputFiles":['/afs/cern.ch/atlas/maxidisk/d158/alignment/InDetESD_91361_1.root'] 
-                                ,"CosmicsGRL":""
-                                }
-
-# If the variables are defined use thier values.
-# If not defined the defaults given above are used
-for var in loadInDetRec_cosmics_Options:
-  if var in dir():
-    loadInDetRec_cosmics_Options[var] = eval(var)
-
-# Good run list
-if loadInDetRec_cosmics_Options["CosmicsGRL"] != "":
-  from GoodRunsLists.GoodRunsListsConf import *
-  GoodRunsTool = GoodRunsListSelectorTool("GoodRunsTool") 
-  GoodRunsTool.GoodRunsListVec   = [ loadInDetRec_cosmics_Options["CollisionGRL"] ]
-  GoodRunsTool.EventSelectorMode = True
-  GoodRunsTool.OutputLevel = DEBUG
-  print GoodRunsTool
-  AthenaEventLoopMgr=Service("AthenaEventLoopMgr")
-  AthenaEventLoopMgr.PreSelectTools+=[GoodRunsTool]
-  AthenaEventLoopMgr.OutputLevel = DEBUG
-  print AthenaEventLoopMgr
-  
-  
-#--------------------------------------------------------------
-# 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
-# --- read BS - please look at the default input file(s) to know the det descr and cond tag
-doReadBS        = loadInDetRec_cosmics_Options["doReadBS"] 
-# --- 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
-#--------------------------------------------------------------
-# detector description version: both RDO and BS default use this
-#--------------------------------------------------------------
-DetDescrVersion = loadInDetRec_cosmics_Options["detectorDescription"]
-
-#--------------------------------------------------------------
-# load Global Flags and set defaults (import the new jobProperty globalflags)
-#--------------------------------------------------------------
-
-from AthenaCommon.GlobalFlags import globalflags
-# --- default is atlas geometry
-globalflags.DetGeo = 'atlas'
-# --- set defaults
-# --- BS default input uses this
-if loadInDetRec_cosmics_Options["doReadBS"]:
-  globalflags.InputFormat   = 'bytestream'
-else:
-  #globalflags.DataSource = 'geant4'
-  globalflags.InputFormat = 'pool'
-if loadInDetRec_Options["realData"]:
-  globalflags.DataSource = 'data'
-else:
-  globalflags.DataSource = 'geant4'
-
-globalflags.ConditionsTag = loadInDetRec_cosmics_Options["globalTag"]
-# --- set geometry version
-globalflags.DetDescrVersion = DetDescrVersion
-# --- printout
-globalflags.print_JobProperties()
-
-if len(globalflags.ConditionsTag())!=0:
-   from IOVDbSvc.CondDB import conddb
-   conddb.setGlobalTag(globalflags.ConditionsTag()) 
-    
-from AthenaCommon.BeamFlags import jobproperties
-# --- default is zero luminosity
-jobproperties.Beam.numberOfCollisions = 0.0  
-jobproperties.Beam.beamType="cosmics"
-
-#--------------------------------------------------------------
-# Set Detector setup
-#--------------------------------------------------------------
-
-from AthenaCommon.DetFlags import DetFlags 
-# --- switch on InnerDetector
-DetFlags.ID_setOn()
-
-#DetFlags.makeRIO.pixel_setOff()
-#DetFlags.readRIOPool.pixel_setOff()
-#DetFlags.readRIOBS.pixel_setOff() 
-#DetFlags.readRDOBS.pixel_setOff() 
-
-#DetFlags.makeRIO.SCT_setOff()
-#DetFlags.readRIOPool.SCT_setOff()
-#DetFlags.readRIOBS.SCT_setOff() 
-#DetFlags.readRDOBS.SCT_setOff() 
-
-if not loadInDetRec_cosmics_Options["useTRT"]:
-  DetFlags.TRT_setOff()
-  DetFlags.detdescr.TRT_setOn()
-
-# --- and switch off all the rest
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOff()
-
-# --- switch off DCS
-#DetFlags.dcs.pixel_setOff()
-#DetFlags.dcs.SCT_setOff()
-#DetFlags.dcs.TRT_setOff()
-
-# --- printout
-DetFlags.Print()
-
-#--------------------------------------------------------------
-# Load InDet configuration
-#--------------------------------------------------------------
-
-from RecExConfig.RecFlags import rec
-rec.Commissioning = True
-rec.doMonitoring = True
-from AthenaCommon.BFieldFlags import jobproperties
-jobproperties.BField.solenoidOn=loadInDetRec_cosmics_Options["BField"]
-
-# --- setup InDetJobProperties
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool")
-
-#InDetFlags.doCosmics=True
-# --- uncomment to change the default of one of the following options:
-#InDetFlags.doNewTracking  = False
-#InDetFlags.doCTBTracking = False
-##InDetFlags.preProcessing  = True
-#InDetFlags.doLowPt        = True
-#InDetFlags.doBeamGas      = True
-#InDetFlags.doBeamHalo     = True
-##InDetFlags.doxKalman      = False
-##InDetFlags.doiPatRec      = False
-#InDetFlags.doBackTracking = True
-#InDetFlags.doTRTStandalone = True
-##InDetFlags.doVertexFinding=False
-##InDetFlags.doConversions=False
-#InDetFlags.doSingleSpBackTracking = True
-
-# --- Turn off track slimming
-#InDetFlags.doSlimming = False
-
-# --- possibility to run tracking on subdetectors separately (and independent from each other)
-#InDetFlags.doCTBTrackSegmentsPixel = False
-#InDetFlags.doCTBTrackSegmentsSCT   = False
-#InDetFlags.doCTBTrackSegmentsTRT   = False
-#InDetFlags.doCTBTrackSegmentsPixel = True
-#InDetFlags.doCTBTrackSegmentsSCT   = True
-#InDetFlags.doCTBTrackSegmentsTRT   = True
-
-# --- possibility to change the trackfitter
-#InDetFlags.trackFitterType = 'KalmanFitter'
-
-# --- deactivate monitorings
-InDetFlags.doMonitoringGlobal    = False
-InDetFlags.doMonitoringPixel     = False
-InDetFlags.doMonitoringSCT       = False
-InDetFlags.doMonitoringTRT       = False
-InDetFlags.doMonitoringAlignment = False
-
-
-# --- Disable DCS usage
-#InDetFlags.useDCS=False
-
-# --- activate (memory/cpu) monitoring
-#InDetFlags.doPerfMon = True
-
-# --- activate creation of standard plots
-#InDetFlags.doStandardPlots  = True
-
-# --- produce various ntuples (all in one root file)
-InDetFlags.doTrkNtuple      = loadInDetRec_cosmics_Options["doTrkNtuple"]
-InDetFlags.doPixelTrkNtuple = loadInDetRec_cosmics_Options["doTrkNtuple"]
-InDetFlags.doSctTrkNtuple   = loadInDetRec_cosmics_Options["doTrkNtuple"]
-InDetFlags.doTrtTrkNtuple   = loadInDetRec_cosmics_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
-#--------------------------------------------------------------
-
-include("InDetRecExample/InDetRec_all.py")
-
-if not loadInDetRec_cosmics_Options["BField"]:
-  InDetTrackFitter.GetMaterialFromTrack = False
-  InDetTrackFitter.Momentum = 100000. *MeV
-
-from IOVDbSvc.CondDB import conddb
-
-if loadInDetRec_cosmics_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'
-  #filename = '%s%s%s' % ( AlignConstsPath, ReadPrefixName, 'AlignmentConstants.root')
-  ServiceMgr.CondProxyProvider.InputCollections = [ loadInDetRec_cosmics_Options["siPoolFile"] ]
-  ServiceMgr.CondProxyProvider.OutputLevel=INFO
-  print ServiceMgr.CondProxyProvider
-  IOVSvc = Service("IOVSvc")
-  IOVSvc.preLoadData = True
-
-  # With Global Chi2
-  #conddb.blockFolder("/Indet/Align")
-  #conddb.addFolder("","<dbConnection>sqlite://X;schema=mycool.db;dbname=OFLP200</dbConnection> /Indet/Align" + "<tag>cog_tag</tag>", force=True)
-else:
-  if loadInDetRec_cosmics_Options["siAlignmentTag"]:
-    conddb.addOverride('/Indet/Align',loadInDetRec_cosmics_Options["siAlignmentTag"])
-  if loadInDetRec_cosmics_Options["trtAlignmentTag"]:
-    conddb.addOverride('/TRT/Align',loadInDetRec_cosmics_Options["trtAlignmentTag"])  
-
- 
-if loadInDetRec_cosmics_Options["errorScalingTag"]:
-  if ".db" in loadInDetRec_cosmics_Options["errorScalingTag"]:
-    conddb.blockFolder("/Indet/TrkErrorScaling")
-    conddb.addFolder("","<dbConnection>sqlite://;schema="+loadInDetRec_cosmics_Options["errorScalingTag"]+";dbname=OFLP200</dbConnection> /Indet/TrkErrorScaling" + "<tag>IndetTrkErrorScaling_nominal</tag>", force=True)
-  else:
-    conddb.addOverride('/Indet/TrkErrorScaling',loadInDetRec_cosmics_Options["errorScalingTag"])
-else:
-  conddb.addOverride('/Indet/TrkErrorScaling','IndetTrkErrorScaling_nominal')
-
-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
-print InDetRotErrorScalingTool
-if loadInDetRec_cosmics_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_cosmics_Options["TRTCalibTextFile"]
-  
-if loadInDetRec_cosmics_Options["TRTCalibT0TagCos"]:
-  conddb.addOverride('/TRT/Calib/T0',loadInDetRec_cosmics_Options["TRTCalibT0TagCos"])
-if loadInDetRec_cosmics_Options["TRTCalibRtTagCos"]:
-  conddb.addOverride('/TRT/Calib/RT',loadInDetRec_cosmics_Options["TRTCalibRtTagCos"])
-#--------------------------------------------------------------
-# Event related parameters and input files
-#--------------------------------------------------------------
-
-# Number of events to be processed (default is 10)
-theApp.EvtMax = int(loadInDetRec_cosmics_Options["numberOfEvents"])
-ServiceMgr.EventSelector.SkipEvents = int(loadInDetRec_cosmics_Options["SkipEvents"])
-#ServiceMgr.StoreGateSvc.Dump = True
-
-# hack for ATLANIS (rrashes in M8+ data)
-if doJiveXML:
-  ToolSvc.TrackRetriever.OtherTrackCollections =["CombinedInDetTracks", "CombinedInDetTracks_CTB"]
-
-if not  loadInDetRec_cosmics_Options["doReadBS"]:
-  ServiceMgr.PoolSvc.AttemptCatalogPatch=True
-  
-  # cosmic MC without field
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/caf/atlcal/perm/id/cosmics/ESDs/InDetESD_91900_lb3.root" ]
-  ServiceMgr.EventSelector.InputCollections =loadInDetRec_cosmics_Options["inputFiles"]
-  #ServiceMgr.EventSelector.InputCollections = ["/afs/cern.ch/atlas/maxidisk/d17/dig.trtbarrel_ma_B100.root"]
-  #ServiceMgr.EventSelector.InputCollections = ["castor:/castor/cern.ch/grid/atlas/atlasgroupdisk/proj-simcos/rel14/ATLAS-GEO-03-00-00/dig/dig.pixelbarrel_B.400000.root"]
-
-if  loadInDetRec_cosmics_Options["doReadBS"]:
-  # Input file: ConditionsTag = 'COMCOND-ES1C-000-00'
-  ServiceMgr.ByteStreamInputSvc.FullFileName = loadInDetRec_cosmics_Options["inputFiles"]
-  # Input file: real data from M6, ConditionsTag = 'COMCOND-ES1C-000-00'
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/M6/daq.NoTag.0043705.physics.HLT_Cosmic_AllTeIDSelected.LB0000.SFO-1._0001.data" ]
-  # Real data from M8 plus (nearly complete TRT)  
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/80725/physics_HLT_Cosmics_NIM4/daq.ATLAS.0080725.physics.HLT_Cosmics_NIM4.LB0000.SFO-5._0011.data" ]
-  #ServiceMgr.ByteStreamInputSvc.FullFileName = [ "/castor/cern.ch/grid/atlas/DAQ/2008/91890/physics_IDCosmic/daq.ATLAS.0091890.physics.IDCosmic.LB0002.SFO-1._0001.data"]
-
diff --git a/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py
new file mode 100644
index 0000000000000000000000000000000000000000..7aecc8e52e8451bcd363b819ee1a8026f719efdd
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/loadInDetRec_newDBM.py
@@ -0,0 +1,361 @@
+# 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/poolToTxtMatthias.py b/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxtMatthias.py
new file mode 100644
index 0000000000000000000000000000000000000000..bfc2fcb91cd198cde3957dba456650be3b3c35ec
--- /dev/null
+++ b/InnerDetector/InDetExample/InDetAlignExample/share/poolToTxtMatthias.py
@@ -0,0 +1,258 @@
+###############################################################
+#
+# 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 = ["Iter10_AlignmentConstants.root"]
+outputFile = "NewSiAlignment_corrected_v1.root"
+tagSi  = "InDetAlign_NewGeo"
+tagTRT = "TRTAlign_test"
+
+textFileInSi  = "alignmentSi_out.txt"
+textFileOutSi = "alignmentSi_out.txt"                # not needed
+textFileInTRT  = "OutputTRTAlignment.txt"
+textFileInTRTStraw  = "OutputTRTStrawAlignment.txt"
+textFileOutTRT = "alignmentTRT_out.txt"              # not needed
+textFileOutTRTStraw = "alignmentTRTStraw_out.txt"    # not needed
+
+doSilicon = True
+doTRT = False
+
+doPrintDectectorPositions = False
+
+#==============================================================
+
+# 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'
+#globalflags.DataSource='data'
+
+from IOVDbSvc.CondDB import conddb
+#conddb.setGlobalTag("OFLCOND-SDR-BS7T-04-02")
+#conddb.setGlobalTag("OFLCOND-SIM-BS7T-00")
+conddb.setGlobalTag("OFLCOND-MC12-IBL-20-30-25") # latest and greates
+conddb.addOverride('/GLOBAL/TrackingGeo/LayerMaterial','AtlasLayerMat_v15_ATLAS-IBL3D25-04-00-01') 
+# The geometry version does not really matter. Any will do.
+globalflags.DetDescrVersion = 'ATLAS-IBL3D25-04-00-01'  # latest and greatest
+#globalflags.DetDescrVersion = 'ATLAS-GEO-16-00-00'
+
+# 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()
+
+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 = False
+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
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+svcMgr.MessageSvc.defaultLimit = 999999999
+
+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 = 10
+
+if doPrintDectectorPositions:
+    include("InDetSimpleVisual/GetDetectorPositions.py")
+    job.GetDetectorPositions.DetailLevel = 2
+
+#==============================================================
+#
+# End of job options file
+#
+###############################################################