diff --git a/DataQuality/ZLumiScripts/grid/generateDSFile.py b/DataQuality/ZLumiScripts/grid/generateDSFile.py
new file mode 100755
index 0000000000000000000000000000000000000000..502f0ecd7bc3d1320c7ebac9bc04513e22029ba4
--- /dev/null
+++ b/DataQuality/ZLumiScripts/grid/generateDSFile.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+# helper script to generate JSON file of datasets for batch pathena submission
+
+import sys, json
+prefix = sys.argv[1]
+dslist = sys.argv[2:]
+jlist = []
+for ds in dslist:
+    jlist.append({'inDS': ds, 'outDS': prefix + '.' + ds.split(':')[-1]})
+with open('inOutDs.json', 'w') as ofile:
+    json.dump(jlist, ofile)
diff --git a/DataQuality/ZLumiScripts/grid/grl.py b/DataQuality/ZLumiScripts/grid/grl.py
new file mode 100644
index 0000000000000000000000000000000000000000..d37882385badb4c1dd27cfa8c3af770df2d3d3f9
--- /dev/null
+++ b/DataQuality/ZLumiScripts/grid/grl.py
@@ -0,0 +1,18 @@
+#!/us/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+# Postinclude snippet for Reco_tf to bring in a GRL
+
+from __future__ import print_function
+
+from GoodRunsLists.GoodRunsListsConf import GoodRunsListSelectorTool
+from GoodRunsListsUser.GoodRunsListsUserConf import GRLTriggerSelectorAlg
+from AthenaCommon.AlgSequence import AthSequencer
+import os
+if 'GRL' in os.environ:
+    print('Executing GRL code')
+    ToolSvc += GoodRunsListSelectorTool()
+    ToolSvc.GoodRunsListSelectorTool.GoodRunsListVec = [ os.environ['GRL']  ]
+
+    seq = AthSequencer("AthMasterSeq")
+    seq += GRLTriggerSelectorAlg("GRLAlg")
+    seq.GRLAlg.GoodRunsListArray=[ os.environ['GRLNAME'] ]
diff --git a/DataQuality/ZLumiScripts/grid/merge.py b/DataQuality/ZLumiScripts/grid/merge.py
new file mode 100755
index 0000000000000000000000000000000000000000..2d5b11f0a201b25d763cf83664cad2f9f6b11413
--- /dev/null
+++ b/DataQuality/ZLumiScripts/grid/merge.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+# Simple script to invoke DQHistogramMerge for merging Grid output
+
+from __future__ import print_function
+
+import commands, argparse, sys
+parser = argparse.ArgumentParser()
+parser.add_argument('-o', help='outfilename')
+parser.add_argument('infiles', nargs='+', help='infilenames')
+args=parser.parse_args()
+
+with open('merge.txt', 'w') as txtfile:
+    for f in args.infiles:
+        txtfile.write(f + '\n')
+
+status, output = commands.getstatusoutput('DQHistogramMerge.py merge.txt %s' % args.o)
+print(output)
+sys.exit(status)
+
diff --git a/DataQuality/ZLumiScripts/grid/submission.sh b/DataQuality/ZLumiScripts/grid/submission.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8dcc39619265356c36dbe988ac1623fd7940fc31
--- /dev/null
+++ b/DataQuality/ZLumiScripts/grid/submission.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+# Submit pathena jobs to make Z counting HIST files for data
+# Adjust DATASETS and LOWMU variables to configure the job
+# Also see below for commented out code that enables using a GRL
+
+#DATASETS=$(rucio ls 'data16_13TeV.00*physics_Main*.AOD*' --filter account=tzero --short)
+#DATASETS=$(rucio list-content data16_13TeV:data16_13TeV.periodG.physics_Main.PhysCont.AOD.repro21_v01 --short)
+#DATASETS="data18_13TeV.00356124.physics_Main.merge.AOD.f1035_m1999 data18_13TeV.00359823.physics_Main.merge.AOD.f1034_m2020 data18_13TeV.00363738.physics_Main.merge.AOD.f1006_m2037 data18_13TeV.00364292.physics_Main.merge.AOD.f1002_m2037 data18_13TeV.00350361.physics_Main.merge.AOD.f934_m1960"
+
+#DATASETS="data17_13TeV:data17_13TeV.00338834.physics_Main.merge.AOD.r10258_p3399_tid13253867_00"
+#LOWMU=0
+
+# 2017 5 TeV low mu
+#DATASETS=$(rucio list-content data17_5TeV:data17_5TeV.periodM.physics_Main.PhysCont.AOD.pro22_v02 --short)
+#LOWMU=1
+
+# 2017 13 TeV low mu
+#DATASETS=$(rucio list-content data17_13TeV:data17_13TeV.periodN.physics_Main.PhysCont.AOD.pro22_v03 --short)
+#LOWMU=1
+
+# 2018 13 TeV low mu period J
+#DATASETS=$(rucio list-content data18_13TeV:data18_13TeV.periodJ.physics_Main.PhysCont.AOD.t0pro22_v01 --short)
+#LOWMU=1
+
+# 2018 13 TeV low mu period G2
+#DATASETS=$(rucio list-content data18_13TeV:data18_13TeV.periodG2.physics_Main.PhysCont.AOD.t0pro22_v01 --short)
+#LOWMU=1
+
+# 2018 13 TeV low mu period G2
+#DATASETS=$(rucio list-content data18_13TeV:data18_13TeV.periodG4.physics_Main.PhysCont.AOD.t0pro22_v01 --short)
+#LOWMU=1
+
+# 2015 13 TeV high mu
+#DATASETS=$(rucio list-content data15_13TeV:data15_13TeV.periodAllYear.physics_Main.PhysCont.AOD.repro21_v03 --short)
+#LOWMU=0
+
+# 2016 13 TeV high mu
+#DATASETS=$(rucio list-content data16_13TeV:data16_13TeV.periodAllYear.physics_Main.PhysCont.AOD.repro21_v03 --short)
+#LOWMU=0
+
+# 2017 13 TeV high mu
+#DATASETS=$(rucio list-content data17_13TeV:data17_13TeV.periodAllYear.physics_Main.PhysCont.AOD.pro22_v03 --short)
+#LOWMU=0
+
+# 2018 13 TeV high mu
+DATASETS=$(rucio list-content data18_13TeV:data18_13TeV.periodB.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodC.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodD.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodE.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodF.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodH.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodI.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodJ.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodK.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodL.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodM.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodN.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodO.physics_Main.PhysCont.AOD.t0pro22_v01 data18_13TeV:data18_13TeV.periodQ.physics_Main.PhysCont.AOD.t0pro22_v01 --short)
+LOWMU=0
+
+PREFIX=user.ponyisi.2020320a2.merge
+./generateDSFile.py $PREFIX ${DATASETS}
+#POSTEXEC="ToolSvc.DQTMuonSelectionTool.MaxEta=0.9;ToolSvc.DQTGlobalWZFinderTool.MuonMaxEta=0.9"
+#POSTEXEC="pass"
+POSTEXEC="ToolSvc.DQTGlobalWZFinderTool.FillBCIDTrees=True"
+if [[ $LOWMU == 1 ]] ; then {
+    POSTEXEC=${POSTEXEC}";\
+ToolSvc.monTrigTransTool.triggerMapping[\"primary_single_ele_iso\"]=\"\";\
+ToolSvc.monTrigTransTool.triggerMapping[\"primary_single_ele\"]=\"HLT_e15_lhloose_nod0_L1EM12\";\
+ToolSvc.monTrigTransTool.triggerMapping[\"monitoring_muonIso\"]=\"\";\
+ToolSvc.monTrigTransTool.triggerMapping[\"monitoring_muonNonIso\"]=\"HLT_mu14\""
+}; elif [[ $DATASETS == data15* ]] ; then {
+    POSTEXEC=${POSTEXEC}";\
+ToolSvc.monTrigTransTool.triggerMapping[\"primary_single_ele_iso\"]=\"\";\
+ToolSvc.monTrigTransTool.triggerMapping[\"primary_single_ele\"]=\"HLT_e24_lhmedium_L1EM20VH,HLT_e60_lhmedium,HLT_e120_lhloose\";\
+ToolSvc.monTrigTransTool.triggerMapping[\"monitoring_muonIso\"]=\"HLT_mu20_iloose_L1MU15\""
+}; else {
+    POSTEXEC=${POSTEXEC}";\
+ToolSvc.monTrigTransTool.triggerMapping[\"primary_single_ele_iso\"]=\"HLT_e26_lhtight_nod0_ivarloose\";\
+ToolSvc.monTrigTransTool.triggerMapping[\"primary_single_ele\"]=\"HLT_e60_lhmedium_nod0,HLT_e140_lhloose_nod0\""
+    }; fi
+
+if [[ $DATASETS == data18* ]] ; then {
+    export GRL=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.xml
+    export GRLNAME=PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim
+} ; elif [[ $DATASETS == data17* ]] ; then {
+    export GRL=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.xml
+    export GRLNAME=PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim
+} ; elif [[ $DATASETS == data16* ]] ; then {
+    export GRL=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20180129/physics_25ns_21.0.19.xml
+    export GRLNAME=PHYS_StandardGRL_All_Good_25ns
+} ; elif [[ $DATASETS == data15* ]] ; then {
+    export GRL=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20170619/physics_25ns_21.0.19.xml
+    export GRLNAME=PHYS_StandardGRL_All_Good_25ns
+} ; else {
+    export GRL=None
+    export GRLNAME=None
+} ; fi
+
+EXCLUDE=""
+# following gives a GRL filter
+#CMD="export GRL=$GRL;export GRLNAME=$GRLNAME;Reco_tf.py --preExec='rec.doApplyAODFix.set_Value_and_Lock(False);DQMonFlags.set_All_Off();DQMonFlags.doGlobalMon.set_Value_and_Lock(True)' --postExec='$POSTEXEC' --inputAODFile=%IN --outputHIST_AODFile=%OUT.HIST_AOD.root --postInclude='grl.py'"
+CMD="Reco_tf.py --preExec='rec.doApplyAODFix.set_Value_and_Lock(False);DQMonFlags.set_All_Off();DQMonFlags.doGlobalMon.set_Value_and_Lock(True)' --postExec='$POSTEXEC' --inputAODFile=%IN --outputHIST_AODFile=%OUT.HIST_AOD.root"
+
+ADDITIONAL="--addNthFieldOfInDSToLFN=2 --mergeOutput --mergeScript='merge.py' --excludedSite=ANALY_GOEGRID,ANALY_GLASGOW_SL7,UKI-SCOTGRID-GLASGOW,ANALY_LANCS_SL7,ANALY_FZU"
+
+echo pathena $EXCLUDE --trf "$CMD" $ADDITIONAL --inOutDsJson inOutDs.json
+pathena $EXCLUDE --trf "$CMD" $ADDITIONAL --inOutDsJson inOutDs.json
+
+rm inOutDs.json
diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.cxx
index 21dca7a010edd475ab54ddd2d7605c879fe64772..35485e43128fee2f8458432d8b4efd31ac2c11bc 100644
--- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.cxx
+++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -20,9 +20,11 @@ using namespace RadDam;
 
 PixelDiodeCrossTalkGenerator::PixelDiodeCrossTalkGenerator(const std::string& type, const std::string& name,const IInterface* parent):
   PixelProcessorTool(type,name,parent),
-  m_diodeCrossTalk(.06)
+  m_diodeCrossTalk(.06),
+  m_diodeCrossTalkIBL(.30)
 {  
   declareProperty("DiodeCrossTalk",m_diodeCrossTalk,"Diode cross talk factor");
+  declareProperty("DiodeCrossTalkIBL",m_diodeCrossTalkIBL,"Diode cross talk factor");
 }
 
 PixelDiodeCrossTalkGenerator::~PixelDiodeCrossTalkGenerator() {}
@@ -47,6 +49,9 @@ void PixelDiodeCrossTalkGenerator::process(SiChargedDiodeCollection &collection)
   const PixelModuleDesign *p_design= static_cast<const PixelModuleDesign *>(&(collection.design()));
   if (!p_design) return;
 
+  double xsecFactor = m_diodeCrossTalk;
+  if (p_design->getReadoutTechnology()==InDetDD::PixelModuleDesign::FEI4) { xsecFactor = m_diodeCrossTalkIBL; }
+
   // create a local copy of the current collection
   // (cross-talk must be added only to the current SiChargedDiodes)
   // -ME fix- std::map<Identifier32,SiChargedDiode> oldChargedDiodes=collection.chargedDiodes();
@@ -86,7 +91,7 @@ void PixelDiodeCrossTalkGenerator::process(SiChargedDiodeCollection &collection)
         //
         const SiChargedDiode & chargedDiode = (*p_chargedDiode).second;
 
-        SiCharge charge(chargedDiode.charge()*intersection*m_diodeCrossTalk, chargedDiode.totalCharge().time(), SiCharge::diodeX_Talk, chargedDiode.totalCharge().particleLink());
+        SiCharge charge(chargedDiode.charge()*intersection*xsecFactor, chargedDiode.totalCharge().time(), SiCharge::diodeX_Talk, chargedDiode.totalCharge().particleLink());
         // add this new charge
         collection.add(*p_neighbour,charge);
       }
diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.h b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.h
index 76b9fbcfad40dff80dc049f32b2f4906e198ba02..d34d0c7ece6114b80e95e24071c1b3c25e9ff30e 100644
--- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.h
+++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelDiodeCrossTalkGenerator.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -30,6 +30,7 @@ class PixelDiodeCrossTalkGenerator:public PixelProcessorTool {
     PixelDiodeCrossTalkGenerator();
 
     double m_diodeCrossTalk; 
+    double m_diodeCrossTalkIBL; 
 };
 }
 
diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.cxx
index e1942eff29a80aedc5ff4b2ec47755dee75fad82..740025a272eec65ab117c8469bc4c10d089fc0fb 100644
--- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.cxx
+++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -264,7 +264,7 @@ StatusCode SensorSimPlanarTool::initialize() {
             m_voltage_layers.push_back(m_voltage2);
         }else{
             ATH_MSG_WARNING("m_fluence could not match becnhmark value but interpolation not indicated.");
-            return StatusCode::FAILURE; 
+            return StatusCode::SUCCESS;
         }
     }else{
         if(!doInterpolateEfield){
@@ -376,6 +376,12 @@ StatusCode SensorSimPlanarTool::initialize() {
     distanceMap_h[Layer]=distanceMap_h_hold;
     timeMap_e[Layer]=timeMap_e_hold;
     timeMap_h[Layer]=timeMap_h_hold;
+    
+    // Define necessary variables to describe hists stored in ramoPotentialMap
+    // to skip calling FindBin during induceCharge for speed reasons
+    ramo_x_binMap[Layer] = 1000. * (ramoPotentialMap[Layer]->GetNbinsX() / (ramoPotentialMap[Layer]->GetXaxis()->GetXmax() - ramoPotentialMap[Layer]->GetXaxis()->GetXmin()));
+    ramo_y_binMap[Layer] = 1000. * (ramoPotentialMap[Layer]->GetNbinsY() / (ramoPotentialMap[Layer]->GetYaxis()->GetXmax() - ramoPotentialMap[Layer]->GetYaxis()->GetXmin()));
+    ramo_z_binMap[Layer] = 1000. * (ramoPotentialMap[Layer]->GetNbinsZ() / (ramoPotentialMap[Layer]->GetZaxis()->GetXmax() - ramoPotentialMap[Layer]->GetZaxis()->GetXmin()));
   }
   return StatusCode::SUCCESS;
 }
@@ -482,8 +488,6 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC
     }
 
     SiLocalPosition centreOfPixel_i;
-    double pixelEta_i = 0.;
-    double pixelPhi_i =0.;
 
     int nnLoop_pixelEtaMax =0; 
     int nnLoop_pixelEtaMin=0; 
@@ -499,21 +503,17 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC
     if (m_doRadDamage && m_fluence>0 && !(Module.isDBM()) && isBarrel) {
         centreOfPixel_i = p_design.positionFromColumnRow(pixel_i.etaIndex(), pixel_i.phiIndex());
 
-        //Find the displacment of the charge carriers from the centre of the pixel in +ve quadrant
-        pixelEta_i =  eta_i - centreOfPixel_i.xEta();
-        pixelPhi_i =  phi_i - centreOfPixel_i.xPhi();
-        
-	//Make limits for NN loop
-        nnLoop_pixelEtaMax = std::min( 2,pixel_i.etaIndex() );
-        nnLoop_pixelEtaMin = std::max( -2, pixel_i.etaIndex() + 1 - etaCells );
-	
-        nnLoop_pixelPhiMax = std::min( 2,pixel_i.phiIndex() );
-        nnLoop_pixelPhiMin = std::max( -2, pixel_i.phiIndex() + 1 - phiCells );
-	
-	//Setup values to check for overflow when using maps
-	numBins_driftTime_e = distanceMap_e[Layer]->GetNbinsY(); //Returns nBins = totalBins - underflow - overflow 
-	numBins_driftTime_h = distanceMap_h[Layer]->GetNbinsY();   
-	
+        //Make limits for NN loop
+        nnLoop_pixelEtaMax = std::min( 1,pixel_i.etaIndex() );
+        nnLoop_pixelEtaMin = std::max( -1, pixel_i.etaIndex() + 1 - etaCells );
+
+        nnLoop_pixelPhiMax = std::min( 1,pixel_i.phiIndex() );
+        nnLoop_pixelPhiMin = std::max( -1, pixel_i.phiIndex() + 1 - phiCells );
+
+        //Setup values to check for overflow when using maps
+        numBins_driftTime_e = distanceMap_e[Layer]->GetNbinsY(); //Returns nBins = totalBins - underflow - overflow 
+        numBins_driftTime_h = distanceMap_h[Layer]->GetNbinsY();   
+
         numBins_weightingPotential_x = ramoPotentialMap[Layer]->GetNbinsX();
         numBins_weightingPotential_y = ramoPotentialMap[Layer]->GetNbinsY();
         numBins_weightingPotential_z = ramoPotentialMap[Layer]->GetNbinsZ();        
@@ -535,41 +535,41 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC
     double energy_per_step = 1.0*iHitRecord.second/1.E+6/ncharges;
 
     // scale factors accounting for different pixel sizes
-    double scale_i=1., scale_f_e=1., scale_f_h=1.;
+    double scale_f_e=1., scale_f_h=1.;
     double columnWidth=p_design.widthFromColumnRange(pixel_i.etaIndex(),pixel_i.etaIndex());
 
 
-     if (abs(columnWidth-0.6)<1e-9){scale_i = 4./6.; scale_f_e = 4./6.; scale_f_h = 4./6.;}
-else if (abs(columnWidth-0.45)<1e-9){scale_i = 25./45.; scale_f_e = 25./45.; scale_f_h = 25./45.;}
-else if (abs(columnWidth-0.05)<1e-9){scale_i = 1.; scale_f_e = 1.; scale_f_h = 1.;}
-else if (abs(columnWidth-0.5)<1e-9){scale_i = 25./50.; scale_f_e = 25./50.; scale_f_h = 25./50.;}
+    if (std::abs(columnWidth-0.6)<1e-9){scale_f_e = 4./6.; scale_f_h = 4./6.;}
+    else if (std::abs(columnWidth-0.45)<1e-9){scale_f_e = 25./45.; scale_f_h = 25./45.;}
+    else if (std::abs(columnWidth-0.05)<1e-9){scale_f_e = 1.; scale_f_h = 1.;}
+    else if (std::abs(columnWidth-0.5)<1e-9){scale_f_e = 25./50.; scale_f_h = 25./50.;}
 
     //Loop over charge-carrier pairs
     for(int j=0 ; j<ncharges ; j++) {
 
-    if( m_doRadDamage && m_fluence>0 && !(Module.isDBM()) && isBarrel){
+      if( m_doRadDamage && m_fluence>0 && !(Module.isDBM()) && isBarrel){
         double u = CLHEP::RandFlat::shoot(0.,1.);
         double drifttime_e = (-1.)*m_trappingTimeElectrons*TMath::Log(u); //ns
         u = CLHEP::RandFlat::shoot(0.,1.);
         double drifttime_h = (-1.)*m_trappingTimeHoles*TMath::Log(u); //ns
 
-	//Now, need the z-position at the trap.
+        //Now, need the z-position at the trap.
         int nbin_z_e_xbin = distanceMap_e[Layer]->GetXaxis()->FindBin(dist_electrode);
         int nbin_z_e_ybin = distanceMap_e[Layer]->GetYaxis()->FindBin(drifttime_e);
         if (nbin_z_e_ybin >  numBins_driftTime_e  ) nbin_z_e_ybin = numBins_driftTime_e;
         double depth_f_e = distanceMap_e[Layer]->GetBinContent( nbin_z_e_xbin,nbin_z_e_ybin );
-        double dz_e = fabs(dist_electrode - depth_f_e); 
-        
-	//TODO: the holes map does not currently extend for a drift time long enough that, any hole will reach
-	//the corresponding electrode. This needs to be rectified by either (a) extrapolating the current map or
-	//(b) making a new map with a y-axis (drift time) that extends to at least 18 ns so all charge carriers reach electrode.
-	//However, if choose (b), will need to reduce granularity of map. 
+        double dz_e = std::abs(dist_electrode - depth_f_e); 
+
+        //TODO: the holes map does not currently extend for a drift time long enough that, any hole will reach
+        //the corresponding electrode. This needs to be rectified by either (a) extrapolating the current map or
+        //(b) making a new map with a y-axis (drift time) that extends to at least 18 ns so all charge carriers reach electrode.
+        //However, if choose (b), will need to reduce granularity of map. 
         int nbin_z_h_xbin = distanceMap_h[Layer]->GetXaxis()->FindBin(dist_electrode);
         int nbin_z_h_ybin = distanceMap_h[Layer]->GetYaxis()->FindBin(drifttime_h);
         if (nbin_z_h_ybin >  numBins_driftTime_h  )
-        nbin_z_h_ybin = numBins_driftTime_h;
+          nbin_z_h_ybin = numBins_driftTime_h;
         double depth_f_h = distanceMap_h[Layer]->GetBinContent( nbin_z_h_xbin,nbin_z_h_ybin );
-        double dz_h = fabs(depth_f_h - dist_electrode);           
+        double dz_h = std::abs(depth_f_h - dist_electrode);           
 
         //Apply drift due to Lorentz force and diffusion
         double phiRand = CLHEP::RandGaussZiggurat::shoot(m_rndmEngine);
@@ -579,7 +579,7 @@ else if (abs(columnWidth-0.5)<1e-9){scale_i = 25./50.; scale_f_e = 25./50.; scal
         coLorentz=sqrt(1+pow(tanLorentz,2));
 
         //Apply diffusion. rdif is teh max. diffusion
-        double rdif_e=this->m_diffusionConstant*sqrt( fabs(dist_electrode - depth_f_e)*coLorentz/0.3);
+        double rdif_e=this->m_diffusionConstant*sqrt( std::abs(dist_electrode - depth_f_e)*coLorentz/0.3);
         double phi_f_e=phi_i + dz_e*tanLorentz + rdif_e*phiRand;
         double etaRand = CLHEP::RandGaussZiggurat::shoot(m_rndmEngine);
         double eta_f_e=eta_i + rdif_e*etaRand;
@@ -590,7 +590,7 @@ else if (abs(columnWidth-0.5)<1e-9){scale_i = 25./50.; scale_f_e = 25./50.; scal
         tanLorentz = lorentzMap_h[Layer]->GetBinContent(nbin_Lorentz_h);       
         coLorentz=sqrt(1+pow(tanLorentz,2));
 
-        double rdif_h=this->m_diffusionConstant*sqrt( fabs(dist_electrode - depth_f_h)*coLorentz/0.3);
+        double rdif_h=this->m_diffusionConstant*sqrt( std::abs(dist_electrode - depth_f_h)*coLorentz/0.3);
 
         double phi_f_h=phi_i + dz_h*tanLorentz + rdif_h*phiRand;
         etaRand = CLHEP::RandGaussZiggurat::shoot(m_rndmEngine);
@@ -598,108 +598,155 @@ else if (abs(columnWidth-0.5)<1e-9){scale_i = 25./50.; scale_f_e = 25./50.; scal
 
         // Slim Edge for IBL planar sensors:
         if ( p_design.getReadoutTechnology()==InDetDD::PixelModuleDesign::FEI4) {
-            CHECK( applySlimEdges( energy_per_step, eta_f_e ) );
-            CHECK( applySlimEdges( energy_per_step, eta_f_h ) );
+          CHECK( applySlimEdges( energy_per_step, eta_f_e ) );
+          CHECK( applySlimEdges( energy_per_step, eta_f_h ) );
+        }
+        
+        int nbin_ramo_f_e_z;
+        int nbin_ramo_f_h_z;
+        // distinction necessary because of min(z) = -0.5
+        if (Layer.second != 0){
+            nbin_ramo_f_e_z = int( 1.5 + depth_f_e * ramo_z_binMap[Layer] );
+            nbin_ramo_f_h_z = int( 1.5 + depth_f_h * ramo_z_binMap[Layer] );
+        }
+        else {
+          nbin_ramo_f_e_z = int( 1 + depth_f_e * ramo_z_binMap[Layer] );
+          nbin_ramo_f_h_z = int( 1 + depth_f_h * ramo_z_binMap[Layer] );
         }
-   
+
+        // Check for overflow in ramo hists in z-direction
+        if (nbin_ramo_f_h_z > numBins_weightingPotential_z){ nbin_ramo_f_h_z = numBins_weightingPotential_z + 1; }
+        if (nbin_ramo_f_e_z > numBins_weightingPotential_z){ nbin_ramo_f_e_z = numBins_weightingPotential_z + 1; }
+
+        bool doRamoE = true;
+        if(ramoPotentialMap[Layer]->GetZaxis()->FindBin(depth_f_e*1000) ==  1) doRamoE = false;
+
+        bool doRamoH = true;
+        if( std::abs(depth_f_h-sensorThickness) < 0.001 ) doRamoH = false;
+        
+        double induced_sumcharge = 0.0;
+
         //Loop over nearest neighbours in x and y
         //We assume that the lateral diffusion is minimal
         for (int p=nnLoop_pixelEtaMin; p<=nnLoop_pixelEtaMax; p++){ 
-            for (int q=nnLoop_pixelPhiMin; q<=nnLoop_pixelPhiMax; q++){
-
-              //Since both e-h charge carriers start in the same place, they have the same initial ramo value       
-              //Centre of nearest neighbour (nn) pixel
-              SiLocalPosition centreOfPixel_nn = p_design.positionFromColumnRow( pixel_i.etaIndex() - p, pixel_i.phiIndex() - q );
-
-              //What is the displacement of the nn pixel from the primary pixel. 
-              //This is to index the correct entry in the Ramo weighting potential map
-              double dPhi_nn_centre = centreOfPixel_nn.xPhi() - centreOfPixel_i.xPhi(); //in mm
-              double dEta_nn_centre = centreOfPixel_nn.xEta() - centreOfPixel_i.xEta(); //in mm
-
-              //Find weighting potential in initial position. This all has to be done relative to the (0,0) position since the 
-              //Ramo weighting potential is only mapped out for 1/8th of a pixel. Much of this logic is reflecting the charge
-              //carrier across the boundaries.
-              double dEta_i_e = pixelEta_i - dEta_nn_centre;
-              double dPhi_i_e = pixelPhi_i - dPhi_nn_centre;
-
-              dEta_i_e*=scale_i;
-
-              int nbin_ramo_i_x = ramoPotentialMap[Layer]->GetXaxis()->FindBin( fabs( dPhi_i_e )*1000. );
-              int nbin_ramo_i_y = ramoPotentialMap[Layer]->GetYaxis()->FindBin( fabs( dEta_i_e )*1000. );
-              int nbin_ramo_i_z = ramoPotentialMap[Layer]->GetZaxis()->FindBin( dist_electrode*1000 );
-              //int nbin_ramo_i = ramoPotentialMap[0]->FindBin( fabs( dEta_i_e )*1000. , fabs( dPhi_i_e )*1000., dist_electrode*1000);
-             
-	      //Boundary check on maps
-              double ramo_i=0.;
-              if( nbin_ramo_i_x <= numBins_weightingPotential_x && nbin_ramo_i_y <= numBins_weightingPotential_y && nbin_ramo_i_z <=numBins_weightingPotential_z ){
-               ramo_i =ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_i_x,nbin_ramo_i_y,nbin_ramo_i_z );
-              }     	
-              //Find the displacment of the charge carriers from the centre of the pixel in +ve quadrant
-              double pixelEta_f_e = eta_f_e - centreOfPixel_i.xEta() ;
-              double pixelPhi_f_e = phi_f_e - centreOfPixel_i.xPhi() ;
-        
-              double pixelEta_f_h = eta_f_h - centreOfPixel_i.xEta() ;
-              double pixelPhi_f_h = phi_f_h - centreOfPixel_i.xPhi() ;
-	      
-	      //Final position of charge carriers wrt nn centre
-	          double dEta_f_e = pixelEta_f_e  - dEta_nn_centre ;
-              double dPhi_f_e = pixelPhi_f_e  - dPhi_nn_centre ;
-
-              dEta_f_e*=scale_f_e;
-
-              int nbin_ramo_f_e_x = ramoPotentialMap[Layer]->GetXaxis()->FindBin( fabs( dPhi_f_e )*1000. );
-              int nbin_ramo_f_e_y = ramoPotentialMap[Layer]->GetYaxis()->FindBin( fabs( dEta_f_e )*1000. );
-              int nbin_ramo_f_e_z = ramoPotentialMap[Layer]->GetZaxis()->FindBin( depth_f_e*1000 );
-              //int nbin_ramo_f_e = ramoPotentialMap[0]->FindBin( fabs( dEta_f_e )*1000. , fabs( dPhi_f_e )*1000., depth_f_e*1000);
-              double ramo_f_e=0.;
-              if( nbin_ramo_f_e_x <= numBins_weightingPotential_x && nbin_ramo_f_e_y <= numBins_weightingPotential_y && nbin_ramo_f_e_z <=numBins_weightingPotential_z ){
-               ramo_f_e =ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_f_e_x,nbin_ramo_f_e_y,nbin_ramo_f_e_z );
-              }   
-
-              double dEta_f_h = pixelEta_f_h - dEta_nn_centre ;
-              double dPhi_f_h = pixelPhi_f_h - dPhi_nn_centre ;
-              
-              dEta_f_h*=scale_f_h;
-              
-              int nbin_ramo_f_h_x = ramoPotentialMap[Layer]->GetXaxis()->FindBin( fabs( dPhi_f_h )*1000. );
-              int nbin_ramo_f_h_y = ramoPotentialMap[Layer]->GetYaxis()->FindBin( fabs( dEta_f_h )*1000. );
-              int nbin_ramo_f_h_z = ramoPotentialMap[Layer]->GetZaxis()->FindBin( depth_f_h*1000 );
-	      //int nbin_ramo_f_h = ramoPotentialMap->FindBin( fabs( dEta_f_h )*1000. , fabs( dPhi_f_h )*1000., depth_f_h*1000);
-              //Boundary check on maps
-              double ramo_f_h=0.;
-              if( nbin_ramo_f_h_x <= numBins_weightingPotential_x && nbin_ramo_f_h_y <= numBins_weightingPotential_y && nbin_ramo_f_h_z <=numBins_weightingPotential_z ){
+          for (int q=nnLoop_pixelPhiMin; q<=nnLoop_pixelPhiMax; q++){
+
+            //Since both e-h charge carriers start in the same place, they have the same initial ramo value
+           //Centre of nearest neighbour (nn) pixel
+           SiLocalPosition centreOfPixel_nn = p_design.positionFromColumnRow( pixel_i.etaIndex() - p, pixel_i.phiIndex() - q );
+
+           //What is the displacement of the nn pixel from the primary pixel.
+           //This is to index the correct entry in the Ramo weighting potential map
+           double dPhi_nn_centre = centreOfPixel_nn.xPhi() - centreOfPixel_i.xPhi(); //in mm
+           double dEta_nn_centre = centreOfPixel_nn.xEta() - centreOfPixel_i.xEta(); //in mm
+           double pixelEta_f_e = eta_f_e - centreOfPixel_i.xEta() ;
+           double pixelPhi_f_e = phi_f_e - centreOfPixel_i.xPhi() ;
+           //Final position of charge carriers wrt nn centre
+           double dEta_f_e = pixelEta_f_e  - dEta_nn_centre ;
+           double dPhi_f_e = pixelPhi_f_e  - dPhi_nn_centre ;
+
+           dEta_f_e*=scale_f_e;
+
+           double ramo_f_e=0.;
+           if(doRamoE){
+
+             int nbin_ramo_f_e_x = int( 1 + std::abs( dPhi_f_e ) * ramo_x_binMap[Layer] );
+             int nbin_ramo_f_e_y = int( 1 + std::abs( dEta_f_e ) * ramo_y_binMap[Layer] );
+
+             // Check for overflow in ramo hists in x- and y-direction
+             if (nbin_ramo_f_e_x > numBins_weightingPotential_x){ 
+                 nbin_ramo_f_e_x = numBins_weightingPotential_x + 1;
+             }
+             if (nbin_ramo_f_e_y > numBins_weightingPotential_y){
+                 nbin_ramo_f_e_y = numBins_weightingPotential_y + 1;
+             }
+
+             if( nbin_ramo_f_e_x <= numBins_weightingPotential_x && nbin_ramo_f_e_y <= numBins_weightingPotential_y && nbin_ramo_f_e_z <=numBins_weightingPotential_z ){
+              ramo_f_e =ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_f_e_x,nbin_ramo_f_e_y,nbin_ramo_f_e_z );
+             }
+           }
+           else{
+             if (std::abs(dEta_f_e)<Module.etaPitch()/2.  && std::abs(dPhi_f_e)<Module.phiPitch()/2.) ramo_f_e=1.;
+           }
+
+           double ramo_f_h=0;
+           if(doRamoH){
+             double pixelEta_f_h = eta_f_h - centreOfPixel_i.xEta() ;
+             double pixelPhi_f_h = phi_f_h - centreOfPixel_i.xPhi() ;
+             double dEta_f_h = pixelEta_f_h - dEta_nn_centre ;
+             double dPhi_f_h = pixelPhi_f_h - dPhi_nn_centre ;
+
+             dEta_f_h*=scale_f_h;
+
+             int nbin_ramo_f_h_x = int( 1 + std::abs( dPhi_f_h ) * ramo_x_binMap[Layer] );
+             int nbin_ramo_f_h_y = int( 1 + std::abs( dEta_f_h ) * ramo_y_binMap[Layer] );
+
+             // Check for overflow in ramo hists in x- and y-direction
+             if (nbin_ramo_f_h_x > numBins_weightingPotential_x){
+                 nbin_ramo_f_h_x = numBins_weightingPotential_x + 1;
+             }
+             if (nbin_ramo_f_h_y > numBins_weightingPotential_y){
+                 nbin_ramo_f_h_y = numBins_weightingPotential_y + 1;
+             }
+
+             //Boundary check on maps
+             if( nbin_ramo_f_h_x <= numBins_weightingPotential_x && nbin_ramo_f_h_y <= numBins_weightingPotential_y && nbin_ramo_f_h_z <=numBins_weightingPotential_z ){
                ramo_f_h =ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_f_h_x,nbin_ramo_f_h_y,nbin_ramo_f_h_z );
-              } 
-
-              //Account for the imperfect binning that would cause charge to be double-counted
-              if(ramoPotentialMap[Layer]->GetZaxis()->FindBin(depth_f_h*1000) == ramoPotentialMap[Layer]->GetNbinsZ()+1) ramo_f_h=0;//this means the hole has reached the back end  
-              if(ramoPotentialMap[Layer]->GetZaxis()->FindBin(depth_f_e*1000) ==  1){
-                if( fabs(dEta_f_e)>=Module.etaPitch()/2.  || fabs(dPhi_f_e)>=Module.phiPitch()/2. ) ramo_f_e=0;
-                else if (fabs(dEta_f_e)<Module.etaPitch()/2.  && fabs(dPhi_f_e)<Module.phiPitch()/2.  ) ramo_f_e=1.;
-              }
-
-
-              //Given final position of charge carrier, find induced charge. The difference in Ramo weighting potential gives the fraction of charge induced.
-              //The energy_per_step is transformed into charge with the eleholePair per Energy
-              double induced_charge_e = (ramo_f_e - ramo_i) * energy_per_step * eleholePairEnergy;
-              double induced_charge_h = -(ramo_f_h - ramo_i) * energy_per_step * eleholePairEnergy;
-          
-	                  
-              //Collect charge in centre of each pixel, since location within pixel doesn't matter for record
-              SiLocalPosition chargePos = Module.hitLocalToLocal( centreOfPixel_nn.xEta(), centreOfPixel_nn.xPhi() );
-
-              //The following lines are adapted from SiDigitization's Inserter class
-              SiSurfaceCharge scharge_e( chargePos,SiCharge( induced_charge_e,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId())));
-              SiSurfaceCharge scharge_h( chargePos,SiCharge( induced_charge_h,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId())));
-              SiCellId diode = Module.cellIdOfPosition(scharge_e.position());
-              SiCharge charge_e = scharge_e.charge();
-              SiCharge charge_h = scharge_h.charge();
-              if (diode.isValid()) {
-                chargedDiodes.add(diode,charge_e);
-                chargedDiodes.add(diode,charge_h);
-              } //IF
-            } //For q
+             }
+           }
+
+           //Given final position of charge carrier, find induced charge. The difference in Ramo weighting potential gives the fraction of charge induced.
+           //The energy_per_step is transformed into charge with the eleholePair per Energy
+           double induced_charge = (ramo_f_e - ramo_f_h) * energy_per_step * eleholePairEnergy;
+           
+           induced_sumcharge += induced_charge;
+
+           //Collect charge in centre of each pixel, since location within pixel doesn't matter for record
+           SiLocalPosition chargePos = Module.hitLocalToLocal( centreOfPixel_nn.xEta(), centreOfPixel_nn.xPhi() );
+
+           //The following lines are adapted from SiDigitization's Inserter class
+           SiSurfaceCharge scharge( chargePos,SiCharge( induced_charge,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId())));
+           SiCellId diode = Module.cellIdOfPosition(scharge.position());
+           SiCharge charge = scharge.charge();
+           if (diode.isValid()) {
+             chargedDiodes.add(diode,charge);
+            } //IF
+          } //For q
         } //for p
+
+        if (induced_sumcharge==0.0) {
+          double rdif=this->m_diffusionConstant*sqrt(dist_electrode*coLorentz/0.3);
+          // position at the surface
+          double phiRand = CLHEP::RandGaussZiggurat::shoot(m_rndmEngine);
+          double phi_drifted=phi_i+dist_electrode*tanLorentz+rdif*phiRand;
+          double etaRand = CLHEP::RandGaussZiggurat::shoot(m_rndmEngine);
+          double eta_drifted=eta_i+rdif*etaRand;
+
+          // Slim Edge for IBL planar sensors:
+          if ( !(Module.isDBM()) && p_design.getReadoutTechnology()==InDetDD::PixelModuleDesign::FEI4) {
+            CHECK( applySlimEdges( energy_per_step, eta_drifted ) );
+          }
+          SiLocalPosition chargePos = Module.hitLocalToLocal(eta_drifted, phi_drifted);
+
+          // The parametrization of the sensor efficiency
+          double ed = 0;
+          if (Module.isDBM()){
+            ed=energy_per_step*eleholePairEnergy*nontrappingProbability*smearScale;
+          }
+          else {
+            ed=energy_per_step*eleholePairEnergy;
+          }
+
+          //The following lines are adapted from SiDigitization's Inserter class
+          SiSurfaceCharge scharge(chargePos,SiCharge(ed,hitTime(phit),SiCharge::track,HepMcParticleLink(phit->trackNumber(),phit.eventId())));
+          SiCellId diode = Module.cellIdOfPosition(scharge.position());
+          SiCharge charge = scharge.charge();
+
+          if (diode.isValid()) {
+            chargedDiodes.add(diode,charge);
+          }
+        }
+
       }else { //If no radDamage, run original
         
 	      double rdif=this->m_diffusionConstant*sqrt(dist_electrode*coLorentz/0.3);
@@ -743,8 +790,8 @@ else if (abs(columnWidth-0.5)<1e-9){scale_i = 25./50.; scale_f_e = 25./50.; scal
 
 StatusCode SensorSimPlanarTool::applySlimEdges( double &energy_per_step, double &eta_drifted){
 
-        if(fabs(eta_drifted) > 20.440)energy_per_step=0.;
-        if(fabs(eta_drifted)< 20.440 && fabs(eta_drifted)> 20.200){
+        if(std::abs(eta_drifted) > 20.440)energy_per_step=0.;
+        if(std::abs(eta_drifted)< 20.440 && std::abs(eta_drifted)> 20.200){
           if(eta_drifted>0){
             energy_per_step=energy_per_step*(68.13-eta_drifted*3.333);            
             eta_drifted = eta_drifted - 0.250;
@@ -753,7 +800,7 @@ StatusCode SensorSimPlanarTool::applySlimEdges( double &energy_per_step, double
             eta_drifted = eta_drifted + 0.250;
           }  
         }
-        if(fabs(eta_drifted)< 20.200 && fabs(eta_drifted)> 20.100){
+        if(std::abs(eta_drifted)< 20.200 && std::abs(eta_drifted)> 20.100){
           if(eta_drifted>0){
             energy_per_step=energy_per_step*(41.2-eta_drifted*2.);             
             eta_drifted = eta_drifted - 0.250;
diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.h b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.h
index 5d0b70196ea7093a94af06d3d648ee87c0c2e45c..a1e7420994cd4bd92cd956aca0db3178cef4fe39 100644
--- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.h
+++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/SensorSimPlanarTool.h
@@ -49,6 +49,10 @@ class SensorSimPlanarTool : public SensorSimTool {
     std::map<std::pair<int, int>, TH1F*> timeMap_h;
     std::map<std::pair<int, int>, TH2F*> lorentzMap_e;
     std::map<std::pair<int, int>, TH2F*> lorentzMap_h;
+    // map to directly get factor to calculate bin instead of calling FindBin
+    std::map<std::pair<int, int>, double> ramo_x_binMap;
+    std::map<std::pair<int, int>, double> ramo_y_binMap;
+    std::map<std::pair<int, int>, double> ramo_z_binMap;
 
     ToolHandle<RadDamageUtil>                     m_radDamageUtil;
   
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py
index 2e1106e9c1fc21d86199bc7776e9bd70dd8a7213..00bdc439d5f7a6b987c42d94016482b435e3ebd6 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py
@@ -656,10 +656,24 @@ IDTRKVALIDStream.AddItem("xAOD::EventAuxInfo#*")
 IDTRKVALIDStream.AddItem("xAOD::TrackParticleContainer#InDetTrackParticles")
 IDTRKVALIDStream.AddItem("xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux."+excludedAuxData)
 
+if InDetFlags.doLowPtRoI:
+    IDTRKVALIDStream.AddItem("xAOD::TrackParticleContainer#LowPtRoITrackParticles")
+    IDTRKVALIDStream.AddItem("xAOD::TrackParticleAuxContainer#LowPtRoITrackParticlesAux."+excludedAuxData)
+    IDTRKVALIDStream.AddItem("xAOD::VertexContainer#LowPtRoIVertexContainer")
+    IDTRKVALIDStream.AddItem("xAOD::VertexAuxContainer#LowPtRoIVertexContainerAux."+excludedAuxData)
+
 if InDetFlags.doStoreTrackSeeds():
    IDTRKVALIDStream.AddItem('xAOD::TrackParticleContainer#'+InDetKeys.SiSPSeedSegments()+"TrackParticle")
    IDTRKVALIDStream.AddItem('xAOD::TrackParticleAuxContainer#'+InDetKeys.SiSPSeedSegments()+"TrackParticle"+'Aux.' + excludedAuxData)
 
+if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI:
+   IDTRKVALIDStream.AddItem('xAOD::TrackParticleContainer#'+InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle")
+   IDTRKVALIDStream.AddItem('xAOD::TrackParticleAuxContainer#'+InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"+'Aux.' + excludedAuxData)
+
+if InDetFlags.doStoreTrackCandidates() and InDetFlags.doLowPtRoI:
+   IDTRKVALIDStream.AddItem('xAOD::TrackParticleContainer#'+InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle")
+   IDTRKVALIDStream.AddItem('xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"+'Aux.' + excludedAuxData)
+
 if InDetFlags.doStoreTrackCandidates():
    IDTRKVALIDStream.AddItem('xAOD::TrackParticleContainer#'+InDetKeys.xAODSiSPTrackCandidates()+"TrackParticle")
    IDTRKVALIDStream.AddItem('xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODSiSPTrackCandidates()+"TrackParticle"+'Aux.' + excludedAuxData)
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py b/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py
index 45284ed3ef3e0a9b8a408901257cf12fb44b0a4b..d6a5bdd82ad9ac7c7018e1f90f92b35eae250ae9 100755
--- a/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py
@@ -213,7 +213,10 @@ class ConfiguredNewTrackingCuts :
     if self.__indetflags.cutLevel() >= 15 :
       self.__minClusters             = 8 #based on studies by R.Jansky     
 
-    if self.__indetflags.cutLevel() >= 16:
+    if self.__indetflags.cutLevel() >= 16 :
+      self.__maxPrimaryImpact        = 5.0 * Units.mm #based on studies by T.Strebler
+
+    if self.__indetflags.cutLevel() >= 17:
       print '--------> FATAL ERROR, cut level undefined, abort !'
       import sys
       sys.exit()
@@ -384,6 +387,36 @@ class ConfiguredNewTrackingCuts :
       self.__seedFilterLevel   = 1
       self.__maxTracksPerSharedPRD = 2
 
+    # --- mode for high-d0 tracks (re-optimisation for Run 3 by M.Danninger)
+    if mode == "R3LargeD0":
+      self.__extension          = "R3LargeD0" # this runs parallel to NewTracking                             
+      self.__maxPT              = 1.0 * Units.TeV
+      self.__minPT              = 1.0 * Units.GeV                                                                                    
+      self.__maxEta             = 3                                                                                                        
+      self.__maxPrimaryImpact   = 300.0 * Units.mm
+      self.__maxZImpact         = 750 * Units.mm    
+      self.__maxSecondaryImpact = 300.0 * Units.mm  
+      self.__minSecondaryPt     = 1000.0 * Units.MeV 
+      self.__minClusters        = 8                  
+      self.__minSiNotShared     = 6                 
+      self.__maxShared          = 2   # cut is now on number of shared modules                                                                                  
+      self.__minPixel           = 0
+      self.__maxHoles           = 2
+      self.__maxPixelHoles      = 1
+      self.__maxSctHoles        = 1  
+      self.__maxDoubleHoles     = 0  
+      self.__radMax             = 600. * Units.mm
+      self.__nHolesMax          = self.__maxHoles
+      self.__nHolesGapMax       = 1 
+      self.__seedFilterLevel    = 1  
+      self.__maxTracksPerSharedPRD   = 2
+      self.__Xi2max                  = 9.0  
+      self.__Xi2maxNoAdd             = 25.0 
+      self.__roadWidth               = 10. 
+      self.__nWeightedClustersMin    = 8   
+      self.__maxdImpactSSSSeeds      = 300.0
+      self.__doZBoundary             = True
+
     # --- mode for high-d0 tracks down to 100 MeV (minPT, minClusters, minSecondaryPt cuts loosened to MinBias level)
     if mode == "LowPtLargeD0": 
       self.__extension          = "LowPtLargeD0" # this runs parallel to NewTracking
@@ -441,7 +474,7 @@ class ConfiguredNewTrackingCuts :
       self.__minClusters      = 5
       self.__minSiNotShared   = 4
       self.__maxShared        = 1   # cut is now on number of shared modules
-      self.__minPixel         = 2   # At least one pixel hit for low-pt (ass seeded on pixels!)                
+      self.__minPixel         = 2   # At least two pixel hit for low-pt (association seeded on pixels!)                
       self.__maxHoles         = 2
       self.__maxPixelHoles    = 1
       self.__maxSctHoles      = 2
@@ -454,6 +487,23 @@ class ConfiguredNewTrackingCuts :
         self.__maxPT            = 1000000 * Units.GeV # Won't accept None *NEEDS FIXING*
         self.__maxPrimaryImpact = 100.0 * Units.mm
 
+    # --- change defaults for low pt tracking within selected roi
+    if mode == "LowPtRoI":
+      self.__extension        = "LowPtRoI" # this runs parallel to NewTracking
+      self.__minPT            = 0.050 * Units.GeV
+      self.__maxPT            = self.__minPT + 0.8 * Units.GeV # some overlap
+      self.__minClusters      = 5
+      self.__minSiNotShared   = 4
+      self.__maxShared        = 1   # cut is now on number of shared modules
+      self.__minPixel         = 2   # At least two pixel hit for low-pt (association seeded on pixels!)                
+      self.__maxHoles         = 2
+      self.__maxPixelHoles    = 1
+      self.__maxSctHoles      = 2
+      self.__maxDoubleHoles   = 1
+      self.__radMax           = 600. * Units.mm
+      self.__nHolesMax        = self.__maxHoles
+      self.__nHolesGapMax     = self.__maxHoles # not as tight as 2*maxDoubleHoles
+
     if mode == "ROIConv":
       self.__extension        = "ROIConv" # this runs parallel to NewTracking
       self.__minPT                   = .9 * Units.GeV
@@ -477,7 +527,7 @@ class ConfiguredNewTrackingCuts :
       self.__minClusters      = 3
       self.__minSiNotShared   = 3
       self.__maxShared        = 1   # cut is now on number of shared modules
-      self.__minPixel         = 3   # At least one pixel hit for low-pt (ass seeded on pixels!)                
+      self.__minPixel         = 3   # At least three pixel hit for low-pt (association seeded on pixels!)                
       self.__maxHoles         = 1
       self.__maxPixelHoles    = 1
       self.__maxSctHoles      = 1
@@ -1097,6 +1147,8 @@ class ConfiguredNewTrackingCuts :
     print '* max eta                     :  ', self.__maxEta
     if self.__mode=="LowPt":
       print '* max PT                      :  ', self.__maxPT, ' MeV'
+    if self.__mode=="LowPtRoI":
+      print '* max PT                      :  ', self.__maxPT, ' MeV'
     print '*'
     print '* NewTracking cuts:'
     print '* -----------------'
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
index 716f87dbe7a29e85af589450cb4e34a599f55f11..1154d5b9792352686ab62a9e7ac291f53ca3f6db 100644
--- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
@@ -271,6 +271,34 @@ class doVeryLowPt(InDetFlagsJobProperty):
     allowedTypes = ['bool']
     StoredValue  = False
 
+class doLowPtRoI(InDetFlagsJobProperty):
+    """Turn running of doLowPtRoI tracking within selected roi second pass on and off"""
+    statusOn     = True
+    allowedTypes = ['bool']
+    StoredValue  = False
+
+class LowPtRoIStrategy(InDetFlagsJobProperty):
+    """Set the strategy to extract the RoI; 1 = with tracks, 2 = with HS Truth, 3 = from file
+    """
+    statusOn     = True
+    allowedTypes = ['int']
+    allowedValues= [1,2,3]
+    StoredValue  = 1
+
+class LowPtRoIWindow(InDetFlagsJobProperty):
+    """The ROI will be plus/minus the value given (in mm), so the total window size will be twice the input value.  Inputting a negative value will run two-pass tracking with a separate container, but without an RoI (i.e. no seeds rejected due to falling outside of RoI).
+    """
+    statusOn     = True
+    allowedTypes = ['float']
+    StoredValue  = 30.0
+
+class LowPtRoIFile(InDetFlagsJobProperty):
+    """Indicate the file (including location) that contains the ROI location information. This MUST be specified if you want to run with file-based ROIs.  Three column format: run number, event number, ROI location (in mm)
+    """
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'None'
+
 class doROIConv(InDetFlagsJobProperty):
     """Turn running of doROIConvFinding second pass on and off"""
     statusOn     = True
@@ -295,6 +323,12 @@ class doLargeD0(InDetFlagsJobProperty):
     allowedTypes = ['bool']
     StoredValue   = False
 
+class doR3LargeD0(InDetFlagsJobProperty):
+    """Turn running of doR3LargeD0 second pass on and off"""
+    statusOn     = True
+    allowedTypes = ['bool']
+    StoredValue   = False
+
 class doDisplacedSoftPion(InDetFlagsJobProperty):
     """Turn running of DisplaceSoftPion second pass down to 100 MeV on and off"""
     statusOn     = True
@@ -313,7 +347,7 @@ class cutLevel(InDetFlagsJobProperty):
     """
     statusOn     = True
     allowedTypes = ['int']
-    allowedValues= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+    allowedValues= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
     StoredValue  = 14
 
 class doBremRecovery(InDetFlagsJobProperty):
@@ -1286,6 +1320,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.doNewTracking          , False)
        self.checkThenSet(self.doLowPt                , False)
        self.checkThenSet(self.doVeryLowPt            , False)
+       self.checkThenSet(self.doLowPtRoI             , False)
        self.checkThenSet(self.doBeamGas              , True )
        self.checkThenSet(self.doBeamHalo             , True )
        self.checkThenSet(self.doParticleCreation     , True )
@@ -1309,6 +1344,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.doNewTracking          , True )
        self.checkThenSet(self.doLowPt                , False)
        self.checkThenSet(self.doVeryLowPt            , False)
+       self.checkThenSet(self.doLowPtRoI             , False)
        self.checkThenSet(self.doBeamGas              , False)
        self.checkThenSet(self.doBeamHalo             , False)
        self.checkThenSet(self.doxKalman              , False)
@@ -1342,6 +1378,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.useZvertexTool         , True )
        self.checkThenSet(self.doLowPt                , False)
        self.checkThenSet(self.doVeryLowPt            , False)
+       self.checkThenSet(self.doLowPtRoI             , False)
        self.checkThenSet(self.doBackTracking         , False)
        self.checkThenSet(self.doTRTStandalone        , False)
        self.checkThenSet(self.doTrackSegmentsPixel   , False)
@@ -1378,6 +1415,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.doNewTracking                     , True )
        self.checkThenSet(self.doLowPt                           , False)
        self.checkThenSet(self.doVeryLowPt                       , False)
+       self.checkThenSet(self.doLowPtRoI                        , False)
        self.checkThenSet(self.doROIConv                         , False)
        self.checkThenSet(self.doBeamGas                         , False)
        self.checkThenSet(self.doBeamHalo                        , False)
@@ -1407,36 +1445,13 @@ class InDetJobProperties(JobPropertyContainer):
     elif (self.doIBL()):
        print "----> InDetJobProperties for IBL"
        print "----> DEPRECATED! This should now be the default settings"
-       #self.checkThenSet(self.doNewTracking          , True )
-       #self.checkThenSet(self.doLowPt                , False)
-       #self.checkThenSet(self.doVeryLowPt            , False)
-       #self.checkThenSet(self.doBeamGas              , False)
-       #self.checkThenSet(self.doBeamHalo             , False)
-       #self.checkThenSet(self.doxKalman              , False)
-       #self.checkThenSet(self.doiPatRec              , False)
-       #self.checkThenSet(self.doBackTracking         , False)
-       #self.checkThenSet(self.doTRTStandalone        , False)
-       #self.checkThenSet(self.doForwardTracks        , False)
-       #self.checkThenSet(self.doVertexFinding        , True)
-       #self.checkThenSet(self.primaryVertexSetup     , "IterativeFinding") 
-       #self.checkThenSet(self.primaryVertexCutSetup  , "IBL") 
-       #self.checkThenSet(self.secondaryVertexCutSetup, "PileUp") 
-       #self.checkThenSet(self.vertexSeedFinder       , "SlidingWindowMultiSeedFinder")
-       #self.checkThenSet(self.doV0Finder             , False)
-       #self.checkThenSet(self.doSimpleV0Finder       , False)      
-       #self.checkThenSet(self.doConversions          , False )        
-       #self.checkThenSet(self.doStatistics           , False) 
-       #self.checkThenSet(self.doTrackSegmentsPixel   , False )
-       #self.checkThenSet(self.doTrackSegmentsSCT     , False )
-       #self.checkThenSet(self.doTrackSegmentsTRT     , False )
-       #self.checkThenSet(self.doSlimming             , False )
-       #self.checkThenSet(self.doSGDeletion           , True )
  
     elif (self.doHighPileup()):
        print "----> InDetJobProperties for high pilep"
        self.checkThenSet(self.doNewTracking          , True )
        self.checkThenSet(self.doLowPt                , False)
        self.checkThenSet(self.doVeryLowPt            , False)
+       self.checkThenSet(self.doLowPtRoI             , False)
        self.checkThenSet(self.doBeamGas              , False)
        self.checkThenSet(self.doBeamHalo             , False)
        self.checkThenSet(self.doxKalman              , False)
@@ -1465,6 +1480,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.doNewTracking          , True )
        self.checkThenSet(self.doLowPt                , False)
        self.checkThenSet(self.doVeryLowPt            , False)
+       self.checkThenSet(self.doLowPtRoI             , False)
        self.checkThenSet(self.doBeamGas              , False)
        self.checkThenSet(self.doBeamHalo             , False)
        self.checkThenSet(self.doxKalman              , False)
@@ -1503,6 +1519,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.doNewTracking          , True )
        self.checkThenSet(self.doLowPt                , False)
        self.checkThenSet(self.doVeryLowPt            , False)
+       self.checkThenSet(self.doLowPtRoI             , False)
        self.checkThenSet(self.doBeamGas              , False)
        self.checkThenSet(self.doBeamHalo             , False)
        self.checkThenSet(self.doxKalman              , False)
@@ -1541,6 +1558,7 @@ class InDetJobProperties(JobPropertyContainer):
        self.checkThenSet(self.doNewTracking          , False )
        self.checkThenSet(self.doLowPt                , False )
        self.checkThenSet(self.doVeryLowPt            , False )
+       self.checkThenSet(self.doLowPtRoI             , False )
        self.checkThenSet(self.doForwardTracks        , False )
        self.checkThenSet(self.doBeamGas              , False )
        self.checkThenSet(self.doBeamHalo             , False )
@@ -1663,6 +1681,7 @@ class InDetJobProperties(JobPropertyContainer):
           # --- run soft tracking, but not low-pt
           self.checkThenSet(self.doLowPt             , True )    
           self.checkThenSet(self.doVeryLowPt         , False )
+          self.checkThenSet(self.doLowPtRoI          , False )    
           # --- disable forward tracklets
           self.checkThenSet(self.doForwardTracks     , False )
           # --- run tracklets
@@ -1760,6 +1779,7 @@ class InDetJobProperties(JobPropertyContainer):
       # --------------------------------------------------------------------      
       # no Large radius tracking if pixel or sct off (new tracking = inside out only)
       self.doLargeD0           = self.doLargeD0() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())
+      self.doR3LargeD0         = self.doR3LargeD0() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())
       self.doLowPtLargeD0      = self.doLowPtLargeD0() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())
       self.doDisplacedSoftPion = self.doDisplacedSoftPion() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())
 
@@ -1790,6 +1810,8 @@ class InDetJobProperties(JobPropertyContainer):
       self.doLowPt       = self.doLowPt() and self.doNewTracking() and ( DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on() ) and not self.doCosmics()
       # no low pt tracking if no new tracking before or if pixels are off (since low-pt tracking is pixel seeded)!      
       self.doVeryLowPt   = self.doVeryLowPt() and self.doLowPt()
+# no low pt roi tracking if no new tracking before or if pixels are off (since low-pt tracking is pixel seeded)!  Explicitly veto for cosmics to aid T0
+      self.doLowPtRoI    = self.doLowPtRoI() and self.doNewTracking() and ( DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on() ) and not self.doCosmics()
       #
       self.doROIConv = self.doROIConv() and self.doSLHC() and self.doNewTracking() and ( DetFlags.haveRIO.pixel_on() and DetFlags.haveRIO.SCT_on() ) and not self.doCosmics()
       # new forward tracklets
@@ -1797,6 +1819,7 @@ class InDetJobProperties(JobPropertyContainer):
       #
       # no Large radius tracking if pixel or sct off (new tracking = inside out only)
       self.doLargeD0 = self.doLargeD0() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())
+
       # no BeamGas tracking if no new tracking before (but only if beamtype is not single beam!)      
       if (jobproperties.Beam.beamType()!="singlebeam"):
         self.doBeamGas     = self.doBeamGas() and self.doNewTracking()
@@ -1808,7 +1831,7 @@ class InDetJobProperties(JobPropertyContainer):
       #
       # control whether to run SiSPSeededTrackFinder
       self.doSiSPSeededTrackFinder = (self.doNewTracking() or self.doNewTrackingSegments() or \
-                                      self.doBeamGas() or self.doLargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() ) \
+                                      self.doBeamGas() or self.doLargeD0() or self.doR3LargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() ) \
                                     and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())      
       # failsafe lines in case requirements are not met to run TRT standalone or back tracking
       self.doTRTStandalone         = self.doTRTStandalone() and DetFlags.haveRIO.TRT_on()
@@ -1997,7 +2020,7 @@ class InDetJobProperties(JobPropertyContainer):
   def doAmbiSolving(self):
     from AthenaCommon.DetFlags import DetFlags
     return (not self.doFastTracking()) and (self.doNewTracking() or self.doBeamGas() or self.doTrackSegmentsPixel() \
-            or self.doTrackSegmentsSCT() or self.doLargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() ) \
+            or self.doTrackSegmentsSCT() or self.doLargeD0() or self.doR3LargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() ) \
            and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on())
   
   def loadRotCreator(self):
@@ -2020,8 +2043,8 @@ class InDetJobProperties(JobPropertyContainer):
 
   def doNewTrackingPattern(self):
     return self.doNewTracking() or self.doBackTracking() or self.doBeamGas() \
-           or self.doLowPt() or self.doVeryLowPt() or self.doTRTStandalone() \
-           or self.doForwardTracks() or self.doLargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion()
+           or self.doLowPt() or self.doVeryLowPt() or self.doLowPtRoI() or self.doTRTStandalone() \
+           or self.doForwardTracks() or self.doLargeD0() or self.doR3LargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion()
 
   def doNewTrackingSegments(self):
     return self.doTrackSegmentsPixel() or self.doTrackSegmentsSCT() or self.doTrackSegmentsTRT()
@@ -2031,12 +2054,12 @@ class InDetJobProperties(JobPropertyContainer):
   
   def doTRTExtension(self):
     from AthenaCommon.DetFlags import DetFlags
-    return ((self.doNewTracking() or self.doBeamGas() or self.doLargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() ) \
+    return ((self.doNewTracking() or self.doBeamGas() or self.doLargeD0() or self.doR3LargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() ) \
              and DetFlags.haveRIO.TRT_on() ) and self.doTRTExtensionNew()
   
   def doExtensionProcessor(self):
     from AthenaCommon.DetFlags    import DetFlags
-    return (self.doNewTracking() or self.doBeamGas() or self.doLargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion()) \
+    return (self.doNewTracking() or self.doBeamGas() or self.doLargeD0() or self.doR3LargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion()) \
             and DetFlags.haveRIO.TRT_on()
  
   def solenoidOn(self):
@@ -2079,10 +2102,12 @@ class InDetJobProperties(JobPropertyContainer):
        self.doBackTracking            = False
        self.doTRTStandalone           = False
        self.doTrtSegments             = False
-       self.doLowPt                   = False  
-       self.doVeryLowPt               = False  
+       self.doLowPt                   = False
+       self.doVeryLowPt               = False
+       self.doLowPtRoI                = False
        self.doForwardTracks           = False
        self.doLargeD0                 = False
+       self.doR3LargeD0               = False
        self.doLowPtLargeD0            = False
        self.doDisplacedSoftPion       = False
        self.doHadCaloSeededSSS        = False
@@ -2120,6 +2145,7 @@ class InDetJobProperties(JobPropertyContainer):
 
      if self.doRobustReco() and jobproperties.Beam.beamType()=="collisions":
         self.doLowPt                = False
+        self.doLowPtRoI             = False
         self.useHVForSctDCS         = True
         self.primaryVertexSetup     = "DefaultFullFinding"
         self.primaryVertexCutSetup  = "StartUp"
@@ -2147,6 +2173,7 @@ class InDetJobProperties(JobPropertyContainer):
      # [ switch off the other modes
      self.doLowPt                  = False
      self.doVeryLowPt              = False
+     self.doLowPtRoI               = False
      self.doForwardTracks          = False
      self.doBeamGas                = False
      self.doBeamHalo               = False
@@ -2363,7 +2390,7 @@ class InDetJobProperties(JobPropertyContainer):
           standAloneTracking += 'TRT'
        print standAloneTracking
     # -----------------------------------------
-    if self.doLargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() :
+    if self.doLargeD0() or self.doR3LargeD0() or self.doLowPtLargeD0() or self.doDisplacedSoftPion() :
        print '*'
        print '* LargeD0 Tracking is ON'
        if self.doSiSPSeededTrackFinder() :
@@ -2389,6 +2416,10 @@ class InDetJobProperties(JobPropertyContainer):
        if self.doVeryLowPt() :
           print '* and VeryLowPtTracking is ON'
     # -----------------------------------------
+    if self.doLowPtRoI() :
+       print '*'
+       print '* LowPtTracking within selected roi is ON'
+    # -----------------------------------------
     if self.doROIConv() :
        print '*'
        print '* ROIConversionFinding is ON'
@@ -2704,10 +2735,15 @@ _list_InDetJobProperties = [Enabled,
                             doBackTracking,
                             doLowPt,
                             doVeryLowPt,
+                            doLowPtRoI,
+                            LowPtRoIStrategy,
+                            LowPtRoIWindow,
+                            LowPtRoIFile,
                             doROIConv,
                             doForwardTracks,
                             doLowPtLargeD0,
                             doLargeD0,
+                            doR3LargeD0,
                             doDisplacedSoftPion,
                             useExistingTracksAsInput,
                             cutLevel,
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py
index 647ba67ac010c11ad29128805eb37390c283e0dc..4fb22c3df251c9747e391119cc873650ae2e765a 100644
--- a/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py
@@ -104,7 +104,6 @@ class TRT_RDOs(JobProperty):
     statusOn     = True
     allowedTypes = ['str']
     StoredValue  = 'TRT_RDOs'
-
 	   
 class PixelPURDOs(JobProperty):
     """StoreGate key for PU pixel raw data objects"""
@@ -340,7 +339,6 @@ class TRT_Tracks_Phase(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'TRTTracks_Phase'
 
-
 class TRTSeededTracks(JobProperty):
     """StoreGate key for TRT Seeded Tracks"""
     statusOn     = True
@@ -419,6 +417,12 @@ class ExtendedTracksMapLowPt(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'ExtendedTracksMapLowPt'
 
+class ExtendedTracksMapLowPtRoI(JobProperty):
+    """ Storegate key for new-tracking low Pt extended tracks map within selected roi"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'ExtendedTracksMapLowPtRoI'
+
 class ExtendedTracksMapBeamGas(JobProperty):
     """ Storegate key for new-tracking beam gas extended tracks map"""
     statusOn     = True
@@ -461,6 +465,12 @@ class ExtendedLowPtTracks(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'ExtendedLowPtTracks'
 
+class ExtendedLowPtRoITracks(JobProperty):
+    """ Storegate key for new-tracking extended low Pt tracks within selected roi"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'ExtendedLowPtRoITracks'
+
 class ExtendedBeamGasTracks(JobProperty):
     """ Storegate key for new-tracking extended beam gas tracks"""
     statusOn     = True
@@ -485,7 +495,6 @@ class ProcessedESDTracks(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'Tracks'
 
-
 class ExtendedDetailedTracksTruth(JobProperty):
     """StoreGate key for detailed track truth of unslimmed inside out tracks"""
     statusOn     = True
@@ -582,6 +591,24 @@ class SiSpSeededSCTTracks(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'SiSPSeededSCTTracks'
 
+class LowPtRoITracks(JobProperty):
+    """StoreGate key for LowPtRoI tracks """
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'LowPtRoITracks'
+
+class LowPtRoIDetailedTracksTruth(JobProperty):
+    """StoreGate key for DetailedTrackTruth  (doLowPtRoI)"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'ResolvedLowPtRoITrackDetailedTruth'
+
+class LowPtRoITracksTruth(JobProperty):
+    """StoreGate key for TracksTruth  (doLowPtRoI)"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'ResolvedLowPtRoITrackTruthCollection'
+
 class PixelTracks(JobProperty):
     """StoreGate key for resolved pixel standalone tracks """
     statusOn     = True
@@ -721,6 +748,12 @@ class SiSPSeedSegments(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'SiSPSeedSegments'
 
+class SiSPLowPtRoISeedSegments(JobProperty):
+    """ Storegate key for SP LowPtRoI Seed Segments to studies"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'SiSPLowPtRoISeedSegments'
+
 class SiSpSeededTrackCandidates(JobProperty):
     """ Storegate key for SP Seed Track Candidates to studies"""
     statusOn     = True
@@ -745,6 +778,12 @@ class SiSpSeededVeryLowPtTracks(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'SiSPSeededVeryLowPtTracks'
 
+class SiSpSeededLowPtRoITracks(JobProperty):
+    """ Storegate key for new-tracking SP seeded low Pt tracks within selected roi"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'SiSPSeededLowPtRoITracks'
+
 class SiSpSeededForwardTracks(JobProperty):
     """ Storegate key for new-tracking SP seeded very forward tracks"""
     statusOn     = True
@@ -793,6 +832,12 @@ class ResolvedLowPtTracks(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'ResolvedLowPtTracks'
 
+class ResolvedLowPtRoITracks(JobProperty):
+    """ Storegate key for new-tracking resolved low Pt tracks within selected roi"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'ResolvedLowPtRoITracks'
+
 class ResolvedForwardTracks(JobProperty):
     """ Storegate key for new-tracking resolved very forward tracks"""
     statusOn     = True
@@ -1046,7 +1091,6 @@ class OutputAODFileName(JobProperty):
     allowedTypes = ['str']
     StoredValue  = "AOD.pool.root"    
 
-
 class McEventCollection(JobProperty):
     """DetectorManager for Pixel"""
     statusOn     = True
@@ -1149,6 +1193,18 @@ class xAODPseudoTrackParticleContainer(JobProperty):
     allowedTypes = ['str']
     StoredValue = "InDetPseudoTrackParticles"
 
+class xAODLowPtRoITrackParticleContainer(JobProperty):
+    """xAOD TrackParticle for LowPtRoI"""
+    statusOn = True
+    allowedTypes = ['str']
+    StoredValue = "LowPtRoITrackParticles"
+
+class xAODLowPtRoIVertexContainer(JobProperty):
+    """xAOD Vertex for LowPtRoI"""
+    statusOn = True
+    allowedTypes = ['str']
+    StoredValue = "LowPtRoIVertexContainer"
+
 class xAODPixelTrackParticleContainer(JobProperty):
     """xAOD PixelTrackParticle"""
     statusOn = True
@@ -1209,6 +1265,12 @@ class xAODSiSPTrackCandidates(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'SiSpTrackCandidates'
 
+class xAODSiSPLowPtRoITrackCandidates(JobProperty):
+    """ Storegate key for SP Seed LowPtRoI Track Candidates to studies"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'SiSpLowPtRoITrackCandidates'
+
 ##-----------------------------------------------------------------------------
 ## 2nd step
 ## Definition of the InDet flag container
@@ -1288,6 +1350,7 @@ jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMap)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapPhase)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapSLHC)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapLowPt)
+jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapLowPtRoI)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapBeamGas)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapLargeD0)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksMapDSP)
@@ -1295,6 +1358,7 @@ jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedTracksPhase)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedSLHCTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedLowPtTracks)
+jobproperties.InDetContainerKeys.add_JobProperty(ExtendedLowPtRoITracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedBeamGasTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedLargeD0Tracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ExtendedDSPTracks)
@@ -1315,6 +1379,9 @@ jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededPixelPrdAssociationTr
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededPixelFourLayerTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededPixelThreeLayerTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededSCTTracks)
+jobproperties.InDetContainerKeys.add_JobProperty(LowPtRoITracks)
+jobproperties.InDetContainerKeys.add_JobProperty(LowPtRoITracksTruth)
+jobproperties.InDetContainerKeys.add_JobProperty(LowPtRoIDetailedTracksTruth)
 jobproperties.InDetContainerKeys.add_JobProperty(PixelTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(PixelDetailedTracksTruth)
 jobproperties.InDetContainerKeys.add_JobProperty(PixelTracksTruth)
@@ -1341,10 +1408,12 @@ jobproperties.InDetContainerKeys.add_JobProperty(TRTTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(TRTTracks_NewT)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSPSeedSegments)
+jobproperties.InDetContainerKeys.add_JobProperty(SiSPLowPtRoISeedSegments)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededTrackCandidates)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededSLHCTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededLowPtTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededVeryLowPtTracks)
+jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededLowPtRoITracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededForwardTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededROIConvTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededBeamGasTracks)
@@ -1354,6 +1423,7 @@ jobproperties.InDetContainerKeys.add_JobProperty(ResolvedTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ResolvedSLHCTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ResolvedLowPtTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ResolvedVeryLowPtTracks)
+jobproperties.InDetContainerKeys.add_JobProperty(ResolvedLowPtRoITracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ResolvedForwardTracks)
 jobproperties.InDetContainerKeys.add_JobProperty(ResolvedForwardTracksTruth)
 jobproperties.InDetContainerKeys.add_JobProperty(ResolvedForwardTrackParticles)
@@ -1412,6 +1482,8 @@ jobproperties.InDetContainerKeys.add_JobProperty(xAODSecVertexDecayContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODForwardTrackParticleContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODLowBetaTrackParticleContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODPseudoTrackParticleContainer)
+jobproperties.InDetContainerKeys.add_JobProperty(xAODLowPtRoITrackParticleContainer)
+jobproperties.InDetContainerKeys.add_JobProperty(xAODLowPtRoIVertexContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODPixelTrackParticleContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODSCTTrackParticleContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODTRTTrackParticleContainer)
@@ -1422,6 +1494,7 @@ jobproperties.InDetContainerKeys.add_JobProperty(xAODPixelFourLayerExtendedTrack
 jobproperties.InDetContainerKeys.add_JobProperty(xAODPixelThreeLayerTrackParticleContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODPixelThreeLayerExtendedTrackParticleContainer)
 jobproperties.InDetContainerKeys.add_JobProperty(xAODSiSPTrackCandidates)
+jobproperties.InDetContainerKeys.add_JobProperty(xAODSiSPLowPtRoITrackCandidates)
 jobproperties.InDetContainerKeys.add_JobProperty(DBMDetailedTracksTruth) 
 jobproperties.InDetContainerKeys.add_JobProperty(DBMTracksTruth) 
 jobproperties.InDetContainerKeys.add_JobProperty(SiSpSeededDBMTracks) 
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
index 08bcf0717ca9e61345041bd51a02c88c2a5c27d9..f9ff846eecea99a27d915cdb41f36300972c620d 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
@@ -23,7 +23,7 @@ class  ConfiguredNewTrackingSiPattern:
       #
       # --- decide if use the association tool
       #
-      if (len(InputCollections) > 0) and (NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0" or NewTrackingCuts.mode() == "DisplacedSoftPion" or NewTrackingCuts.mode() == "PixelThreeLayer" or NewTrackingCuts.mode() == "BeamGas" or NewTrackingCuts.mode() == "ForwardTracks"  or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "ROIConv"):
+      if (len(InputCollections) > 0) and (NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LowPtRoI" or NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "R3LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0" or NewTrackingCuts.mode() == "DisplacedSoftPion" or NewTrackingCuts.mode() == "PixelThreeLayer" or NewTrackingCuts.mode() == "BeamGas" or NewTrackingCuts.mode() == "ForwardTracks"  or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "ROIConv"):
          usePrdAssociationTool = True
       else:
          usePrdAssociationTool = False
@@ -58,6 +58,8 @@ class  ConfiguredNewTrackingSiPattern:
             from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_HeavyIon as SiSpacePointsSeedMaker
          elif NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()) :
             from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_LowMomentum as SiSpacePointsSeedMaker
+         elif NewTrackingCuts.mode() == "LowPtRoI" :
+            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
          elif NewTrackingCuts.mode() == "BeamGas":
             from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_BeamGas as SiSpacePointsSeedMaker
          elif NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "ROIConv" :
@@ -93,6 +95,9 @@ class  ConfiguredNewTrackingSiPattern:
          if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  NewTrackingCuts.mode() == "ForwardTracks":
             InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds()
             InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds()
+         if NewTrackingCuts.mode() == "R3LargeD0":
+            InDetSiSpacePointsSeedMaker.usePixel = False
+            InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta() 
          if usePrdAssociationTool:
             # not all classes have that property !!!
             InDetSiSpacePointsSeedMaker.UseAssociationTool = True
@@ -107,6 +112,12 @@ class  ConfiguredNewTrackingSiPattern:
             except:
                pass 
             InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
+         if NewTrackingCuts.mode() == "LowPtRoI" :
+            try :
+               InDetSiSpacePointsSeedMaker.pTmax              = NewTrackingCuts.maxPT()
+            except:
+               pass
+            InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
          if NewTrackingCuts.mode() == "ForwardTracks":
             InDetSiSpacePointsSeedMaker.checkEta           = True
             InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
@@ -154,6 +165,55 @@ class  ConfiguredNewTrackingSiPattern:
          else:
             InDetZvertexMaker = None
 
+
+         # ------------------------------------------------------------
+         #
+         # ----------- Loading of ZWindowRoISeedTool for LowPtRoI
+         #
+         # ------------------------------------------------------------
+
+         if NewTrackingCuts.mode() == "LowPtRoI" :
+
+            # ZWindowRoI Tool needed for InDet__SiSpacePointsSeeded tool            
+            if (len(InputCollections) == 0) :
+               InputZWindowTracks = ""
+               print "InputCollections is empty, ZWindowRoI tool needs at least one"
+            else :
+               InputZWindowTracks = InputCollections[0] ##list(InputCollections)
+               print "InputCollections is not empty, ZWindowRoI tool will use the first track colletion in the list"
+               print "Size of the track collection ",len(InputCollections)," The collection is ",InputCollections
+
+            if InDetFlags.LowPtRoIStrategy() == 1:
+               from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__ZWindowRoISeedTool
+               ZWindowRoISeedTool = InDet__ZWindowRoISeedTool (name  = 'InDetZWindowRoISeedTool',
+                                                               InputTracksCollection     = InputZWindowTracks,
+                                                               LeadingMinTrackPt         = 18.*Units.GeV,
+                                                               SubleadingMinTrackPt      = 12.5*Units.GeV,
+                                                               TracksMaxEta              = 2.5,
+                                                               TracksMaxD0               = 9999.,
+                                                               MaxDeltaZTracksPair       = 1.0,
+                                                               TrackZ0Window             = InDetFlags.LowPtRoIWindow() )
+            elif InDetFlags.LowPtRoIStrategy() == 2:
+               from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__TruthHSRoISeedTool
+               ZWindowRoISeedTool = InDet__TruthHSRoISeedTool (name = "InDetZWindowRoISeedTool",
+                                                               InputTruthEventsCollection = "TruthEvents",
+                                                               TrackZ0Window             = InDetFlags.LowPtRoIWindow() )
+            elif InDetFlags.LowPtRoIStrategy() == 3:
+               from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__FileRoISeedTool
+               ZWindowRoISeedTool = InDet__FileRoISeedTool (name = "InDetZWindowRoISeedTool",
+                                                               InputFileName = InDetFlags.LowPtRoIFile(),
+                                                               TrackZ0Window             = InDetFlags.LowPtRoIWindow() )
+            ToolSvc += ZWindowRoISeedTool
+
+            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__RandomRoISeedTool
+            RandomRoISeedTool = InDet__RandomRoISeedTool(name = "RandomRoISeedTool",
+                                                         TrackZ0Window             = InDetFlags.LowPtRoIWindow() )
+            ToolSvc += RandomRoISeedTool
+
+            #ZWindowRoISeedTool.OutputLevel = VERBOSE
+            #ServiceMgr.MessageSvc.debugLimit = 1000000
+            #ServiceMgr.MessageSvc.verboseLimit = 1000000
+
          #
          # --- SCT and Pixel detector elements road builder
          #
@@ -251,6 +311,9 @@ class  ConfiguredNewTrackingSiPattern:
          elif NewTrackingCuts.mode() == "LowPt":
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'
 
+         elif NewTrackingCuts.mode() == "LowPtRoI":
+           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'
+
          elif NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'           
 
@@ -263,7 +326,7 @@ class  ConfiguredNewTrackingSiPattern:
          elif NewTrackingCuts.mode() == "ROIConv":
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ROIConvTracks'
 
-         elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0":
+         elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "R3LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0":
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'
 
          elif NewTrackingCuts.mode() == "DisplacedSoftPion":
@@ -272,11 +335,12 @@ class  ConfiguredNewTrackingSiPattern:
          else:
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
            
-         if InDetFlags. doStoreTrackSeeds():
+         if InDetFlags. doStoreTrackSeeds() and not NewTrackingCuts.mode() == "LowPtRoI":
               InDetSiTrackMaker.SeedSegmentsWrite=True
               InDetSiTrackMaker.SeedToTrackConversion=InDet_SeedToTrackConversion
-         #InDetSiTrackMaker.OutputLevel = VERBOSE				  
-         
+         if InDetFlags. doStoreTrackSeeds() and NewTrackingCuts.mode() == "LowPtRoI":
+              InDetSiTrackMaker.SeedSegmentsWrite=True
+              InDetSiTrackMaker.SeedToTrackConversion=InDet_SeedToTrackConversionLowPtRoI         #InDetSiTrackMaker.OutputLevel = VERBOSE				  
          ToolSvc += InDetSiTrackMaker
          
          if (InDetFlags.doPrintConfigurables()):
@@ -328,7 +392,19 @@ class  ConfiguredNewTrackingSiPattern:
                                                                     useZBoundFinding = False)
           if InDetFlags.doHeavyIon() :
            InDetSiSPSeededTrackFinder.FreeClustersCut = 2 #Heavy Ion optimization from Igor
-         
+
+         elif NewTrackingCuts.mode() == "LowPtRoI" :
+          from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinderRoI
+          InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinderRoI(name            = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
+                                                                    TrackTool          = InDetSiTrackMaker,
+                                                                    TracksLocation     = self.__SiTrackCollection,
+                                                                    SeedsTool          = InDetSiSpacePointsSeedMaker,
+                                                                    VxOutputName    = InDetKeys.xAODLowPtRoIVertexContainer(),
+                                                                    ZWindowRoISeedTool = ZWindowRoISeedTool,
+                                                                    RandomRoISeedTool = RandomRoISeedTool,
+                                                                    RoIWidth = InDetFlags.LowPtRoIWindow())
+          #InDetSiSpSeededTrackFinder.OutputLevel = DEBUG
+
          else:
           InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name           = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                     TrackTool      = InDetSiTrackMaker,
@@ -506,7 +582,7 @@ class  ConfiguredNewTrackingSiPattern:
 
          if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "DBM"):
            from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityProcessorTool as ProcessorTool
-           use_low_pt_fitter =  True if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()) else False
+           use_low_pt_fitter =  True if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LowPtRoI" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()) else False
            fitter_list=[( InDetTrackFitter if not use_low_pt_fitter else InDetTrackFitterLowPt )]
            if InDetFlags.doRefitInvalidCov() :
               from AthenaCommon import CfgGetter
@@ -547,7 +623,7 @@ class  ConfiguredNewTrackingSiPattern:
 
          if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode() == "DBM":
             InDetAmbiguityProcessor.SuppressHoleSearch = True
-         if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
+         if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LowPtRoI" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
             if InDetAmbiguityProcessor.getName().find('Dense') :
                pass
             else :
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
index ba530df8e7a6d9bad83dc373c5083b599191f568..a34b16dbb78dc8f9bf3c5d8e0f96fadb77c133d5 100755
--- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
@@ -216,6 +216,13 @@ if InDetFlags.loadRotCreator():
         InDet_SeedToTrackConversion = InDet__SeedToTrackConversionTool( name = "InDet_SeedToTrackConversion")
         ToolSvc += InDet_SeedToTrackConversion
 
+    if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI():
+        from SeedToTrackConversionTool.SeedToTrackConversionToolConf import InDet__SeedToTrackConversionTool
+        InDet_SeedToTrackConversionLowPtRoI = InDet__SeedToTrackConversionTool( name = "InDet_SeedToTrackConversionLowPtRoI", 
+                                                                                TrackPatternRecoInfo = "SiSpacePointsSeedMaker_LowMomentum",
+                                                                                SeedsegmentsOutput = "SiSPLowPtRoISeedSegments")
+        ToolSvc += InDet_SeedToTrackConversionLowPtRoI
+
 ################################################################################
 # Note here: We *could* use the flag below in a smarter way for the current    #
 # configuration (e.g. to set up an 'all digital' path for ITK or a 'no digital'#
@@ -691,7 +698,7 @@ if InDetFlags.loadFitter():
         #
         # ----------- Global Chi2 Fitter for Low-Pt with different settings 
         #
-        if InDetFlags.doLowPt() or InDetFlags.doVeryLowPt() or (InDetFlags.doTrackSegmentsPixel() and InDetFlags.doMinBias()):
+        if InDetFlags.doLowPt() or InDetFlags.doVeryLowPt() or InDetFlags.doLowPtRoI() or (InDetFlags.doTrackSegmentsPixel() and InDetFlags.doMinBias()):
             InDetTrackFitterLowPt = Trk__GlobalChi2Fitter(name                  = 'InDetTrackFitterLowPt',
                                                           ExtrapolationTool     = InDetExtrapolator,
                                                           NavigatorTool         = InDetNavigator,
@@ -825,7 +832,7 @@ if InDetFlags.loadFitter():
             ToolSvc += InDetTrackFitterTRT
             if (InDetFlags.doPrintConfigurables()):
                 print InDetTrackFitterTRT
-        if InDetFlags.doLowPt() or (InDetFlags.doTrackSegmentsPixel() and InDetFlags.doMinBias()):
+        if InDetFlags.doLowPt() or InDetFlags.doLowPtRoI() or (InDetFlags.doTrackSegmentsPixel() and InDetFlags.doMinBias()):
             ToolSvc+=InDetTrackFitterLowPt
             if (InDetFlags.doPrintConfigurables()):
                 print InDetTrackFitterLowPt
@@ -1376,6 +1383,7 @@ if InDetFlags.doTruth() and (InDetFlags.doStatistics() or InDetFlags.doStandardP
     if (InDetFlags.doPrintConfigurables()):
         print InDetTruthToTrack
 
+
 # ------------------------------------------------------------
 #
 # ----------- Loading of tools for Vertexing
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py
index 3da12e0225dcae5faa5a824e92a71a0e853c5853..493031b3fb0cda65e15a1823129aad8167f0928c 100755
--- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_jobOptions.py
@@ -445,7 +445,7 @@ else:
     #     after standard reconstruction...?
     #
     # ------------------------------------------------------------
-    if InDetFlags.doLargeD0() or InDetFlags.doLowPtLargeD0():
+    if InDetFlags.doLargeD0() or InDetFlags.doR3LargeD0() or InDetFlags.doLowPtLargeD0():
       #
       # --- run Si pattern for high-d0
       #
@@ -457,6 +457,8 @@ else:
         from InDetRecExample.ConfiguredNewTrackingCuts import ConfiguredNewTrackingCuts
         if InDetFlags.doLowPtLargeD0():
           InDetNewTrackingCutsLargeD0 = ConfiguredNewTrackingCuts("LowPtLargeD0")
+        elif InDetFlags.doR3LargeD0():
+          InDetNewTrackingCutsLargeD0 = ConfiguredNewTrackingCuts("R3LargeD0")
         else:
           InDetNewTrackingCutsLargeD0 = ConfiguredNewTrackingCuts("LargeD0")
       InDetNewTrackingCutsLargeD0.printInfo()
@@ -529,6 +531,43 @@ else:
       # --- add into list for combination
       InputCombinedInDetTracks += [ InDetLowPtTRTExtension.ForwardTrackCollection() ]
 
+    # ------------------------------------------------------------
+    #
+    # --- Low Pt option within selected roi (after BackTracking)
+    #
+    # ------------------------------------------------------------
+
+    if InDetFlags.doLowPtRoI():
+      #
+      # --- configure cuts for Low Pt tracking
+      #
+      if (not 'InDetNewTrackingCutsLowPtRoI' in dir()):
+        print "InDetRec_jobOptions: InDetNewTrackingCutsLowPtRoI not set before - import them now"
+        from InDetRecExample.ConfiguredNewTrackingCuts import ConfiguredNewTrackingCuts
+        InDetNewTrackingCutsLowPtRoI = ConfiguredNewTrackingCuts("LowPtRoI")
+      InDetNewTrackingCutsLowPtRoI.printInfo()
+      #
+      # --- now run Si pattern for Low Pt
+      #
+      include ("InDetRecExample/ConfiguredNewTrackingSiPattern.py")
+      InDetLowPtRoISiPattern = ConfiguredNewTrackingSiPattern(InputCombinedInDetTracks,
+                                                           InDetKeys.ResolvedLowPtRoITracks(),
+                                                           InDetKeys.SiSpSeededLowPtRoITracks(),
+                                                           InDetNewTrackingCutsLowPtRoI,
+                                                           TrackCollectionKeys,
+                                                           TrackCollectionTruthKeys)
+      
+      #
+      # --- do the TRT pattern
+      #
+      include ("InDetRecExample/ConfiguredNewTrackingTRTExtension.py")
+      InDetLowPtRoITRTExtension = ConfiguredNewTrackingTRTExtension(InDetNewTrackingCutsLowPtRoI,
+                                                                 InDetLowPtRoISiPattern.SiTrackCollection(),
+                                                                 InDetKeys.ExtendedLowPtRoITracks(),
+                                                                 InDetKeys.ExtendedTracksMapLowPtRoI(),
+                                                                 TrackCollectionKeys,
+                                                                 TrackCollectionTruthKeys)
+
     # ------------------------------------------------------------
     #
     # --- Very Low Pt option (after LowPt)
@@ -1083,6 +1122,12 @@ else:
                                                                    InDetKeys.SiSPSeedSegments()+'DetailedTruth',
                                                                    InDetKeys.SiSPSeedSegments()+'TruthCollection')
 
+            if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI():
+              include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
+              InDetTracksTruthSegemntsLowPtRoI = ConfiguredInDetTrackTruth(InDetKeys.SiSPLowPtRoISeedSegments(),
+                                                                   InDetKeys.SiSPLowPtRoISeedSegments()+'DetailedTruth',
+                                                                   InDetKeys.SiSPLowPtRoISeedSegments()+'TruthCollection')
+
           #
           # add final output for statistics
           #
@@ -1174,6 +1219,33 @@ else:
        if (InDetFlags.doPrintConfigurables()):
          print TrkTrackCollectionMerger_pixThreeLayer
 
+      # Dummy Merger to fill additional info for all LowPt within slected roi tracks
+      if InDetFlags.doLowPtRoI():
+       DummyCollectionLowPtRoI = []
+       DummyCollectionLowPtRoI += [ InDetKeys.ExtendedLowPtRoITracks()]
+       TrkTrackCollectionMerger_LowPtRoI = Trk__TrackCollectionMerger(name                    = "InDetTrackCollectionMerger_LowPtRoI",
+                                                                           TracksLocation          = DummyCollectionLowPtRoI,
+                                                                           OutputTracksLocation    = InDetKeys.LowPtRoITracks(),
+                                                                           AssoTool                = InDetPrdAssociationTool,
+                                                                           UpdateSharedHitsOnly    = False,
+                                                                           UpdateAdditionalInfo    = True,
+                                                                           SummaryTool             = InDetTrackSummaryToolSharedHits)
+       #TrkTrackCollectionMerger_LowPtRoI.OutputLevel = VERBOSE
+       topSequence += TrkTrackCollectionMerger_LowPtRoI
+
+       
+       if InDetFlags.doTruth():
+          # set up the truth info for this container
+          #
+            include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
+            InDetTracksTruth = ConfiguredInDetTrackTruth(InDetKeys.LowPtRoITracks(),
+                                                         InDetKeys.LowPtRoIDetailedTracksTruth(),
+                                                         InDetKeys.LowPtRoITracksTruth())
+    
+
+       if (InDetFlags.doPrintConfigurables()):
+         print TrkTrackCollectionMerger_LowPtRoI
+
     # ------------------------------------------------------------
     #
     # ----------- prepare output track collection for post processing
@@ -1391,6 +1463,8 @@ else:
         cuts = InDetNewTrackingCutsVeryLowPt
       elif InDetFlags.doLowPt():
         cuts = InDetNewTrackingCutsLowPt
+      elif InDetFlags.doLowPtRoI():
+        cuts = InDetNewTrackingCutsLowPtRoI
       elif InDetFlags.doROIConv():
         cuts = InDetNewTrackingCutsROIConv
       else:
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py
index 2946a17b6e26b4317a6ab727c5c06d069d60b173..d48f7aa3e27fb2baff2b6afb911f7273654428f5 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetxAODCreator.py
@@ -1,9 +1,9 @@
 from InDetRecExample.InDetJobProperties import InDetFlags
 from InDetRecExample.InDetKeys import InDetKeys
 
-doCreation = ( InDetFlags.doNewTracking() or InDetFlags.doPseudoTracking() or InDetFlags.doLargeD0() or InDetFlags.doLowPtLargeD0() or InDetFlags.doDisplacedSoftPion() ) \
+doCreation = ( InDetFlags.doNewTracking() or InDetFlags.doPseudoTracking() or InDetFlags.doLargeD0() or InDetFlags.doR3LargeD0() or InDetFlags.doLowPtLargeD0() or InDetFlags.doDisplacedSoftPion() ) \
                     and InDetFlags.doParticleCreation()
-doConversion = not InDetFlags.doNewTracking()  and not InDetFlags.doPseudoTracking() and not InDetFlags.doLargeD0() \
+doConversion = not InDetFlags.doNewTracking()  and not InDetFlags.doPseudoTracking() and not InDetFlags.doLargeD0() and not InDetFlags.doR3LargeD0() \
                     and not InDetFlags.doLowPtLargeD0() and not InDetFlags.doDisplacedSoftPion() and InDetFlags.doParticleConversion()
 
 if doCreation:
@@ -280,3 +280,49 @@ if InDetFlags.doStoreTrackCandidates() and InDetFlags.doParticleCreation():
  #xAODSeedsTrackParticleCnvAlg.OutputLevel = VERBOSE
  topSequence += xAODTrkCanTrackParticleCnvAlg
 
+# Store track candidates created if InDetFlags.doLowPtRoI() into separate collection
+if InDetFlags.doLowPtRoI() and InDetFlags.doParticleCreation():
+ from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
+ xAODLowPtRoITrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg( InDetKeys.xAODLowPtRoITrackParticleContainer() ) 
+ xAODLowPtRoITrackParticleCnvAlg.xAODContainerName = InDetKeys.xAODLowPtRoITrackParticleContainer()
+ xAODLowPtRoITrackParticleCnvAlg.xAODTrackParticlesFromTracksContainerName = InDetKeys.xAODLowPtRoITrackParticleContainer()
+ xAODLowPtRoITrackParticleCnvAlg.TrackParticleCreator = InDetxAODParticleCreatorTool
+ xAODLowPtRoITrackParticleCnvAlg.TrackContainerName = InDetKeys.LowPtRoITracks()
+ xAODLowPtRoITrackParticleCnvAlg.TrackTruthContainerName = InDetKeys.LowPtRoITracksTruth()
+ xAODLowPtRoITrackParticleCnvAlg.ConvertTrackParticles = False
+ xAODLowPtRoITrackParticleCnvAlg.ConvertTracks = True
+ xAODLowPtRoITrackParticleCnvAlg.AddTruthLink = InDetFlags.doTruth()
+ xAODLowPtRoITrackParticleCnvAlg.PrintIDSummaryInfo = True
+ #xAODLowPtRoITrackParticleCnvAlg.OutputLevel = VERBOSE
+ topSequence += xAODLowPtRoITrackParticleCnvAlg
+
+if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI() and InDetFlags.doParticleCreation():
+ from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
+ xAODLowPtRoISeedsTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg( InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle" )
+ xAODLowPtRoISeedsTrackParticleCnvAlg.xAODContainerName = InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"
+ xAODLowPtRoISeedsTrackParticleCnvAlg.xAODTrackParticlesFromTracksContainerName = InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"
+ xAODLowPtRoISeedsTrackParticleCnvAlg.TrackParticleCreator = InDetxAODParticleCreatorTool
+ xAODLowPtRoISeedsTrackParticleCnvAlg.TrackContainerName = InDetKeys.SiSPLowPtRoISeedSegments()
+ xAODLowPtRoISeedsTrackParticleCnvAlg.TrackTruthContainerName = InDetKeys.SiSPLowPtRoISeedSegments()+'TruthCollection'
+ xAODLowPtRoISeedsTrackParticleCnvAlg.ConvertTrackParticles = False
+ xAODLowPtRoISeedsTrackParticleCnvAlg.ConvertTracks = True
+ xAODLowPtRoISeedsTrackParticleCnvAlg.AddTruthLink = InDetFlags.doTruth()
+ xAODLowPtRoISeedsTrackParticleCnvAlg.PrintIDSummaryInfo = True
+ #xAODLowPtRoISeedsTrackParticleCnvAlg.OutputLevel = VERBOSE
+ topSequence += xAODLowPtRoISeedsTrackParticleCnvAlg
+
+# Store track candidates when requested
+if InDetFlags.doStoreTrackCandidates() and InDetFlags.doLowPtRoI() and InDetFlags.doParticleCreation():
+ from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
+ xAODLowPtRoITrkCanTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg( InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle" )
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.xAODContainerName = InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.xAODTrackParticlesFromTracksContainerName = InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.TrackParticleCreator = InDetxAODParticleCreatorTool
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.TrackContainerName = InDetKeys.SiSpSeededLowPtRoITracks()
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.TrackTruthContainerName = InDetKeys.SiSpSeededLowPtRoITracks()+'TruthCollection'
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.ConvertTrackParticles = False
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.ConvertTracks = True
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.AddTruthLink = InDetFlags.doTruth()
+ xAODLowPtRoITrkCanTrackParticleCnvAlg.PrintIDSummaryInfo = True
+ #xAODLowPtRoITrkCanTrackParticleCnvAlg.OutputLevel = VERBOSE
+ topSequence += xAODLowPtRoITrkCanTrackParticleCnvAlg
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py
index 232b631b08e008663238f755f2f4e307c88270b1..380095619c9b465c070965f2dde9005e84e13abe 100755
--- a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py
@@ -59,6 +59,23 @@ if InDetFlags.doxAOD():
   if InDetFlags.doTrackSegmentsTRT():
     InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODTRTTrackParticleContainer()]
     InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODTRTTrackParticleContainer()+'Aux.' + excludedAuxData]
+  InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODLowPtRoITrackParticleContainer()]
+  InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODLowPtRoITrackParticleContainer()+'Aux.' + excludedAuxData]
+  InDetAODList+=['xAOD::VertexContainer#'+InDetKeys.xAODLowPtRoIVertexContainer()]
+  InDetAODList+=['xAOD::VertexAuxContainer#'+InDetKeys.xAODLowPtRoIVertexContainer()+'Aux.' + excludedVertexAuxData]
+  if InDetFlags.doStoreTrackSeeds():
+    InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.SiSPSeedSegments()+"TrackParticle"]
+    InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.SiSPSeedSegments()+"TrackParticle"+'Aux.' + excludedAuxData]
+  if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI():
+    InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"]
+    InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"+'Aux.' + excludedAuxData]
+  if InDetFlags.doStoreTrackCandidates():
+    InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODSiSPTrackCandidates()+"TrackParticle"]
+    InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODSiSPTrackCandidates()+"TrackParticle"+'Aux.' + excludedAuxData]
+  if InDetFlags.doStoreTrackCandidates() and InDetFlags.doLowPtRoI():
+    InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"]
+    InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"+'Aux.' + excludedAuxData]
+   
   if InDetFlags.doDBMstandalone() or InDetFlags.doDBM(): 
     InDetAODList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODDBMTrackParticleContainer()] 
     InDetAODList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODDBMTrackParticleContainer()+'Aux.' + excludedAuxData] 
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py
index 306270062916a9c2c6e4f0664539ba42b444662c..ac05e4d5e8f7e1c9628b5ec8b581f65098f1fcd2 100755
--- a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py
@@ -45,9 +45,15 @@ if InDetFlags.doCosmics():
 if InDetFlags.doStoreTrackSeeds() and ( InDetFlags.doWriteTracksToESD() or  not InDetFlags.doxAOD() ) :
    InDetESDList+=["TrackCollection#"+InDetKeys.SiSPSeedSegments()]
 
+if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI() and ( InDetFlags.doWriteTracksToESD() or  not InDetFlags.doxAOD() ) :
+   InDetESDList+=["TrackCollection#"+InDetKeys.SiSPLowPtRoISeedSegments()]
+
 if InDetFlags.doStoreTrackCandidates() and ( InDetFlags.doWriteTracksToESD() or  not InDetFlags.doxAOD() ) :
    InDetESDList+=["TrackCollection#"+InDetKeys.SiSpSeededTrackCandidates()]
 
+if InDetFlags.doStoreTrackCandidates() and InDetFlags.doLowPtRoI() and ( InDetFlags.doWriteTracksToESD() or  not InDetFlags.doxAOD() ) :
+   InDetESDList+=["TrackCollection#"+InDetKeys.SiSpSeededLowPtRoITracks()]
+
 if InDetFlags.doWriteTracksToESD() or not InDetFlags.doxAOD() :
    if InDetKeys.AliasToTracks() == 'none':
       InDetESDList+=["TrackCollection#"+InDetKeys.Tracks()]
@@ -90,6 +96,11 @@ if InDetFlags.doDBMstandalone() or InDetFlags.doDBM():
       InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODDBMTrackParticleContainer()] 
       InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODDBMTrackParticleContainer()+'Aux.' + excludedAuxData] 
 
+# add LowPtRoI tracks
+if InDetFlags.doLowPtRoI():
+   if InDetFlags.doWriteTracksToESD() or not InDetFlags.doxAOD():
+      InDetESDList += ["TrackCollection#"+InDetKeys.LowPtRoITracks()]
+
 # add the forward tracks for combined muon reconstruction
 if InDetFlags.doForwardTracks():
    if InDetFlags.doWriteTracksToESD() or not InDetFlags.doxAOD():
@@ -170,10 +181,18 @@ if InDetFlags.doxAOD():
    InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.SiSPSeedSegments()+"TrackParticle"]
    InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.SiSPSeedSegments()+"TrackParticle"+'Aux.' + excludedAuxData]
 
+  if InDetFlags.doStoreTrackSeeds() and InDetFlags.doLowPtRoI():
+   InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"]
+   InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.SiSPLowPtRoISeedSegments()+"TrackParticle"+'Aux.' + excludedAuxData]
+
   if InDetFlags.doStoreTrackCandidates():
    InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODSiSPTrackCandidates()+"TrackParticle"]
    InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODSiSPTrackCandidates()+"TrackParticle"+'Aux.' + excludedAuxData]
 
+  if InDetFlags.doStoreTrackCandidates() and InDetFlags.doLowPtRoI():
+   InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"]
+   InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODSiSPLowPtRoITrackCandidates()+"TrackParticle"+'Aux.' + excludedAuxData]
+
   if not InDetFlags.doSLHC():
      InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODForwardTrackParticleContainer()]
      InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODForwardTrackParticleContainer()+'Aux.' + excludedAuxData ]
@@ -218,6 +237,12 @@ if InDetFlags.doxAOD():
   if InDetFlags.doPseudoTracking():
     InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODPseudoTrackParticleContainer()]
     InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODPseudoTrackParticleContainer()+'Aux.' + excludedAuxData]
+  if InDetFlags.doLowPtRoI():
+    InDetESDList+=['xAOD::TrackParticleContainer#'+InDetKeys.xAODLowPtRoITrackParticleContainer()]
+    InDetESDList+=['xAOD::TrackParticleAuxContainer#'+InDetKeys.xAODLowPtRoITrackParticleContainer()+'Aux.' + excludedAuxData]
+    InDetESDList+=['xAOD::VertexContainer#'+InDetKeys.xAODLowPtRoIVertexContainer()]
+    InDetESDList+=['xAOD::VertexAuxContainer#'+InDetKeys.xAODLowPtRoIVertexContainer()+'Aux.' + excludedVertexAuxData]
+     
 # next is only for InDetRecExample stand alone! RecExCommon uses InDetESDList directly
 # added to InDetRec_all.py after include WriteInDetESD!
 #StreamESD.ItemList += InDetESDList
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
index 28ce73cff26bc67a431d0cf52864ecd760b01cc2..165af4a68a40790f1f6084127ddadcf5fd575637 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
@@ -478,10 +478,14 @@ void IDAlignMonResiduals::InitializeHistograms()
   m_si_ecc_pullY_mean = 0;
   m_pix_b_residualx = 0;
   m_pix_b_residualy = 0;
+  m_oldpix_b_residualx = 0;
+  m_oldpix_b_residualy = 0;
   m_pix_b_residualx_fine = 0;
   m_pix_b_residualy_fine = 0;
   m_pix_b_biased_residualx = 0;
   m_pix_b_biased_residualy = 0;
+  m_pix_ec_residualx = 0;
+  m_pix_ec_residualy = 0;
   m_pix_eca_residualx = 0;
   m_pix_eca_residualy = 0;
   m_pix_ecc_residualx = 0;
@@ -491,6 +495,12 @@ void IDAlignMonResiduals::InitializeHistograms()
   m_pix_ecc_residualx_fine = 0;
   m_pix_ecc_residualy_fine = 0;
  
+  // IBL split in planar and 3D
+  m_pix_b0_planars_residualx = 0;
+  m_pix_b0_planars_residualy = 0;
+  m_pix_b0_3D_residualx = 0;
+  m_pix_b0_3D_residualy = 0;
+
   m_pix_eca_pullx = 0;
   m_pix_eca_pully = 0;
   m_pix_ecc_pullx = 0;
@@ -1426,16 +1436,14 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       			
       const Identifier & hitId = hit->identify();
       if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Defined  hit Identifier " << endmsg;
-      // Salva (Feb 2017): problem observed with a hit not being pixel -> make sure hits are from an ID part     
 
-      // Salva: new code
-      detType = -1; // unknown
+      detType = -1; // default unknown
       if (m_idHelper->is_trt(hitId)) detType = 2;
       if (m_idHelper->is_sct(hitId)) detType = 1;
       if (m_idHelper->is_pixel(hitId)) detType = 0;
 
       if(detType==2){
-	//have identified a TRT hit
+	// This hit has been identified as a TRT hit
 	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Hit is from the TRT, finding residuals... " << endmsg;
 	bool isTubeHit = (mesh->localCovariance()(Trk::locX,Trk::locX) > 1.0) ? 1 : 0;			
 	const Trk::TrackParameters* trackParameter = (*iter_tsos)->trackParameters();
@@ -1799,12 +1807,24 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  m_pix_b_xresvsmodetaphi_3ds[layerDisk] -> Fill(modEta, modPhi, residualX, TrkWeight);
 	  m_pix_b_yresvsmodetaphi_3ds[layerDisk] -> Fill(modEta, modPhi, residualY, TrkWeight);
 
+	  // old Pixel detector (Pixel excluding IBL) 
+	  if (layerDisk != 0) {
+	    m_oldpix_b_residualx->Fill(residualX, TrkWeight);
+	    m_oldpix_b_residualy->Fill(residualY, TrkWeight);
+	  }
 	  if (layerDisk == 0) {
 	    m_pix_b0_resXvsetaLumiBlock->Fill(float(lumiblock), modEta, residualX, TrkWeight);
 
-	    if (modEta<=6 && modEta>=-6)
+	    if (modEta<=5 && modEta>=-6) {
 	      m_pix_b0_resXvsetaLumiBlock_planars->Fill(float(lumiblock),modEta,residualX,TrkWeight);
-	    
+	      m_pix_b0_planars_residualx->Fill(residualX, TrkWeight);
+	      m_pix_b0_planars_residualy->Fill(residualY, TrkWeight);
+	    }
+	    if (modEta < -6 || modEta >=6) {
+	      m_pix_b0_3D_residualx->Fill(residualX, TrkWeight);
+	      m_pix_b0_3D_residualy->Fill(residualY, TrkWeight);
+	    }
+
 	    if (m_doIBLLBPlots)
 	      {
 		m_pix_b0_resXvsetaLumiBlock_3d->Fill(float(lumiblock), modEta, residualX, TrkWeight);
@@ -1854,6 +1874,8 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  m_si_eca_pullY-> Fill(layerDisk,pullY    , TrkWeight);
 	  m_si_eca_resX -> Fill(layerDisk,residualX, TrkWeight);
 	  m_si_eca_resY -> Fill(layerDisk,residualY, TrkWeight);
+	  m_pix_ec_residualx      -> Fill(residualX, TrkWeight);
+	  m_pix_ec_residualy      -> Fill(residualY, TrkWeight);
 	  m_pix_eca_residualx     -> Fill(residualX, TrkWeight);
 	  m_pix_eca_residualy     -> Fill(residualY, TrkWeight);
 	  m_pix_eca_pullx         -> Fill(pullX    , TrkWeight);
@@ -1899,6 +1921,8 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 					
 	  float disk = (float)layerDisk;
 	  disk =  -1.0*(disk + 0.1);
+	  m_pix_ec_residualx      -> Fill(residualX, TrkWeight);
+	  m_pix_ec_residualy      -> Fill(residualY, TrkWeight);
 	  m_pix_ecc_residualx     -> Fill(residualX, TrkWeight);
 	  m_pix_ecc_residualy     -> Fill(residualY, TrkWeight);
 	  m_pix_ecc_pullx         -> Fill(pullX    , TrkWeight);
@@ -2370,7 +2394,8 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 
 	    m_sct_eca_biased_residualsx[layerDisk]   -> Fill(biasedResidualX       , TrkWeight);
 	    m_sct_eca_biased_residualsx_pt[layerDisk]-> Fill(trkpt, biasedResidualX, TrkWeight);
-	    m_sct_eca_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
+	    // fill only side 0: XXYYZZ
+	    if(sctSide==0) m_sct_eca_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
 	    m_sct_eca_pullsx_pt[layerDisk]           -> Fill(trkpt, pullX          , TrkWeight);
 	    m_sct_eca_biased_residualsx_qoverp2[layerDisk]  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
 	    m_sct_eca_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, residualX      , TrkWeight);
@@ -2421,7 +2446,8 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 
 	    m_sct_ecc_biased_residualsx[layerDisk]   -> Fill(biasedResidualX       , TrkWeight);
 	    m_sct_ecc_biased_residualsx_pt[layerDisk]-> Fill(trkpt, biasedResidualX, TrkWeight);
-	    m_sct_ecc_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
+	    // fill only side 0
+	    if(sctSide==0) m_sct_ecc_residualsx_pt[layerDisk]       -> Fill(trkpt, residualX      , TrkWeight);
 	    m_sct_ecc_pullsx_pt[layerDisk]          -> Fill(trkpt, pullX          , TrkWeight);
 	    m_sct_ecc_biased_residualsx_qoverp2[layerDisk]  -> Fill(trkqoverp2, biasedResidualX, TrkWeight);
 	    m_sct_ecc_residualsx_qoverp2[layerDisk]-> Fill(trkqoverp2, residualX      , TrkWeight);
@@ -2550,13 +2576,12 @@ StatusCode IDAlignMonResiduals::procHistograms()
       }
       
       
-      if (m_extendedPlots)
-	{
-	  for(unsigned int phi=0; phi <32; ++phi){
-	    fillRMSFromProfile(m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phi],m_trt_b_hist->rmsResVsStrawLayerStackLevel[side][phi]);
-	    SetMinWindow(m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phi],m_minTRTResWindow, m_maxTRTResWindow);
-	  }
+      if (m_extendedPlots) {
+	for(unsigned int phi=0; phi <32; ++phi){
+	  fillRMSFromProfile(m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phi],m_trt_b_hist->rmsResVsStrawLayerStackLevel[side][phi]);
+	  SetMinWindow(m_trt_b_hist->aveResVsStrawLayerStackLevel[side][phi],m_minTRTResWindow, m_maxTRTResWindow);
 	}
+      }
 	  
       for(unsigned int position=0; position<5; ++position){ 
 	fillRMSFromProfile(m_trt_b_hist->aveResOverPhiVsStrawLayer[position][side],m_trt_b_hist->rmsResOverPhiVsStrawLayer[position][side]);
@@ -3822,6 +3847,26 @@ void IDAlignMonResiduals::MakePIXBarrelHistograms(MonGroup& al_mon)
   RegisterHisto(al_mon,m_pix_b_residualx);  
   m_pix_b_residualy = new TH1F("pix_b_residualy","Unbiased Y residual Pixel barrel;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
   RegisterHisto(al_mon,m_pix_b_residualy);  
+
+  // same as above (excluding IBL)
+  m_oldpix_b_residualx = new TH1F("oldpix_b_residualx","Unbiased X residual Pixel barrel;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResXFillRange,m_maxPIXResXFillRange);
+  RegisterHisto(al_mon,m_oldpix_b_residualx);  
+  m_oldpix_b_residualy = new TH1F("oldpix_b_residualy","Unbiased Y residual Pixel barrel;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
+  RegisterHisto(al_mon,m_oldpix_b_residualy);  
+
+  // IBL planars
+  m_pix_b0_planars_residualx = new TH1F("pix_b0_planars_residualx","Unbiased X residual IBL planars;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResXFillRange,m_maxPIXResXFillRange);
+  RegisterHisto(al_mon,m_pix_b0_planars_residualx);  
+  m_pix_b0_planars_residualy = new TH1F("pix_b0_planars_residualy","Unbiased Y residual IBL planars;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
+  RegisterHisto(al_mon,m_pix_b0_planars_residualy);  
+
+  // IBL 3D
+  m_pix_b0_3D_residualx = new TH1F("pix_b0_3D_residualx","Unbiased X residual IBL 3D;Residual [mm]", 100*m_FinerBinningFactor, m_minPIXResXFillRange, m_maxPIXResXFillRange);
+  RegisterHisto(al_mon,m_pix_b0_3D_residualx);  
+  m_pix_b0_3D_residualy = new TH1F("pix_b0_3D_residualy","Unbiased Y residual IBL 3D;Residual [mm]",100*m_FinerBinningFactor, m_minPIXResYFillRange, m_maxPIXResYFillRange);
+  RegisterHisto(al_mon,m_pix_b0_3D_residualy);  
+
+
   m_pix_b_biased_residualx = new TH1F("pix_b_biasedresidualx","Biased X Residual Pixel Barrel;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResXFillRange,m_maxPIXResXFillRange);
   RegisterHisto(al_mon,m_pix_b_biased_residualx);  
   m_pix_b_biased_residualy = new TH1F("pix_b_biasedresidualy","Biased Y Residual Pixel Barrel;Residual [mm]",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
@@ -4163,6 +4208,11 @@ void IDAlignMonResiduals::MakePIXEndCapsHistograms(MonGroup& al_mon){
     }
   //General Basic plots
   //Residuals
+  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " -- build pix EC histos -- Range: " << m_minPIXResXFillRange << "  -->  " << m_maxPIXResXFillRange << endmsg;
+  m_pix_ec_residualx = new TH1F("pix_ec_residualx","UnBiased X Residual Pixel EndCaps A & C",100*m_FinerBinningFactor,m_minPIXResXFillRange,m_maxPIXResXFillRange);
+  RegisterHisto(al_mon,m_pix_ec_residualx);
+  m_pix_ec_residualy = new TH1F("pix_ec_residualy","UnBiased Y Residual Pixel EndCaps A & C",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
+  RegisterHisto(al_mon,m_pix_ec_residualy);
   m_pix_eca_residualx = new TH1F("pix_eca_residualx","UnBiased X Residual Pixel EndCap A",100*m_FinerBinningFactor,m_minPIXResXFillRange,m_maxPIXResXFillRange);
   RegisterHisto(al_mon,m_pix_eca_residualx);
   m_pix_eca_residualy = new TH1F("pix_eca_residualy","UnBiased Y Residual Pixel EndCap A",100*m_FinerBinningFactor,m_minPIXResYFillRange,m_maxPIXResYFillRange);
@@ -4356,15 +4406,29 @@ void IDAlignMonResiduals::MakeSCTBarrelHistograms(MonGroup& al_mon){
       RegisterHisto(al_mon,m_sct_b_xoverlapresidualsx[iLayer]);
       m_sct_b_yoverlapresidualsx.push_back(new TH1F(("sct_b"+intToString(iLayer)+"_yoverlapresidualx").c_str(),("Unbiased Y_Overlap Residual X SCT Barrel Layer "+intToString(iLayer)+";Residual [mm]").c_str(),100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
       RegisterHisto(al_mon,m_sct_b_yoverlapresidualsx[iLayer]);
+
       //3d histograms of residual distribution versus module eta/phi in barrel - eta on xaxis, phi on yaxis
       //Used in post-prcessing to fill 2-d residual map histograms of each silicon layer
-      m_sct_b_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_xresvsmodetaphi_3d").c_str(),("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+";Mod Eta; Mod Phi").c_str(),EtaModules*m_mapSplit,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer*m_mapSplit,0,maxPhiModulesPerLayer,100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
+      m_sct_b_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_xresvsmodetaphi_3d").c_str(),
+						     ("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+";Mod Eta; Mod Phi").c_str(),
+						     EtaModules, -(EtaModules/2.), (EtaModules/2.),
+						     maxPhiModulesPerLayer, -0.5, maxPhiModulesPerLayer-0.5,
+						     100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
       RegisterHisto(al_mon,m_sct_b_xresvsmodetaphi_3ds[iLayer]); 
       
       if(m_do3DOverlapHistos) {
-	m_sct_b_Oxresxvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_Oxresxvsmodetaphi_3d").c_str(),("X_Overlap Residual X Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+";Mod Eta; Mod Phi").c_str(),EtaModules*m_mapSplit,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer*m_mapSplit,0,maxPhiModulesPerLayer,100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
+	m_sct_b_Oxresxvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_Oxresxvsmodetaphi_3d").c_str(),
+							 ("X_Overlap Residual X Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+";Mod Eta; Mod Phi").c_str(),
+							 EtaModules*m_mapSplit, -(EtaModules/2.),(EtaModules/2.), 
+							 maxPhiModulesPerLayer*m_mapSplit, -0.5, maxPhiModulesPerLayer-0.5,
+							 100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
 	RegisterHisto(al_mon,m_sct_b_Oxresxvsmodetaphi_3ds[iLayer]);
-	m_sct_b_Oyresxvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_Oyresxvsmodetaphi_3d").c_str(),("Y_Overlap Residual X Distbn vs Module Eta-Phi-ID SCT Barrel L0"+intToString(iLayer)+";Mod Eta; Mod Phi").c_str(),EtaModules*m_mapSplit,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer*m_mapSplit,0,maxPhiModulesPerLayer,100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
+
+	m_sct_b_Oyresxvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_Oyresxvsmodetaphi_3d").c_str(),
+							 ("Y_Overlap Residual X Distbn vs Module Eta-Phi-ID SCT Barrel L0"+intToString(iLayer)+";Mod Eta; Mod Phi").c_str(),
+							 EtaModules*m_mapSplit, -(EtaModules/2.),(EtaModules/2.),
+							 maxPhiModulesPerLayer*m_mapSplit, -0.5, maxPhiModulesPerLayer-0.5,
+							 100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
 	RegisterHisto(al_mon,m_sct_b_Oyresxvsmodetaphi_3ds[iLayer]);
       }
 
@@ -4379,7 +4443,11 @@ void IDAlignMonResiduals::MakeSCTBarrelHistograms(MonGroup& al_mon){
       			 
       if (m_extendedPlots){
 
-	  m_sct_b_s0_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_s0_xresvsmodetaphi_3d").c_str(),("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+" Side 0;Mod Eta; Mod Phi").c_str(),EtaModules,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer,-0.5,maxPhiModulesPerLayer-0.5,100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
+	  m_sct_b_s0_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_s0_xresvsmodetaphi_3d").c_str(),
+							    ("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+" Side 0;Mod Eta; Mod Phi").c_str(),
+							    EtaModules, -(EtaModules/2.), (EtaModules/2.),
+							    maxPhiModulesPerLayer,-0.5,maxPhiModulesPerLayer-0.5, 
+							    100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
       RegisterHisto(al_mon,m_sct_b_s0_xresvsmodetaphi_3ds[iLayer]);
 
       m_sct_b_s1_xresvsmodetaphi_3ds.push_back(new TH3F(("sct_b"+intToString(iLayer)+"_s1_xresvsmodetaphi_3d").c_str(),("X Residual Distbn vs Module Eta-Phi-ID SCT Barrel L"+intToString(iLayer)+" Side 1;Mod Eta; Mod Phi").c_str(),EtaModules,-(EtaModules/2.),(EtaModules/2.),maxPhiModulesPerLayer,-0.5,maxPhiModulesPerLayer-0.5,100*m_FinerBinningFactor,m_minSCTResFillRange,m_maxSCTResFillRange));
@@ -4602,7 +4670,10 @@ void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon){
 	      RegisterHisto(al_mon,m_sct_eca_s1_biased_xresvsmodetaphi_3ds[iWheel]);
 
 	      //unbiased residual vs pT
-	      m_sct_eca_residualsx_pt.push_back(new TH2F(("sct_eca_d"+intToString(iWheel)+"_residualx_pt").c_str(),("X Residual Vs Pt SCT Endcap A Disk"+intToString(iWheel)+";Track pT (GeV);SCT Res (mm)").c_str(),m_nBinsPtRange,-m_PtRange,m_PtRange,100*m_FinerBinningFactor,m_minSiResFillRange,m_maxSiResFillRange)); 
+	      m_sct_eca_residualsx_pt.push_back(new TH2F(("sct_eca_d"+intToString(iWheel)+"_residualx_pt").c_str(),
+							 ("Residual vs p_{T} SCT Endcap A Disk"+intToString(iWheel)+";Track p_{T} [GeV]; SCT Res [mm]").c_str(),
+							 m_nBinsPtRange, -m_PtRange, m_PtRange,
+							 100*m_FinerBinningFactor, m_minSiResFillRange,m_maxSiResFillRange)); 
 	      RegisterHisto(al_mon,m_sct_eca_residualsx_pt[iWheel]);
 
 	      //unbiased residual vs QoverP2
@@ -4829,6 +4900,8 @@ void IDAlignMonResiduals::MakeSCTEndcapsHistograms(MonGroup& al_mon){
       RegisterHisto(al_mon,m_hiterror_sct_ec_WideRange);
     }
 
+
+  return;
 }
 
 
@@ -4892,9 +4965,9 @@ void IDAlignMonResiduals::MakeTRTBarrelHistograms(MonGroup& al_mon){
 	
   for(unsigned int side = 0; side<3; ++side){
     /** Residual in the TRT Barrel */ 
-    m_trt_b_hist->residualR[side] = MakeHist("trt_b_residualR"+sideName[side],"UnBiased Residual for the TRT Barrel "+sideName[side],500, m_minTRTResWindow, m_maxTRTResWindow, "Residual (mm)","Entries");
+    m_trt_b_hist->residualR[side] = MakeHist("trt_b_residualR"+sideName[side],"UnBiased Residual for the TRT Barrel "+sideName[side],100, m_minTRTResWindow, m_maxTRTResWindow, "Residual (mm)","Entries");
     RegisterHisto(al_mon,m_trt_b_hist->residualR[side]);
-    m_trt_b_hist->residualR_notube[side] = MakeHist("trt_b_residualR"+sideName[side]+"_notube","UnBiased Residual (notube) for the TRT Barrel "+sideName[side],500, m_minTRTResWindow, m_maxTRTResWindow, "Residual (mm)","Entries");
+    m_trt_b_hist->residualR_notube[side] = MakeHist("trt_b_residualR"+sideName[side]+"_notube","UnBiased Residual (notube) for the TRT Barrel "+sideName[side],100, m_minTRTResWindow, m_maxTRTResWindow, "Residual (mm)","Entries");
     RegisterHisto(al_mon,m_trt_b_hist->residualR_notube[side]);
 		
     /** Pull in the TRT Barrel */
@@ -4973,26 +5046,29 @@ void IDAlignMonResiduals::MakeTRTBarrelHistograms(MonGroup& al_mon){
 	RegisterHisto(al_mon,m_trt_b_hist->resVsPhiZ[side][lay]);
 
 	/** Average residuals vs PhiSector & Z for 3 Barrel Layers (A and C, A Only, C Only)*/
-	m_trt_b_hist->aveResVsPhiZ[side][lay] = MakeHist("trt_b_aveResVsPhiZ_l"+intToString(lay)+sideName[side],"Average Residual vs Phi Sector & Z for TRT Barrel Modules in layer "+intToString(lay)+sideName[side],60,-712,712,32,0,32,"z [mm]","#phi Sector");
+	m_trt_b_hist->aveResVsPhiZ[side][lay] = MakeHist("trt_b_aveResVsPhiZ_l"+intToString(lay)+sideName[side],"Average Residual vs Phi Sector & Z for TRT Barrel Modules in layer "+intToString(lay)+sideName[side],60,-712,712, 32, -0.5, 31.5,"z [mm]","#phi Sector");
 	RegisterHisto(al_mon,m_trt_b_hist->aveResVsPhiZ[side][lay]);
 	
 	/** Residual RMS vs PhiSector & Z for 3 Barrel Layers (A and C, A Only, C Only)*/
-	m_trt_b_hist->rmsResVsPhiZ[side][lay] = MakeHist("trt_b_rmsResVsPhiZ_l"+intToString(lay)+sideName[side],"Residual RMS vs Phi Sector & Z for TRT Barrel Modules in layer "+intToString(lay)+sideName[side],60,-712,712,32,0,32,"z [mm]","#phi Sector");
+	m_trt_b_hist->rmsResVsPhiZ[side][lay] = MakeHist("trt_b_rmsResVsPhiZ_l"+intToString(lay)+sideName[side],"Residual RMS vs Phi Sector & Z for TRT Barrel Modules in layer "+intToString(lay)+sideName[side],60,-712,712, 32,-0.5 ,31.5,"z [mm]","#phi Sector");
 	RegisterHisto(al_mon,m_trt_b_hist->rmsResVsPhiZ[side][lay]);
 	
 	/** Residuals vs PhiSector & Eta for 3 Barrel Layers (A and C, A Only, C Only)*/
-	m_trt_b_hist->resVsPhiEta[side][lay] = new TH3F(("trt_b_resVsPhiEta_l"+intToString(lay)+sideName[side]).c_str(),("Residual Distribution vs Phi Sector & Eta for TRT Barrel Modules in layer "+intToString(lay)+sideName[side]).c_str(),60,-1.1,1.1,32,0,32,50*m_FinerBinningFactor,m_minTRTResWindow,m_maxTRTResWindow);
+	m_trt_b_hist->resVsPhiEta[side][lay] = new TH3F(("trt_b_resVsPhiEta_l"+intToString(lay)+sideName[side]).c_str(),
+							("Residual vs Phi Sector & Eta for TRT Barrel Modules in layer "+intToString(lay)+sideName[side]+";#eta;Sector;Residual [mm]").c_str(), 
+							60, -1.1, 1.1, 32, -0.5, 31.5, 50*m_FinerBinningFactor,m_minTRTResWindow,m_maxTRTResWindow);
 	RegisterHisto(al_mon,m_trt_b_hist->resVsPhiEta[side][lay]);
 	
 	/** Average residuals vs PhiSector & Eta for 3 Barrel Layers (A and C, A Only, C Only)*/
-	m_trt_b_hist->aveResVsPhiEta[side][lay] = MakeHist("trt_b_aveResVsPhiEta_l"+intToString(lay)+sideName[side],"Average Residual vs Phi Sector & Eta for TRT Barrel Modules in layer "+intToString(lay)+sideName[side],60,-1.1,1.1,32,0,32,"#eta","#phi Sector");
+	m_trt_b_hist->aveResVsPhiEta[side][lay] = MakeHist("trt_b_aveResVsPhiEta_l"+intToString(lay)+sideName[side],
+							   "Average Residual vs Phi Sector & Eta for TRT Barrel Modules in layer "+intToString(lay)+sideName[side], 
+							   60,-1.1,1.1, 32, -0.5, 31.5,"#eta","#phi Sector");
 	RegisterHisto(al_mon,m_trt_b_hist->aveResVsPhiEta[side][lay]);
 
 	/** Residual RMS vs PhiSector & Eta for 3 Barrel Layers (A and C, A Only, C Only)*/
-	m_trt_b_hist->rmsResVsPhiEta[side][lay] = MakeHist("trt_b_rmsResVsPhiEta_l"+intToString(lay)+sideName[side],"Residual RMS vs Phi Sector & Eta for TRT Barrel Modules in layer "+intToString(lay)+sideName[side],60,-1.1,1.1,32,0,32,"#eta","#phi Sector");
+	m_trt_b_hist->rmsResVsPhiEta[side][lay] = MakeHist("trt_b_rmsResVsPhiEta_l"+intToString(lay)+sideName[side],"Residual RMS vs Phi Sector & Eta for TRT Barrel Modules in layer "+intToString(lay)+sideName[side], 60, -1.1, 1.1, 32, -0.5, 31.5, "#eta","#phi Sector");
 	RegisterHisto(al_mon,m_trt_b_hist->rmsResVsPhiEta[side][lay]);
       } // extendedPlots
-      
     } 
     
     if (m_extendedPlots)
@@ -5052,8 +5128,7 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
       m_trt_ec_hist->pullR_notube_pt[endcap] = MakeHist("trt_ec_pullRnotube_pt_"+endcapName[endcap],"UnBiased Pull vs pT for the TRT (no tube hits)"+endcapName[endcap],m_nBinsPtRange,-m_PtRange,m_PtRange,100,-m_RangeOfPullHistos,m_RangeOfPullHistos, "Track p_{T} [GeV]","Pull");
       RegisterHisto(al_mon,m_trt_ec_hist->pullR_notube_pt[endcap]);  
 
-      /** Residuals and pulls vs pt per wheel */
-      // SALVA
+      /** Residuals vs pt per wheel */
       for (int iWheel=0; iWheel < 40; iWheel++) {
 	m_trt_ec_hist->residualR_ptwheel[endcap][iWheel] = MakeProfile("trt_"+endcapName[endcap]+"_resvspt_wheel_"+intToString(iWheel),
 								       "Residual vs p_{T} for TRT "+endcapName[endcap]+" "+intToString(iWheel),
@@ -5105,9 +5180,11 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
     
     for(unsigned int ring=0; ring<totalRings; ++ring){//The "extra one is the total"
       if(!ring){
-	m_trt_ec_hist->residualR[endcap][ring] = MakeHist("trt_ec_residualR_"+endcapName[endcap],"UnBiased Residual for TRT "+endcapName[endcap],500,m_minTRTResWindow,m_maxTRTResWindow,"Residual (mm)","Entries");
+	m_trt_ec_hist->residualR[endcap][ring] = MakeHist("trt_ec_residualR_"+endcapName[endcap],"UnBiased Residual for TRT "+endcapName[endcap],
+							  100,m_minTRTResWindow,m_maxTRTResWindow,"Residual (mm)","Entries");
 	RegisterHisto(al_mon,m_trt_ec_hist->residualR[endcap][ring]);  
-	m_trt_ec_hist->residualR_notube[endcap][ring] = MakeHist("trt_ec_residualR_notube"+endcapName[endcap],"UnBiased Residual (notube) for TRT "+endcapName[endcap],500,m_minTRTResWindow,m_maxTRTResWindow,"Residual (mm)","Entries");
+	m_trt_ec_hist->residualR_notube[endcap][ring] = MakeHist("trt_ec_residualR_notube"+endcapName[endcap],"UnBiased Residual (notube) for TRT "+endcapName[endcap],
+								 100,m_minTRTResWindow,m_maxTRTResWindow,"Residual (mm)","Entries");
 	RegisterHisto(al_mon,m_trt_ec_hist->residualR_notube[endcap][ring]);  
 	m_trt_ec_hist->pullR[endcap][ring] = MakeHist("trt_ec_pullR_"+endcapName[endcap],"Pull for TRT "+endcapName[endcap],100,-m_RangeOfPullHistos, m_RangeOfPullHistos,"Pull","Entries");
 	RegisterHisto(al_mon,m_trt_ec_hist->pullR[endcap][ring]);  
@@ -5274,17 +5351,14 @@ void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_o
     for(int lay=0; lay<3; ++lay){
       if(lay == m_layer_or_wheel){
 	m_trt_b_hist->lrOverPhiVsStrawLayer[side] -> Fill(numStrawLayers[lay]+m_straw_layer, LRcorrect, TrkWeight);
-	if(m_extendedPlots && hitZ!=-999){
-	  m_trt_b_hist->resVsPhiZ[side][lay]->Fill(hitZ,m_phi_module,residualR,TrkWeight);
-	  m_trt_b_hist->resVsPhiEta[side][lay]->Fill(trketa,m_phi_module,residualR,TrkWeight);
-	}
-	if (m_extendedPlots)
-	  {
-	    for(int m_testPhi=0; m_testPhi < 32; ++m_testPhi ){
-	      if(m_phi_module == m_testPhi)
-		m_trt_b_hist->aveResVsStrawLayerStackLevel[side][m_testPhi] -> Fill(numStrawLayers[lay]+m_straw_layer, residualR, TrkWeight);
-	    }
+	if (m_extendedPlots)               m_trt_b_hist->resVsPhiEta[side][lay]->Fill(trketa,m_phi_module, residualR, TrkWeight);
+	if (m_extendedPlots && hitZ!=-999) m_trt_b_hist->resVsPhiZ[side][lay]  ->Fill(hitZ,  m_phi_module, residualR, TrkWeight);
+	if (m_extendedPlots) {
+	  for(int m_testPhi=0; m_testPhi < 32; ++m_testPhi ){
+	    if(m_phi_module == m_testPhi)
+	      m_trt_b_hist->aveResVsStrawLayerStackLevel[side][m_testPhi] -> Fill(numStrawLayers[lay]+m_straw_layer, residualR, TrkWeight);
 	  }
+	}
 				
 	for(unsigned int position=0; position<5;++position){
 	  bool doFillPosition = false;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
index 04201af6aaa283caa7b7e87bff87dfae9504284d..16105abb4b21e42ccdd0cf0a284ef33dfcba787f 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
@@ -592,10 +592,14 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   //Pixel Histograms
   TH1F* m_pix_b_residualx;
   TH1F* m_pix_b_residualy;
+  TH1F* m_oldpix_b_residualx;
+  TH1F* m_oldpix_b_residualy;
   TH1F* m_pix_b_residualx_fine;
   TH1F* m_pix_b_residualy_fine;
   TH1F* m_pix_b_biased_residualx;
   TH1F* m_pix_b_biased_residualy;
+  TH1F* m_pix_ec_residualx;
+  TH1F* m_pix_ec_residualy;
   TH1F* m_pix_eca_residualx;
   TH1F* m_pix_eca_residualy;
   TH1F* m_pix_ecc_residualx;
@@ -605,6 +609,11 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   TH1F* m_pix_ecc_residualx_fine;
   TH1F* m_pix_ecc_residualy_fine;
 
+  TH1F* m_pix_b0_planars_residualx; // IBL planars
+  TH1F* m_pix_b0_planars_residualy;
+  TH1F* m_pix_b0_3D_residualx; // IBL 3D
+  TH1F* m_pix_b0_3D_residualy;
+
   TH1F* m_pix_eca_pullx;
   TH1F* m_pix_eca_pully;
   TH1F* m_pix_ecc_pullx;
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py
index 08145ca8dfcfeffb66a46cac0d97bb9468c959ce..4a37939b3106fcfe739eb42b9454d8ed632be8a5 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py
@@ -534,6 +534,9 @@ def getGridSubmissionCommand(runNumber, infoFromAMI):
     if (m_userFilesPerJob > 0 ):
         theOptions = "%s --nFilesPerJob %d" % (theOptions, m_userFilesPerJob)
 
+    if (m_userFiles > 0 ):
+        theOptions = "%s --nFiles %d" % (theOptions, m_userFiles)
+
     theExtraOptions = "" 
     if (len(m_workDirPlatform)>0): 
         theExtraOptions = "--cmtConfig %s --excludedSite=ANALY_HPC2N,ANALY_RHUL_SL6,ANALY_JINR_MIG,ANALY_IHEP,ANALY_JINR,ANALY_CSCS-HPC" %m_workDirPlatform 
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/FourMuonEvent.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/FourMuonEvent.h
index b2fed6e387994ed217a90f408bc9320a48f7d9f1..bd20a0409f8958a55fc2c88bb186bc432a5d82a1 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/FourMuonEvent.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/FourMuonEvent.h
@@ -20,7 +20,10 @@
 
 #include "xAODEgamma/Electron.h"
 #include "xAODEgamma/ElectronContainer.h"
-//==============================================================================
+
+//-
+#include "AthenaBaseComps/AthAlgorithm.h"
+///==============================================================================
 // Forward class declarations...
 //==============================================================================
 class TrackParticle;
@@ -60,7 +63,7 @@ class FourMuonEvent : public EventAnalysis
     NUM_TYPES
   };
 
-  void Init(); 
+  void Init();  
   bool Reco();
 
   // Public access methods
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h
index fc23050e669d0975976113a2339f2c9695ce006a..af976d8286fcd9cab35b29f166ef3f15b431b06f 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h
@@ -10,14 +10,11 @@
 #include "InDetPerformanceMonitoring/FourMuonEvent.h"
 #include "InDetPerformanceMonitoring/EventAnalysis.h"
 
-//#include "TrkFitterInterfaces/ITrackFitter.h"
 #include "xAODTruth/TruthVertex.h"
 #include "xAODTruth/TruthParticle.h"
-//#include "xAODTruth/xAODTruthHelpers.h"
 #include "xAODTruth/TruthParticleContainer.h"
 #include "ITrackToVertex/ITrackToVertex.h"
 
-
 #include "GeneratorObjects/xAODTruthParticleLink.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "xAODEgamma/Electron.h"
@@ -38,7 +35,6 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "TrkExInterfaces/IExtrapolator.h"
 
-
 class IegammaTrkRefitterTool;
 class IBeamCondSvc;
 
@@ -139,10 +135,10 @@ class IDPerfMonZmumu : public AthAlgorithm
   std::string                     m_refit1TreeName;        //Refit ID Tracks
   std::string                     m_refit2TreeName;        //Refit ID Tracks
   std::string                     m_truthTreeName;         //Truth Tracks
-  //  std::string                     m_meStacoTreeName;       //Extrapolated Staco not existent in xAOD anymore
-  std::string                     m_combTreeName;     //Combined Staco
+  std::string                     m_combTreeName;          //Combined Staco
   std::string                     m_combMuidTreeName;      //Combined Muid
-  std::string                     m_FourMuTreeName;      //Combined Muid
+  std::string                     m_FourMuTreeName;        //Four lepton tree
+
   //!< validation tree description - second argument in TTree
   std::string                     m_ValidationTreeDescription;
   //!< stream/folder to for the TTree to be written out
@@ -151,7 +147,6 @@ class IDPerfMonZmumu : public AthAlgorithm
   std::string                     m_refit1TreeFolder;
   std::string                     m_refit2TreeFolder;
   std::string                     m_truthTreeFolder;
-  //  std::string                     m_meStacoTreeFolder; // not existent in xAOD anymore
   std::string                     m_combTreeFolder;
   std::string                     m_combMuidTreeFolder;
   std::string                     m_FourMuTreeFolder;
@@ -166,7 +161,6 @@ class IDPerfMonZmumu : public AthAlgorithm
   TTree*                          m_refit1Tree;
   TTree*                          m_refit2Tree;
   TTree*                          m_truthTree;
-  TTree*                          m_meStacoTree;
   TTree*                          m_combTree;
   TTree*                          m_combMuidTree;
   TTree*                          m_FourMuTree;
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/InDetAlign_Geometry_Setup.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/InDetAlign_Geometry_Setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..e791a62d95a2e090beb8e5714318c738f67bd583
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/InDetAlign_Geometry_Setup.py
@@ -0,0 +1,723 @@
+##############################
+#
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+#############################
+########################################################################################
+#
+#  This script sets up the geometry manager tool and the database tool for
+#  the alignment framework based on the alignment requirements.
+#
+#  As a result three tools are setup which can be used in the definition of
+#  Trk::AlignAlg and some supporting tools :
+#
+#    alignModuleTool
+#    trkAlignGeoManagerTool
+#    trkAlignDBTool
+#
+#  Started:  Daniel Kollar <daniel.kollar@cern.ch>  (09/2009)
+#
+########################################################################################
+## common options
+
+
+newInDetAlignGeo_Options = {
+    "outputLevel" : DEBUG                 #  output level for log messages for all tools and algs
+    ,"writeTextFiles" :  True            #  whether to write out text files with final constants
+    ,"siliconTextFile" :  "OutputSiAlignment.txt"  #  name of the output text file with Si constants
+    ,"trtTextFile" :  "OutputTRTAlignment.txt"     #  name of the output text file with TRT constants
+    ,"updateConstants" : True            #  whether to update the constants in the DB
+    ,"writeOldConstants" : True          #  whether to write out text files with initial constants
+    ,"alignInDet" :  True                #  whether to align the full Inner Detector
+    ,"alignSilicon" :  True              #  whether to align Si
+    ,"alignPixel" :  True                #  whether to align Pixel
+    ,"pixelAlignDBM" :  False            #  whether to align DBM instead of actual Pixel detector
+    ,"alignSCT" :  True                  #  whether to align SCT
+    ,"alignTRT" :  True                  #  whether to align TRT
+    ,"doModuleSelection" : False         #  whether to align only selected modules
+    ,"moduleSelection" : []              #  identifiers of selected modules
+}
+
+print " <NewInDetAlignGeometrySetup> ** START **"
+print " <NewInDetAlignGeometrySetup> ** updateConstants: ", newInDetAlignGeo_Options["updateConstants"]
+print " <NewInDetAlignGeometrySetup> ** doModuleSelection: ", newInDetAlignGeo_Options["doModuleSelection"]
+print " <NewInDetAlignGeometrySetup> ** writeTextFiles: ", newInDetAlignGeo_Options["writeTextFiles"]
+
+for var in newInDetAlignGeo_Options:
+    if var in dir():
+        newInDetAlignGeo_Options[var] = eval(var)
+
+########################################################################################
+## TRT Alignment Options
+trtAlignment_Options = {
+    # setup alignment geometry for TRT
+    # if level for Barrel or Endcap is set to -1 then it is set to the level
+    # set up for the whole TRT
+    "trtAlignmentLevelBarrel" : -1       #  alignment level for the TRT barrel
+    ,"trtAlignmentLevelEndcaps" : -1     #  alignment level for the TRT endcaps
+    ,"trtAlignmentLevel" : 1             #  alignment level for the whole TRT
+
+    # switch on or off of the whole TRT barrel or both end-caps
+    ,"trtAlignBarrel" : True             #  whether to align TRT barrel
+    ,"trtAlignEndcaps" : True            #  whether to align TRT endcap
+
+    # switch on or off the alignment of the individual degrees-of-freedom
+    ,"trtAlignBarrelX" : True            #  whether to align TRT barrel wrt. translations along X
+    ,"trtAlignBarrelY" : True            #  whether to align TRT barrel wrt. translations along Y
+    ,"trtAlignBarrelZ" : True            #  whether to align TRT barrel wrt. translations along Z
+    ,"trtAlignBarrelRotX" : True         #  whether to align TRT barrel wrt. rotations around X
+    ,"trtAlignBarrelRotY" : True         #  whether to align TRT barrel wrt. rotations around Y
+    ,"trtAlignBarrelRotZ" : True         #  whether to align TRT barrel wrt. rotations around Z
+    ,"trtAlignEndcapX" : True            #  whether to align TRT endcaps wrt. translations along X
+    ,"trtAlignEndcapY" : True            #  whether to align TRT endcaps wrt. translations along Y
+    ,"trtAlignEndcapZ" : True            #  whether to align TRT endcaps wrt. translations along Z
+    ,"trtAlignEndcapRotX" : True         #  whether to align TRT endcaps wrt. rotations around X
+    ,"trtAlignEndcapRotY" : True         #  whether to align TRT endcaps wrt. rotations around Y
+    ,"trtAlignEndcapRotZ" : True         #  whether to align TRT endcaps wrt. rotations around Z
+
+   # sigma for a given DoF is used for scaling for vector and matrix entries
+   # for that DoF before solving
+    ,"trtSetSigmaBarrelX" : 1            #  scaling constant for translations along X in TRT barrel
+    ,"trtSetSigmaBarrelY" : 1            #  scaling constant for translations along Y in TRT barrel
+    ,"trtSetSigmaBarrelZ" : 1            #  scaling constant for translations along Z in TRT barrel
+    ,"trtSetSigmaBarrelRotX" : 0.001     #  scaling constant for rotations around X in TRT barrel
+    ,"trtSetSigmaBarrelRotY" : 0.001     #  scaling constant for rotations around Y in TRT barrel
+    ,"trtSetSigmaBarrelRotZ" : 0.001     #  scaling constant for rotations around Z in TRT barrel
+    ,"trtSetSigmaEndcapX" : 1            #  scaling constant for translations along X in TRT endcaps
+    ,"trtSetSigmaEndcapY" : 1            #  scaling constant for translations along Y in TRT endcaps
+    ,"trtSetSigmaEndcapZ" : 1            #  scaling constant for translations along Z in TRT endcaps
+    ,"trtSetSigmaEndcapRotX" : 0.001     #  scaling constant for rotations around X in TRT endcaps
+    ,"trtSetSigmaEndcapRotY" : 0.001     #  scaling constant for rotations around Y in TRT endcaps
+    ,"trtSetSigmaEndcapRotZ" : 0.001     #  scaling constant for rotations around Z in TRT endcaps
+
+    # soft cut for a given DoF is multiplied by the overall soft-mode-cut
+    # which is set in the NewInDetAlignAlgs.py and then added to the
+    # diagonal element of the matrix for that DoF;
+    # the addition happens after the scaling
+    ,"trtSetSoftCutBarrelX" : 0.1          #  soft cut for translations along X in TRT barrel
+    ,"trtSetSoftCutBarrelY" : 0.1          #  soft cut for translations along Y in TRT barrel
+    ,"trtSetSoftCutBarrelZ" : 0.1        #  soft cut for translations along Z in TRT barrel
+    ,"trtSetSoftCutBarrelRotX" : 0.05       #  soft cut for rotations around X in TRT barrel
+    ,"trtSetSoftCutBarrelRotY" : 0.05       #  soft cut for rotations around Y in TRT barrel
+    ,"trtSetSoftCutBarrelRotZ" : 0.05       #  soft cut for rotations around Z in TRT barrel
+    ,"trtSetSoftCutEndcapX" : 0.1          #  soft cut for translations along X in TRT endcaps
+    ,"trtSetSoftCutEndcapY" : 0.1          #  soft cut for translations along Y in TRT endcaps
+    ,"trtSetSoftCutEndcapZ" : 0.001          #  soft cut for translations along Z in TRT endcaps
+    ,"trtSetSoftCutEndcapRotX" : 0.05       #  soft cut for rotations around X in TRT endcaps
+    ,"trtSetSoftCutEndcapRotY" : 0.05       #  soft cut for rotations around Y in TRT endcaps
+    ,"trtSetSoftCutEndcapRotZ" : 0.05       #  soft cut for rotations around Z in TRT endcaps
+
+    #trt module selection
+    ,"trtAlignBarrelPhiSectors" : []     #  selection of phi sectors in the TRT barrel
+    ,"trtAlignBarrelLayers" : []         #  selection of layers in the TRT barrel
+    ,"trtAlignEndcapPhiSectors" : []     #  selection of phi sectors in the TRT endcap
+    ,"trtAlignEndcapWheels" : []         #  selection of wheels in the TRT endcap
+    ,"trtAlignSingleEndcap" : 0          #  Align single endcap option (-2 is C, 2 is A, 0 is both (default))
+    #Level 3 module selection
+}
+
+for var in trtAlignment_Options:
+  if var in dir():
+    trtAlignment_Options[var] = eval(var)
+
+#
+# The options for Pixel and SCT are analogical to those for TRT.
+#
+########################################################################################
+## Pixel Alignment Options
+pixelAlignment_Options = {
+    "pixelAlignmentLevelBarrel" : -1
+    ,"pixelAlignmentLevelEndcaps": -1
+    ,"pixelAlignmentLevel" : 1
+#   ,"pixelAlignDBM" :  False            #  whether to align DBM instead of actual Pixel detector
+        ,"pixelAlignBarrel" : True
+    ,"pixelAlignEndcaps" : True
+    ,"pixelAlignBarrelX" : True
+    ,"pixelAlignBarrelY" : True
+    ,"pixelAlignBarrelZ" : True
+    ,"pixelAlignBarrelRotX" : True
+    ,"pixelAlignBarrelRotY" : True
+    ,"pixelAlignBarrelRotZ" : True
+    ,"pixelAlignBarrelBowX" : False
+    ,"pixelAlignEndcapX" : True
+    ,"pixelAlignEndcapY" : True
+    ,"pixelAlignEndcapZ" : True
+    ,"pixelAlignEndcapRotX" : True
+    ,"pixelAlignEndcapRotY" : True
+    ,"pixelAlignEndcapRotZ" : True
+    ,"pixelSetSigmaBarrelX" : 1
+    ,"pixelSetSigmaBarrelY" : 1
+    ,"pixelSetSigmaBarrelZ" : 1
+    ,"pixelSetSigmaBarrelRotX" : 0.001
+    ,"pixelSetSigmaBarrelRotY" : 0.001
+    ,"pixelSetSigmaBarrelRotZ" : 0.001
+    ,"pixelSetSigmaEndcapX" : 1
+    ,"pixelSetSigmaEndcapY" : 1
+    ,"pixelSetSigmaEndcapZ" : 1
+    ,"pixelSetSigmaEndcapRotX" : 0.001
+    ,"pixelSetSigmaEndcapRotY" : 0.001
+    ,"pixelSetSigmaEndcapRotZ" : 0.001
+    ,"pixelSetSoftCutBarrelX" : 0.02
+    ,"pixelSetSoftCutBarrelY" : 0.02
+    ,"pixelSetSoftCutBarrelZ" : 0.02
+    ,"pixelSetSoftCutBarrelRotX" : 0.05
+    ,"pixelSetSoftCutBarrelRotY" : 0.05
+    ,"pixelSetSoftCutBarrelRotZ" : 0.05
+    ,"pixelSetSoftCutEndcapX" : 0.02
+    ,"pixelSetSoftCutEndcapY" : 0.02
+    ,"pixelSetSoftCutEndcapZ" : 0.02
+    ,"pixelSetSoftCutEndcapRotX" : 0.05
+    ,"pixelSetSoftCutEndcapRotY" : 0.05
+    ,"pixelSetSoftCutEndcapRotZ" : 0.05
+}
+
+for var in pixelAlignment_Options:
+  if var in dir():
+    pixelAlignment_Options[var] = eval(var)
+
+## SCT alignment Options
+sctAlignment_Options = {
+    "sctAlignmentLevelBarrel" : -1
+    ,"sctAlignmentLevelEndcaps" : -1
+    ,"sctAlignmentLevel" : 1
+    ,"sctAlignBarrel" : False
+    ,"sctAlignEndcaps" : True
+    ,"sctAlignBarrelX" : True
+    ,"sctAlignBarrelY" : True
+    ,"sctAlignBarrelZ" : True
+    ,"sctAlignBarrelRotX" : True
+    ,"sctAlignBarrelRotY" : True
+    ,"sctAlignBarrelRotZ" : True
+    ,"sctAlignEndcapX" : True
+    ,"sctAlignEndcapY" : True
+    ,"sctAlignEndcapZ" : True
+    ,"sctAlignEndcapRotX" : True
+    ,"sctAlignEndcapRotY" : True
+    ,"sctAlignEndcapRotZ" : True
+    ,"sctSetSigmaBarrelX" : 1
+    ,"sctSetSigmaBarrelY" : 1
+    ,"sctSetSigmaBarrelZ" : 1
+    ,"sctSetSigmaBarrelRotX" : 0.001
+    ,"sctSetSigmaBarrelRotY" : 0.001
+    ,"sctSetSigmaBarrelRotZ" : 0.001
+    ,"sctSetSigmaEndcapX" : 1
+    ,"sctSetSigmaEndcapY" : 1
+    ,"sctSetSigmaEndcapZ" : 1
+    ,"sctSetSigmaEndcapRotX" : 0.001
+    ,"sctSetSigmaEndcapRotY" : 0.001
+    ,"sctSetSigmaEndcapRotZ" : 0.001
+    ,"sctSetSoftCutBarrelX" : 0.05
+    ,"sctSetSoftCutBarrelY" : 0.05
+    ,"sctSetSoftCutBarrelZ" : 0.05
+    ,"sctSetSoftCutBarrelRotX" : 0.05
+    ,"sctSetSoftCutBarrelRotY" : 0.05
+    ,"sctSetSoftCutBarrelRotZ" : 0.05
+    ,"sctSetSoftCutEndcapX" : 0.05
+    ,"sctSetSoftCutEndcapY" : 0.05
+    ,"sctSetSoftCutEndcapZ" : 0.005
+    ,"sctSetSoftCutEndcapRotX" : 0.005
+    ,"sctSetSoftCutEndcapRotY" : 0.05
+    ,"sctSetSoftCutEndcapRotZ" : 0.05
+}
+
+for var in sctAlignment_Options:
+  if var in dir():
+    sctAlignment_Options[var] = eval(var)
+
+## Silicon alignment Options
+siAlignment_Options = {
+    "siAlignmentLevel" : -1
+    ,"siAlignX" : True
+    ,"siAlignY" : True
+    ,"siAlignZ" : True
+    ,"siAlignRotX" : True
+    ,"siAlignRotY" : True
+    ,"siAlignRotZ" : True
+}
+
+for var in siAlignment_Options:
+  if var in dir():
+    print  siAlignment_Options[var], " " ,  eval(var)
+    siAlignment_Options[var] = eval(var)
+
+## InDet alignment Options
+## -1 - use standalone Silicon and TRT setup
+##  0 - L0
+indetAlignment_Options = {
+    "indetAlignmentLevel" : -1
+    ,"indetAlignX" : True
+    ,"indetAlignY" : True
+    ,"indetAlignZ" : True
+    ,"indetAlignRotX" : True
+    ,"indetAlignRotY" : True
+    ,"indetAlignRotZ" : True
+}
+
+for var in indetAlignment_Options:
+  if var in dir():
+    indetAlignment_Options[var] = eval(var)
+
+################################################################################
+####
+####    Check which geometry managers need to be set up
+####
+# we need the silicon geometry manager when both Pixel and SCT are to be aligned
+# but we might also need it when the whole Inner Detector is to be aligned
+# in the later one of Pixel or SCT is in principle enough
+if newInDetAlignGeo_Options["alignPixel"] and newInDetAlignGeo_Options["alignSCT"]:
+    print " <NewInDetAlignGeometrySetup> The silicon is ON"
+    newInDetAlignGeo_Options["alignSilicon"] = True
+else:
+    print " <NewInDetAlignGeometrySetup> The silicon is OFF"
+    newInDetAlignGeo_Options["alignSilicon"] = False
+
+#
+# for level 0 we don't need standalone Pixel and SCT geometry managers
+if (siAlignment_Options["siAlignmentLevel"]==0):
+    print " <NewInDetAlignGeometrySetup> siAlignmentLevel = 0 !! -> switch off alignPixel and alignSCT"
+    newInDetAlignGeo_Options["alignPixel"] = False
+    newInDetAlignGeo_Options["alignSCT"] = False
+#
+# similar to the silicon case above, we need the inner detector geometry manager
+# when both Silicon and TRT are to be aligned
+# but we might also need it when the whole ATLAS (?) is to be aligned, in the
+# later one of Silicon or TRT is in principle enough
+if newInDetAlignGeo_Options["alignTRT"] and newInDetAlignGeo_Options["alignSilicon"]:
+    newInDetAlignGeo_Options["alignInDet"] = True
+else:
+    newInDetAlignGeo_Options["alignInDet"] = False
+#
+# Inner Detector alignment level
+# for alignment level -1 the level is set up separately
+# for Silicon and TRT according to their setup
+
+#
+# for level 0 we don't need standalone Silicon and TRT geometry managers
+if (indetAlignment_Options["indetAlignmentLevel"] ==0):
+    print "<NewIndetAlignGeometry> user indetAlignmentLevel = 0 --> NO ALIGNMENT "
+    newInDetAlignGeo_Options["alignSilicon"] = False
+    newInDetAlignGeo_Options["alignTRT"] = False
+
+if (not newInDetAlignGeo_Options["alignTRT"] or not newInDetAlignGeo_Options["alignSCT"] or not newInDetAlignGeo_Options["alignPixel"]):
+    newInDetAlignGeo_Options["alignInDet"] = False
+if (not newInDetAlignGeo_Options["alignSCT"] or not newInDetAlignGeo_Options["alignPixel"]):
+    newInDetAlignGeo_Options["alignSilicon"] = False
+
+
+
+ToolSvc = Service('ToolSvc')
+
+#
+# AlignModuleTool
+#
+# If we're running sct endcap alignment or TRT L3, we need to load
+# ID specific AlignModuleTool, but we rather should do it always just in case
+# there are changes in the future. It won't hurt anything.
+from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__InDetAlignModuleTool
+alignModuleTool = InDet__InDetAlignModuleTool(name = "InDetAlignModuleTool")
+alignModuleTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
+ToolSvc += alignModuleTool
+print alignModuleTool
+
+########################################################################################
+####
+####    Pixel Alignment Geometry Setup
+####
+
+#
+print " <NewInDetAlignGeometrySetup> setting up Pixel Alignment_Options --> PixelGeometryManagerTool"
+if newInDetAlignGeo_Options["alignPixel"]:
+    # Pixel geometry manager tool
+    from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__PixelGeometryManagerTool
+    pixelGeometryManagerTool = InDet__PixelGeometryManagerTool(name = "PixelGeometryManagerTool")
+    pixelGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
+    pixelGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
+    if (pixelGeometryManagerTool.doModuleSelection): print " <NewInDetAlignGeometrySetup> doModuleSelection True for Pixels "
+    pixelGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
+    pixelGeometryManagerTool.AlignModuleTool = alignModuleTool
+    # Pixel alignment level
+    pixelGeometryManagerTool.AlignmentLevel = pixelAlignment_Options["pixelAlignmentLevel"]
+    pixelGeometryManagerTool.AlignmentLevelBarrel = pixelAlignment_Options["pixelAlignmentLevelBarrel"]
+    pixelGeometryManagerTool.AlignmentLevelEndcaps = pixelAlignment_Options["pixelAlignmentLevelEndcaps"]
+    pixelGeometryManagerTool.AlignmentDBM = newInDetAlignGeo_Options["pixelAlignDBM"]
+    # Pixel alignment degrees of freedom
+    # Barrel
+    pixelGeometryManagerTool.AlignBarrel = pixelAlignment_Options["pixelAlignBarrel"]
+    if pixelAlignment_Options["pixelAlignBarrel"]:
+        pixelGeometryManagerTool.AlignBarrelX = pixelAlignment_Options["pixelAlignBarrelX"]
+        pixelGeometryManagerTool.AlignBarrelY = pixelAlignment_Options["pixelAlignBarrelY"]
+        pixelGeometryManagerTool.AlignBarrelZ = pixelAlignment_Options["pixelAlignBarrelZ"]
+        pixelGeometryManagerTool.AlignBarrelRotX = pixelAlignment_Options["pixelAlignBarrelRotX"]
+        pixelGeometryManagerTool.AlignBarrelRotY = pixelAlignment_Options["pixelAlignBarrelRotY"]
+        pixelGeometryManagerTool.AlignBarrelRotZ = pixelAlignment_Options["pixelAlignBarrelRotZ"]
+        pixelGeometryManagerTool.AlignBarrelBowX = pixelAlignment_Options["pixelAlignBarrelBowX"]
+        pixelGeometryManagerTool.SetSigmaBarrelX = pixelAlignment_Options["pixelSetSigmaBarrelX"]
+        pixelGeometryManagerTool.SetSigmaBarrelY = pixelAlignment_Options["pixelSetSigmaBarrelY"]
+        pixelGeometryManagerTool.SetSigmaBarrelZ = pixelAlignment_Options["pixelSetSigmaBarrelZ"]
+        pixelGeometryManagerTool.SetSigmaBarrelRotX = pixelAlignment_Options["pixelSetSigmaBarrelRotX"]
+        pixelGeometryManagerTool.SetSigmaBarrelRotY = pixelAlignment_Options["pixelSetSigmaBarrelRotY"]
+        pixelGeometryManagerTool.SetSigmaBarrelRotZ = pixelAlignment_Options["pixelSetSigmaBarrelRotZ"]
+        pixelGeometryManagerTool.SetSoftCutBarrelX = pixelAlignment_Options["pixelSetSoftCutBarrelX"]
+        pixelGeometryManagerTool.SetSoftCutBarrelY = pixelAlignment_Options["pixelSetSoftCutBarrelY"]
+        pixelGeometryManagerTool.SetSoftCutBarrelZ = pixelAlignment_Options["pixelSetSoftCutBarrelZ"]
+        pixelGeometryManagerTool.SetSoftCutBarrelRotX = pixelAlignment_Options["pixelSetSoftCutBarrelRotX"]
+        pixelGeometryManagerTool.SetSoftCutBarrelRotY = pixelAlignment_Options["pixelSetSoftCutBarrelRotY"]
+        pixelGeometryManagerTool.SetSoftCutBarrelRotZ = pixelAlignment_Options["pixelSetSoftCutBarrelRotZ"]
+    # Endcaps
+    pixelGeometryManagerTool.AlignEndcaps = pixelAlignment_Options["pixelAlignEndcaps"]
+    if pixelAlignment_Options["pixelAlignEndcaps"]:
+        pixelGeometryManagerTool.AlignEndcapX = pixelAlignment_Options["pixelAlignEndcapX"]
+        pixelGeometryManagerTool.AlignEndcapY = pixelAlignment_Options["pixelAlignEndcapY"]
+        pixelGeometryManagerTool.AlignEndcapZ = pixelAlignment_Options["pixelAlignEndcapZ"]
+        pixelGeometryManagerTool.AlignEndcapRotX = pixelAlignment_Options["pixelAlignEndcapRotX"]
+        pixelGeometryManagerTool.AlignEndcapRotY = pixelAlignment_Options["pixelAlignEndcapRotY"]
+        pixelGeometryManagerTool.AlignEndcapRotZ = pixelAlignment_Options["pixelAlignEndcapRotZ"]
+        pixelGeometryManagerTool.SetSigmaEndcapX = pixelAlignment_Options["pixelSetSigmaEndcapX"]
+        pixelGeometryManagerTool.SetSigmaEndcapY = pixelAlignment_Options["pixelSetSigmaEndcapY"]
+        pixelGeometryManagerTool.SetSigmaEndcapZ = pixelAlignment_Options["pixelSetSigmaEndcapZ"]
+        pixelGeometryManagerTool.SetSigmaEndcapRotX = pixelAlignment_Options["pixelSetSigmaEndcapRotX"]
+        pixelGeometryManagerTool.SetSigmaEndcapRotY = pixelAlignment_Options["pixelSetSigmaEndcapRotY"]
+        pixelGeometryManagerTool.SetSigmaEndcapRotZ = pixelAlignment_Options["pixelSetSigmaEndcapRotZ"]
+        pixelGeometryManagerTool.SetSoftCutEndcapX = pixelAlignment_Options["pixelSetSoftCutBarrelX"]
+        pixelGeometryManagerTool.SetSoftCutEndcapY = pixelAlignment_Options["pixelSetSoftCutBarrelY"]
+        pixelGeometryManagerTool.SetSoftCutEndcapZ = pixelAlignment_Options["pixelSetSoftCutBarrelZ"]
+        pixelGeometryManagerTool.SetSoftCutEndcapRotX = pixelAlignment_Options["pixelSetSoftCutBarrelRotX"]
+        pixelGeometryManagerTool.SetSoftCutEndcapRotY = pixelAlignment_Options["pixelSetSoftCutBarrelRotY"]
+        pixelGeometryManagerTool.SetSoftCutEndcapRotZ = pixelAlignment_Options["pixelSetSoftCutBarrelRotZ"]
+    #
+    ToolSvc += pixelGeometryManagerTool
+    print pixelGeometryManagerTool
+print " <NewInDetAlignGeometrySetup> PixelGeometryManagerTool completed"
+
+
+
+########################################################################################
+####
+####    SCT Alignment Geometry Setup
+####
+
+#
+print " <NewInDetAlignGeometrySetup> setting up SCT Alignment_Options --> SCTGeometryManagerTool"
+if newInDetAlignGeo_Options["alignSCT"]:
+    print " <NewInDetAlignGeometrySetup> setting up SCT Alignment_Options "
+    # SCT geometry manager tool
+    from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__SCTGeometryManagerTool
+    sctGeometryManagerTool = InDet__SCTGeometryManagerTool(name = "SCTGeometryManagerTool")
+    sctGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
+    sctGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
+    if (sctGeometryManagerTool.doModuleSelection): print " <NewInDetAlignGeometrySetup> doModuleSelection True for SCT "
+    sctGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
+    sctGeometryManagerTool.AlignModuleTool = alignModuleTool
+    # SCT alignment level
+    sctGeometryManagerTool.AlignmentLevel = sctAlignment_Options["sctAlignmentLevel"]
+    sctGeometryManagerTool.AlignmentLevelBarrel = sctAlignment_Options["sctAlignmentLevelBarrel"]
+    sctGeometryManagerTool.AlignmentLevelEndcaps = sctAlignment_Options["sctAlignmentLevelEndcaps"]
+    # SCT alignment degrees of freedom
+    # Barrel
+    sctGeometryManagerTool.AlignBarrel = sctAlignment_Options["sctAlignBarrel"]
+    if sctAlignment_Options["sctAlignBarrel"]:
+        sctGeometryManagerTool.AlignBarrelX = sctAlignment_Options["sctAlignBarrelX"]
+        sctGeometryManagerTool.AlignBarrelY = sctAlignment_Options["sctAlignBarrelY"]
+        sctGeometryManagerTool.AlignBarrelZ = sctAlignment_Options["sctAlignBarrelZ"]
+        sctGeometryManagerTool.AlignBarrelRotX = sctAlignment_Options["sctAlignBarrelRotX"]
+        sctGeometryManagerTool.AlignBarrelRotY = sctAlignment_Options["sctAlignBarrelRotY"]
+        sctGeometryManagerTool.AlignBarrelRotZ = sctAlignment_Options["sctAlignBarrelRotZ"]
+        sctGeometryManagerTool.SetSigmaBarrelX = sctAlignment_Options["sctSetSigmaBarrelX"]
+        sctGeometryManagerTool.SetSigmaBarrelY = sctAlignment_Options["sctSetSigmaBarrelY"]
+        sctGeometryManagerTool.SetSigmaBarrelZ = sctAlignment_Options["sctSetSigmaBarrelZ"]
+        sctGeometryManagerTool.SetSigmaBarrelRotX = sctAlignment_Options["sctSetSigmaBarrelRotX"]
+        sctGeometryManagerTool.SetSigmaBarrelRotY = sctAlignment_Options["sctSetSigmaBarrelRotY"]
+        sctGeometryManagerTool.SetSigmaBarrelRotZ = sctAlignment_Options["sctSetSigmaBarrelRotZ"]
+        sctGeometryManagerTool.SetSoftCutBarrelX = sctAlignment_Options["sctSetSoftCutBarrelX"]
+        sctGeometryManagerTool.SetSoftCutBarrelY = sctAlignment_Options["sctSetSoftCutBarrelY"]
+        sctGeometryManagerTool.SetSoftCutBarrelZ = sctAlignment_Options["sctSetSoftCutBarrelZ"]
+        sctGeometryManagerTool.SetSoftCutBarrelRotX = sctAlignment_Options["sctSetSoftCutBarrelRotX"]
+        sctGeometryManagerTool.SetSoftCutBarrelRotY = sctAlignment_Options["sctSetSoftCutBarrelRotY"]
+        sctGeometryManagerTool.SetSoftCutBarrelRotZ = sctAlignment_Options["sctSetSoftCutBarrelRotZ"]
+    # Endcaps
+    sctGeometryManagerTool.AlignEndcaps = sctAlignment_Options["sctAlignEndcaps"]
+    if sctAlignment_Options["sctAlignEndcaps"]:
+        sctGeometryManagerTool.AlignEndcapX = sctAlignment_Options["sctAlignEndcapX"]
+        sctGeometryManagerTool.AlignEndcapY = sctAlignment_Options["sctAlignEndcapY"]
+        sctGeometryManagerTool.AlignEndcapZ = sctAlignment_Options["sctAlignEndcapZ"]
+        sctGeometryManagerTool.AlignEndcapRotX = sctAlignment_Options["sctAlignEndcapRotX"]
+        sctGeometryManagerTool.AlignEndcapRotY = sctAlignment_Options["sctAlignEndcapRotY"]
+        sctGeometryManagerTool.AlignEndcapRotZ = sctAlignment_Options["sctAlignEndcapRotZ"]
+        sctGeometryManagerTool.SetSigmaEndcapX = sctAlignment_Options["sctSetSigmaEndcapX"]
+        sctGeometryManagerTool.SetSigmaEndcapY = sctAlignment_Options["sctSetSigmaEndcapY"]
+        sctGeometryManagerTool.SetSigmaEndcapZ = sctAlignment_Options["sctSetSigmaEndcapZ"]
+        sctGeometryManagerTool.SetSigmaEndcapRotX = sctAlignment_Options["sctSetSigmaEndcapRotX"]
+        sctGeometryManagerTool.SetSigmaEndcapRotY = sctAlignment_Options["sctSetSigmaEndcapRotY"]
+        sctGeometryManagerTool.SetSigmaEndcapRotZ = sctAlignment_Options["sctSetSigmaEndcapRotZ"]
+        sctGeometryManagerTool.SetSoftCutEndcapX = sctAlignment_Options["sctSetSoftCutEndcapX"]
+        sctGeometryManagerTool.SetSoftCutEndcapY = sctAlignment_Options["sctSetSoftCutEndcapY"]
+        sctGeometryManagerTool.SetSoftCutEndcapZ = sctAlignment_Options["sctSetSoftCutEndcapZ"]
+        sctGeometryManagerTool.SetSoftCutEndcapRotX = sctAlignment_Options["sctSetSoftCutEndcapRotX"]
+        sctGeometryManagerTool.SetSoftCutEndcapRotY = sctAlignment_Options["sctSetSoftCutEndcapRotY"]
+        sctGeometryManagerTool.SetSoftCutEndcapRotZ = sctAlignment_Options["sctSetSoftCutEndcapRotZ"]
+    #
+    ToolSvc += sctGeometryManagerTool
+    print sctGeometryManagerTool
+print " <NewInDetAlignGeometrySetup> SCTGeometryManagerTool completed"
+
+
+########################################################################################
+####
+####    Silicon Alignment Geometry Setup
+####
+if newInDetAlignGeo_Options["alignSilicon"]:
+    # Silicon geometry manager tool
+    from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__SiGeometryManagerTool
+    siGeometryManagerTool = InDet__SiGeometryManagerTool(name = "SiGeometryManagerTool")
+    siGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
+    siGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
+    if (siGeometryManagerTool.doModuleSelection): print " <NewInDetAlignGeometrySetup> doModuleSelection True for Silicon "
+    siGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
+    siGeometryManagerTool.AlignModuleTool = alignModuleTool
+    #
+    # Silicon alignment level
+    siGeometryManagerTool.AlignmentLevel = siAlignment_Options["siAlignmentLevel"]
+    #
+    # we don't need the Pixel and SCT geometry managers if Silicon alignment level is 0
+    if not (siAlignment_Options["siAlignmentLevel"]==0):
+        if newInDetAlignGeo_Options["alignPixel"]:
+            siGeometryManagerTool.PixelGeometryManager = pixelGeometryManagerTool
+        if newInDetAlignGeo_Options["alignSCT"]:
+            siGeometryManagerTool.SCTGeometryManager = sctGeometryManagerTool
+    siGeometryManagerTool.AlignPixel = newInDetAlignGeo_Options["alignPixel"]
+    siGeometryManagerTool.AlignSCT = newInDetAlignGeo_Options["alignSCT"]
+    #
+    # Silicon alignment degrees of freedom
+    siGeometryManagerTool.AlignX = siAlignment_Options["siAlignX"]
+    siGeometryManagerTool.AlignY = siAlignment_Options["siAlignY"]
+    siGeometryManagerTool.AlignZ = siAlignment_Options["siAlignZ"]
+    siGeometryManagerTool.AlignRotX = siAlignment_Options["siAlignRotX"]
+    siGeometryManagerTool.AlignRotY = siAlignment_Options["siAlignRotY"]
+    siGeometryManagerTool.AlignRotZ = siAlignment_Options["siAlignRotZ"]
+    #
+    ToolSvc += siGeometryManagerTool
+    print siGeometryManagerTool
+
+
+########################################################################################
+####
+####    TRT Alignment Geometry Setup
+####
+
+print " <NewInDetAlignGeometrySetup> setting up TRT Alignment_Options --> TRTGeometryManagerTool"
+if newInDetAlignGeo_Options["alignTRT"]:
+    # TRT geometry manager tool
+    from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__TRTGeometryManagerTool
+    trtGeometryManagerTool = InDet__TRTGeometryManagerTool(name = "TRTGeometryManagerTool")
+    trtGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
+    trtGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
+    trtGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
+    trtGeometryManagerTool.AlignBarrelPhiSectors = trtAlignment_Options["trtAlignBarrelPhiSectors"]
+    trtGeometryManagerTool.AlignBarrelLayers = trtAlignment_Options["trtAlignBarrelLayers"]
+    trtGeometryManagerTool.AlignEndcapPhiSectors = trtAlignment_Options["trtAlignEndcapPhiSectors"]
+    trtGeometryManagerTool.AlignEndcapWheels = trtAlignment_Options["trtAlignEndcapWheels"]
+    trtGeometryManagerTool.AlignSingleEndcap = trtAlignment_Options["trtAlignSingleEndcap"]
+    trtGeometryManagerTool.AlignModuleTool = alignModuleTool
+    # TRT alignment level
+    trtGeometryManagerTool.AlignmentLevel = trtAlignment_Options["trtAlignmentLevel"]
+    trtGeometryManagerTool.AlignmentLevelBarrel = trtAlignment_Options["trtAlignmentLevelBarrel"]
+    trtGeometryManagerTool.AlignmentLevelEndcaps = trtAlignment_Options["trtAlignmentLevelEndcaps"]
+
+    # TRT alignment degrees of freedom
+    # Barrel
+    print " <NewInDetAlignGeometrySetup> setting up TRT barrel Alignment_Options "
+    trtGeometryManagerTool.AlignBarrel = trtAlignment_Options["trtAlignBarrel"]
+    if trtAlignment_Options["trtAlignBarrel"]:
+        trtGeometryManagerTool.AlignBarrelX = trtAlignment_Options["trtAlignBarrelX"]
+        trtGeometryManagerTool.AlignBarrelY = trtAlignment_Options["trtAlignBarrelY"]
+        trtGeometryManagerTool.AlignBarrelZ = trtAlignment_Options["trtAlignBarrelZ"]
+        trtGeometryManagerTool.AlignBarrelRotX = trtAlignment_Options["trtAlignBarrelRotX"]
+        trtGeometryManagerTool.AlignBarrelRotY = trtAlignment_Options["trtAlignBarrelRotY"]
+        trtGeometryManagerTool.AlignBarrelRotZ = trtAlignment_Options["trtAlignBarrelRotZ"]
+        trtGeometryManagerTool.SetSigmaBarrelX = trtAlignment_Options["trtSetSigmaBarrelX"]
+        trtGeometryManagerTool.SetSigmaBarrelY = trtAlignment_Options["trtSetSigmaBarrelY"]
+        trtGeometryManagerTool.SetSigmaBarrelZ = trtAlignment_Options["trtSetSigmaBarrelZ"]
+        trtGeometryManagerTool.SetSigmaBarrelRotX = trtAlignment_Options["trtSetSigmaBarrelRotX"]
+        trtGeometryManagerTool.SetSigmaBarrelRotY = trtAlignment_Options["trtSetSigmaBarrelRotY"]
+        trtGeometryManagerTool.SetSigmaBarrelRotZ = trtAlignment_Options["trtSetSigmaBarrelRotZ"]
+        trtGeometryManagerTool.SetSoftCutBarrelX = trtAlignment_Options["trtSetSoftCutBarrelX"]
+        trtGeometryManagerTool.SetSoftCutBarrelY = trtAlignment_Options["trtSetSoftCutBarrelY"]
+        trtGeometryManagerTool.SetSoftCutBarrelZ = trtAlignment_Options["trtSetSoftCutBarrelZ"]
+        trtGeometryManagerTool.SetSoftCutBarrelRotX = trtAlignment_Options["trtSetSoftCutBarrelRotX"]
+        trtGeometryManagerTool.SetSoftCutBarrelRotY = trtAlignment_Options["trtSetSoftCutBarrelRotY"]
+        trtGeometryManagerTool.SetSoftCutBarrelRotZ = trtAlignment_Options["trtSetSoftCutBarrelRotZ"]
+        print " <InDetAlign_Geometry_Setup> trtAlignment_Options[trtAlignmentLevelBarrel]=", trtAlignment_Options["trtAlignmentLevelBarrel"]
+        if (trtAlignment_Options["trtAlignmentLevel"] == 1 or trtAlignment_Options["trtAlignmentLevelBarrel"] == 1):
+            trtGeometryManagerTool.AlignBarrelZ = False
+                    
+
+    # Endcaps
+    print " <NewInDetAlignGeometrySetup> setting up TRT endcaps Alignment_Options "
+    trtGeometryManagerTool.AlignEndcaps = trtAlignment_Options["trtAlignEndcaps"]
+    if trtAlignment_Options["trtAlignEndcaps"]:
+        trtGeometryManagerTool.AlignEndcapX = trtAlignment_Options["trtAlignEndcapX"]
+        trtGeometryManagerTool.AlignEndcapY = trtAlignment_Options["trtAlignEndcapY"]
+        trtGeometryManagerTool.AlignEndcapZ = trtAlignment_Options["trtAlignEndcapZ"]
+        trtGeometryManagerTool.AlignEndcapRotX = trtAlignment_Options["trtAlignEndcapRotX"]
+        trtGeometryManagerTool.AlignEndcapRotY = trtAlignment_Options["trtAlignEndcapRotY"]
+        trtGeometryManagerTool.AlignEndcapRotZ = trtAlignment_Options["trtAlignEndcapRotZ"]
+        trtGeometryManagerTool.SetSigmaEndcapX = trtAlignment_Options["trtSetSigmaEndcapX"]
+        trtGeometryManagerTool.SetSigmaEndcapY = trtAlignment_Options["trtSetSigmaEndcapY"]
+        trtGeometryManagerTool.SetSigmaEndcapZ = trtAlignment_Options["trtSetSigmaEndcapZ"]
+        trtGeometryManagerTool.SetSigmaEndcapRotX = trtAlignment_Options["trtSetSigmaEndcapRotX"]
+        trtGeometryManagerTool.SetSigmaEndcapRotY = trtAlignment_Options["trtSetSigmaEndcapRotY"]
+        trtGeometryManagerTool.SetSigmaEndcapRotZ = trtAlignment_Options["trtSetSigmaEndcapRotZ"]
+        trtGeometryManagerTool.SetSoftCutEndcapX = trtAlignment_Options["trtSetSoftCutEndcapX"]
+        trtGeometryManagerTool.SetSoftCutEndcapY = trtAlignment_Options["trtSetSoftCutEndcapY"]
+        trtGeometryManagerTool.SetSoftCutEndcapZ = trtAlignment_Options["trtSetSoftCutEndcapZ"]
+        trtGeometryManagerTool.SetSoftCutEndcapRotX = trtAlignment_Options["trtSetSoftCutEndcapRotX"]
+        trtGeometryManagerTool.SetSoftCutEndcapRotY = trtAlignment_Options["trtSetSoftCutEndcapRotY"]
+        trtGeometryManagerTool.SetSoftCutEndcapRotZ = trtAlignment_Options["trtSetSoftCutEndcapRotZ"]
+        if (trtAlignment_Options["trtAlignmentLevel"] == 1 or trtAlignment_Options["trtAlignmentLevelEndcaps"] == 1):
+            trtGeometryManagerTool.AlignEndcapZ = False
+
+    #
+    ToolSvc += trtGeometryManagerTool
+    print trtGeometryManagerTool
+print " <NewInDetAlignGeometrySetup> TRTGeometryManagerTool completed"
+
+
+########################################################################################
+####
+####    Inner Detector Alignment Geometry Setup
+####
+if newInDetAlignGeo_Options["alignInDet"]:
+    print " <NewInDetAlignGeometrySetup> alignInDet = ",newInDetAlignGeo_Options["alignInDet"]
+    # Inner Detector geometry manager tool
+    from InDetAlignGeomTools.InDetAlignGeomToolsConf import InDet__InDetGeometryManagerTool
+    indetGeometryManagerTool = InDet__InDetGeometryManagerTool(name = "InDetGeometryManagerTool")
+    indetGeometryManagerTool.OutputLevel = newInDetAlignGeo_Options["outputLevel"]
+    indetGeometryManagerTool.doModuleSelection = newInDetAlignGeo_Options["doModuleSelection"]
+    indetGeometryManagerTool.ModuleSelection = newInDetAlignGeo_Options["moduleSelection"]
+    indetGeometryManagerTool.AlignModuleTool = alignModuleTool
+    #
+    # Inner Detector alignment level
+    indetGeometryManagerTool.AlignmentLevel = indetAlignment_Options["indetAlignmentLevel"]
+    #
+    # we don't need the Pixel and SCT geometry managers if Inner Detector alignment level is 0
+    if not (indetAlignment_Options["indetAlignmentLevel"]==0):
+        if newInDetAlignGeo_Options["alignSilicon"]:
+            indetGeometryManagerTool.SiGeometryManager = siGeometryManagerTool
+        if newInDetAlignGeo_Options["alignTRT"]:
+            indetGeometryManagerTool.TRTGeometryManager = trtGeometryManagerTool
+    indetGeometryManagerTool.AlignSilicon = newInDetAlignGeo_Options["alignSilicon"]
+    indetGeometryManagerTool.AlignTRT = newInDetAlignGeo_Options["alignTRT"]
+    print " <NewInDetAlignGeometrySetup> indetGeometryManagerTool.AlignSilicon = ", indetGeometryManagerTool.AlignSilicon
+    print " <NewInDetAlignGeometrySetup> indetGeometryManagerTool.AlignTRT = ", indetGeometryManagerTool.AlignTRT
+    #
+    # Inner Detector alignment degrees of freedom
+    indetGeometryManagerTool.AlignX = indetAlignment_Options["indetAlignX"]
+    indetGeometryManagerTool.AlignY = indetAlignment_Options["indetAlignY"]
+    indetGeometryManagerTool.AlignZ = indetAlignment_Options["indetAlignZ"]
+    indetGeometryManagerTool.AlignRotX = indetAlignment_Options["indetAlignRotX"]
+    indetGeometryManagerTool.AlignRotY = indetAlignment_Options["indetAlignRotY"]
+    indetGeometryManagerTool.AlignRotZ = indetAlignment_Options["indetAlignRotZ"]
+    #
+    ToolSvc += indetGeometryManagerTool
+    print indetGeometryManagerTool
+
+
+# select geometry manager to be used in the alignment
+if newInDetAlignGeo_Options["alignInDet"]:
+    trkAlignGeoManagerTool = indetGeometryManagerTool
+elif newInDetAlignGeo_Options["alignTRT"]:
+    trkAlignGeoManagerTool = trtGeometryManagerTool
+elif newInDetAlignGeo_Options["alignSilicon"]:
+    trkAlignGeoManagerTool = siGeometryManagerTool
+elif newInDetAlignGeo_Options["alignPixel"]:
+    trkAlignGeoManagerTool = pixelGeometryManagerTool
+elif newInDetAlignGeo_Options["alignSCT"]:
+    trkAlignGeoManagerTool = sctGeometryManagerTool
+
+
+
+
+########################################################################################
+####
+####    Inner Detector DB I/O Setup
+####
+
+########################
+#### Silicon DB Output
+if (newInDetAlignGeo_Options["alignInDet"] or newInDetAlignGeo_Options["alignSilicon"] or newInDetAlignGeo_Options["alignSCT"] or newInDetAlignGeo_Options["alignPixel"]):
+    from InDetAlignDBTools.InDetAlignDBToolsConf import InDet__SiTrkAlignDBTool
+    siTrkDBTool = InDet__SiTrkAlignDBTool(OutputLevel = newInDetAlignGeo_Options["outputLevel"]);
+    siTrkDBTool.AlignModuleTool = alignModuleTool
+    if (newInDetAlignGeo_Options["alignPixel"] or newInDetAlignGeo_Options["alignSCT"] and not newInDetAlignGeo_Options["alignSilicon"]):
+        if newInDetAlignGeo_Options["alignPixel"]:
+            siTrkDBTool.PixelGeometryManager = pixelGeometryManagerTool
+        if newInDetAlignGeo_Options["alignSCT"]:
+            siTrkDBTool.SCTGeometryManager = sctGeometryManagerTool
+    elif newInDetAlignGeo_Options["alignSilicon"]:
+        siTrkDBTool.SiGeometryManager = siGeometryManagerTool
+    else:
+        siTrkDBTool.SiGeometryManager = indetGeometryManagerTool
+    siTrkDBTool.UpdateConstants = newInDetAlignGeo_Options["updateConstants"]
+    siTrkDBTool.WriteTextFile = newInDetAlignGeo_Options["writeTextFiles"]
+    siTrkDBTool.OutputTextFile = newInDetAlignGeo_Options["siliconTextFile"]
+    siTrkDBTool.WriteOldConstants = newInDetAlignGeo_Options["writeOldConstants"]
+    siTrkDBTool.AlignmentDBM = newInDetAlignGeo_Options["pixelAlignDBM"]
+    siTrkDBTool.WriteAsL3 = False
+    print " <NewInDetAlignGeometrySetup> siTrkDBTool.WriteAsL3 ", siTrkDBTool.WriteAsL3
+
+
+    ToolSvc += siTrkDBTool
+    print      siTrkDBTool
+
+########################
+#### TRT DB Output
+if (newInDetAlignGeo_Options["alignInDet"] or newInDetAlignGeo_Options["alignTRT"]):
+    print " <NewInDetAlignGeometrySetup> defining TRT_AlignDbSvc "
+    from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_AlignDbSvc
+    from AthenaCommon.AppMgr import ServiceMgr
+    ServiceMgr += TRT_AlignDbSvc(
+        name = "TRT_AlignDbSvc",
+        #StreamTool = TRTCondStream,
+        alignTextFile = "",
+        #alignString = "ALold",
+        OutputLevel = DEBUG)
+        #OutputLevel = newInDetAlignGeo_Options["outputLevel"])
+
+    from InDetAlignDBTools.InDetAlignDBToolsConf import InDet__TRTTrkAlignDBTool
+    trtTrkDBTool = InDet__TRTTrkAlignDBTool(OutputLevel = newInDetAlignGeo_Options["outputLevel"]);
+    trtTrkDBTool.AlignModuleTool = alignModuleTool
+    if newInDetAlignGeo_Options["alignTRT"]:
+        trtTrkDBTool.TRTGeometryManager = trtGeometryManagerTool
+    else:
+        trtTrkDBTool.SiGeometryManager = indetGeometryManagerTool
+    trtTrkDBTool.UpdateConstants = newInDetAlignGeo_Options["updateConstants"]
+    trtTrkDBTool.WriteTextFile = newInDetAlignGeo_Options["writeTextFiles"]
+    trtTrkDBTool.OutputTextFile = newInDetAlignGeo_Options["trtTextFile"]
+    trtTrkDBTool.WriteOldConstants = newInDetAlignGeo_Options["writeOldConstants"]
+    trtTrkDBTool.WriteTRTAsL2 = False
+
+    ToolSvc += trtTrkDBTool
+    print "<NewInDetAligGeometrySetup> next lines are for trtDBTool "
+    print      trtTrkDBTool
+
+########################
+#### Inner Detector DB Output
+if newInDetAlignGeo_Options["alignInDet"]:
+    from InDetAlignDBTools.InDetAlignDBToolsConf import InDet__InDetTrkAlignDBTool
+    indetTrkDBTool = InDet__InDetTrkAlignDBTool(OutputLevel = newInDetAlignGeo_Options["outputLevel"]);
+    indetTrkDBTool.SiTrkAlignDBTool = siTrkDBTool
+    indetTrkDBTool.TRTTrkAlignDBTool = trtTrkDBTool
+
+    ToolSvc += indetTrkDBTool
+    print      indetTrkDBTool
+
+
+# select DB tool to be used in the alignment
+if newInDetAlignGeo_Options["alignInDet"]:
+    trkAlignDBTool = indetTrkDBTool
+elif newInDetAlignGeo_Options["alignTRT"]:
+    trkAlignDBTool = trtTrkDBTool
+else:
+    trkAlignDBTool = siTrkDBTool
+
+print "<NewInDetAlignGeometrySetup> ** COMPLETED **"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/InDetAlign_Setup.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/InDetAlign_Setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..e2d2b04e1e8fc047a8859842ecc3e1d733dd48fa
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/InDetAlign_Setup.py
@@ -0,0 +1,716 @@
+##############################
+#
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+#############################
+##############################################################################
+#
+#  Main alignment script which sets up all tools and algorithms to run global
+#  or local chi2 alignment using analytical derivatives.
+#
+##############################################################################
+#
+# The Following options can be specified seperately in a file that include this one
+#
+# General Alignemnt Options and their defaults
+newInDetAlignAlg_Options = {
+    "outputLevel"           : INFO                   #  output level for log messages for all tools and algs
+    ,"trackCollection"      : "Tracks"               #  track collection to process
+    ,"d0significanceCut"    : -1                     #  Cut on d0 significance
+    ,"CorrectD0"            : False                  #  whether to use D0 constraint
+    ,"CorrectZ0"            : False                  #  whether to use Z0 constraint
+    ,"readConstantsFromPool": False                  #  whether to read initial alignment constants from pool file
+    ,"readSilicon"          : True                   #  whether to read initial Si alignment constants from pool file
+    ,"readTRT"              : True                   #  whether to read initial TRT alignment constnats from pool file
+    ,"readTRTL3"            : False                  #  whether to read initial TRT L3 alignment constnats from pool file
+    ,"inputPoolFiles"       : ["IDalignment_nominal.pool.root"]  #  pool files to read the constants from
+    ,"writeConstantsToPool" : True                   #  whether to write final alignment constants to pool file
+    ,"writeSilicon"         : True                   #  whether to write final Si constants to pool file
+    ,"writeTRT"             : True                   #  whether to write final TRT constants to pool file
+    ,"writeTRTL3"           : False                  #  whether to write final TRT L3 constants to pool file
+    ,"writeIBLDistDB"       : True                   #  whether to write /Indet/IBLDist to db file
+    ,"writeDynamicDB"       : True                   #  whether to write new dynamic folder sheme or old static
+    ,"outputPoolFile"       : "alignment_output.pool.root"  #  pool file to write the final constants
+    ,"outputCoolFile"       : "mycool2.db"           #  cool file to write the final bowing
+    ,"tagSi"                : "IndetAlign_test"      #  DB tag to use for final Si constants
+    ,"tagTRT"               : "TRTAlign_test"        #  DB tag to use for final TRT constnats
+    ,"tagBow"               : "IndetIBLDist"         #  DB tag to use for final Bowing constants
+    ,"runAccumulate"        : True                   #  whether to run the event/track processing
+    ,"runSolving"           : True                   #  whether to run the solving
+    ,"runLocal"             : False                  #  whether to runlocal or global Chi2 method
+    ,"residualType"         : 0                      #  type of residual to use in local method 0 - hit-only (biased), 1 - unbiased
+    ,"usePixelErrors"       : True                   #  whether to use real Pixel errors (only for local method)
+    ,"useSCTErrors"         : True                   #  whether to use real SCT errors (only for local method)
+    ,"useTRTErrors"         : True                   #  whether to use real TRT errors (only for local method)
+    ,"inputMatrixFiles"     : [ "matrix.bin" ]       #  list of matrix files when solving only
+    ,"inputVectorFiles"     : [ "vector.bin" ]       #  list of vector files when solving only
+    ,"inputTFiles"          : ["AlignmentTFile.root"]# list of the Alignment TFiles, used only if WriteTFile is True
+    ,"solvingOption"        : 3                      #  which global solver to run 0-none, 1-Lapack, 2-Eigen, 6-ROOT, 7-CLHEP
+    ,"solveLocal"           : False                  #  whether to run local 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"              : 100                    #  minimal number of hits in module to do the solving
+    ,"scaleMatrix"          : True                   #  whethwe to normalize the matrix to number of hits before solving (Lapack)
+    ,"calculateFullCovariance" : True                #  whether to calculate the full covariance matrix of the alignment parameters
+    ,"refitTracks"          : True                   #  whether to refit tracks before processing
+    ,"runOutlier"           : True                   #  whether to refit tracks with outlier removal
+    ,"particleNumber"       : 3                      #  particle hypothesis to use in the refit
+    ,"useTrackSelector"     : True                   #  whether to use track selector
+    ,"writeAlignNtuple"     : False                       #  whether to write an alignment specific ntuple
+    ,"alignNtupleName"      : "newIDalign.root"          #  name of the ntuple file
+    ,"writeDerivatives"     : False                      #  whether to store dr/da in the ntuple
+    ,"writeHitmap"          : True                           #  whether to store the hitmap
+    ,"writeHitmapTxt"       : True                       #  whether to store the hitmap in a text file
+    ,"writeEigenMat"        : False                      #  whether to write the eigenspectrum/eigenvectors into files
+    ,"writeEigenMatTxt"     : False                      #  whether to write the eigenspectrum/eigenvectors into text files
+    ,"inputHitmapFiles"     : [ "hitmap.bin" ]               #  list of hitmap files when solving only
+    ,"readHitmaps"              : True                           #  whether to use the hitmap information when solve only
+    ,"doMonitoring"             : True                       #  whether to run the monitoring scripts
+    ,"monitoringName"           : ""                         # apply a monitoring name
+    ,"Cosmics"                  : False                          #  whether to use special cosmic track selection
+    ,"useTRT"                   : True                           #  whether to use TRT for track selection
+    ,"useOldPreProcessor"       : False                               #  temporary option, new preProcessor with beam-spot constraint is
+                                                         #  available only from tag TrkAlignGenTools-01-07-08 which didn't
+                                                         #  make it into 15.6.9, once in the release, old preProcessor will
+                                                         #  be removed
+    ,"doBSConstraint"           : True                      #  run with beam-spot constraint
+    ,"doPVConstraint"           : False                  #  run with primary vertex constraint
+    ,"doFullVertex"             : False                              #  run with the full GX vertex constraint
+    ,"doBSTrackSelection"       : False                       #  run BS constraint only for tracks which pass tighter track selection
+    ,"doBSAssociatedToPVSelection"  : False                  #  run BS constraint only for tracks associated to primary vertex
+    ,"beamspotScalingFactor"    : 1.                     #  factor to scale the size of the beam spot
+    ,"PtCutForBSConstraint"     : 0.                     #  Max Pt Cut for the BS constraint in order to not clash with the IP constraints
+    ,"MinPtForConstrainedProvider" : 0.                     #  Max Pt Cut for the BS constraint in order to not clash with the IP constraints
+    ,"eoverpmapconstraint"      : ""                                 #  sagitta bias map for momentum constraint(could be E/P or Z->mumu method )
+    ,"eoverpmapconstraintmap"   : ""                                 #  sagitta bias map for momentum constraint(could be E/P or Z->mumu method )
+    ,"z0mapconstraint"          : ""                                 #  z0 bias map file for IP constraint
+    ,"z0mapconstraintmap"       : "z0CorrectionVsEtaPhi"                                 #  z0 bias map name for IP constraint
+    ,"d0mapconstraint"          : ""                     #  filename for d0 bias map for IP constraint
+    ,"d0mapconstraintmap"       : "d0CorrectionVsEtaPhi"                     #  d0 bias map for IP constraint
+    ,"PtCut"                    : 5000                  #  Pt cut for the reconstruction [MeV]
+
+
+    ,"doSiHitQualSel"       : True                   #  perform Si hit (pix+sct) quality selection with InDetAlinHitQualSelTool
+    ,"AlignIBLbutNotPixel"  : False		# Set to True to align the IBL but not the Old Pixel (L11).
+    ,"AlignPixelbutNotIBL"  : False		# Set to True to align the Old Pixel but not the IBL (L11).
+
+    ,"Remove_Pixel_Tx"      : False		# Set to True to remove Old Pixel's Tx Dof from the alignment Matrix (L11).
+    ,"Remove_Pixel_Ty"      : False		# Set to True to remove Old Pixel's Ty Dof from the alignment Matrix (L11).
+    ,"Remove_Pixel_Tz"      : False		# Set to True to remove Old Pixel's Tz Dof from the alignment Matrix (L11).
+    ,"Remove_Pixel_Rx"      : False		# Set to True to remove Old Pixel's Rx Dof from the alignment Matrix (L11).
+    ,"Remove_Pixel_Ry"      : False		# Set to True to remove Old Pixel's Ry Dof from the alignment Matrix (L11).
+    ,"Remove_Pixel_Rz"      : False		# Set to True to remove Old Pixel's Rz Dof from the alignment Matrix (L11).
+
+    ,"Remove_IBL_Tx"        : False		# Set to True to remove IBL's Tx Dof from the alignment Matrix (L11).
+    ,"Remove_IBL_Ty"        : False		# Set to True to remove IBL's Ty Dof from the alignment Matrix (L11).
+    ,"Remove_IBL_Tz"        : False		# Set to True to remove IBL's Tz Dof from the alignment Matrix (L11).
+    ,"Remove_IBL_Rx"        : False		# Set to True to remove IBL's Rx Dof from the alignment Matrix (L11).
+    ,"Remove_IBL_Ry"        : False		# Set to True to remove IBL's Ry Dof from the alignment Matrix (L11).
+    ,"Remove_IBL_Rz"        : False		# Set to True to remove IBL's Rz Dof from the alignment Matrix (L11).
+
+    ,"FixMomentum"          : False             # Set to True to remove the QoverP from the track parameters when deriving the residuals.
+    ,"LumiblockSelection"   : False				     #	whether to select events from a list of lumiblocks.
+    ,"LumiblockList"	    : range(400,420,1) 		     #	The list of LBs you want to select
+
+}
+
+##############################################################################
+## If the variables are defined use thier values.
+## If not defined the defaults given above are used
+for var in newInDetAlignAlg_Options:
+    if var in dir():
+        newInDetAlignAlg_Options[var] = eval(var)
+
+print " <InDetAlign_setup> set up for cosmics ? ", newInDetAlignAlg_Options["Cosmics"]
+
+if newInDetAlignAlg_Options["Cosmics"]:
+    # If Cosmics, switch off Beamspot / Vtx constraint
+    newInDetAlignAlg_Options["doBSConstraint"] = False
+    newInDetAlignAlg_Options["doPVConstraint"] = False
+    newInDetAlignAlg_Options["doFullVertex"] = False
+    newInDetAlignAlg_Options["doBSTrackSelection"] = False
+    newInDetAlignAlg_Options["doBSAssociatedToPVSelection"] = False
+
+if newInDetAlignAlg_Options["doBSConstraint"]:
+    newInDetAlignAlg_Options["doBSTrackSelection"] = True
+
+print " <InDetAlign_setup> setup check for BS and Pvx constraints:"
+print " <InDetAlign_setup> doBSConstraint ?: ",newInDetAlignAlg_Options["doBSConstraint"]
+print " <InDetAlign_setup> doPVConstraint ?: ",newInDetAlignAlg_Options["doPVConstraint"]
+print " <InDetAlign_setup> doFullVertex   ?: ",newInDetAlignAlg_Options["doFullVertex"]
+print " <InDetAlign_setup> doBSTrackSelec ?: ",newInDetAlignAlg_Options["doBSTrackSelection"]
+print " <InDetAlign_setup> doBSAssoc2PV   ?: ",newInDetAlignAlg_Options["doBSAssociatedToPVSelection"]
+
+
+if (len(newInDetAlignAlg_Options["eoverpmapconstraint"])>0):
+    print (" <InDetAlign_setup> file with momentum constraint map: %s" %newInDetAlignAlg_Options["eoverpmapconstraint"])
+    print (" <InDetAlign_setup> histogram momentum constraint map: %s" %newInDetAlignAlg_Options["eoverpmapconstraintmap"])
+else:
+    print (" <InDetAlign_setup> NO momentum constraint")
+
+if (len(newInDetAlignAlg_Options["d0mapconstraint"])>0):
+    newInDetAlignAlg_Options["CorrectD0"] = True
+    print (" <InDetAlign_setup> file with d0 constraint map: %s" %newInDetAlignAlg_Options["d0mapconstraint"])
+    print (" <InDetAlign_setup> histogram z0 constraint map: %s" %newInDetAlignAlg_Options["d0mapconstraintmap"])
+else:
+    print (" <InDetAlign_setup> NO d0 constraint")
+
+if (len(newInDetAlignAlg_Options["z0mapconstraint"])>0):
+    newInDetAlignAlg_Options["CorrectZ0"] = True
+    print (" <InDetAlign_setup> file with z0 constraint map: %s" %newInDetAlignAlg_Options["z0mapconstraint"])
+    print (" <InDetAlign_setup> histogram z0 constraint map: %s" %newInDetAlignAlg_Options["z0mapconstraintmap"])
+else:
+    print (" <InDetAlign_setup> NO z0 constraint")
+
+
+## ===================================================================
+## Preprocessor Check ##
+if newInDetAlignAlg_Options["doBSConstraint"] or newInDetAlignAlg_Options["doPVConstraint"] or newInDetAlignAlg_Options["doBSTrackSelection"] or newInDetAlignAlg_Options["doBSAssociatedToPVSelection"]:
+    print " <InDetAlign_setup> Switching off the OldPreprocessor"
+    newInDetAlignAlg_Options["useOldPreProcessor"] = False
+
+if newInDetAlignAlg_Options["useOldPreProcessor"]:
+    print " <InDetAlign_setup> WARNING: The BeamSpot constraint and PV Constraint are disabled"
+
+## ===================================================================
+## ===================================================================
+## ==                                                               ==
+## ==               Settings for the alignment                      ==
+## ==                                                               ==
+if not newInDetAlignAlg_Options["runAccumulate"] and not newInDetAlignAlg_Options["runSolving"]:
+    print ' <InDetAlign_setup> 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("InDetPerformanceMonitoring/InDetAlign_Geometry_Setup.py")
+
+################################
+# make GlobalChi2AlignTool
+from TrkGlobalChi2AlignTools.TrkGlobalChi2AlignToolsConf import Trk__GlobalChi2AlignTool
+globalChi2AlignTool = Trk__GlobalChi2AlignTool(
+    name = 'GlobalChi2AlignTool',
+    AlignModuleTool = alignModuleTool,
+    StoreLocalDerivOnly = (newInDetAlignAlg_Options["solveLocal"] and newInDetAlignAlg_Options["solvingOption"]==0), # If we're running local later, we want to store ony local derivs
+    SecondDerivativeCut = 0, # this is just for the moment :(
+    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
+)
+ToolSvc += globalChi2AlignTool
+
+# setup MatrixTool
+matrixTool = globalChi2AlignTool.MatrixTool
+matrixTool.OutputLevel      = newInDetAlignAlg_Options["outputLevel"]
+matrixTool.AlignModuleTool  = alignModuleTool
+matrixTool.UseSparse        = newInDetAlignAlg_Options["useSparse"]
+matrixTool.SolveOption      = newInDetAlignAlg_Options["solvingOption"]
+matrixTool.MinNumHitsPerModule  = newInDetAlignAlg_Options["minHits"]
+matrixTool.Diagonalize      = newInDetAlignAlg_Options["runDiagonalization"]
+matrixTool.EigenvalueThreshold  = newInDetAlignAlg_Options["eigenvalueCut"]
+matrixTool.RunLocalMethod       = newInDetAlignAlg_Options["solveLocal"]
+matrixTool.WriteMat         = newInDetAlignAlg_Options["writeMatrixFile"]
+matrixTool.WriteMatTxt      = newInDetAlignAlg_Options["writeMatrixFileTxt"]
+matrixTool.WriteEigenMat    = newInDetAlignAlg_Options["writeEigenMat"]
+matrixTool.WriteEigenMatTxt     = newInDetAlignAlg_Options["writeEigenMatTxt"]
+matrixTool.ModCut       = newInDetAlignAlg_Options["ModCut"]
+matrixTool.InputMatrixFiles     = newInDetAlignAlg_Options["inputMatrixFiles"]
+matrixTool.InputVectorFiles     = newInDetAlignAlg_Options["inputVectorFiles"]
+matrixTool.WriteHitmap      = newInDetAlignAlg_Options["writeHitmap"]
+matrixTool.WriteHitmapTxt   = newInDetAlignAlg_Options["writeHitmapTxt"]
+matrixTool.ReadHitmaps      = newInDetAlignAlg_Options["readHitmaps"]
+matrixTool.InputHitmapFiles     = newInDetAlignAlg_Options["inputHitmapFiles"]
+matrixTool.SoftEigenmodeCut     = newInDetAlignAlg_Options["softModeCut"]
+matrixTool.ScaleMatrix      = newInDetAlignAlg_Options["scaleMatrix"]
+matrixTool.PathBinName      = newInDetAlignAlg_Options["PathBinName"]
+
+matrixTool.AlignIBLbutNotPixel = newInDetAlignAlg_Options["AlignIBLbutNotPixel"]
+matrixTool.AlignPixelbutNotIBL = newInDetAlignAlg_Options["AlignPixelbutNotIBL"]
+
+if newInDetAlignAlg_Options["WriteTFile"]:
+    matrixTool.WriteTFile   = True
+    matrixTool.ReadTFile    = True
+    matrixTool.WriteMat     = False
+    matrixTool.WriteHitmap  = False
+    matrixTool.TFileName        = newInDetAlignAlg_Options["TFileName"]
+    matrixTool.InputTFiles      = newInDetAlignAlg_Options["inputTFiles"]
+
+if not newInDetAlignAlg_Options["runLocal"]:
+    # we want to set 'reasonable' defaults for global L3 solving
+    if (
+            ("sctAlignmentLevel" in dir()       and sctAlignmentLevel==3) or
+            ("sctAlignmentLevelBarrel" in dir()     and sctAlignmentLevelBarrel==3) or
+            ("sctAlignmentLevelEndcaps" in dir()    and sctAlignmentLevelEndcaps==3) or
+            ("pixelAlignmentLevel" in dir()     and pixelAlignmentLevel==3) or
+            ("pixelAlignmentLevelBarrel" in dir()   and pixelAlignmentLevelBarrel==3) or
+            ("pixelAlignmentLevelEndcaps" in dir()  and pixelAlignmentLevelEndcaps==3)
+        ):
+        matrixTool.WriteEigenMat = False
+        matrixTool.UseSparse = True
+        matrixTool.SolveOption = 2 # run Eigen for L3 by default
+        matrixTool.WriteMatTxt = False
+        matrixTool.WriteHitmapTxt = False
+        matrixTool.CalculateFullCovariance = False
+    # but the defaults can still be overwritten if explicitely requested
+    if 'useSparse' in dir():
+        matrixTool.UseSparse            = newInDetAlignAlg_Options["useSparse"]
+    if 'solvingOption' in dir():
+        matrixTool.SolveOption          = newInDetAlignAlg_Options["solvingOption"]
+    if 'writeMatrixFileTxt' in dir():
+        matrixTool.WriteMatTxt          = newInDetAlignAlg_Options["writeMatrixFileTxt"]
+    if 'writeHitmapTxt' in dir():
+        matrixTool.WriteHitmapTxt       = newInDetAlignAlg_Options["writeMatrixFileTxt"]
+    if 'writeEigenMat' in dir():
+        matrixTool.WriteEigenMat        = newInDetAlignAlg_Options["writeEigenMat"]
+    if 'writeEigenMatTxt' in dir():
+        matrixTool.WriteEigenMatTxt         = newInDetAlignAlg_Options["writeEigenMatTxt"]
+    if 'calculateFullCovariance' in dir():
+        matrixTool.CalculateFullCovariance  = newInDetAlignAlg_Options["calculateFullCovariance"]
+
+print matrixTool
+print globalChi2AlignTool
+
+#################################################
+##
+## Hit quality selection tool
+##
+from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignHitQualSelTool
+myHitQualSelTool = InDetAlignHitQualSelTool(
+    name = "AlignSiHitQualSelTool",
+    OutputLevel = INFO,
+    RejectOutliers = True,
+    RejectEdgeChannels = False,
+    #AcceptIBLHits = True,
+    #AcceptPixelHits = True,
+    #AcceptSCTHits = True,
+    )
+ToolSvc += myHitQualSelTool
+print myHitQualSelTool
+
+##################################################
+##
+##  Setup all tools needed for event processing
+##
+if newInDetAlignAlg_Options["runAccumulate"]:
+    ###############################
+    # New InDetTrackSelectionTool
+    if newInDetAlignAlg_Options["useTrackSelector"]:
+        minNTRTHits  = -1
+        maxEtaForTRTHitCuts = 0
+        maxTRTEtaAcceptance = 1e+16
+        if newInDetAlignAlg_Options["useTRT"]:
+            print " <InDetAlign_setup> InDetAlign_setup : setting TRT Cuts"
+            minNTRTHits = 0
+            maxEtaForTRTHitCuts = 1.9 # was 1.9
+            maxTRTEtaAcceptance = 0
+
+        from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+        if not newInDetAlignAlg_Options["Cosmics"] : # collision events
+            print " <InDetAlign_setup> InDetAlign_setup : setting InDetTrackSelectionToolAlignTracks"
+            trackSelectorNew = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolAlignTracks",
+                                                              UseTrkTrackTools = True,
+                                                              OutputLevel       = newInDetAlignAlg_Options["outputLevel"],
+                                                              minPt = float(newInDetAlignAlg_Options["PtCut"]),
+                                                              #maxPt = 5000., # in MeV
+                                                              maxD0 = 500,
+                                                              maxZ0 = 500,
+                                                              #minNPixelHits = 1,
+                                                              minNPixelHitsPhysical = 2,
+                                                              #minNSiHits = 5,
+                                                              minNSiHitsPhysical = 10,
+                                                              minNSctHits = 5,
+                                                              minNSctHitsPhysical = 7,
+                                                              minNTrtHits  = minNTRTHits,
+                                                              maxEtaForTrtHitCuts = maxEtaForTRTHitCuts,
+                                                              maxTrtEtaAcceptance = maxTRTEtaAcceptance,
+                                                              CutLevel = "TightPrimary",
+                                                              TrackSummaryTool    = InDetTrackSummaryTool,
+                                                              Extrapolator        = InDetExtrapolator)
+            if newInDetAlignAlg_Options["d0significanceCut"] > 0:
+                trackSelectorNew.maxD0overSigmaD0 = 3
+        else:
+            print " <InDetAlign_setup> InDetAlign_setup : setting InDetTrackSelectionToolAlignTracks for cosmics"
+            trackSelectorNew= InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectionToolAlignTracks",
+                                                             UseTrkTrackTools = True,
+                                                             minPt = float(newInDetAlignAlg_Options["PtCut"]),
+                                                             maxD0 = 9999.,
+                                                             maxZ0 = 9999.,
+                                                             minNPixelHits = 1,
+                                                             minNSctHits = 8,
+                                                             minNSiHitsModTop = 2,
+                                                             minNSiHitsModBottom = 2,
+                                                             minNTrtHits = minNTRTHits,
+                                                             maxEtaForTrtHitCuts = maxEtaForTRTHitCuts,
+                                                             maxTrtEtaAcceptance = maxTRTEtaAcceptance,
+                                                             CutLevel = "Loose",
+                                                             TrackSummaryTool    = InDetTrackSummaryTool,
+                                                             Extrapolator        = InDetExtrapolator)
+        ToolSvc+=trackSelectorNew
+        print trackSelectorNew
+
+    ###############################
+    # create AlignTrackPreProcessor
+    if newInDetAlignAlg_Options["useOldPreProcessor"] :
+        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackPreProcessor
+        # with hit quality selection tool
+        preProcessor = Trk__AlignTrackPreProcessor(
+            name = "AlignTrackPreProcessor",
+            OutputLevel = newInDetAlignAlg_Options["outputLevel"],
+            RefitTracks = newInDetAlignAlg_Options["refitTracks"],
+            TrackFitterTool = trackFitter,
+            SLTrackFitterTool = trackFitter,
+            UseSingleFitter = True,
+            ParticleHypothesis = newInDetAlignAlg_Options["particleNumber"],
+            RunOutlierRemoval = newInDetAlignAlg_Options["runOutlier"],
+            HitQualityTool = myHitQualSelTool
+        )
+        if newInDetAlignAlg_Options["doSiHitQualSel"]:
+            preProcessor.SelectHits = newInDetAlignAlg_Options["doSiHitQualSel"]
+
+        if newInDetAlignAlg_Options["FixMomentum"]:
+            preProcessor.FixMomentum = newInDetAlignAlg_Options["FixMomentum"]
+            print " <InDetAlign_setup> OldProcessor -> Using FixMomentum = ", newInDetAlignAlg_Options["FixMomentum"]
+
+        # don't store matrices when running local
+        if newInDetAlignAlg_Options["runLocal"]:
+            preProcessor.StoreFitMatricesAfterRefit = False
+
+        if newInDetAlignAlg_Options["useTrackSelector"]:
+            preProcessor.SelectTracks = True
+            preProcessor.TrackSelectorTool = trackSelectorNew
+    else :
+        print " <InDetAlign_setup> OldPreProcessor is NOT used " 
+        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__BeamspotVertexPreProcessor
+        #print " <InDetAlign_setup> TYPE PtCutForBSConstraint", type(newInDetAlignAlg_Options["PtCutForBSConstraint"])
+        print " <InDetAlign_setup> setting BeamspotVertexPreProcessor " 
+        preProcessor = Trk__BeamspotVertexPreProcessor("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"],
+                                                       #maxPt                = newInDetAlignAlg_Options["PtCutForBSConstraint"],
+                                                       DoPVConstraint        = newInDetAlignAlg_Options["doPVConstraint"],
+                                                       DoAssociatedToPVSelection = newInDetAlignAlg_Options["doBSAssociatedToPVSelection"],
+                                                       BeamspotScalingFactor     = newInDetAlignAlg_Options["beamspotScalingFactor"],
+                                                       DoBSTrackSelection        = newInDetAlignAlg_Options["doBSTrackSelection"],
+                                                       BSConstraintTrackSelector = trackSelectorNew
+        )
+
+        #if newInDetAlignAlg_Options["doSiHitQualSel"]:        
+        #    preProcessor.SelectHits = newInDetAlignAlg_Options["doSiHitQualSel"]
+
+        if newInDetAlignAlg_Options["FixMomentum"]:
+            preProcessor.FixMomentum = newInDetAlignAlg_Options["FixMomentum"]
+            print " <InDetAlign_setup> NewProcessor -> Using FixMomentum = ", newInDetAlignAlg_Options["FixMomentum"]
+
+        # don't store matrices when running local
+        if newInDetAlignAlg_Options["runLocal"]:
+            preProcessor.StoreFitMatrices = False
+
+        if newInDetAlignAlg_Options["useTrackSelector"]:
+            preProcessor.TrackSelector = trackSelectorNew
+
+    ToolSvc += preProcessor
+    print " <InDetAlign_setup.py> preProcessor properties follow (Trk__BeamspotVertexPreProcessor):"
+    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:
+        newInDetAlignAlg_Options["trackCollection"] = "SelectedMuonsRefit1"
+        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__TrackCollectionProvider
+        trackCollectionProvider=Trk__TrackCollectionProvider("TrackCollectionProvider2",
+                                                             OutputLevel = newInDetAlignAlg_Options["outputLevel"],
+                                                             InputTrkCol = newInDetAlignAlg_Options["trackCollection"]
+                                                        )
+    else:
+        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__ConstrainedTrackProvider
+        trackCollectionProvider=Trk__ConstrainedTrackProvider("TrackCollectionProvider",
+                                      #OutputLevel = newInDetAlignAlg_Options["outputLevel"],
+                                      OutputLevel = DEBUG,
+                                      InputTracksCollection= newInDetAlignAlg_Options["trackCollection"],
+                                      MinPt = newInDetAlignAlg_Options["MinPtForConstrainedProvider"],
+                                      MaxPt = 120,
+                                      MomentumConstraintFileName = newInDetAlignAlg_Options["eoverpmapconstraint"],
+                                      MomentumConstraintHistName = newInDetAlignAlg_Options["eoverpmapconstraintmap"],
+                                      CorrectMomentum = True,
+                                      DeltaScaling = 1,
+                                      ReduceConstraintUncertainty = 1.,
+                                      CorrectZ0 = newInDetAlignAlg_Options["CorrectZ0"],
+                                      z0ConstraintFileName =  newInDetAlignAlg_Options["z0mapconstraint"],
+                                      z0ConstraintHistName =  newInDetAlignAlg_Options["z0mapconstraintmap"],
+                                      CorrectD0 = newInDetAlignAlg_Options["CorrectD0"],
+                                      d0ConstraintFileName =  newInDetAlignAlg_Options["d0mapconstraint"],
+                                      d0ConstraintHistName =  newInDetAlignAlg_Options["d0mapconstraintmap"],
+                                      UseConstraintError =  False,
+                                      UseConstrainedTrkOnly= False,
+                                      TrackFitter = trackFitter   )
+        print trackCollectionProvider
+    ToolSvc += trackCollectionProvider
+
+    ################################
+    ################################
+    # build GlobalAlign algorithm
+    #
+    from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
+    InDetGlobalAlign =  Trk__AlignAlg(
+        "InDetGlobalAlign",
+        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
+        TrackCollectionProvider = trackCollectionProvider,
+        AlignTrackCreator = alignTrackCreator,
+        AlignTrackDresser = alignTrackDresser,
+        AlignTrackPreProcessor = preProcessor,
+        GeometryManagerTool = trkAlignGeoManagerTool,
+        FillNtupleTool = ntupleTool,
+        WriteNtuple = newInDetAlignAlg_Options["writeAlignNtuple"],
+        FileName = newInDetAlignAlg_Options["alignNtupleName"],
+        AlignTool = globalChi2AlignTool,
+        AlignDBTool = trkAlignDBTool
+    )
+
+    topSequence += InDetGlobalAlign
+    print InDetGlobalAlign
+
+##################################################
+##
+##  Setup solving from accumulated files
+##
+else:
+    ################################
+    # build GlobalAlign algorithm
+    #
+    from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
+    InDetGlobalSolve =  Trk__AlignAlg(
+        "InDetGlobalSolve",
+        OutputLevel = newInDetAlignAlg_Options["outputLevel"],
+        GeometryManagerTool = trkAlignGeoManagerTool,
+        AlignTool = globalChi2AlignTool,
+        AlignDBTool = trkAlignDBTool,
+        SolveOnly = True,
+        WriteNtuple = False
+    )
+
+    topSequence += InDetGlobalSolve
+    print InDetGlobalSolve
+
+################################
+# Write constants to Pool file
+# the OutputConditionsAlg has to be set up at the end
+# so that it runs last and picks up the latest version
+# of constants from memory
+if newInDetAlignAlg_Options["runSolving"] and newInDetAlignAlg_Options["writeConstantsToPool"]:
+    objectList = []
+    tagList = []
+
+    if newInDetAlignAlg_Options["writeSilicon"]:
+        if newInDetAlignAlg_Options["writeDynamicDB"]:
+            objectList += ["CondAttrListCollection#/Indet/AlignL1/ID"]
+            objectList += ["CondAttrListCollection#/Indet/AlignL2/PIX"]
+            objectList += ["CondAttrListCollection#/Indet/AlignL2/SCT"]
+            objectList += [ "AlignableTransformContainer#/Indet/AlignL3" ]
+            tagList += [ "IndetL1Test", "IndetL2PIXTest", "IndetL2SCTTest",  newInDetAlignAlg_Options["tagSi"] ]
+        else:
+            objectList += [ "AlignableTransformContainer#/Indet/Align" ]
+            tagList += [ newInDetAlignAlg_Options["tagSi"] ]
+    if newInDetAlignAlg_Options["writeTRT"]:
+        if newInDetAlignAlg_Options["writeDynamicDB"]:
+            objectList += ["CondAttrListCollection#/TRT/AlignL1/TRT"]
+            objectList += [ "AlignableTransformContainer#/TRT/AlignL2" ]
+            tagList += [ "IndetL1TRTTest", newInDetAlignAlg_Options["tagTRT"] ]
+        else:
+            objectList += [ "AlignableTransformContainer#/TRT/Align" ]
+            tagList += [ newInDetAlignAlg_Options["tagTRT"] ]
+    if newInDetAlignAlg_Options["writeTRTL3"]:
+        objectList += [ "TRTCond::StrawDxContainer#/TRT/Calib/DX"]
+    if newInDetAlignAlg_Options["writeIBLDistDB"]:
+        objectList += ["CondAttrListCollection#/Indet/IBLDist"]
+        tagList    += [newInDetAlignAlg_Options["tagBow"]]
+
+
+    from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
+    myOCA = OutputConditionsAlg(outputFile = newInDetAlignAlg_Options["outputPoolFile"])
+    myOCA.ObjectList = objectList
+    myOCA.IOVTagList = tagList
+
+################################
+# build AlignTrack collection splitter algorithm
+print " <InDetAlign_setup> Setting up the AlignTrackCollSplitter "
+from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignTrackCollSplitter
+AlignTrackCollSplitter = Trk__AlignTrackCollSplitter(
+    "AlignTrackCollSplitter",
+    OutputLevel = newInDetAlignAlg_Options["outputLevel"]
+)
+
+topSequence += AlignTrackCollSplitter
+print AlignTrackCollSplitter
+
+
+################################
+if newInDetAlignAlg_Options["LumiblockSelection"]:
+	print " <InDetAlign_setup>      **************************** "
+	print "                         **  Selecting LumiBlocks  ** "
+	print "                         **************************** "
+	print "                         **   List of LumiBlocks   ** "
+	print str(newInDetAlignAlg_Options["LumiblockList"]).strip('[]')
+	print " **                      ** "
+	import InDetBeamSpotExample.FilterUtils as FilterUtils
+	FilterUtils.filterSeq += FilterUtils.LBFilter(newInDetAlignAlg_Options["LumiblockList"])
+else:
+	print " <InDetAlign_setup> ** Selecting LumiBlocks is NOT active ** "
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring.py
deleted file mode 100644
index f90a1878d15cff512a00394ff6f2f17db482d38b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring.py
+++ /dev/null
@@ -1,187 +0,0 @@
-#example of personal topOptions
-#
-# to use it
-# athena >! athena.log
-#  ( myTopOptions.py is defaulted through jobOptions.py soft link)
-#
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-#
-# doESD, DetDescrVersion and other flags
-# needs be set before the include, since several
-# secondary flags are configured according to that one
-#
-#   1) Specify the input in here
-#      - One file
-#PoolInput = ["/home/wdic/data15_comm.00264034.physics_MinBias.recon.ESD.x322._lb0805._SFO-1._0001.1"]
-#   2) Feed files when executing the script
-if 'inputFiles' in dir():
-  print inputFiles
-PoolInput = inputFiles
-
-# number of event to process
-EvtMax=-1
-SkipEvents = 0
-
-NoBeamConstraint=True
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-pmjp.PerfMonFlags.doFastMon=True
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
-athenaCommonFlags.SkipEvents = SkipEvents
-
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-REPPST-007-08")
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-#rec.doPerfMon.set_Value_and_Lock(True)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(True)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-#rec.doMuon.set_Value_and_Lock(True)
-#rec.doMuonCombined.set_Value_and_Lock(True)
-#rec.doEgamma.set_Value_and_Lock(True)
-#rec.doJetMissingETTag.set_Value_and_Lock(True)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(False)
-rec.doTruth.set_Value_and_Lock(False)
-
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
-#with beamconstraint
-if NoBeamConstraint:
-  from InDetRecExample.InDetJobProperties import InDetFlags
-  InDetFlags.useBeamConstraint.set_Value_and_Lock(False)
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-#DetFlags.Calo_setOn()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-
-DetFlags.makeRIO.Calo_setOff()
-DetFlags.detdescr.Calo_setOn()
-
-
-#USE temporary to DEBUG
-#from AthenaCommon.AppMgr import theApp
-#theApp.ReflexPluginDebugLevel=1
-
-
-readPool = False
-
-from IOVDbSvc.CondDB import conddb
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_189598_189845v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_189598_189845v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_ZDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_ZDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
-#conddb.addOverride('/Indet/TrkErrorScaling', 'IndetTrkErrorScaling_nominal')
-
-if not conddb.folderRequested('PIXEL/PixReco'):
-  conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
-
-if readPool :
-	conddb.blockFolder("/Indet/Align")
-	conddb.blockFolder("/TRT/Align")
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	# set this to the file containing AlignableTransform objects
-	ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-	ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-	print ServiceMgr.CondProxyProvider
-	# this preload causes callbacks for read in objects to be activated,
-	# allowing GeoModel to pick up the transforms
-	ServiceMgr.IOVSvc.preLoadData=True
-	ServiceMgr.IOVSvc.OutputLevel=INFO
-
-include ("InDetRecExample/InDetRecConditionsAccess.py")
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
-varsVSmeanJpsi = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
-varsVSwidthJpsi = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
-varsDistrJpsi = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
-JpsiMon = DiMuMon(name = "JpsiMon_NoTrig",
-                  resonName = "Jpsi",
-                  minInvmass = 2.5,
-                  maxInvmass = 3.5,
-                  nMassBins = 50,
-                  triggerChainName = "NoTrig",
-                  regions = ["All","BB","EAEA","ECEC"],
-                  varsVSmean = varsVSmeanJpsi,
-                  varsVSwidth = varsVSwidthJpsi,
-                  varsDistr = varsDistrJpsi,
-                  doFits = True,
-                  doSaveFits = False,
-                  OutputLevel = VERBOSE)
-
-ToolSvc += JpsiMon
-
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
-                                    FileKey             = DQMonFlags.monManFileKey(),
-                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                    DataType            = DQMonFlags.monManDataType(),
-                                    Environment         = "user",
-                                    ManualRunLBSetup    = True,
-                                    Run                 = 1,
-                                    LumiBlock           = 1)
-IDPerfMonManager.AthenaMonTools += [ JpsiMon ]
-
-from GaudiSvc.GaudiSvcConf import THistSvc
-ServiceMgr += THistSvc()
-ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='./DiMuMon.root' OPT='RECREATE'"]
-IDPerfMonManager.FileKey = "DiMuMon"
-
-topSequence += IDPerfMonManager
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring_data.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring_data.py
deleted file mode 100644
index 9fa692a77b111f746e0655ff8529e785a38bf8b5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring_data.py
+++ /dev/null
@@ -1,229 +0,0 @@
-#example of personal topOptions
-#
-# to use it
-# athena >! athena.log
-#  ( myTopOptions.py is defaulted through jobOptions.py soft link)
-#
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-#
-# doESD, DetDescrVersion and other flags
-# needs be set before the include, since several
-# secondary flags are configured according to that one
-#
-#   1) Specify the input in here
-#      - One file
-#PoolInput = ["/home/wdic/data15_comm.00264034.physics_MinBias.recon.ESD.x322._lb0805._SFO-1._0001.1"]
-#   2) Feed files when executing the script
-if 'inputFiles' in dir():
-  print inputFiles
-PoolInput = inputFiles
-
-# number of event to process
-EvtMax=-1
-SkipEvents = 0
-
-NoBeamConstraint=True
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-pmjp.PerfMonFlags.doFastMon=True
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
-athenaCommonFlags.SkipEvents = SkipEvents
-
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-REPPST-007-08")
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-#rec.doPerfMon.set_Value_and_Lock(True)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(True)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-#rec.doMuon.set_Value_and_Lock(True)
-#rec.doMuonCombined.set_Value_and_Lock(True)
-#rec.doEgamma.set_Value_and_Lock(True)
-#rec.doJetMissingETTag.set_Value_and_Lock(True)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(False)
-rec.doTruth.set_Value_and_Lock(False)
-
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
-#with beamconstraint
-if NoBeamConstraint:
-  from InDetRecExample.InDetJobProperties import InDetFlags
-  InDetFlags.useBeamConstraint.set_Value_and_Lock(False)
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-#DetFlags.Calo_setOn()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-
-DetFlags.makeRIO.Calo_setOff()
-DetFlags.detdescr.Calo_setOn()
-
-
-#USE temporary to DEBUG
-#from AthenaCommon.AppMgr import theApp
-#theApp.ReflexPluginDebugLevel=1
-
-
-
-from GaudiSvc.GaudiSvcConf import THistSvc
-
-# add LumiBlockMetaDataTool to ToolSvc and configure
-from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
-ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
-LumiBlockMetaDataTool.calcLumi = True # False by default
-
-# add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
-from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
-svcMgr += MetaDataSvc( "MetaDataSvc" )
-svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
-
-# Configure the goodrunslist selector tool
-from GoodRunsLists.GoodRunsListsConf import *
-ToolSvc += GoodRunsListSelectorTool()
-GoodRunsListSelectorTool.GoodRunsListVec = [ '$TestArea/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/data15_13TeV.periodAllYear_DetStatus-v63-pro18-01_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml' ]
-
-## This Athena job consists of algorithms that loop over events;
-## here, the (default) top sequence is used:
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-job = AlgSequence()
-seq = AthSequencer("AthFilterSeq")
-
-## AthFilterSeq is always executed before the top sequence, and is configured such that
-## any follow-up sequence (eg. top sequence) is not executed in case GRLTriggerAlg1 does
-## not pass the event
-## In short, the sequence AthFilterSeq makes sure that all algs in the job sequence
-## are skipped when an event gets rejects
-from GoodRunsListsUser.GoodRunsListsUserConf import *
-seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']        ## pick up correct name from inside xml file!
-#seq.GRLTriggerAlg1.TriggerSelectionRegistration = 'L1_MBTS_1' ## set this to your favorite trigger, eg. L1_MBTS_1_1
-
-## Add the ntuple dumper to the top sequence, as usual
-## DummyDumperAlg1 is run in the top sequence, but is not executed in case GRLTriggerAlg1 rejects the event.
-job += DummyDumperAlg('DummyDumperAlg1')
-# job.DummyDumperAlg1.RootFileName = 'selection1.root'
-ServiceMgr += THistSvc()
-ServiceMgr.THistSvc.Output = ["new DATAFILE='selection1.root' TYP='ROOT' OPT='RECREATE'"];
-job.DummyDumperAlg1.GRLNameVec = [ 'LumiBlocks_GoodDQ0', 'IncompleteLumiBlocks_GoodDQ0' ]
-
-
-
-readPool = False
-
-from IOVDbSvc.CondDB import conddb
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_189598_189845v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_189598_189845v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_ZDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_ZDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
-#conddb.addOverride('/Indet/TrkErrorScaling', 'IndetTrkErrorScaling_nominal')
-
-if not conddb.folderRequested('PIXEL/PixReco'):
-  conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
-
-if readPool :
-	conddb.blockFolder("/Indet/Align")
-	conddb.blockFolder("/TRT/Align")
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	# set this to the file containing AlignableTransform objects
-	ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-	ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-	print ServiceMgr.CondProxyProvider
-	# this preload causes callbacks for read in objects to be activated,
-	# allowing GeoModel to pick up the transforms
-	ServiceMgr.IOVSvc.preLoadData=True
-	ServiceMgr.IOVSvc.OutputLevel=INFO
-
-include ("InDetRecExample/InDetRecConditionsAccess.py")
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
-varsVSmeanJpsi = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
-varsVSwidthJpsi = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
-varsDistrJpsi = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
-JpsiMon = DiMuMon(name = "JpsiMon_NoTrig",
-                  resonName = "Jpsi",
-                  minInvmass = 2.5,
-                  maxInvmass = 3.5,
-                  nMassBins = 50,
-                  triggerChainName = "NoTrig",
-                  regions = ["All","BB","EAEA","ECEC"],
-                  varsVSmean = varsVSmeanJpsi,
-                  varsVSwidth = varsVSwidthJpsi,
-                  varsDistr = varsDistrJpsi,
-                  doFits = True,
-                  doSaveFits = False,
-                  OutputLevel = VERBOSE)
-
-ToolSvc += JpsiMon
-
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
-                                    FileKey             = DQMonFlags.monManFileKey(),
-                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                    DataType            = DQMonFlags.monManDataType(),
-                                    Environment         = "user",
-                                    ManualRunLBSetup    = True,
-                                    Run                 = 1,
-                                    LumiBlock           = 1)
-IDPerfMonManager.AthenaMonTools += [ JpsiMon ]
-
-ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='./DiMuMon.root' OPT='RECREATE'"]
-IDPerfMonManager.FileKey = "DiMuMon"
-
-topSequence += IDPerfMonManager
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring_data_grid.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring_data_grid.py
deleted file mode 100644
index 38c99ce343fececad79c4132a1ba4aab9db7572b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJPsiMonitoring_data_grid.py
+++ /dev/null
@@ -1,229 +0,0 @@
-#example of personal topOptions
-#
-# to use it
-# athena >! athena.log
-#  ( myTopOptions.py is defaulted through jobOptions.py soft link)
-#
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-#
-# doESD, DetDescrVersion and other flags
-# needs be set before the include, since several
-# secondary flags are configured according to that one
-#
-#   1) Specify the input in here
-#      - One file
-#PoolInput = ["/home/wdic/data15_comm.00264034.physics_MinBias.recon.ESD.x322._lb0805._SFO-1._0001.1"]
-#   2) Feed files when executing the script
-if 'inputFiles' in dir():
-  print inputFiles
-PoolInput = inputFiles
-
-# number of event to process
-EvtMax=-1
-SkipEvents = 0
-
-NoBeamConstraint=True
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-pmjp.PerfMonFlags.doFastMon=True
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
-athenaCommonFlags.SkipEvents = SkipEvents
-
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-REPPST-007-08")
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-#rec.doPerfMon.set_Value_and_Lock(True)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(True)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-#rec.doMuon.set_Value_and_Lock(True)
-#rec.doMuonCombined.set_Value_and_Lock(True)
-#rec.doEgamma.set_Value_and_Lock(True)
-#rec.doJetMissingETTag.set_Value_and_Lock(True)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(False)
-rec.doTruth.set_Value_and_Lock(False)
-
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
-#with beamconstraint
-if NoBeamConstraint:
-  from InDetRecExample.InDetJobProperties import InDetFlags
-  InDetFlags.useBeamConstraint.set_Value_and_Lock(False)
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-#DetFlags.Calo_setOn()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-
-DetFlags.makeRIO.Calo_setOff()
-DetFlags.detdescr.Calo_setOn()
-
-
-#USE temporary to DEBUG
-#from AthenaCommon.AppMgr import theApp
-#theApp.ReflexPluginDebugLevel=1
-
-
-
-from GaudiSvc.GaudiSvcConf import THistSvc
-
-# add LumiBlockMetaDataTool to ToolSvc and configure
-from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool
-ToolSvc += LumiBlockMetaDataTool( "LumiBlockMetaDataTool" )
-LumiBlockMetaDataTool.calcLumi = True # False by default
-
-# add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc
-from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
-svcMgr += MetaDataSvc( "MetaDataSvc" )
-svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.LumiBlockMetaDataTool ]
-
-# Configure the goodrunslist selector tool
-from GoodRunsLists.GoodRunsListsConf import *
-ToolSvc += GoodRunsListSelectorTool()
-GoodRunsListSelectorTool.GoodRunsListVec = [ './data15_13TeV.periodAllYear_DetStatus-v63-pro18-01_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml' ]
-
-## This Athena job consists of algorithms that loop over events;
-## here, the (default) top sequence is used:
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-job = AlgSequence()
-seq = AthSequencer("AthFilterSeq")
-
-## AthFilterSeq is always executed before the top sequence, and is configured such that
-## any follow-up sequence (eg. top sequence) is not executed in case GRLTriggerAlg1 does
-## not pass the event
-## In short, the sequence AthFilterSeq makes sure that all algs in the job sequence
-## are skipped when an event gets rejects
-from GoodRunsListsUser.GoodRunsListsUserConf import *
-seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']        ## pick up correct name from inside xml file!
-#seq.GRLTriggerAlg1.TriggerSelectionRegistration = 'L1_MBTS_1' ## set this to your favorite trigger, eg. L1_MBTS_1_1
-
-## Add the ntuple dumper to the top sequence, as usual
-## DummyDumperAlg1 is run in the top sequence, but is not executed in case GRLTriggerAlg1 rejects the event.
-job += DummyDumperAlg('DummyDumperAlg1')
-# job.DummyDumperAlg1.RootFileName = 'selection1.root'
-ServiceMgr += THistSvc()
-ServiceMgr.THistSvc.Output = ["new DATAFILE='selection1.root' TYP='ROOT' OPT='RECREATE'"];
-job.DummyDumperAlg1.GRLNameVec = [ 'LumiBlocks_GoodDQ0', 'IncompleteLumiBlocks_GoodDQ0' ]
-
-
-
-readPool = False
-
-from IOVDbSvc.CondDB import conddb
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_189598_189845v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_189598_189845v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_EoverP_190608_191239v0')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_EoverP_189598_189845v0')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_RDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
-#conddb.addOverride('/Indet/Align', 'InDetAlign_Nominal_ZDeltaPhi_01')
-#conddb.addOverride('/TRT/Align',   'TRTAlign_Nominal_ZDeltaPhi_01')
-#conddb.addOverride('/TRT/Calib/DX','TRTCalibDX_nominal')
-
-#conddb.addOverride('/Indet/TrkErrorScaling', 'IndetTrkErrorScaling_nominal')
-
-if not conddb.folderRequested('PIXEL/PixReco'):
-  conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
-
-if readPool :
-	conddb.blockFolder("/Indet/Align")
-	conddb.blockFolder("/TRT/Align")
-	from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-	from AthenaCommon.AppMgr import ServiceMgr
-	ServiceMgr += CondProxyProvider()
-	ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-	# set this to the file containing AlignableTransform objects
-	ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-	ServiceMgr.CondProxyProvider.OutputLevel=DEBUG
-	print ServiceMgr.CondProxyProvider
-	# this preload causes callbacks for read in objects to be activated,
-	# allowing GeoModel to pick up the transforms
-	ServiceMgr.IOVSvc.preLoadData=True
-	ServiceMgr.IOVSvc.OutputLevel=INFO
-
-include ("InDetRecExample/InDetRecConditionsAccess.py")
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
-varsVSmeanJpsi = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
-varsVSwidthJpsi = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
-varsDistrJpsi = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
-JpsiMon = DiMuMon(name = "JpsiMon_NoTrig",
-                  resonName = "Jpsi",
-                  minInvmass = 2.5,
-                  maxInvmass = 3.5,
-                  nMassBins = 50,
-                  triggerChainName = "NoTrig",
-                  regions = ["All","BB","EAEA","ECEC"],
-                  varsVSmean = varsVSmeanJpsi,
-                  varsVSwidth = varsVSwidthJpsi,
-                  varsDistr = varsDistrJpsi,
-                  doFits = True,
-                  doSaveFits = False,
-                  OutputLevel = VERBOSE)
-
-ToolSvc += JpsiMon
-
-from AthenaMonitoring.DQMonFlags import DQMonFlags
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
-                                    FileKey             = DQMonFlags.monManFileKey(),
-                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                    DataType            = DQMonFlags.monManDataType(),
-                                    Environment         = "user",
-                                    ManualRunLBSetup    = True,
-                                    Run                 = 1,
-                                    LumiBlock           = 1)
-IDPerfMonManager.AthenaMonTools += [ JpsiMon ]
-
-ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='./DiMuMon.root' OPT='RECREATE'"]
-IDPerfMonManager.FileKey = "DiMuMon"
-
-topSequence += IDPerfMonManager
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJpsimumuValidation.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJpsimumuValidation.py
deleted file mode 100644
index 21066ee839ef24cfe49d831484f7c9d09264a36b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runJpsimumuValidation.py
+++ /dev/null
@@ -1,152 +0,0 @@
-#example of personal topOptions
-#
-# to use it
-# athena >! athena.log
-#  ( myTopOptions.py is defaulted through jobOptions.py soft link)
-#
-# see RecExCommon/share/RecExCommon_flags.py for more available flags
-# and https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonFlags
-# for more complete documentation.
-#
-# doESD, DetDescrVersion and other flags
-# needs be set before the include, since several
-# secondary flags are configured according to that one
-#
-#   1) Specify the input in here
-#      - One file
-#PoolInput = ["/afs/cern.ch/work/s/sthenkel/work/testarea/20.1.0.6/MCsets/valid1.167824.Sherpa_CT10_ZmumuMassiveCBPt280_500_BFilter.recon.ESD.e3099_s1982_s1964_r6006_tid04628773_00/ESD.04628773._000033.pool.root.1"]
-#PoolInput = ["/afs/cern.ch/user/s/sthenkel/eos/atlas/user/s/sthenkel/MC/valid3.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3099_s2578_r6588_tid05292497_00/ESD.05292497._000150.pool.root.1"]
-#   2) Feed files when executing the script
-if 'inputFiles' in dir():
-  print inputFiles
-PoolInput = inputFiles
-
-
-#      - Multiple files
-#PoolInput = ["root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._007903.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._007027.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005086.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005166.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005436.pool.root.1","root://eosatlas//eos/atlas/user/s/sthenkel/MC/mc14_13TeV.147407.PowhegPythia8_AZNLO_Zmumu.recon.ESD.e3059_s2046_s2008_r5862_tid01612263_00/ESD.01612264._005561.pool.root.1"]
-
-# number of event to process
-EvtMax=-1
-SkipEvents = 0
-
-NoBeamConstraint=True
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-pmjp.PerfMonFlags.doFastMon=True
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
-athenaCommonFlags.SkipEvents = SkipEvents
-
-from AthenaCommon.GlobalFlags import globalflags
-#globalflags.ConditionsTag.set_Value_and_Lock("COMCOND-REPPST-007-08")
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-GEO-16-00-01")
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-#rec.doPerfMon.set_Value_and_Lock(True)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(True)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-#rec.doMuon.set_Value_and_Lock(True)
-#rec.doMuonCombined.set_Value_and_Lock(True)
-#rec.doEgamma.set_Value_and_Lock(True)
-#rec.doJetMissingETTag.set_Value_and_Lock(True)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(False)
-rec.doTruth.set_Value_and_Lock(False)
-
-
-from LArConditionsCommon.LArCondFlags import larCondFlags
-larCondFlags.LoadElecCalib.set_Value_and_Lock(True)
-
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
-#with beamconstraint
-if NoBeamConstraint:
-  from InDetRecExample.InDetJobProperties import InDetFlags
-  InDetFlags.useBeamConstraint.set_Value_and_Lock(False)
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-DetFlags.Calo_setOn()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-
-#DetFlags.makeRIO.Calo_setOff()
-#DetFlags.detdescr.Calo_setOn()
-
-
-
-#USE temporary to DEBUG
-#from AthenaCommon.AppMgr import theApp
-#theApp.ReflexPluginDebugLevel=1
-
-
-readPool = False
-
-from IOVDbSvc.CondDB import conddb
-
-if not conddb.folderRequested('PIXEL/PixReco'):
-  conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')
-
-
-
-include ("InDetRecExample/InDetRecConditionsAccess.py")
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-
-from GaudiSvc.GaudiSvcConf import THistSvc
-ServiceMgr += THistSvc()
-ServiceMgr.THistSvc.Output += ["JpsimumuValidation DATAFILE='JpsimumuValidationOut.root' OPT='RECREATE'"]
-include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
-
-from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonJpsimumu
-iDPerfMonJpsimumu = IDPerfMonJpsimumu(name = 'IDPerfMonJpsimumu',
-                                     ReFitterTool1 = MuonRefitterTool,
-                                     ReFitterTool2 = MuonRefitterTool2,
-				     OutputTracksName =  "SelectedMuons",
-#				     isMC = True,
-				     isMC = False,
-				     doIsoSelection = False,
-                                     OutputLevel= DEBUG)
-
-
-#ToolSvc += funIDPerfMonJpsimumu
-job += iDPerfMonJpsimumu
-
-trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
-#StoreGateSvc = Service("StoreGateSvc")
-#StoreGateSvc.Dump = True
-include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_align.py
similarity index 76%
rename from InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py
rename to InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_align.py
index 8b42fb6e004eecc72d72b4cf98002e7f3969794c..737d2e26cfd7f4c0a5fe2cf9adfc4d99cf44c4e9 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_align.py
@@ -1,12 +1,13 @@
+##############################
+#
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
 #############################
-# Rel 21
-###############################
 import commands
 import os
 #
 print ' == runzmumu == START == TestArea = ',os.getenv("TestArea")
 print ' == runzmumu == CHECK if the TestArea is setup such that the setup.sh is sourced '
-#theCommand = "source %s/build/x86_64-slc6-gcc62-opt/setup.sh" %(os.getenv("TestArea"))
 theCommand = "source %s/x86_64-slc6-gcc62-opt/setup.sh" %(os.getenv("TestArea"))
 theOutput =  commands.getoutput(theCommand)
 print ' == runzmumu == Rel21 init command: ',theCommand
@@ -22,10 +23,11 @@ try:
     Athena_VERSION = os.getenv("Athena_VERSION")
 except:
     Athena_VERSION = "21.0.69"
+
 ###############################
 # enable outputs
 zmumuval = True
-globalAlignmentMon = False #no refitting for extracting the recommendations, only bulk as it comes out
+globalAlignmentMon = True #no refitting for extracting the recommendations, only bulk as it comes out
 dimuonmon = False
 monitoringAllTracks = True
 
@@ -33,7 +35,7 @@ monitoringAllTracks = True
 useGRL = False
 
 # MC
-MC_bool = True
+MC_bool = False
 
 # do Trigger
 DoTrigger = False
@@ -41,15 +43,19 @@ DoTrigger = False
 # where to run
 grid_bool = True
 
+# run alignment
+run_alignment = True
+
 # handle input constants
-readPool = False # default True
-readLocalDynamicDB = False # default False
+readPool = False  
+readLocalDynamicDB = False 
+AlignYear = 2018
+
+inputConstants = "step06_ConfigID_2_310634_AlignmentConstants_Iter0_Block00.root"
+if (AlignYear == 2018): 
+    inputConstants = "step_17_ConfigID_2_352448_AlignmentConstants_Iter0_Block00.root"
 
-#inputConstants = "ReAlign_2018_L6_Step28_L3.root"
-inputConstants = "step29_358395_AlignmentConstants_Iter0_Block00.root"
-#inputConstants = "MisalignmentSet11_p01.pool.root"
 inputdb = "Javi_Test_mycool.db"
-#inputdb = "step8_Iter1_mycool.db"
 
 if (readPool):
     print " readPool = True file: %s" %(inputConstants)
@@ -58,12 +64,15 @@ if (readPool):
     if ("lxplus" not in socket.gethostname()):
         inputConstants = "usr/WorkDir/%s/InstallArea/%s/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/%s" % (Athena_VERSION, WorkDir_PLATFORM, inputConstants)
         inputdb = "usr/WorkDir/%s/InstallArea/%s/src/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/%s" % (Athena_VERSION, WorkDir_PLATFORM, inputdb)
+else:
+    inputConstants = ""
+    inputdb = ""
 
 # weight file for IDAlignment monitoring
 useWeightInMonitoring = False
 
 # use configuration for conditions (True) or autoconfigured (False)
-useConfigConditions = True
+useConfigConditions = False
 
 # use IDAlignment dynamic folders for 2016 data
 useIDADynamicFolders = True
@@ -77,6 +86,8 @@ print ' == useConfigConditions = ', useConfigConditions
 print ' == useWeightInMonitoring =', useWeightInMonitoring
 print ' == useIDADynamicFolders =', useIDADynamicFolders
 print ' == useGRL =', useGRL
+print ' == runAlignment =', run_alignment
+print ' == AlignYear =', AlignYear
 print ' == readPool =',readPool
 if (readPool): 
     print ' == inputConstants =',inputConstants
@@ -88,16 +99,11 @@ print ' ========= runzmumu === config == end == '
 #include("InDetSimpleVisual/GetDetectorPositions.py")
 
 if (grid_bool):
-    #PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/data18_13TeV.00352436.physics_Main.merge.DAOD_ZMUMU.f938_m1831_f938_m1982._0027.1"]
-    PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/DAOD_HIGG2D1.14773488._000014.pool.root.1"]
+    PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/data18_13TeV.00352436.physics_Main.merge.DAOD_ZMUMU.f938_m1831_f938_m1982._0027.1"]
 if (MC_bool): 
-    PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/ggH400NW_ZZ4lep_AOD.16564460._000001.pool.root.1"]
-    #PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/ZmumuMC16_AOD.18379878._000123.pool.root.1"]
-    #PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/mc16_13TeV_361603.PowhegPy8EG_CT10nloME_AZNLOCTEQ6L1_ZZllll_mll4.deriv.DAOD_HIGG2D1_file11.pool.root.1"]
-    #PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/mc16_13TeV.361603.PowhegPy8EG_CT10nloME_AZNLOCTEQ6L1_ZZllll_mll4.AOD.file01.pool.root.1"]
-
+    PoolInput =["/eos/user/m/martis/data/mc16_13TeV/folder_mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s3126_r10201/ESD.13642341._000503.pool.root.1"]
 EvtMax= -1
-EvtMax = 5000 #2000
+EvtMax = 20000 
 SkipEvents = 0
 
 from AthenaCommon.AlgSequence import AlgSequence
@@ -117,10 +123,6 @@ if useGRL:
 # END GRL
 ###############
 
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-#pmjp.PerfMonFlags.doFastMon=True
-
 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
 athenaCommonFlags.FilesInput = PoolInput
 athenaCommonFlags.EvtMax = EvtMax
@@ -128,13 +130,12 @@ athenaCommonFlags.SkipEvents = SkipEvents
 
 from AthenaCommon.GlobalFlags import globalflags
 
-myConditionsTag = "auto-configured" #"CONDBR2-BLKPA-2018-10"
+myConditionsTag = "auto-configured"
 if (useConfigConditions):
     if MC_bool: # -> MC
-        #myConditionsTag = "OFLCOND-MC15c-SDR-05" # mc15
         myConditionsTag = "OFLCOND-MC16-SDR-25"
     if not MC_bool: # --> real data 
-        myConditionsTag = "CONDBR2-BLKPA-2018-10" # RD
+        myConditionsTag = "CONDBR2-BLKPA-2018-15" # RD
 
     print " == runzmumu == globalflags.ConditionsTag -> manually configured to ", myConditionsTag
     globalflags.ConditionsTag.set_Value_and_Lock(myConditionsTag)
@@ -142,7 +143,7 @@ if (useConfigConditions):
 else: 
     print " == runzmumu == globalflags.ConditionsTag -> use default: ", myConditionsTag 
 
-myDetDescr = "auto-configured" #ATLAS-R2-2015-04-00-00  ATLAS-R2-2016-00-01-00
+myDetDescr = "auto-configured" 
 if (useConfigConditions):
     myDetDescr = "ATLAS-R2-2016-01-00-01"
     print " == runzmumu == globalflags.DetDescrVersion -> manually configured to ", myDetDescr
@@ -176,16 +177,11 @@ rec.doTau.set_Value_and_Lock(False)
 rec.doTrigger.set_Value_and_Lock(DoTrigger)
 rec.doTruth.set_Value_and_Lock(False)
 
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
 #use dynamic alignment 
 from InDetRecExample.InDetJobProperties import InDetFlags 
 InDetFlags.useDynamicAlignFolders.set_Value_and_Lock(useIDADynamicFolders)
 
 
-
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr
 
 include("RecExCond/RecExCommon_flags.py")
@@ -198,43 +194,39 @@ DetFlags.Muon_setOn()
 print " == runzmumu == user may define his favourite alignment == start == "
 from IOVDbSvc.CondDB import conddb
 if (useIDADynamicFolders):
-    if (False):
-        print (" == runzmumu == configuring 2018 ReAlign family ") 
-        conddb.addOverride("/Indet/AlignL1/ID" ,"IndetAlignL1ID-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/AlignL2/PIX" ,"IndetAlignL2PIX-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/AlignL2/SCT" ,"IndetAlignL2SCT-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/AlignL3" ,"IndetAlignL3-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/IBLDist", "IndetAlignL3-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/TRT/AlignL2", "TRTAlignL2-R2dynamic_2018_ReAlign_Initial")
-    if (False):
+    print " == runzmumu == in useIDADynamicFolders with AlignYear = ", AlignYear
+    if (AlignYear == 2018): # --> ReAlign 2018 default True
+        print (" == runzmumu == 2018 part 1 -- initial tags + SiL3 + TRTL2.... ") 
+        conddb.addOverride("/Indet/AlignL1/ID",  "IndetAlignL1ID-R2dynamic_2018_Part1_ReAlign_Initial")
+        conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX-R2dynamic_2018_Part1_ReAlign_Initial")
+        conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT-R2dynamic_2018_Part1_ReAlign_Initial")
+        conddb.addOverride("/Indet/IBLDist",     "IndetIBLDist-R2dynamic_2018_Part1_ReAlign_Initial")
+        conddb.addOverride("/TRT/AlignL1/TRT",   "TRTAlignL1-R2dynamic_2018_Part1_ReAlign_Initial")
+        #
         if readPool :
             conddb.blockFolder("/Indet/AlignL3")
             conddb.blockFolder("/TRT/AlignL2")
-        if readLocalDynamicDB :
-            conddb.blockFolder("/Indet/AlignL1/ID")
-            conddb.blockFolder("/Indet/AlignL2/PIX")
-            conddb.blockFolder("/Indet/AlignL2/SCT")
-            conddb.blockFolder("/TRT/AlignL1/TRT")
-            conddb.blockFolder("/Indet/IBLDist")
-
-            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/AlignL1/ID','IndetL1Test',True);
-            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/AlignL2/PIX','IndetL2PIXTest',True);
-            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/AlignL2/SCT','IndetL2SCTTest',True);
-            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/TRT/AlignL1/TRT','IndetL1TRTTest',True);
-            conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputdb+';dbname=CONDBR2</dbConnection>/Indet/IBLDist','IndetIBLDist',True); 
-
-    if (False): # --> ReAlign 2018 default True
-        print (" == runzmumu == tags + SiL3 + TRTL2.... ") 
-        conddb.addOverride("/Indet/AlignL1/ID",  "IndetAlignL1ID-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/Indet/IBLDist",     "IndetIBLDist-R2dynamic_2018_ReAlign_Initial")
-        conddb.addOverride("/TRT/AlignL1/TRT",   "TRTAlignL1-R2dynamic_2018_ReAlign_Initial")
+        else:
+            conddb.addOverride("/Indet/AlignL3",     "IndetAlignL3-R2dynamic_2018_Part1_ReAlign_Initial")
+            conddb.addOverride("/TRT/AlignL2",       "TRTAlignL2-R2dynamic_2018_Part1_ReAlign_Initial")
+        
+    if (AlignYear == 2016): # --> ReAlign 2016 default True
+        print (" == runzmumu == 2016 part 1 --  Initial tags. Use family: IndetAlignL1ID_2016_ReAlign_April2020_Initial ") 
+        conddb.addOverride("/Indet/AlignL1/ID",  "IndetAlignL1ID_2016_ReAlign_April2020_Initial")
+        conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX_2016_ReAlign_April2020_Initial")
+        conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT_2016_ReAlign_April2020_Initial")
+        conddb.addOverride("/Indet/IBLDist",     "IndetIBLDist_2016_ReAlign_April2020_Initial")
+        conddb.addOverride("/TRT/AlignL1/TRT",   "TRTAlignL1_2016_ReAlign_April2020_Initial")
+        #
         if readPool :
+            print (" == runzmumu == 2016 part 1 -- reading pool file for Silicon L3: %s" %inputConstants)
             conddb.blockFolder("/Indet/AlignL3")
             conddb.blockFolder("/TRT/AlignL2")
-        
+        else:
+            print (" == runzmumu == 2016 part 1 -- using silicon L3 tag: Repro-Rel21-UPD3-00")
+            conddb.addOverride("/Indet/AlignL3", "IndetAlignL3-Repro-Rel21-UPD3-00")
+            conddb.addOverride("/TRT/AlignL2",   "TRTAlignL2-Repro-Rel21-UPD3-00")
+
 print " == runzmumu == user may define his favourite alignment == completed == "
 ##
 
@@ -309,23 +301,24 @@ if zmumuval == True:
                                     doIPextrToPV = False, # True for IP resolution studies, extrapolates IP parameters to primary vertex
                                     UseTrackSelectionTool = False, # If set to True, it will use the specified TrackSelectionTool in the next Line
                                     TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
-                                    TrackParticleName = 'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees
+                                    TrackParticleName = "combined", #'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees
                                     defaultTreeFolder = "/ZmumuValidationUserSel/default",#always filled with information retrieved from TrackParticle associated to selected muon
                                     truthTreeFolder = "/ZmumuValidationUserSel/truth", # Only filled if isMC is set to True
                                     refit1TreeFolder = "/ZmumuValidationUserSel/refit1",# Only filled if doRefit is set to True
                                     refit2TreeFolder = "/ZmumuValidationUserSel/refit2",# Only filled if doRefit is set to True
                                     combTreeFolder = "/ZmumuValidationUserSel/comb",#always filled with information retrieved from TrackParticle associated to selected muon
+                                    IDTreeFolder = "/ZmumuValidationUserSel/ID",#always filled with information retrieved from TrackParticle associated to selected muon
                                     FourMuTreeFolder = "/ZmumuValidationUserSel/fourmu",# Only filled if doFourMuAnalysis is set to true
                                     doIsoSelection = True,
                                     doIPSelection = True,
                                     doMCPSelection = True, # Medium 
-                                    doFourMuAnalysis = True,
-                                    StoreZmumuNtuple = False,
+                                    doFourMuAnalysis = False,
+                                    StoreZmumuNtuple = True,
                                     #loose selection to keep Z and JPsi events in the ntuple
                                     MassWindowLow = 2.,
                                     MassWindowHigh = 2000.,
-                                    PtLeadingMuon = 5., #10 #4 #15.,
-                                    PtSecondMuon =  5., #10 #4 #15.,
+                                    PtLeadingMuon = 2., #10 #4 #15.,
+                                    PtSecondMuon =  2., #10 #4 #15.,
                                     OpeningAngle = 0.01, # in radians. 1 radian ~60 deg
                                     Z0Gap = 5.0, # in mm
                                     OutputLevel = INFO)
@@ -390,8 +383,11 @@ if (monitoringAllTracks):
 if (zmumuval and globalAlignmentMon):
     trackCollections = ["SelectedMuonsRefit1", "SelectedMuonsRefit2", "Tracks"]
     if (monitoringAllTracks): trackCollections.append("CombinedInDetTracks")
-#   trackCollections = ["SelectedMuonsDefault"]
     StoreGateSvc = Service("StoreGateSvc")
     StoreGateSvc.Dump = False # True in case of debug ** WARNING ** very large output
     include("InDetPerformanceMonitoring/TrackMonitoring.py")
-    #include("TrackMonitoring.py")
+
+### try ID alignment
+##-------- Load Alignment --------------------
+if (run_alignment):
+    include("InDetPerformanceMonitoring/InDetAlign_Setup.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations.py
deleted file mode 100644
index d250325deba0c70b40e7915845b2abb4834e88a7..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations.py
+++ /dev/null
@@ -1,279 +0,0 @@
-# enable outputs
-zmumuval = True
-globalAlignmentMon = False #no refitting for extracting the recommendations, only bulk as it comes out
-dimuonmon = False
-
-# use GRL
-useGRL = False
-
-# MC
-MC_bool = False
-
-#do Trigger
-DoTrigger = False
-
-# where to run
-grid = False
-
-# handle input constants
-readPool = False
-inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
-
-
-#include("InDetSimpleVisual/GetDetectorPositions.py")
-
-if grid == True:
-    PoolInput = ["/afs/cern.ch/work/o/oestrada/public/alignment2/Jpsi_20.7.3.8/20.7.3.8/JpsiNtuplesMC/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587/data16_13TeV.00296939.physics_Main.merge.DESDM_MCP.f689_m1587._0004.1"]
-
-elif 'inputFiles' in dir():
-    print inputFiles
-    PoolInput = inputFiles
-else:
-    print 'WARNING: No inputfiles specified'
-
-#    print inputFiles
-#PoolInput = inputFiles
-# number of event to process
-
-
-EvtMax=-1
-SkipEvents = 0
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-job = AlgSequence()
-seq = AthSequencer("AthFilterSeq")
-
-###############
-# END GRL
-###############
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-#pmjp.PerfMonFlags.doFastMon=True
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
-athenaCommonFlags.SkipEvents = SkipEvents
-
-#
-# Get information about the input file
-#(SH)
-from PyUtils import AthFile
-af = AthFile.fopen( athenaCommonFlags.FilesInput()[0] )
-camp = af.fileinfos['tag_info']['project_name']
-print af.fileinfos['tag_info']
-###############
-# GRL
-###############
-if useGRL:
-    print "-- INFO :: user JO ----------------------------"
-    print "- Enabling GRL for "+str(camp)+"-"
-    print "-----------------------------------------------"
-    if "15" in camp:
-        include("InDetPerformanceMonitoring/jobOptions_useGRL_2015.py")
-
-    if "16" in camp:
-        include("InDetPerformanceMonitoring/jobOptions_useGRL_2016.py")
-
-
-
-
-
-
-
-from AthenaCommon.GlobalFlags import globalflags
-if not MC_bool:
-    globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
-else:
-    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
-
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(True)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(DoTrigger)
-rec.doTruth.set_Value_and_Lock(False)
-
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-#DetFlags.Calo_setOn()
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-
-#DetFlags.makeRIO.Calo_setOff()
-#DetFlags.detdescr.Calo_setOn()
-
-
-
-from IOVDbSvc.CondDB import conddb
-inputCollectons =[]
-if 'inputConstants' in dir():
-    inputCollections = [inputConstants]
-
-
-if readPool :
-  conddb.blockFolder("/Indet/Align")
-  conddb.blockFolder("/TRT/Align")
-  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-  from AthenaCommon.AppMgr import ServiceMgr
-  ServiceMgr += CondProxyProvider()
-  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-  # set this to the file containing AlignableTransform objects
-  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-  ServiceMgr.CondProxyProvider.OutputLevel=INFO
-  print ServiceMgr.CondProxyProvider
-  # this preload causes callbacks for read in objects to be activated,
-  # allowing GeoModel to pick up the transforms
-  ServiceMgr.IOVSvc.preLoadData=True
-  ServiceMgr.IOVSvc.OutputLevel=INFO
-
-include ("InDetRecExample/InDetRecConditionsAccess.py")
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-from PerfMonComps.PerfMonFlags import jobproperties
-jobproperties.PerfMonFlags.doMonitoring = False
-
-print svcMgr.IOVDbSvc
-
-
-####  Track Selection Tool
-
-from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
-                                                          CutLevel = "Loose",
-                                                        minPt = 400
-#                                                                  maxD0overSigmaD0 = 1.5
-                                                                  )
-ToolSvc += m_TrackSelectorTool_Loose
-
-m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
-                                                                  CutLevel = "TightPrimary",
-                                                                  minPt = 400
-                                                             #     maxD0overSigmaD0 = 1.5,
-
-                                                                  )
-ToolSvc += m_TrackSelectorTool_TightPrimary
-
-#### run zmumu validation
-
-if zmumuval == True:
-
-#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
-    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
-
-    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
-
-#use to run with qualityselection that needs to be set in MuonSelector
-    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
-    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
-                                    ReFitterTool1 = MuonRefitterTool,
-                                    ReFitterTool2 = MuonRefitterTool2,
-                                    OutputTracksName =  "SelectedMuons",
-                                    isMC = MC_bool,
-                                    doRefit = False,
-                                    UseTrackSelectionTool = True,
-                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
-                                    TrackParticleName = 'InnerDetectorTrackParticles',
-                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
-                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
-                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
-                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
-                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
-                                    doIsoSelection = False,
-                                    doIPSelection = True,
-                                    #loose selection to have Z and JPsi in the n tuple
-                                    MassWindowLow = 1.,
-                                    MassWindowHigh = 120.,
-                                    PtLeadingMuon = 1.0,
-                                    OpeningAngle = 0.001,
-                                    OutputLevel= DEBUG)
-    job += iDPerfMonZmumu
-
-
-##### run dimuon monitoring
-if dimuonmon == True:
-    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
-
-
-    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
-    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
-    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
-
-    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
-                        resonName = "Zmumu",
-                        minInvmass = 10.,
-                        maxInvmass = 120.,
-                        nMassBins = 60,
-                        triggerChainName = "NoTrig",
-                        regions = ["All","BB","EAEA","ECEC"],
-                        varsVSmean = varsVSmeanZmumu,
-                        varsVSwidth = varsVSwidthZmumu,
-                        varsDistr = varsDistrZmumu,
-                        doFits = True,
-                        doSaveFits = False,
-    #                               setDebug = True,
-    OutputLevel = INFO)
-    ToolSvc += ZmumuMon
-
-    from AthenaMonitoring.DQMonFlags import DQMonFlags
-    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
-                                    FileKey             = DQMonFlags.monManFileKey(),
-                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                    DataType            = DQMonFlags.monManDataType(),
-                                    Environment         = "user",
-                                    ManualRunLBSetup    = True,
-                                    Run                 = 1,
-                                    LumiBlock           = 1)
-    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
-
-
-    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
-    IDPerfMonManager.FileKey = "DiMuMon"
-
-    topSequence += IDPerfMonManager
-
-#### run global alignment monitoring
-
-if zmumuval == True and globalAlignmentMon == True:
-    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
-#    trackCollections = ["SelectedMuonsDefault"]
-    StoreGateSvc = Service("StoreGateSvc")
-    StoreGateSvc.Dump = False
-    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations_grid.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations_grid.py
deleted file mode 100644
index 8c64d189b37a14ba88cc3e508ff536b80acdcdef..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_recommendations_grid.py
+++ /dev/null
@@ -1,264 +0,0 @@
-# enable outputs
-zmumuval = True
-globalAlignmentMon = False #no refitting for extracting the recommendations, only bulk as it comes out
-dimuonmon = False
-
-# use GRL
-useGRL = True
-d2015 = False
-d2016 = True
-
-# MC
-MC_bool = False
-
-#do Trigger
-DoTrigger = False
-
-# where to run
-grid =True
-
-# handle input constants
-readPool = False
-inputConstants = "/afs/cern.ch/work/s/sthenkel/public/forPF/ScriptsToRunWeakModeMaps/runOnBatch/AlignmentConstants/Iter0_AlignmentConstants.root"
-
-if grid == True:
-    PoolInput = ["/data/sthenkel/work/Performance/Alignment/data16_13TeV.00297730.physics_Main.merge.DESDM_MCP.r9264_p3082_p3082/DESDM_MCP.11056398._000011.pool.root.1"]
-
-#include("InDetSimpleVisual/GetDetectorPositions.py")
-
-
-elif 'inputFiles' in dir():
-    print inputFiles
-    PoolInput = inputFiles
-else:
-    print 'WARNING: No inputfiles specified'
-
-#    print inputFiles
-#PoolInput = inputFiles
-# number of event to process
-
-EvtMax=-1
-SkipEvents = 0
-
-
-from AthenaCommon.AlgSequence import AlgSequence
-from AthenaCommon.AlgSequence import AthSequencer
-
-job = AlgSequence()
-seq = AthSequencer("AthFilterSeq")
-
-###############
-# GRL
-###############
-
-if useGRL and d2015:
-      include("InDetPerformanceMonitoring/jobOptions_useGRL_2015.py")
-if useGRL and d2016:
-      include("InDetPerformanceMonitoring/jobOptions_useGRL_2016.py")
-
-###############
-# END GRL
-###############
-
-# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
-#from PerfMonComps.PerfMonFlags import jobproperties as pmjp
-#pmjp.PerfMonFlags.doFastMon=True
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-athenaCommonFlags.FilesInput=PoolInput
-athenaCommonFlags.EvtMax = EvtMax
-athenaCommonFlags.SkipEvents = SkipEvents
-
-from AthenaCommon.GlobalFlags import globalflags
-
-#if not MC_bool:
-#    globalflags.ConditionsTag.set_Value_and_Lock("CONDBR2-BLKPA-2016-16")
-#else:
-#    globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC15c-SDR-05")
-
-#globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-04-00-00")
-
-from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
-GeoModelSvc = GeoModelSvc()
-GeoModelSvc.IgnoreTagDifference = True
-
-from RecExConfig.RecFlags import rec
-rec.AutoConfiguration=['everything']
-rec.doAOD.set_Value_and_Lock(False)
-rec.doESD.set_Value_and_Lock(False) # uncomment if rec.do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if rec.do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if rec.do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if rec.do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if rec.do not write TAG
-rec.doCBNT.set_Value_and_Lock(False)
-rec.doPerfMon.set_Value_and_Lock(False)
-rec.doInDet.set_Value_and_Lock(True)
-rec.doTile.set_Value_and_Lock(False)
-rec.doLArg.set_Value_and_Lock(False)
-rec.doCalo.set_Value_and_Lock(False)
-rec.doMuon.set_Value_and_Lock(False)
-rec.doMuonCombined.set_Value_and_Lock(False)
-rec.doEgamma.set_Value_and_Lock(False)
-rec.doJetMissingETTag.set_Value_and_Lock(False)
-rec.doTau.set_Value_and_Lock(False)
-rec.doTrigger.set_Value_and_Lock(DoTrigger)
-rec.doTruth.set_Value_and_Lock(False)
-
-#rec.doMonitoring.set_Value_and_Lock(True)
-#from AthenaMonitoring.DQMonFlags import DQMonFlags
-#DQMonFlags.doInDetPerfMon.set_Value_and_Lock(True)
-
-
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-include ("RecExCond/RecExCommon_flags.py")
-# switch off ID, calo, or muons
-DetFlags.ID_setOn()
-#DetFlags.Calo_setOn()
-DetFlags.Calo_setOff()
-DetFlags.Muon_setOn()
-#DetFlags.Tile_setOff()
-
-#DetFlags.makeRIO.Calo_setOff()
-#DetFlags.detdescr.Calo_setOn()
-
-
-
-from IOVDbSvc.CondDB import conddb
-inputCollectons =[]
-if 'inputConstants' in dir():
-    inputCollections = [inputConstants]
-
-
-if readPool :
-  conddb.blockFolder("/Indet/Align")
-  conddb.blockFolder("/TRT/Align")
-  from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider
-  from AthenaCommon.AppMgr import ServiceMgr
-  ServiceMgr += CondProxyProvider()
-  ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
-  # set this to the file containing AlignableTransform objects
-  ServiceMgr.CondProxyProvider.InputCollections += inputCollections
-  ServiceMgr.CondProxyProvider.OutputLevel=INFO
-  print ServiceMgr.CondProxyProvider
-  # this preload causes callbacks for read in objects to be activated,
-  # allowing GeoModel to pick up the transforms
-  ServiceMgr.IOVSvc.preLoadData=True
-  ServiceMgr.IOVSvc.OutputLevel=INFO
-
-include ("InDetRecExample/InDetRecConditionsAccess.py")
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-from PerfMonComps.PerfMonFlags import jobproperties
-jobproperties.PerfMonFlags.doMonitoring = False
-
-print svcMgr.IOVDbSvc
-
-
-####  Track Selection Tool
-
-from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-m_TrackSelectorTool_Loose = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorLoose",
-                                                          CutLevel = "Loose",
-                                                        minPt = 400
-#                                                                  maxD0overSigmaD0 = 1.5
-                                                                  )
-ToolSvc += m_TrackSelectorTool_Loose
-
-m_TrackSelectorTool_TightPrimary = InDet__InDetTrackSelectionTool(name         = "InDetTrackSelectorTightPrimary",
-                                                                  CutLevel = "TightPrimary",
-                                                                  minPt = 400
-                                                             #     maxD0overSigmaD0 = 1.5,
-
-                                                                  )
-ToolSvc += m_TrackSelectorTool_TightPrimary
-
-#### run zmumu validation
-
-if zmumuval == True:
-
-#    ServiceMgr.THistSvc.Output += ["ZmumuValidation DATAFILE='ZmumuValidationOut.root' OPT='RECREATE'"]
-    include ("InDetPerformanceMonitoring/ElectronEoverPTracking.py")
-
-    from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu
-
-#use to run with qualityselection that needs to be set in MuonSelector
-    ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidationUserSel.root' OPT='RECREATE'"]
-    iDPerfMonZmumu = IDPerfMonZmumu(name = 'IDPerfMonZmumu',
-                                    ReFitterTool1 = MuonRefitterTool,
-                                    ReFitterTool2 = MuonRefitterTool2,
-                                    OutputTracksName =  "SelectedMuons",
-                                    isMC = MC_bool,
-                                    doRefit = False,
-                                    UseTrackSelectionTool = True,
-                                    TrackSelectionTool = m_TrackSelectorTool_TightPrimary,
-                                    TrackParticleName = 'InnerDetectorTrackParticles',
-                                    defaultTreeFolder = "/ZmumuValidationUserSel/default",
-                                    truthTreeFolder = "/ZmumuValidationUserSel/truth",
-                                    refit1TreeFolder = "/ZmumuValidationUserSel/refit1",
-                                    refit2TreeFolder = "/ZmumuValidationUserSel/refit2",
-                                    combTreeFolder = "/ZmumuValidationUserSel/comb",
-                                    doIsoSelection = False,
-                                    doIPSelection = True,
-                                    #loose selection to have Z and JPsi in the n tuple
-                                    MassWindowLow = 1.,
-                                    MassWindowHigh = 120.,
-                                    PtLeadingMuon = 1.0,
-                                    OpeningAngle = 0.001,
-                                    OutputLevel= DEBUG)
-    job += iDPerfMonZmumu
-
-
-##### run dimuon monitoring
-if dimuonmon == True:
-    from InDetDiMuonMonitoring.InDetDiMuonMonitoringConf import DiMuMon
-
-
-    varsVSmeanZmumu = ["eta","etaAll","etaPos","etaNeg","phi","phiAll","phiPos","phiNeg","pt","ptAll","ptPos","ptNeg","etaDiff","etaSumm","phiDiff","phiSumm","crtDiff"]
-    varsVSwidthZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg","etaDiff","phiDiff","crtDiff"]
-    varsDistrZmumu = ["etaAll","etaPos","etaNeg","phiAll","phiPos","phiNeg","ptAll","ptPos","ptNeg"]
-
-    ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig",
-                        resonName = "Zmumu",
-                        minInvmass = 10.,
-                        maxInvmass = 120.,
-                        nMassBins = 60,
-                        triggerChainName = "NoTrig",
-                        regions = ["All","BB","EAEA","ECEC"],
-                        varsVSmean = varsVSmeanZmumu,
-                        varsVSwidth = varsVSwidthZmumu,
-                        varsDistr = varsDistrZmumu,
-                        doFits = True,
-                        doSaveFits = False,
-    #                               setDebug = True,
-    OutputLevel = INFO)
-    ToolSvc += ZmumuMon
-
-    from AthenaMonitoring.DQMonFlags import DQMonFlags
-    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-    IDPerfMonManager = AthenaMonManager(name                = "IDPerfMonManager",
-                                    FileKey             = DQMonFlags.monManFileKey(),
-                                    ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(),
-                                    DataType            = DQMonFlags.monManDataType(),
-                                    Environment         = "user",
-                                    ManualRunLBSetup    = True,
-                                    Run                 = 1,
-                                    LumiBlock           = 1)
-    IDPerfMonManager.AthenaMonTools += [ ZmumuMon ]
-
-
-    ServiceMgr.THistSvc.Output += ["DiMuMon DATAFILE='DiMuMon.root' OPT='RECREATE'"]
-    IDPerfMonManager.FileKey = "DiMuMon"
-
-    topSequence += IDPerfMonManager
-
-#### run global alignment monitoring
-
-if zmumuval == True and globalAlignmentMon == True:
-    trackCollections = ["SelectedMuonsRefit1","SelectedMuonsRefit2"]
-#    trackCollections = ["SelectedMuonsDefault"]
-    StoreGateSvc = Service("StoreGateSvc")
-    StoreGateSvc.Dump = False
-    include ("InDetPerformanceMonitoring/TrackMonitoring.py")
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx
index 4a5865158f81485dda2b294bc529fb8b899062ec..8a6c70378d64e7a6900d34b234db6ef218c620ce 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx
@@ -91,7 +91,24 @@ bool ZmumuEvent::Reco()
 
   // Clear out the previous events record.
   this->Clear();
+
   const xAOD::MuonContainer* pxMuonContainer = PerfMonServices::getContainer<xAOD::MuonContainer>( m_container );
+
+  // START patch by Anthony to avoid crash when MuonSpetrometer::Pt was not defined
+  if (false) {
+    for( auto muon :  *pxMuonContainer ){
+      const xAOD::TrackParticle* idtrk(0);
+      const xAOD::TrackParticle* metrk(0);
+      idtrk = muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
+      metrk = muon->trackParticle(xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle);
+      if (idtrk && metrk) {
+	muon->auxdecor<float>("InnerDetectorPt") = idtrk->pt();      
+	muon->auxdecor<float>("MuonSpectrometerPt") = metrk->pt();
+      }
+    }
+  }
+  // END patch 
+
   if (pxMuonContainer != NULL) {
     if(m_doDebug) {std::cout << " * ZmumuEvent * track list has "<< pxMuonContainer->size() << " muon in xAOD::MuonContainer " << m_container <<std::endl; }
     xAOD::MuonContainer::const_iterator xMuonItr  = pxMuonContainer->begin();
diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx
index 824a9deee8e0e72f7a73be19766db437d91d4ee0..9792aab988e7cc86df219d01223538cd7e4ee4ac 100644
--- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx
+++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx
@@ -113,7 +113,7 @@ StatusCode PixelMainMon::bookRODErrorMon(void) {
     "Readout processor",         "17",                   "18",                   "19",
     "20",                        "21",                   "22",                   "Skipped trig counter",
     "Truncated event flag",      "25",                   "26",                   "27",
-    "28",                        "29",                   "30"                    "31"
+    "28",                        "29",                   "30",                   "31",
     "Triple redundant CNFGMEM",  "Write reg data",       "Address error",        "Other CMD decoder",
     "CMD decoder bit flip",      "CMD decoder SEU",      "Data bus address",     "Triple redundant EFUSE"
   };
@@ -291,13 +291,13 @@ StatusCode PixelMainMon::bookRODErrorMon(void) {
   sc = rodExpert.regHist(m_errhist_expert_servrec_ibl_count = TH1F_LW::create(hname.c_str(), htitles.c_str(), 100, -0.5, 99.5));
 
   if (m_errhist_expert_servrec_ibl_unweighted) {
-    for (int i = 0; i < kNumErrorBits; i++) {
+    for (int i = 0; i < kNumErrorBitsIBL; i++) {
       m_errhist_expert_servrec_ibl_unweighted->GetXaxis()->SetBinLabel(i + 1, errorBitsIBL[i]);
     }
   }
 
   if (m_errhist_expert_servrec_ibl_weighted) {
-    for (int i = 0; i < kNumErrorBits; i++) {
+    for (int i = 0; i < kNumErrorBitsIBL; i++) {
       m_errhist_expert_servrec_ibl_weighted->GetXaxis()->SetBinLabel(i + 1, errorBitsIBL[i]);
     }
   }
@@ -584,7 +584,7 @@ StatusCode PixelMainMon::fillRODErrorMon(void) {
 
               if (bit == 8)                                                                                 error_type = 1;  // synchronization error   (8:BCID counter)
               if (bit == 24)                                                                                error_type = 3;  // truncation error        (24:Truncated event)
-              if (bit == 9 || bit == 10 || bit == 11 || bit == 32 || bit == 36 || bit == 38 || bit == 40)   error_type = 6;  // SEU error               (9:Hamming code 0, 10:Hamming code 1, 12:Hamming code 2, 32:Triple redundant CNFGMEM, 36:Bit flip in CMD, 38:Triple redundant CMD, 40:Triple redundant EFUSE)
+              if (bit == 9 || bit == 10 || bit == 11 || bit == 32 || bit == 36 || bit == 37 || bit == 39)   error_type = 6;  // SEU error               (9:Hamming code 0, 10:Hamming code 1, 12:Hamming code 2, 32:Triple redundant CNFGMEM, 36:Bit flip in CMD, 37:Triple redundant CMD, 39:Triple redundant EFUSE)
 
 
               if (error_type) {
@@ -937,10 +937,10 @@ int PixelMainMon::getErrorState(int bit, bool isibl) {
       case 36:
         erstate = 32;  // Bit flip in CMD, FE SEU
         break;
-      case 38:
+      case 37:
         erstate = 33;  // Triple redundant mismatch in CMD, FE SEU
         break;
-      case 40:
+      case 39:
         erstate = 34;  // Triple redundant mismatch in EFUSE, FE SEU
         break;
       case 2:
@@ -964,7 +964,7 @@ int PixelMainMon::getErrorState(int bit, bool isibl) {
       case 35:
         erstate = 41;  // Other CMD decoder error, FE
         break;
-      case 39:
+      case 38:
         erstate = 42;  // Data bus address, FE
         break;
       default:
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h
index 6fbe2b2ca8c65142ce53f6e7c1d06e633450b578..94ff552339ab8c666b23bf6b2c5b00d375db861a 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/SCT_Monitoring/SCTLorentzMonTool.h
@@ -35,6 +35,8 @@
 //for vertexTool
 #include "ITrackToVertex/ITrackToVertex.h" //for  m_trackToVertexTool
 
+#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
+
 // Forward declarations
 class IInterface;
 class TH1I;
@@ -104,6 +106,8 @@ private:
   Prof_t m_phiVsNstrips_Side_100_eta[4][2][12];
   Prof_t m_phiVsNstrips_Side_111_eta[4][2][12];
 
+  ToolHandle < Trk::ITrackHoleSearchTool >  m_holeSearchTool;
+
   std::string m_stream;
   std::string m_path;
   //@}
diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx
index b5db29b53bcf961cd3b2c8f4cb609eb9212ac39f..86b2d6684c45256db0e6415dcb0caf5497483000 100755
--- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTLorentzMonTool.cxx
@@ -6,7 +6,7 @@
  *
  *    @author Elias Coniavitis based on code from Luca Fiorini,
  *    Shaun Roe, Manuel Diaz, Rob McPherson & Richard Batley
- *    Modified by Yuta
+ *    Modified by Yuta, Arka Santra
  */
 #include "SCT_Monitoring/SCTLorentzMonTool.h"
 #include "deletePointers.h"
@@ -30,6 +30,11 @@
 #include "InDetPrepRawData/SiCluster.h"
 #include "TrkParameters/TrackParameters.h"
 
+#include "TrkTrack/Track.h"
+#include "TrkTrack/TrackCollection.h"
+#include "TrkToolInterfaces/IResidualPullCalculator.h"
+#include "TrkToolInterfaces/IRIO_OnTrackCreator.h"
+
 // for sct residuals
 #include "TrkTrackSummary/TrackSummary.h"
 
@@ -37,6 +42,18 @@ using namespace std;
 using namespace Rec;
 using namespace SCT_Monitoring;
 
+namespace{//anonymous namespace for functions at file scope
+  template< typename T > Identifier surfaceOnTrackIdentifier(T & tsos, const bool useTrackParameters=true){
+    Identifier result(0); //default constructor produces invalid value
+    const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
+    if (mesb and mesb->associatedSurface().associatedDetectorElement())
+      result = mesb->associatedSurface().associatedDetectorElement()->identify();
+    else if (useTrackParameters and tsos->trackParameters()){
+      result = tsos->trackParameters()->associatedSurface().associatedDetectorElementIdentifier();
+    }
+    return result;
+  }
+}//namespace end
 // ====================================================================================================
 /** Constructor, calls base class constructor with parameters
  *
@@ -53,20 +70,15 @@ SCTLorentzMonTool::SCTLorentzMonTool(const string &type, const string &name,
   m_phiVsNstrips_Side{},
   m_phiVsNstrips_Side_100{},
   m_phiVsNstrips_Side_111{},
+  m_holeSearchTool("InDet::InDetTrackHoleSearchTool"),
   m_pSCTHelper(nullptr),
   m_sctmgr(nullptr) {
-    /** sroe 3 Sept 2015:
-	histoPathBase is declared as a property in the base class, assigned to m_path
-	with default as empty string.
-	Declaring it here as well gives rise to compilation warning
-	WARNING duplicated property name 'histoPathBase', see https://its.cern.ch/jira/browse/GAUDI-1023
-
-	declareProperty("histoPathBase", m_stream = "/stat"); **/
-    m_stream = "/stat";
-    declareProperty("tracksName", m_tracksName = "CombinedInDetTracks"); // this recommended
-    declareProperty("TrackToVertexTool", m_trackToVertexTool); // for TrackToVertexTool
-    m_numberOfEvents = 0;
-  }
+  m_stream = "/stat";
+  declareProperty("tracksName", m_tracksName = "CombinedInDetTracks"); // this recommended
+  declareProperty("TrackToVertexTool", m_trackToVertexTool); // for TrackToVertexTool
+  m_numberOfEvents = 0;
+  declareProperty("HoleSearch", m_holeSearchTool);
+}
 
 // ====================================================================================================
 // ====================================================================================================
@@ -83,6 +95,7 @@ StatusCode
 SCTLorentzMonTool::bookHistogramsRecurrent( ) {                                                                                              //
                                                                                                                                              // hidetoshi
                                                                                                                                              // 14.01.21
+  CHECK (m_holeSearchTool.retrieve());
   m_path = "";
   if (newRunFlag()) {
     m_numberOfEvents = 0;                                                                                                                        //
@@ -109,6 +122,7 @@ StatusCode
 SCTLorentzMonTool::bookHistograms( ) {                                                                                                      //
                                                                                                                                             // hidetoshi
                                                                                                                                             // 14.01.21
+  CHECK (m_holeSearchTool.retrieve());
   m_path = "";
   m_numberOfEvents = 0;                                                                                                                                  //
                                                                                                                                                          // hidetoshi
@@ -174,9 +188,15 @@ SCTLorentzMonTool::fillHistograms() {
 
   for (; trkitr != trkend; ++trkitr) {
     // Get track
-    const Trk::Track *track = (*trkitr);
+    const Trk::Track *track = m_holeSearchTool->getTrackWithHoles(**trkitr);
     if (not track) {
-      msg(MSG::ERROR) << "no pointer to track!!!" << endmsg;
+      ATH_MSG_WARNING ("track pointer is invalid");
+      continue;
+    }
+
+    const Trk::Track * track2 = (*trkitr);
+    if (not track2) {
+      ATH_MSG_ERROR("no pointer to track2!!!");
       continue;
     }
 
@@ -188,7 +208,7 @@ SCTLorentzMonTool::fillHistograms() {
       continue;
     }
 
-    const Trk::TrackSummary *summary = track->trackSummary();
+    const Trk::TrackSummary *summary = track2->trackSummary();
     if (not summary) {
       msg(MSG::WARNING) << " null trackSummary" << endmsg;
       continue;
@@ -240,7 +260,7 @@ SCTLorentzMonTool::fillHistograms() {
             if (bec != 0) {
               continue; // We only care about the barrel
             }
-            // wtf is this?
+            
             for (unsigned int i = 0; i < layer100_n; i++) {
               if (layer100[i] == layer && eta100[i] == eta && phi100[i] == phi) {
                 in100 = true;
@@ -276,7 +296,7 @@ SCTLorentzMonTool::fillHistograms() {
 
               if ((AthenaMonManager::dataType() == AthenaMonManager::cosmics) &&
                   (trkp->momentum().mag() > 500.) &&  // Pt > 500MeV
-                  (summary->get(Trk::numberOfSCTHits) > 6)// && // #SCTHits >6
+                  (summary->get(Trk::numberOfSCTHits) > 6)// && // SCTHits >6
                   ) {
                 passesCuts = true;
               }// 01.02.2015
@@ -286,13 +306,10 @@ SCTLorentzMonTool::fillHistograms() {
               /// d0 < 1 mm, pT > 500 MeV, N_hit(SCT in any region) >=7 , N_hit(Pixel) >= 2
 
               else if ((track->perigeeParameters()->parameters()[Trk::qOverP] < 0.) && // use negative track only
-                       (fabs(perigee->parameters()[Trk::d0]) < 1.) && // d0 < 1mm
-                       // (fabs(perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta])) < 1.) && // d0 <
-		       // 1mm
-                       (trkp->momentum().mag() > 500.) &&  // Pt > 500MeV
-                       //(summary->get(Trk::numberOfSCTHits) > 6)// && // #SCTHits >6
-                       (nSCTBarrel > 7) && // this is for barrel SCT hits, tighter
-                       (summary->get(Trk::numberOfPixelHits) > 1) // nPixelHits > 1
+                       (std::abs(perigee->parameters()[Trk::d0]) < 1.) && // d0 < 1mm
+		       //(std::abs( perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta]) ) < 1.) // another way to implement d0 < 1mm
+		       (trkp->momentum().perp() > 500.) &&   // Pt > 500MeV
+                       (summary->get(Trk::numberOfSCTHits) > 6)// // SCTHits >6
                        ) {
                 passesCuts = true;
               }else {
@@ -314,9 +331,7 @@ SCTLorentzMonTool::fillHistograms() {
 		m_phiVsNstrips_Side[layer][side]->Fill(phiToWafer, nStrip, 1.);
 		m_phiVsNstrips_Side_eta[layer][side][etaIndex]->Fill(phiToWafer, nStrip, 1.);
                     
-		//std::cout << "@@@@@@@@@@ the eta and etaIndex " << eta << " : " << etaIndex << std::endl;
 		if (in100) {
-		  // cout << "This event is going to 100" << endl;
 		  m_phiVsNstrips_100[layer]->Fill(phiToWafer, nStrip, 1.);
 		  m_phiVsNstrips_Side_100[layer][side]->Fill(phiToWafer, nStrip, 1.);
                                         
@@ -333,11 +348,105 @@ SCTLorentzMonTool::fillHistograms() {
 		}
               }// end if passesCuts
             }// end if mtrkp
-            //            delete perigee;perigee = 0;
-          } // end if SCT..
+	  } // end if SCT..
         } // end if(clus)
       } // if((*it)->type(Trk::TrackStateOnSurface::Measurement)){
+      else if((*it)->type(Trk::TrackStateOnSurface::Hole)) {
+	Identifier surfaceID;
+	surfaceID = surfaceOnTrackIdentifier(*it);
+	if(not m_pSCTHelper->is_sct(surfaceID)) continue; //We only care about SCT
+	const int bec(m_pSCTHelper->barrel_ec(surfaceID));
+	const int layer(m_pSCTHelper->layer_disk(surfaceID));
+	const int side(m_pSCTHelper->side(surfaceID));
+	const int eta(m_pSCTHelper->eta_module(surfaceID));
+	const int phi(m_pSCTHelper->phi_module(surfaceID));
+	bool in100 = false;
+	if(bec!=0) {
+	  continue; //We only care about the barrel
+	}
+	//wtf is this?
+	for (unsigned int i=0 ; i<layer100_n ; i++){
+	  if (layer100[i]==layer && eta100[i]==eta && phi100[i]==phi){
+	    in100=true;
+	    break;
+	  }
+	}
+	// find cluster size
+	int nStrip = 0;
+	const Trk::TrackParameters *trkp = dynamic_cast<const Trk::TrackParameters*>( (*it)->trackParameters() );
+	if (not trkp) {
+	  ATH_MSG_WARNING(" Null pointer to MeasuredTrackParameters");
+	  continue;
+	}
+
+	const Trk::Perigee* perigee = track->perigeeParameters();
+
+	if (perigee){
+	  //Get angle to wafer surface
+	  float phiToWafer(90.),thetaToWafer(90.);
+	  float sinAlpha = 0.; //for barrel, which is the only thing considered here
+	  float pTrack[3];
+	  pTrack[0] = trkp->momentum().x();
+	  pTrack[1] = trkp->momentum().y();
+	  pTrack[2] = trkp->momentum().z();
+	  int iflag = findAnglesToWaferSurface (pTrack, sinAlpha, surfaceID, thetaToWafer, phiToWafer );
+	  if ( iflag < 0) {
+	    ATH_MSG_WARNING("Error in finding track angles to wafer surface");
+	    continue; // Let's think about this (later)... continue, break or return?
+	  }
+	  bool passesCuts = true;
+	  if( (AthenaMonManager::dataType() ==  AthenaMonManager::cosmics) &&
+	      (trkp->momentum().mag() > 500.) &&  // Pt > 500MeV
+	      (summary->get(Trk::numberOfSCTHits) > 6 )// && // #SCTHits >6
+	      ){
+	    passesCuts=true;
+	  }
+	  else if( (track->perigeeParameters()->parameters()[Trk::qOverP] < 0.) && // use negative track only
+		   (std::abs( perigee->parameters()[Trk::d0] ) < 1.) &&  // d0 < 1mm
+		   //(std::abs( perigee->parameters()[Trk::z0] * sin(perigee->parameters()[Trk::theta]) ) < 1.)  // another way to implement d0 < 1mm
+		   (trkp->momentum().perp() > 500.) &&   // Pt > 500MeV
+		   (summary->get(Trk::numberOfSCTHits) > 6 )// && // SCTHits >6
+		   ){
+	    passesCuts=true;
+	  }else{
+	    passesCuts=false;
+	  }
+
+	  if (passesCuts) {
+	    // Fill profile
+	    /// first change the negative eta to positive eta index. This is needed to fill the array of histograms. 
+		int etaIndex(0);
+		if(eta < 0 )
+		  etaIndex = eta + 6;
+		else
+		  etaIndex = eta + 5;
+                    
+		m_phiVsNstrips[layer]->Fill(phiToWafer, nStrip, 1.);
+		m_phiVsNstrips_eta[layer][etaIndex]->Fill(phiToWafer, nStrip, 1.);
+		m_phiVsNstrips_Side[layer][side]->Fill(phiToWafer, nStrip, 1.);
+		m_phiVsNstrips_Side_eta[layer][side][etaIndex]->Fill(phiToWafer, nStrip, 1.);
+                    
+		if (in100) {
+		  m_phiVsNstrips_100[layer]->Fill(phiToWafer, nStrip, 1.);
+		  m_phiVsNstrips_Side_100[layer][side]->Fill(phiToWafer, nStrip, 1.);
+                                        
+		  m_phiVsNstrips_100_eta[layer][etaIndex]->Fill(phiToWafer, nStrip, 1.);
+		  m_phiVsNstrips_Side_100_eta[layer][side][etaIndex]->Fill(phiToWafer, nStrip, 1.);
+                                    
+		}else {
+		  m_phiVsNstrips_111[layer]->Fill(phiToWafer, nStrip, 1.);
+		  m_phiVsNstrips_Side_111[layer][side]->Fill(phiToWafer, nStrip, 1.);
+                                        
+		  m_phiVsNstrips_111_eta[layer][etaIndex]->Fill(phiToWafer, nStrip, 1.);
+		  m_phiVsNstrips_Side_111_eta[layer][side][etaIndex]->Fill(phiToWafer, nStrip, 1.);
+                                
+		}
+	  }// end if passesCuts
+	}// end if mtrkp
+      } // if((*it)->type(Trk::TrackStateOnSurface::Measurement)){
     }// end of loop on TrackStatesonSurface (they can be SiClusters, TRTHits,..)
+    delete track;
+    track=0;
   } // end of loop on tracks
 
   m_numberOfEvents++;
@@ -482,24 +591,7 @@ SCTLorentzMonTool::bookLorentzHistos() {
   }
   if (success == 0) {
     return StatusCode::FAILURE;
-  }
-  //  }
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //   
-  //                                                                                                                 //
-  // hidetoshi 14.01.22
+  }                                                                                                                 //
   return StatusCode::SUCCESS;
 }
 
diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinderRoI.h b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinderRoI.h
new file mode 100755
index 0000000000000000000000000000000000000000..cb8df7bdb00f01be63a78c691e063e9bce8f35b0
--- /dev/null
+++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinderRoI.h
@@ -0,0 +1,117 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#ifndef SiSPSeededTrackFinderRoI_H
+#define SiSPSeededTrackFinderRoI_H
+
+#include <string>
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "GaudiKernel/ToolHandle.h"
+#include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
+#include "InDetRecToolInterfaces/ISiZvertexMaker.h" 
+#include "InDetRecToolInterfaces/ISiTrackMaker.h"
+#include "InDetRecToolInterfaces/IZWindowRoISeedTool.h"
+#include "TrkSpacePoint/SpacePointContainer.h" 
+
+#include "TrkTrack/TrackCollection.h"
+#include "InDetBeamSpotService/IBeamCondSvc.h"
+#include "TrkExInterfaces/IPatternParametersPropagator.h"
+#include "TrkGeometry/MagneticFieldProperties.h"
+#include "TrkSurfaces/PerigeeSurface.h" 
+#include "StoreGate/DataHandle.h"
+
+namespace InDet {
+
+  // Class-algorithm for track finding in Pixels and SCT
+  // initiated by space points seeds filtering in a given
+  // RoI within the z axis
+  //
+  class SiSPSeededTrackFinderRoI : public AthAlgorithm 
+    {
+    
+      ///////////////////////////////////////////////////////////////////
+      // Public methods:
+      ///////////////////////////////////////////////////////////////////
+      
+    public:
+      
+      ///////////////////////////////////////////////////////////////////
+      // Standard Algotithm methods
+      ///////////////////////////////////////////////////////////////////
+
+      SiSPSeededTrackFinderRoI(const std::string &name, ISvcLocator *pSvcLocator);
+      virtual ~SiSPSeededTrackFinderRoI() {}
+      StatusCode initialize();
+      StatusCode execute();
+      StatusCode finalize();
+
+      ///////////////////////////////////////////////////////////////////
+      // Print internal tool parameters and status
+      ///////////////////////////////////////////////////////////////////
+
+      MsgStream&    dump     (MsgStream&    out) const;
+      std::ostream& dump     (std::ostream& out) const;
+
+    protected:
+
+      ///////////////////////////////////////////////////////////////////
+      // Protected data 
+      ///////////////////////////////////////////////////////////////////
+     
+      int                            m_outputlevel        ; // Print level for debug
+      int                            m_nprint             ; // Kind of  print    
+      int                            m_nseeds             ; // Number seeds
+      int                            m_ntracks            ; // Number found tracks
+      int                            m_nseedsTotal        ; // Number seeds
+      int                            m_ntracksTotal       ; // Number found tracks
+      int                            m_neventsTotal       ; // Number events 
+      int                            m_problemsTotal      ; // Numbe revents with number seeds > maxNumber
+      int                            m_maxNumberSeeds     ; // Max. number used seeds
+      int                            m_maxPIXsp           ; // Max. number pixels space points
+      int                            m_maxSCTsp           ; // Max. number sct    space points
+      int                            m_nfreeCut           ; // Min number free clusters
+      bool                            m_doRandomSpot          ; // Low-pT tracking in random spot?
+
+      SG::ReadHandle<SpacePointContainer> m_SpacePointsSCT  ;
+      SG::ReadHandle<SpacePointContainer> m_SpacePointsPixel;
+      SG::WriteHandle<TrackCollection>    m_outputTracks    ;
+
+      std::string m_vxOutputName;
+
+      ToolHandle< ISiSpacePointsSeedMaker > m_seedsmaker    ;  // Space poins seed     maker
+      ToolHandle< ISiTrackMaker           > m_trackmaker    ;  // Track                maker     
+    
+      // For new strategy reconstruction
+      //
+      double                         m_pTcut     ;
+      double                         m_imcut     ;
+
+      std::string                                      m_beamconditions          ;
+      std::string                                      m_fieldmode               ; 
+      IBeamCondSvc*                                    m_beam     ;
+      ToolHandle<Trk::IPatternParametersPropagator>    m_proptool ;
+      Trk::MagneticFieldProperties                     m_fieldprop;
+      ToolHandle<InDet::IZWindowRoISeedTool>           m_ZWindowRoISeedTool;
+      ToolHandle<InDet::IZWindowRoISeedTool>           m_RandomRoISeedTool;
+      std::vector<InDet::IZWindowRoISeedTool::ZWindow> m_listRoIs;
+      std::vector<InDet::IZWindowRoISeedTool::ZWindow> m_listRandRoIs;
+      float m_RoIWidth; /// width of z0 window; mostly to be used to bypass RoI if input is negative!
+
+      ///////////////////////////////////////////////////////////////////
+      // Protected methods
+      ///////////////////////////////////////////////////////////////////
+      
+      double trackQuality(const Trk::Track*);
+      void filterSharedTracks(std::multimap<double,Trk::Track*>&);
+      void magneticFieldInit();
+
+      MsgStream&    dumptools(MsgStream&    out) const;
+      MsgStream&    dumpevent(MsgStream&    out) const;
+
+    };
+  MsgStream&    operator << (MsgStream&   ,const SiSPSeededTrackFinderRoI&);
+  std::ostream& operator << (std::ostream&,const SiSPSeededTrackFinderRoI&); 
+}
+#endif // SiSPSeededTrackFinderRoI_H
diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/cmt/requirements b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/cmt/requirements
index 31b5a60846e21a08a734e76fd7d8caf721dc6fa2..cdfd1f82feeb00f80f714e2d66dd46766f0309c4 100755
--- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/cmt/requirements
+++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/cmt/requirements
@@ -6,8 +6,10 @@ private
 
 use xAODEventInfo                xAODEventInfo-*          Event/xAOD
 use TrkTrack                     TrkTrack-*               Tracking/TrkEvent
+use VxVertex           VxVertex-*          Tracking/TrkEvent
 use TrkRIO_OnTrack               TrkRIO_OnTrack-*         Tracking/TrkEvent
 use TrkPatternParameters         TrkPatternParameters-*   Tracking/TrkEvent
+use xAODTracking           xAODTracking-*           Event/xAOD
 use CxxUtils           CxxUtils-*               Control
 
 public
diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinderRoI.cxx b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinderRoI.cxx
new file mode 100755
index 0000000000000000000000000000000000000000..ac25dcc615c59c80ccc73d75502857e5b371be88
--- /dev/null
+++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinderRoI.cxx
@@ -0,0 +1,500 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include <set>
+#include <vector>
+
+#include "SiSPSeededTrackFinder/SiSPSeededTrackFinderRoI.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "TrkTrack/TrackCollection.h"
+#include "TrkRIO_OnTrack/RIO_OnTrack.h"
+#include "TrkPatternParameters/PatternTrackParameters.h"
+#include "CxxUtils/make_unique.h"
+
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexContainer.h"
+#include "xAODTracking/VertexAuxContainer.h"
+
+#include <sstream>
+#include <fstream>
+#include <string>
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+
+InDet::SiSPSeededTrackFinderRoI::SiSPSeededTrackFinderRoI
+(const std::string& name,ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator),
+  m_outputlevel(0)                                                     ,
+  m_nprint(0)                                                          ,
+  m_nseeds(0)                                                          ,
+  m_ntracks(0)                                                         ,
+  m_maxNumberSeeds(3000000)                                            , 
+  m_maxPIXsp(150000)                                                   ,
+  m_maxSCTsp(500000) 						       ,
+  m_nfreeCut(1)                                                        ,
+  m_doRandomSpot(false)                                                        , //see comment proceding line with "double RandZBoundary[2];"
+  m_SpacePointsSCT("SCT_SpacePoints"),
+  m_SpacePointsPixel("PixelSpacePoints"),
+  m_outputTracks("SiSPSeededTracks"),
+  m_vxOutputName ( "LowPtRoIVertices" ),
+  m_seedsmaker("InDet::SiSpacePointsSeedMaker_ATLxk/InDetSpSeedsMaker"),
+  m_trackmaker("InDet::SiTrackMaker_xk/InDetSiTrackMaker")             ,
+  m_fieldmode("MapSolenoid")                                           ,
+  m_proptool   ("Trk::RungeKuttaPropagator/InDetPropagator"  ),         
+  m_ZWindowRoISeedTool("InDet::ZWindowRoISeedTool"),
+  m_RandomRoISeedTool("InDet::RandomRoISeedTool")
+{
+  m_beamconditions         = "BeamCondSvc"     ;
+  m_beam                   = 0                 ;
+  m_nseedsTotal            = 0                 ;
+  m_ntracksTotal           = 0                 ;
+  m_neventsTotal           = 0                 ;
+  m_problemsTotal          = 0                 ; 
+
+  // SiSPSeededTrackFinderRoI steering parameters
+  //
+  declareProperty("ZWindowRoISeedTool"  ,m_ZWindowRoISeedTool  );
+  declareProperty("RandomRoISeedTool"  ,m_RandomRoISeedTool  );
+  declareProperty("RoIWidth", m_RoIWidth = 1.0);
+  declareProperty("SeedsTool"           ,m_seedsmaker          );
+  declareProperty("TrackTool"           ,m_trackmaker          );
+  declareProperty("TracksLocation"      ,m_outputTracks        );
+  declareProperty ( "VxOutputName",m_vxOutputName );
+  //declareProperty ( "VxOutputNameAuxPostfix",m_vxOutputNameAuxPostfix );
+  declareProperty("maxNumberSeeds"      ,m_maxNumberSeeds      );
+  declareProperty("maxNumberPIXsp"      ,m_maxPIXsp            );
+  declareProperty("maxNumberSCTsp"      ,m_maxSCTsp            );
+  declareProperty("SpacePointsSCTName"  ,m_SpacePointsSCT      );
+  declareProperty("SpacePointsPixelName",m_SpacePointsPixel    );
+  declareProperty("FreeClustersCut"     ,m_nfreeCut            );
+  declareProperty("doRandomSpot"     ,m_doRandomSpot            );
+  declareProperty("PropagatorTool"      ,m_proptool            );
+  declareProperty("BeamConditionsService",m_beamconditions     ); 
+  declareProperty("MagneticFieldMode"   ,m_fieldmode           );
+}
+
+///////////////////////////////////////////////////////////////////
+// Initialisation
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::SiSPSeededTrackFinderRoI::initialize() 
+{
+
+  // Initialize read and write handles
+  ATH_CHECK( m_SpacePointsSCT.initialize() );
+  ATH_CHECK( m_SpacePointsPixel.initialize() );
+  ATH_CHECK( m_outputTracks.initialize() );
+
+  // Get the ZWindowRoI seed tool
+  ATH_CHECK( m_ZWindowRoISeedTool.retrieve() );
+  ATH_MSG_DEBUG("Retrieved tool " << m_ZWindowRoISeedTool);
+
+  if(m_doRandomSpot){ //see comment proceding line with "double RandZBoundary[2];"
+    ATH_CHECK( m_RandomRoISeedTool.retrieve() );
+    ATH_MSG_DEBUG("Retrieved tool " << m_RandomRoISeedTool);
+  }
+
+
+  // Get tool for space points seed maker
+  //
+  ATH_CHECK( m_seedsmaker.retrieve() );
+  ATH_MSG_DEBUG( "Retrieved tool " << m_seedsmaker );
+
+
+  // Get track-finding tool
+  //
+  ATH_CHECK( m_trackmaker.retrieve() );
+  ATH_MSG_DEBUG("Retrieved tool " << m_trackmaker );
+
+  // Get beam condition service and propagator (SP: check if we really need propagator..)
+  // 
+  if(m_beamconditions!="") {service(m_beamconditions,m_beam);} 
+  if(m_beam) {    
+    // Get RungeKutta propagator tool
+    ATH_CHECK( m_proptool.retrieve() );
+    ATH_MSG_DEBUG("Retrieved tool " << m_proptool );
+    // Setup for magnetic field
+    magneticFieldInit();      
+  }
+
+  // Get output print level
+  //
+  m_outputlevel = msg().level()-MSG::DEBUG;
+  if(m_outputlevel<=0) {
+    m_nprint=0; ATH_MSG_DEBUG((*this));
+  }
+  m_nseedsTotal    = 0;
+  m_ntracksTotal   = 0;
+  m_neventsTotal   = 0;
+  m_problemsTotal  = 0; 
+
+  return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////
+// Execute
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::SiSPSeededTrackFinderRoI::execute() 
+{ 
+
+  m_outputTracks = CxxUtils::make_unique<TrackCollection>();
+
+  std::multimap<double,Trk::Track*>    qualityTrack;
+  const InDet::SiSpacePointsSeed* seed = 0;
+
+  bool PIX = true ;
+  bool SCT = true ;
+  bool ERR = false;
+
+  //CREATE CONTAINER FOR RoI INFORMATION
+  xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
+  xAOD::VertexAuxContainer* theVertexAuxContainer = new xAOD::VertexAuxContainer;
+  theVertexContainer->setStore( theVertexAuxContainer );
+
+  // Find reference point of the event and create z boundary region
+  //
+  m_listRoIs =  m_ZWindowRoISeedTool->getRoIs();
+
+  double ZBoundary[2];
+  //if no RoI found; no need to go further
+  if ( m_listRoIs.empty() ) {
+    ATH_MSG_DEBUG("no selectedRoIs " );
+    StatusCode sc = evtStore()->record(theVertexContainer, m_vxOutputName);
+    StatusCode sc_aux = evtStore()->record(theVertexAuxContainer, m_vxOutputName+"Aux.");
+    if ( sc.isFailure() || sc_aux.isFailure() ) {
+      // can't write output container. Clean-up and abort
+      ATH_MSG_ERROR("Cannot write output container: " << m_vxOutputName);
+      if ( sc.isFailure() ) delete theVertexContainer;
+      if ( sc_aux.isFailure() ) delete theVertexAuxContainer;
+      return StatusCode::FAILURE;
+    }
+    else{
+      // empty container written successfully.  No need to continue with rest of code
+      return StatusCode::SUCCESS;
+    }
+  }
+  ZBoundary[0] = m_listRoIs[0].zWindow[0];
+  ZBoundary[1] = m_listRoIs[0].zWindow[1];
+  //m_listRoIs[0].zReference is the midpoint
+  ATH_MSG_DEBUG("selectedRoIs " << ZBoundary[0] <<" " << ZBoundary[1]);
+  
+  //VERTEX
+  for( size_t r = 0; r < m_listRoIs.size(); r++ ){
+
+    theVertexContainer->push_back( new xAOD::Vertex );
+
+    theVertexContainer->back()->setZ( m_listRoIs[r].zReference );
+    theVertexContainer->back()->auxdecor<double>("boundaryLow") = m_listRoIs[r].zWindow[0];
+    theVertexContainer->back()->auxdecor<double>("boundaryHigh") = m_listRoIs[r].zWindow[1];
+
+    theVertexContainer->back()->auxdecor<double>("perigeeZ0Lead") = m_listRoIs[r].zPerigeePos[0];
+    theVertexContainer->back()->auxdecor<double>("perigeeZ0Sublead") = m_listRoIs[r].zPerigeePos[1];
+    theVertexContainer->back()->auxdecor<int>("IsHS") = 1;
+
+  }
+  
+  //Analyses that want to run low-pt tracking with a region of interest care about the beam conditions near a collision of interest.  Validation of the beam conditions elsewhere in the beamspot (regarding low-pt tracks) will be needed to establish meaningful uncertainties.  Choosing a random position allows for this check.  Run with RAWtoESD section of postexec: ToolSvc.InDetSiSpTrackFinder_LowPtRoI.doRandomSpot = True
+  double RandZBoundary[2];
+  if(m_doRandomSpot){
+    //Finding Random Spot in beamspot
+    m_listRandRoIs =  m_RandomRoISeedTool->getRoIs();
+
+    while( std::abs( m_listRoIs[0].zReference - m_listRandRoIs[0].zReference ) < 5. || std::abs(m_listRandRoIs[0].zReference) > 250.0 ){
+      m_listRandRoIs.clear();
+      m_listRandRoIs =  m_RandomRoISeedTool->getRoIs();
+    }
+
+    RandZBoundary[0] = m_listRandRoIs[0].zWindow[0];
+    RandZBoundary[1] = m_listRandRoIs[0].zWindow[1];
+    for( size_t r = 0; r < m_listRandRoIs.size(); r++ ){
+
+      theVertexContainer->push_back( new xAOD::Vertex );
+      
+      theVertexContainer->back()->setZ( m_listRandRoIs[r].zReference );
+      theVertexContainer->back()->auxdecor<double>("boundaryLow") = m_listRandRoIs[r].zWindow[0];
+      theVertexContainer->back()->auxdecor<double>("boundaryHigh") = m_listRandRoIs[r].zWindow[1];
+      
+      theVertexContainer->back()->auxdecor<double>("perigeeZ0Lead") = m_listRandRoIs[r].zPerigeePos[0];
+      theVertexContainer->back()->auxdecor<double>("perigeeZ0Sublead") = m_listRandRoIs[r].zPerigeePos[1];
+      theVertexContainer->back()->auxdecor<int>("IsHS") = 0;
+      
+    }
+  }
+  
+  // Record the RoI information
+  StatusCode sc = evtStore()->record(theVertexContainer, m_vxOutputName);
+  StatusCode sc_aux = evtStore()->record(theVertexAuxContainer, m_vxOutputName+"Aux.");
+  if ( sc.isFailure() || sc_aux.isFailure() ) {
+    // can't write output container. Clean-up and abort
+    ATH_MSG_ERROR("Cannot write output container: " << m_vxOutputName);
+    if ( sc.isFailure() ) delete theVertexContainer;
+    if ( sc_aux.isFailure() ) delete theVertexAuxContainer;
+    return StatusCode::FAILURE;
+  }
+  else{
+    // empty container written successfully.  No need to continue with rest of code
+    return StatusCode::SUCCESS;
+  }
+
+  
+
+  // Find seeds that point within the RoI region in z
+  //  
+  m_seedsmaker  ->newEvent(-1); 
+  std::list<Trk::Vertex> VZ; 
+  if(m_RoIWidth >= 0.) m_seedsmaker->find3Sp(VZ, ZBoundary); 
+  if(m_RoIWidth < 0.) m_seedsmaker->find3Sp(VZ); //If you want to disable the RoI but still have a separate container for low-pt tracks, make the RoI input width a negative value.  The RoI "vertex" container will still be there in case you want to use that information for whatever reason (ie where the RoI would have been centered)
+  if(m_doRandomSpot) m_seedsmaker->find3Sp(VZ, RandZBoundary); //see comment proceding line with "double RandZBoundary[2];"
+  m_trackmaker->newEvent(PIX,SCT);
+
+  // Loop through all seed and create track candidates
+  //
+  m_nseeds  = 0;
+  m_ntracks = 0;
+
+  while((seed = m_seedsmaker->next())) {
+
+    ++m_nseeds;
+    const std::list<Trk::Track*>& T = m_trackmaker->getTracks(seed->spacePoints()); 
+    for(std::list<Trk::Track*>::const_iterator t=T.begin(); t!=T.end(); ++t) {
+      qualityTrack.insert(std::make_pair(-trackQuality((*t)),(*t)));
+    }
+    if( m_nseeds >= m_maxNumberSeeds) {
+      ERR = true; ++m_problemsTotal;  break;
+    }
+  }
+  
+  m_trackmaker->endEvent();
+
+  // Remove shared tracks with worse quality
+  //
+  filterSharedTracks(qualityTrack);
+
+  // Save good tracks in track collection
+  //
+  std::multimap<double,Trk::Track*>::iterator 
+    q = qualityTrack.begin(), qe =qualityTrack.end(); 
+
+  for(; q!=qe; ++q) {++m_ntracks; m_outputTracks->push_back((*q).second);}
+
+  m_nseedsTotal += m_nseeds ;
+
+  ++m_neventsTotal;
+
+  // In case of errors, clear output tracks
+  //
+  if(ERR) { m_outputTracks->clear(); }
+  else    {m_ntracksTotal+=m_ntracks;}
+
+  // Print common event information
+  //
+  if(m_outputlevel<=0) {
+    m_nprint=1; ATH_MSG_DEBUG((*this));
+  }
+  return StatusCode::SUCCESS;
+
+}
+
+///////////////////////////////////////////////////////////////////
+// Finalize
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::SiSPSeededTrackFinderRoI::finalize() 
+{
+  m_nprint=2; ATH_MSG_DEBUG((*this));
+  return StatusCode::SUCCESS;
+}
+
+///////////////////////////////////////////////////////////////////
+// Overload of << operator MsgStream
+///////////////////////////////////////////////////////////////////
+
+MsgStream& InDet::operator    << 
+  (MsgStream& sl,const InDet::SiSPSeededTrackFinderRoI& se)
+{ 
+  return se.dump(sl);
+}
+
+///////////////////////////////////////////////////////////////////
+// Overload of << operator std::ostream
+///////////////////////////////////////////////////////////////////
+
+std::ostream& InDet::operator << 
+  (std::ostream& sl,const InDet::SiSPSeededTrackFinderRoI& se)
+{
+  return se.dump(sl);
+}   
+
+///////////////////////////////////////////////////////////////////
+// Dumps relevant information into the MsgStream
+///////////////////////////////////////////////////////////////////
+
+MsgStream& InDet::SiSPSeededTrackFinderRoI::dump( MsgStream& out ) const
+{
+  out<<std::endl;
+  if(m_nprint)  return dumpevent(out); 
+  return dumptools(out);
+}
+
+///////////////////////////////////////////////////////////////////
+// Dumps conditions information into the MsgStream
+///////////////////////////////////////////////////////////////////
+
+MsgStream& InDet::SiSPSeededTrackFinderRoI::dumptools( MsgStream& out ) const
+{
+  int n;
+  n     = 65-m_seedsmaker.type().size();
+  std::string s2; for(int i=0; i<n; ++i) s2.append(" "); s2.append("|");
+  n     = 65-m_trackmaker.type().size();
+  std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
+  n     = 65-m_outputTracks.name().size();
+  std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
+  
+  out<<"|----------------------------------------------------------------"
+     <<"----------------------------------------------------|"
+     <<std::endl;
+  out<<"| Tool for space points seeds             finding | "<<m_seedsmaker.type()<<s2
+     <<std::endl;
+  out<<"| Tool for space points seeded track      finding | "<<m_trackmaker.type()<<s3
+     <<std::endl;
+  out<<"| Location of output tracks                       | "<<m_outputTracks.name()<<s4
+     <<std::endl;
+  out<<"|----------------------------------------------------------------"
+     <<"----------------------------------------------------|"
+     <<std::endl;
+  return out;
+}
+
+///////////////////////////////////////////////////////////////////
+// Dumps event information into the ostream
+///////////////////////////////////////////////////////////////////
+
+MsgStream& InDet::SiSPSeededTrackFinderRoI::dumpevent( MsgStream& out ) const
+{
+  int ns = m_nseeds;
+  int nt = m_ntracks;
+  if(m_nprint > 1) {ns = m_nseedsTotal; nt = m_ntracksTotal;}
+
+  out<<"|-------------------------------------------------------------------|" <<std::endl;
+  out<<"|  Investigated "
+     <<std::setw(9)<<ns<<" space points seeds and found ";
+  out<<std::setw(9)<<nt<<" tracks using RoI-z strategy           |"<<std::endl;
+
+  out<<"|-------------------------------------------------------------------|" <<std::endl;
+  if(m_problemsTotal > 0) {
+    out<<"|  Events       "
+       <<std::setw(7)<<m_neventsTotal   <<" |"
+       <<std::endl;
+    out<<"|  Problems     "
+       <<std::setw(7)<<m_problemsTotal  <<" |"
+       <<std::endl;
+    out<<"|-------------------------------------------------------------------|" <<std::endl;
+  }
+  return out;
+}
+
+///////////////////////////////////////////////////////////////////
+// Track quality calculation
+///////////////////////////////////////////////////////////////////
+
+double InDet::SiSPSeededTrackFinderRoI::trackQuality(const Trk::Track* Tr)
+{
+  DataVector<const Trk::TrackStateOnSurface>::const_iterator  
+    m  = Tr->trackStateOnSurfaces()->begin(), 
+    me = Tr->trackStateOnSurfaces()->end  ();
+
+ double quality = 0. ;
+ double W       = 17.;
+
+ for(; m!=me; ++m) {
+
+   if(!(*m)->type(Trk::TrackStateOnSurface::Measurement)) continue;
+   const Trk::FitQualityOnSurface* fq =  (*m)->fitQualityOnSurface();
+   if(!fq) continue;
+
+   double x2 = fq->chiSquared();
+   double q;
+   if(fq->numberDoF() == 2) q = (1.2*(W-x2*.5)); 
+   else                     q =      (W-x2    );
+   if(q < 0.) q = 0.; 
+   quality+=q;
+ }
+ if( Tr->info().trackProperties(Trk::TrackInfo::BremFit) ) quality*=.7;
+ return quality;
+}
+
+///////////////////////////////////////////////////////////////////
+// Filer shared tracks
+///////////////////////////////////////////////////////////////////
+
+void InDet::SiSPSeededTrackFinderRoI::filterSharedTracks
+(std::multimap<double,Trk::Track*>& QT)
+{
+  std::set<const Trk::PrepRawData*> clusters;
+  std::multimap<double,Trk::Track*>::iterator q = QT.begin();
+  
+  const Trk::PrepRawData* prd[100]; 
+  
+  while(q!=QT.end()) {
+
+    std::set<const Trk::PrepRawData*>::iterator fe = clusters.end();
+
+    int nf = 0, nc = 0; 
+
+    DataVector<const Trk::MeasurementBase>::const_iterator 
+      m  = (*q).second->measurementsOnTrack()->begin(), 
+      me = (*q).second->measurementsOnTrack()->end  ();
+
+    for(; m!=me; ++m) {
+
+      const Trk::PrepRawData* pr = ((const Trk::RIO_OnTrack*)(*m))->prepRawData();
+      if(pr) {
+	++nc; 
+	if(clusters.find(pr)==fe) {
+	  prd[nf++]=pr; 
+	  if(nf==100) break;
+	}
+      }
+    }
+
+    if(nf >= m_nfreeCut || nf==nc) {
+      for(int n=0; n!=nf; ++n) 
+	clusters.insert(prd[n]); 
+      ++q;
+    } 
+    else  {
+      delete (*q).second; 
+      QT.erase(q++);
+    }
+  }
+}
+
+///////////////////////////////////////////////////////////////////
+// Dumps relevant information into the ostream
+///////////////////////////////////////////////////////////////////
+
+std::ostream& InDet::SiSPSeededTrackFinderRoI::dump( std::ostream& out ) const
+{
+  return out;
+}
+
+///////////////////////////////////////////////////////////////////
+// Callback function - get the magnetic field /
+///////////////////////////////////////////////////////////////////
+
+void InDet::SiSPSeededTrackFinderRoI::magneticFieldInit() 
+{
+  // Build MagneticFieldProperties 
+  //
+  Trk::MagneticFieldProperties* pMF = 0;
+  if(m_fieldmode == "NoField") pMF = new Trk::MagneticFieldProperties(Trk::NoField  );
+  else                         pMF = new Trk::MagneticFieldProperties(Trk::FastField);
+  m_fieldprop = *pMF; delete pMF;
+}
+
+
+
+
diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/components/SiSPSeededTrackFinder_entries.cxx b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/components/SiSPSeededTrackFinder_entries.cxx
index a7e410232bb88cf96a6666a2dab442a4d82ae835..58a4dda04473006c6e429291163890129185016a 100755
--- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/components/SiSPSeededTrackFinder_entries.cxx
+++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/components/SiSPSeededTrackFinder_entries.cxx
@@ -1,12 +1,15 @@
 #include "GaudiKernel/DeclareFactoryEntries.h"
 #include "SiSPSeededTrackFinder/SiSPSeededTrackFinder.h"
+#include "SiSPSeededTrackFinder/SiSPSeededTrackFinderRoI.h"
 
 using namespace InDet;
 
 DECLARE_ALGORITHM_FACTORY( SiSPSeededTrackFinder )
+DECLARE_ALGORITHM_FACTORY( SiSPSeededTrackFinderRoI )
 
 DECLARE_FACTORY_ENTRIES( SiSPSeededTrackFinder )
 {
   DECLARE_ALGORITHM( SiSPSeededTrackFinder )
+  DECLARE_ALGORITHM( SiSPSeededTrackFinderRoI )
 }
 
diff --git a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IZWindowRoISeedTool.h b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IZWindowRoISeedTool.h
new file mode 100755
index 0000000000000000000000000000000000000000..aa9165f7a1746a6e9644cf6623a3b8e10d8ceca4
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IZWindowRoISeedTool.h
@@ -0,0 +1,74 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+/////////////////////////////////////////////////////////////////////////////////
+// Class for Z-window(s) RoI tool
+/////////////////////////////////////////////////////////////////////////////////
+
+#ifndef InDetRecToolInterfaces_IZWindowRoISeedTool_H
+#define InDetRecToolInterfaces_IZWindowRoISeedTool_H
+
+#include "GaudiKernel/AlgTool.h"
+#include "EventPrimitives/EventPrimitives.h" 
+
+namespace InDet
+{
+  static const InterfaceID IID_IZWindowRoISeedTool
+    ("InDet::IZWindowRoISeedTool", 1, 0);
+  class IZWindowRoISeedTool : virtual public IAlgTool
+  {
+  public:
+
+    ///////////////////////////////////////////////////////////////////
+    // Public return type
+    ///////////////////////////////////////////////////////////////////
+    class ZWindow {
+    public:
+      //* Lower and Upper z bound of the window */
+      float zWindow[2];
+      //* Reference z-position (if any) */
+      float zReference;
+      //* The perigee z-positions of the tracks (if any) */
+      float zPerigeePos[2];
+
+      //* Constructor setting default values */
+      ZWindow() { 
+	zReference = -999.;
+	zWindow[0]=zWindow[1]=-999.; 
+	zPerigeePos[0]=zPerigeePos[1]=-999.; 
+      }
+
+      ~ZWindow() {};
+    };
+
+    ///////////////////////////////////////////////////////////////////
+    // Public methods:
+    ///////////////////////////////////////////////////////////////////
+    /*
+      Compute RoI z-window(s)
+    */
+    virtual std::vector<ZWindow> getRoIs() = 0;
+
+  public:
+    ///////////////////////////////////////////////////////////////////
+    // Standard tool methods
+    ///////////////////////////////////////////////////////////////////
+    
+    static const InterfaceID& interfaceID();
+    virtual StatusCode initialize ()=0;
+    virtual StatusCode finalize   ()=0;
+
+  }; // End of IZWindowRoISeedTool class definition 
+
+
+  inline const InterfaceID& IZWindowRoISeedTool::interfaceID()
+    {
+      return IID_IZWindowRoISeedTool;
+    }
+
+
+} // End of namespace InDet
+#endif
diff --git a/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx b/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx
index a2fe2a62047c41a49b220049659da14445ec3a3a..336793f4559bf050b841e1b2f0a5059de9f59926 100644
--- a/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx
+++ b/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx
@@ -14,6 +14,7 @@
 #include "TrkRIO_OnTrack/RIO_OnTrack.h"
 #include "InDetPrepRawData/SiClusterContainer.h"
 #include "SeedToTrackConversionTool/SeedToTrackConversionTool.h"
+#include "AthenaKernel/MsgStreamMember.h"
 
 //================ Constructor =================================================
 
@@ -32,6 +33,7 @@ InDet::SeedToTrackConversionTool::SeedToTrackConversionTool(const std::string& t
   m_nprint = 0;   
   declareInterface<ISeedToTrackConversionTool>(this);
   declareProperty("TrackPatternRecoInfo"    ,m_patternName );
+  declareProperty("SeedsegmentsOutput"    ,m_seedsegmentsOutput );
   //  template for property decalration
   //declareProperty("PropertyName", m_propertyName);
 }
@@ -98,7 +100,8 @@ void InDet::SeedToTrackConversionTool::endEvent()
 {
   // Print event information
   //
-  if (outputLevel()<=0) {
+  Athena::MsgStreamMember msgStream;
+  if (msgStream.get().level() <= MSG::DEBUG) {
     m_nprint=1; msg(MSG::DEBUG)<<(*this)<<endreq;
   }
 
@@ -186,7 +189,8 @@ void  InDet::SeedToTrackConversionTool::executeSiSPSeedSegments(const Trk::Track
 MsgStream&  InDet::SeedToTrackConversionTool::dump( MsgStream& out ) const
 {
   out<<std::endl;
-  if(m_nprint)  return dumpevent(out); return dumpconditions(out);
+  if(m_nprint)  return dumpevent(out);
+  return dumpconditions(out);
 }
  
 ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt
index 74ea72ea3e998ad6a1081d4e70306933d5a34764..3e3ea5ac32bb53d7e23157ccb1120ccbfa31ac2c 100644
--- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt
@@ -27,6 +27,7 @@ atlas_depends_on_subdirs(
    InnerDetector/InDetRecTools/InDetRecToolInterfaces
    Tracking/TrkEvent/TrkParameters
    PRIVATE
+   Tools/PathResolver
    Database/AthenaPOOL/AthenaPoolUtilities
    DetectorDescription/AtlasDetDescr
    DetectorDescription/DetDescrCond/DetDescrCondTools
@@ -38,26 +39,30 @@ atlas_depends_on_subdirs(
    Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils )
 
 # External dependencies:
+find_package( lwtnn )
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core MathCore Hist )
+find_package( COOL COMPONENTS CoolKernel CoolApplication )
 
 # Component(s) in the package:
 atlas_add_library( SiClusterizationToolLib
    SiClusterizationTool/*.h src/*.cxx
    PUBLIC_HEADERS SiClusterizationTool
-   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS}
+   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS}
    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives
+   LINK_LIBRARIES ${ROOT_LIBRARIES} ${LWTNN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives
    Identifier ReadoutGeometryBase EventPrimitives GaudiKernel InDetSimData InDetIdentifier
    InDetReadoutGeometry SCT_ReadoutGeometry PixelReadoutGeometry InDetRawData InDetPrepRawData InDetRecToolInterfaces
    TrkParameters TrkNeuralNetworkUtilsLib
-   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaPoolUtilities AtlasDetDescr
-   TrkSurfaces TrkEventPrimitives VxVertex PixelGeoModelLib )
+   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${COOL_LIBRARIES} AthenaPoolUtilities AtlasDetDescr
+   TrkSurfaces TrkEventPrimitives VxVertex PixelGeoModelLib PathResolver stdc++fs)
 
 atlas_add_component( SiClusterizationTool
    src/components/*.cxx
-   LINK_LIBRARIES GaudiKernel SiClusterizationToolLib )
+   INCLUDE_DIRS ${COOL_INCLUDE_DIRS}
+   LINK_LIBRARIES ${COOL_LIBRARIES} GaudiKernel SiClusterizationToolLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
+atlas_install_data( share/*.db )
diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h
index 9be495d60b8823216521317d5480c30ddea4f636..7f761744a85e51784e9ff2104df763ca0f2cd4e2 100644
--- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h
+++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h
@@ -1,14 +1,14 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
- #ifndef BTAGTOOL_NnClusterizationFactory_C
- #define BTAGTOOL_NnClusterizationFactory_C
+ #ifndef SICLUSTERIZATIONTOOL_NnClusterizationFactory_C
+ #define SICLUSTERIZATIONTOOL_NnClusterizationFactory_C
  
  /******************************************************
      @class NnClusterizationFactory
      @author Giacinto Piacquadio (PH-ADE-ID)
-     Package : JetTagTools 
+     Package : SiClusterizationTool 
      Created : January 2011
      DESCRIPTION: Load neural networks used for clustering 
                   and deal with:
@@ -41,6 +41,11 @@
  class ICoolHistSvc;
  class IPixelCalibSvc;
 
+namespace lwt {
+  class NanReplacer;    
+  class LightweightGraph;
+}
+
 namespace Trk {
   class NeuralNetworkToHistoTool;
   class Surface;
@@ -116,10 +121,33 @@ namespace InDet {
                                                       
     /** Callback for nnSetup */
     StatusCode nnSetup( IOVSVC_CALLBACK_ARGS );
+
+    StatusCode setUpNNLwtnn(IOVSVC_CALLBACK_ARGS);
     
    private:
     void clearCache(std::vector<TTrainedNetwork*>& ttnn);
  
+    // NN implementations
+    std::unique_ptr<lwt::LightweightGraph> m_lwnnNumber;  
+    std::map<int, std::unique_ptr<lwt::LightweightGraph> > m_lwnnPosition;  
+
+    // Flags for determining which NNs to use
+    bool m_useLwtnnNumber;
+    bool m_useLwtnnPosition;
+
+    // Handling inputs and outputs
+    typedef std::map<std::string, std::map<std::string, double> > InputMap;
+
+    // lwtnn version
+    std::vector<Amg::Vector2D> estimatePositions(NnClusterizationFactory::InputMap & input, 
+                                                NNinput* rawInput,
+                                                const InDet::PixelCluster& pCluster,
+                                                int numberSubClusters,
+                                                std::vector<Amg::MatrixX> & errors);
+
+    // For error formatting in lwtnn version
+    double correctedRMSX(double posPixels);
+    double correctedRMSY(double posPixels, double sizeY, std::vector<float>& pitches);    
  
     /* estimate position for both with and w/o tracks */
     std::vector<Amg::Vector2D> estimatePositions(std::vector<double> inputData,
@@ -150,6 +178,7 @@ namespace InDet {
 
     TTrainedNetwork* retrieveNetwork(const std::string& folder, const std::string& subfolder);
 
+  StatusCode configureLwtnn(std::unique_ptr<lwt::LightweightGraph> & thisNN, std::string thisJson);
 
     std::vector<double> assembleInput(NNinput& input,
                                       int sizeX,
@@ -166,8 +195,6 @@ namespace InDet {
                                       int sizeX,
                                       int sizeY);
 
-
-
     std::vector<Amg::Vector2D> getPositionsFromOutput(std::vector<double> & output,
 						      NNinput & input,
 						      const InDet::PixelCluster& pCluster,
@@ -197,7 +224,10 @@ namespace InDet {
      std::vector<TTrainedNetwork*> m_NetworkEstimateImpactPointErrorsY;
      std::vector<TTrainedNetwork*> m_NetworkEstimateImpactPointErrorsY_NoTrack;
 
-     std::string m_coolFolder;
+     // Two different cool folders store the differents kinds of configuration formats
+     // One is stored in root files, the other in json format as strings
+     std::string m_coolFolderRoot;
+     std::string m_coolFolderJson;     
      std::string m_layerInfoHistogram;
      std::string m_layerPrefix;
      std::string m_weightIndicator;
@@ -205,7 +235,8 @@ namespace InDet {
 
     ToolHandle<Trk::NeuralNetworkToHistoTool> m_networkToHistoTool;
     ServiceHandle<IPixelCalibSvc> m_calibSvc;
-    
+
+    InputMap flattenInput(NNinput & input);    
 
     bool m_useToT;
     bool m_addIBL;
diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx
index 44c33343213b1c2cbb4b69e2cf4a7a0b87dc509a..d4255e1f7352eb30e26783ecf5fef14aa16afd4d 100644
--- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx
+++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -37,16 +37,33 @@
 #include "PixelReadoutGeometry/PixelModuleDesign.h"
 #include "ReadoutGeometryBase/SiLocalPosition.h"
 
+// NN includes
+#include "lwtnn/LightweightGraph.hh"
+#include "lwtnn/parse_json.hh"
+#include "lwtnn/Exceptions.hh"
+#include "lwtnn/lightweight_nn_streamers.hh"
+#include "lwtnn/NanReplacer.hh"
+
 #include "TrkEventPrimitives/ParamDefs.h"
 
 #include "PixelConditionsServices/IPixelCalibSvc.h"
 #include "DetDescrCondTools/ICoolHistSvc.h"
 
+// utilities
+#include "PathResolver/PathResolver.h"
+
 #include "AthenaPoolUtilities/CondAttrListCollection.h"
+#include "AthenaPoolUtilities/AthenaAttributeList.h"
+#include "CoolKernel/IObject.h"
 
-//get std::isnan()
-#include <cmath>
+// JSON parsers
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
+#include "boost/property_tree/exceptions.hpp"
 
+#include <cmath>
+#include <experimental/filesystem>
+#include <fstream>
 
 
 namespace InDet {
@@ -54,17 +71,21 @@ namespace InDet {
   NnClusterizationFactory::NnClusterizationFactory(const std::string& name,
                                                    const std::string& n, const IInterface* p):
           AthAlgTool(name, n,p),
+          m_lwnnPosition(),
+          m_useLwtnnNumber(false),
+          m_useLwtnnPosition(false),
           m_loadNoTrackNetworks(true),
           m_loadWithTrackNetworks(false),
           m_NetworkEstimateNumberParticles(0),
           m_NetworkEstimateNumberParticles_NoTrack(0),
-          m_coolFolder("/PIXEL/PixelClustering/PixelClusNNCalib"),
+          m_coolFolderRoot("/PIXEL/PixelClustering/PixelClusNNCalib"),
+          m_coolFolderJson("/PIXEL/PixelClustering/PixelNNCalibJSON"),
           m_layerInfoHistogram("LayersInfo"),
           m_layerPrefix("Layer"), 
           m_weightIndicator("_weights"),
           m_thresholdIndicator("_thresholds"),
           m_networkToHistoTool("Trk::NeuralNetworkToHistoTool/NeuralNetworkToHistoTool"),
-          m_calibSvc("PixelCalibSvc", name),
+          m_calibSvc("PixelCalibSvc", name),        
           m_useToT(true),
           m_addIBL(false),
           m_doRunI(false),
@@ -74,7 +95,8 @@ namespace InDet {
           m_correctLorShiftBarrelWithTracks(0.)
   {
     // histogram loading from COOL
-    declareProperty("CoolFolder",                   m_coolFolder);
+    declareProperty("CoolFolder",                   m_coolFolderRoot);
+    declareProperty("CoolFolder_JSON",             m_coolFolderJson);
     declareProperty("LayerInfoHistogram",           m_layerInfoHistogram);
     declareProperty("LayerPrefix",                  m_layerPrefix);
     declareProperty("LayerWeightIndicator",         m_weightIndicator);
@@ -91,8 +113,8 @@ namespace InDet {
     declareProperty("useRecenteringNNWithTracks",m_useRecenteringNNWithTracks);
     declareProperty("correctLorShiftBarrelWithoutTracks",m_correctLorShiftBarrelWithoutTracks);
     declareProperty("correctLorShiftBarrelWithTracks",m_correctLorShiftBarrelWithTracks);
-        
-    declareInterface<NnClusterizationFactory>(this);
+
+    declareInterface<NnClusterizationFactory>(this);   
   } 
   
 /////////////////////////////////////////////////////////////////////////////////////
@@ -157,22 +179,147 @@ namespace InDet {
       ATH_MSG_ERROR("Could not load: " << m_networkToHistoTool);
       return StatusCode::FAILURE;
     }
-     // register IOV callback function for the COOL folder
-     const DataHandle<CondAttrListCollection> aptr;
-     if ( (detStore()->regFcn(&NnClusterizationFactory::nnSetup,this,aptr,m_coolFolder)).isFailure() ){
-         ATH_MSG_ERROR("Registration of IOV callback for " << m_coolFolder << "failed.");
-         return StatusCode::FAILURE;
-     } else 
-        ATH_MSG_INFO("Registered IOV callback for " << m_coolFolder);
+
+    // register IOV callback function for the COOL folders
+    const DataHandle<CondAttrListCollection> aptr;
+    if ( (detStore()->regFcn(&NnClusterizationFactory::nnSetup,this,aptr,m_coolFolderRoot)).isFailure() ){
+       ATH_MSG_ERROR("Registration of IOV callback for " << m_coolFolderRoot << " failed.");
+       return StatusCode::FAILURE;
+    } else 
+      ATH_MSG_INFO("Registered IOV callback for " << m_coolFolderRoot);
+
+    // Check if json folder is available (will not be during initial transition)
+    bool hasFolderJson = detStore()->contains<CondAttrListCollection>(m_coolFolderJson);
+
+    // If not, don't continue with setup.
+    if (!hasFolderJson) {
+      ATH_MSG_INFO("No folder " << m_coolFolderJson << " available. Will access NN configuration using TTrainedNetwork."); 
+      m_useLwtnnNumber = false;
+      m_useLwtnnPosition = false;
+    }
+    
+    // If yes, set up callback for json folder.
+    else {
+
+      const DataHandle<CondAttrListCollection> lwtnnDatahandle;
+      if ( (detStore()->regFcn(&NnClusterizationFactory::setUpNNLwtnn,this,lwtnnDatahandle,m_coolFolderJson)).isFailure() ){
+          ATH_MSG_ERROR("Registration of IOV callback for " << m_coolFolderJson << " failed.");
+          return StatusCode::FAILURE;
+      } else 
+         ATH_MSG_INFO("Registered IOV callback for " << m_coolFolderJson); 
+
+    }
     
     if (m_calibSvc.retrieve().isFailure()){
         ATH_MSG_ERROR("Could not retrieve " << m_calibSvc);
         return StatusCode::FAILURE;
     }
-    
+
     return StatusCode::SUCCESS;
   }
   
+
+  // Callback for new NN setup
+  StatusCode NnClusterizationFactory::setUpNNLwtnn(IOVSVC_CALLBACK_ARGS_P(I,keys) ){
+
+    // Avoid unused parameter warnings (ugly)
+    (void) I; (void) keys;
+
+    // Retrieve attribute list for table
+    const CondAttrListCollection* attrListColl;
+    CHECK(detStore()->retrieve(attrListColl, m_coolFolderJson));
+
+    // Retrieve channel 0 (only channel there is)
+    const coral::AttributeList& attrList=attrListColl->attributeList(0);
+
+    // Check that it is filled as expected
+    if ((attrList["NNConfigurations"]).isNull()) {
+      ATH_MSG_ERROR( "NNConfigurations is NULL in " << m_coolFolderJson << "!" );
+      return StatusCode::FAILURE;
+    }
+
+    // Retrieve the string
+    // This is for a single LOB when it is all a giant block
+    const std::string megajson = attrList["NNConfigurations"].data<cool::String16M>();
+
+    // Parse the large json to extract the individual configurations for the NNs
+    std::istringstream initializerStream(megajson);
+
+    namespace pt = boost::property_tree;    
+    pt::ptree parentTree;
+    pt::read_json(initializerStream, parentTree);
+    std::ostringstream configStream;
+
+    // First, extract configuration for the number network.
+    pt::ptree subtreeNumberNetwork = parentTree.get_child("NumberNetwork");
+    // If this json is empty, we aren't using
+    // lwtnn for the number network.
+    if(subtreeNumberNetwork.empty()) {
+      ATH_MSG_INFO("Not using lwtnn for number network.");
+      m_useLwtnnNumber = false;
+    }
+    // Otherwise, set up lwtnn.
+    else {      
+      ATH_MSG_INFO("Setting up lwtnn for number network...");
+      pt::write_json(configStream, subtreeNumberNetwork);
+      std::string numberNetworkConfig = configStream.str();      
+      if ((configureLwtnn(m_lwnnNumber, numberNetworkConfig)).isFailure())
+        return StatusCode::FAILURE;      
+    }
+
+    // Now extract configuration for each position network.
+    // For simplicity, we'll require all three configurations
+    // in order to use lwtnn for positions.
+    m_useLwtnnPosition = true;
+    for (int i=1; i<4; i++) {
+      const std::string key = "PositionNetwork_N"+std::to_string(i);
+      configStream.str("");
+      pt::ptree subtreePosNetwork = parentTree.get_child(key);
+      pt::write_json(configStream, subtreePosNetwork);
+      std::string posNetworkConfig = configStream.str();
+      
+      // Now do empty check: if any one of these is empty we won't use lwtnn
+      if(subtreePosNetwork.empty()) {
+        ATH_MSG_INFO("Not using lwtnn for position networks.");
+        m_useLwtnnPosition = false;
+      } else {
+        // Don't bother configuring if we aren't using this
+        if (!m_useLwtnnPosition) continue;
+        // Otherwise, set up lwtnn
+        ATH_MSG_INFO("Setting up lwtnn for n = " << i << " position network...");
+        if ((configureLwtnn(m_lwnnPosition[i], posNetworkConfig)).isFailure())
+          return StatusCode::FAILURE;
+      }
+
+    }
+
+    return StatusCode::SUCCESS;        
+  }
+
+StatusCode NnClusterizationFactory::configureLwtnn(std::unique_ptr<lwt::LightweightGraph> & thisNN, 
+                                      std::string thisJson) {
+
+  // Read DNN weights from input json config
+  lwt::GraphConfig config;
+  try {
+    std::istringstream input_cfg( thisJson );
+    config = lwt::parse_json_graph(input_cfg);
+  } catch (boost::property_tree::ptree_error& err) {
+    ATH_MSG_ERROR("NN file unreadable!");
+    return StatusCode::FAILURE;
+  }
+
+  // Build the network
+  try {
+    thisNN.reset(new lwt::LightweightGraph(config, "merge_1"));
+  } catch (lwt::NNConfigurationException& exc) {
+    ATH_MSG_ERROR("NN configuration problem: " << exc.what());
+    return StatusCode::FAILURE;
+  }
+
+  return StatusCode::SUCCESS;   
+
+}
   
 std::vector<double> NnClusterizationFactory::assembleInput(NNinput& input,
                                                              int sizeX,
@@ -280,6 +427,42 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
     return inputData;
   }
 
+  NnClusterizationFactory::InputMap NnClusterizationFactory::flattenInput(NNinput & input) {
+
+    // Format for use with lwtnn
+    std::map<std::string, std::map<std::string, double> > flattened;
+
+    // Fill it!
+    // Variable names here need to match the ones in the configuration.    
+
+    std::map<std::string, double> simpleInputs;
+    for (unsigned int x = 0; x < input.matrixOfToT.size(); x++) {
+      for (unsigned int y = 0; y < input.matrixOfToT.at(0).size(); y++) {
+        unsigned int index = x*input.matrixOfToT.at(0).size()+y;
+        std::string varname = "NN_matrix"+std::to_string(index);
+        simpleInputs[varname] = input.matrixOfToT.at(x).at(y);
+      }
+    }
+
+    for (unsigned int p = 0; p < input.vectorOfPitchesY.size(); p++) {
+      std::string varname = "NN_pitches" + std::to_string(p);
+      simpleInputs[varname] = input.vectorOfPitchesY.at(p);
+    }
+
+    simpleInputs["NN_layer"] = input.ClusterPixLayer;
+    simpleInputs["NN_barrelEC"] = input.ClusterPixBarrelEC;
+    simpleInputs["NN_phi"] = input.phi;
+    simpleInputs["NN_theta"] = input.theta;
+
+    if (input.useTrackInfo) simpleInputs["NN_etaModule"] = input.etaModule;
+
+    // We have only one node for now, so we just store things there.
+    flattened["NNinputs"] = simpleInputs;
+
+    return flattened;
+
+
+  }
 
   std::vector<double> NnClusterizationFactory::estimateNumberOfParticles(const InDet::PixelCluster& pCluster,
                                                                          Amg::Vector3D & beamSpotPosition,
@@ -438,6 +621,85 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
     return estimatePositions(inputData,input,pCluster,sizeX,sizeY,true,numberSubClusters,errors);
   }
   
+  std::vector<Amg::Vector2D> NnClusterizationFactory::estimatePositions(
+                                                                NnClusterizationFactory::InputMap & input, 
+                                                                NNinput* rawInput,
+                                                                const InDet::PixelCluster& pCluster,
+                                                                int numberSubClusters,
+                                                                std::vector<Amg::MatrixX> & errors) {
+    
+    // Need to evaluate the correct network once per cluster we're interested in.
+    // Save the output
+    std::vector<double> positionValues;
+    std::vector<Amg::MatrixX> errorMatrices;
+    for (int cluster = 1; cluster < numberSubClusters+1; cluster++) {
+
+      std::string outNodeName = "merge_"+std::to_string(cluster);
+      std::map<std::string, double> position = m_lwnnPosition.at(numberSubClusters)->compute(input, {},outNodeName);
+      ATH_MSG_DEBUG("Testing for numberSubClusters " << numberSubClusters << " and cluster " << cluster);
+      for (auto item : position) {
+        ATH_MSG_DEBUG(item.first << ": " << item.second);
+      }
+      positionValues.push_back(position["mean_x"]);
+      positionValues.push_back(position["mean_y"]);
+
+      // Fill errors.
+      // Values returned by NN are inverse of variance, and we want variances.
+      float rawRmsX = sqrt(1.0/position["prec_x"]);
+      float rawRmsY = sqrt(1.0/position["prec_y"]);
+      // Now convert to real space units
+      double rmsX = correctedRMSX(rawRmsX);
+      double rmsY = correctedRMSY(rawRmsY, 7., rawInput->vectorOfPitchesY);
+      ATH_MSG_DEBUG(" Estimated RMS errors (1) x: " << rmsX << ", y: " << rmsY);  
+
+      // Fill matrix    
+      Amg::MatrixX erm(2,2);
+      erm.setZero();
+      erm(0,0)=rmsX*rmsX;
+      erm(1,1)=rmsY*rmsY;
+      errorMatrices.push_back(erm); 
+
+    }
+
+    std::vector<Amg::Vector2D> myPositions = getPositionsFromOutput(positionValues,*rawInput,pCluster);
+    ATH_MSG_DEBUG(" Estimated myPositions (1) x: " << myPositions[0][Trk::locX] << " y: " << myPositions[0][Trk::locY]);
+    
+    for (unsigned int index = 0; index < errorMatrices.size(); index++) errors.push_back(errorMatrices.at(index));
+
+    return myPositions;
+
+  }
+
+  double NnClusterizationFactory::correctedRMSX(double posPixels)
+  {
+
+    // This gives location in pixels
+    double pitch = 0.05;
+    double corrected = posPixels * pitch;
+
+    return corrected;
+  }
+
+  double NnClusterizationFactory::correctedRMSY(double posPixels,
+         double sizeY,
+        std::vector<float>& pitches)
+  {
+    double p = posPixels + (sizeY - 1) / 2.0;
+    double p_Y = -100;
+    double p_center = -100;
+    double p_actual = 0;
+
+    for (int i = 0; i < sizeY; i++) {
+      if (p >= i && p <= (i + 1))
+        p_Y = p_actual + (p - i + 0.5) * pitches.at(i);
+      if (i == (sizeY - 1) / 2)
+        p_center = p_actual + 0.5 * pitches.at(i);
+      p_actual += pitches.at(i);
+    }
+
+    return abs(p_Y - p_center);
+  }  
+
   std::vector<Amg::Vector2D> NnClusterizationFactory::estimatePositions(std::vector<double> inputData,
                                                                              NNinput* input,
                                                                              const InDet::PixelCluster& pCluster,
@@ -449,8 +711,14 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
   {
 
 
+    // If we're using new networks via lwtnn, call those now
+    if (m_useLwtnnPosition) {
+      NnClusterizationFactory::InputMap nnInputData = flattenInput(*input);
+      auto test_position = estimatePositions(nnInputData,input,pCluster,numberSubClusters,errors);
+      return test_position;
+    }
 
-
+    // Otherwise continue to older function.
 
     bool applyRecentering=false;
     if (m_useRecenteringNNWithouTracks && !useTrackInfo)
@@ -486,11 +754,11 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
       }
 
 
-      ATH_MSG_VERBOSE(" RAW Estimated positions (1) x: " << back_posX(position1P[0],applyRecentering) << " y: " << back_posY(position1P[1]));
+      ATH_MSG_DEBUG(" Original RAW Estimated positions (1) x: " << back_posX(position1P[0],applyRecentering) << " y: " << back_posY(position1P[1]));
 
       std::vector<Amg::Vector2D> myPosition1=getPositionsFromOutput(position1P,*input,pCluster,sizeX,sizeY);
 
-      ATH_MSG_VERBOSE(" Estimated myPositions (1) x: " << myPosition1[0][Trk::locX] << " y: " << myPosition1[0][Trk::locY]);
+      ATH_MSG_DEBUG(" Original Estimated myPositions (1) x: " << myPosition1[0][Trk::locX] << " y: " << myPosition1[0][Trk::locY]);
 
       std::vector<double> inputDataNew=inputData;
       inputDataNew.push_back(position1P[0]);
@@ -519,9 +787,7 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
 	    errors1PY=m_NetworkEstimateImpactPointErrorsY[0]->calculateNormalized(inputDataNew);
 	  }
 	}
-     
 
- 
       std::vector<Amg::MatrixX> errorMatrices1;
       getErrorMatrixFromOutput(errors1PX,errors1PY,errorMatrices1,1);
 
@@ -691,6 +957,8 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
     
     int sizeOutputX=outputX.size()/nParticles;
     int sizeOutputY=outputY.size()/nParticles;
+
+    ATH_MSG_VERBOSE( outputX);
     
     double minimumX=-errorHalfIntervalX(nParticles);
     double maximumX=errorHalfIntervalX(nParticles);
@@ -790,7 +1058,6 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
     return;
   
   }//getErrorMatrixFromOutput
-  
     
   std::vector<Amg::Vector2D> NnClusterizationFactory::getPositionsFromOutput(std::vector<double> & output,
                                                                                   NNinput & input,
@@ -1368,7 +1635,7 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
         
         for (std::list<std::string>::const_iterator itr=keys.begin(); itr!=keys.end();++itr) {
             ATH_MSG_INFO(" -- " << *itr);
-           if ( (*itr)==m_coolFolder ){
+           if ( (*itr)==m_coolFolderRoot ){
               // is a memory leak for now : NNs need to be deleted
               clearCache(m_NetworkEstimateImpactPoints_NoTrack);
               clearCache(m_NetworkEstimateImpactPointErrorsX_NoTrack);
@@ -1381,32 +1648,32 @@ if(m_doRunI){    return assembleInputRunI(  input, sizeX, sizeY    );       }els
               if (m_loadNoTrackNetworks)
               {
                 ATH_MSG_VERBOSE("Loading 10 networks for number estimate, position estimate and error PDF estimate (without track info)");
-                m_NetworkEstimateNumberParticles_NoTrack=retrieveNetwork(m_coolFolder,"NumberParticles_NoTrack/");
-                m_NetworkEstimateImpactPoints_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPoints1P_NoTrack/"));
-                m_NetworkEstimateImpactPoints_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPoints2P_NoTrack/"));
-                m_NetworkEstimateImpactPoints_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPoints3P_NoTrack/"));
-                m_NetworkEstimateImpactPointErrorsX_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsX1_NoTrack/"));
-                m_NetworkEstimateImpactPointErrorsX_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsX2_NoTrack/"));
-                m_NetworkEstimateImpactPointErrorsX_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsX3_NoTrack/"));
-                m_NetworkEstimateImpactPointErrorsY_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsY1_NoTrack/"));
-                m_NetworkEstimateImpactPointErrorsY_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsY2_NoTrack/"));
-                m_NetworkEstimateImpactPointErrorsY_NoTrack.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsY3_NoTrack/"));
+                m_NetworkEstimateNumberParticles_NoTrack=retrieveNetwork(m_coolFolderRoot,"NumberParticles_NoTrack/");
+                m_NetworkEstimateImpactPoints_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPoints1P_NoTrack/"));
+                m_NetworkEstimateImpactPoints_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPoints2P_NoTrack/"));
+                m_NetworkEstimateImpactPoints_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPoints3P_NoTrack/"));
+                m_NetworkEstimateImpactPointErrorsX_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsX1_NoTrack/"));
+                m_NetworkEstimateImpactPointErrorsX_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsX2_NoTrack/"));
+                m_NetworkEstimateImpactPointErrorsX_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsX3_NoTrack/"));
+                m_NetworkEstimateImpactPointErrorsY_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsY1_NoTrack/"));
+                m_NetworkEstimateImpactPointErrorsY_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsY2_NoTrack/"));
+                m_NetworkEstimateImpactPointErrorsY_NoTrack.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsY3_NoTrack/"));
               }
               
               //now read all Histograms
               if (m_loadWithTrackNetworks)
               {
                 ATH_MSG_VERBOSE("Loading 10 networks for number estimate, position estimate and error PDF estimate (with track info)");
-                m_NetworkEstimateNumberParticles=retrieveNetwork(m_coolFolder,"NumberParticles/");
-                m_NetworkEstimateImpactPoints.push_back(retrieveNetwork(m_coolFolder,"ImpactPoints1P/"));
-                m_NetworkEstimateImpactPoints.push_back(retrieveNetwork(m_coolFolder,"ImpactPoints2P/"));
-                m_NetworkEstimateImpactPoints.push_back(retrieveNetwork(m_coolFolder,"ImpactPoints3P/"));
-                m_NetworkEstimateImpactPointErrorsX.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsX1/"));
-                m_NetworkEstimateImpactPointErrorsX.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsX2/"));
-                m_NetworkEstimateImpactPointErrorsX.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsX3/"));
-                m_NetworkEstimateImpactPointErrorsY.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsY1/"));
-                m_NetworkEstimateImpactPointErrorsY.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsY2/"));
-                m_NetworkEstimateImpactPointErrorsY.push_back(retrieveNetwork(m_coolFolder,"ImpactPointErrorsY3/"));
+                m_NetworkEstimateNumberParticles=retrieveNetwork(m_coolFolderRoot,"NumberParticles/");
+                m_NetworkEstimateImpactPoints.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPoints1P/"));
+                m_NetworkEstimateImpactPoints.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPoints2P/"));
+                m_NetworkEstimateImpactPoints.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPoints3P/"));
+                m_NetworkEstimateImpactPointErrorsX.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsX1/"));
+                m_NetworkEstimateImpactPointErrorsX.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsX2/"));
+                m_NetworkEstimateImpactPointErrorsX.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsX3/"));
+                m_NetworkEstimateImpactPointErrorsY.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsY1/"));
+                m_NetworkEstimateImpactPointErrorsY.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsY2/"));
+                m_NetworkEstimateImpactPointErrorsY.push_back(retrieveNetwork(m_coolFolderRoot,"ImpactPointErrorsY3/"));
               }        
           }
        }
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt
index a225d0accf0d9dd7e5c5587aa364a39658d946c2..deceea2e9b8b9451bd1731fcaf24e1839e651bfb 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt
@@ -17,16 +17,24 @@ atlas_depends_on_subdirs( PUBLIC
                           MagneticField/MagFieldInterfaces
                           Tracking/TrkDetDescr/TrkSurfaces
                           Tracking/TrkEvent/TrkPseudoMeasurementOnTrack
-                          Tracking/TrkEvent/TrkSpacePoint
+                          Tracking/TrkEvent/TrkSpacePoint			  
+			  Control/AthenaServices
                           PRIVATE
-                          Tracking/TrkTools/TrkToolInterfaces )
+                          Tracking/TrkTools/TrkToolInterfaces 
+			  Tracking/TrkEvent/TrkTrack
+                          Event/xAOD/xAODEventInfo
+			  Event/xAOD/xAODTruth )
+
+find_package( CLHEP )
 
 # Component(s) in the package:
 atlas_add_component( SiSpacePointsSeedTool_xk
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetReadoutGeometry InDetPrepRawData SiSpacePointsSeed 
-                     InDetRecToolInterfaces MagFieldInterfaces TrkSurfaces TrkPseudoMeasurementOnTrack TrkSpacePoint TrkToolInterfaces )
+		     INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetReadoutGeometry InDetPrepRawData SiSpacePointsSeed 
+                     InDetRecToolInterfaces MagFieldInterfaces TrkSurfaces TrkPseudoMeasurementOnTrack TrkSpacePoint 
+		     TrkToolInterfaces xAODTruth ITrackToVertex xAODEventInfo )
 
 # Install files from the package:
 atlas_install_headers( SiSpacePointsSeedTool_xk )
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/FileRoISeedTool.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/FileRoISeedTool.h
new file mode 100755
index 0000000000000000000000000000000000000000..6086e685509906d4f2fab31c52b923011fa67fa9
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/FileRoISeedTool.h
@@ -0,0 +1,63 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+/////////////////////////////////////////////////////////////////////////////////
+// Class for Z-window RoI from an input file
+/////////////////////////////////////////////////////////////////////////////////
+
+#ifndef SiSpacePointsSeedTool_xk_FileRoISeedTool_h
+#define SiSpacePointsSeedTool_xk_FileRoISeedTool_h
+
+#include "InDetRecToolInterfaces/IZWindowRoISeedTool.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+
+#include <string>
+#include <vector>
+
+
+namespace InDet {
+
+  class FileRoISeedTool : 
+   virtual public IZWindowRoISeedTool ,public AthAlgTool
+  {
+
+    ///////////////////////////////////////////////////////////////////
+    // Public methods:
+    ///////////////////////////////////////////////////////////////////
+      
+  public:
+      
+    ///////////////////////////////////////////////////////////////////
+    // Standard tool methods
+    ///////////////////////////////////////////////////////////////////
+
+    FileRoISeedTool(const std::string&,const std::string&,const IInterface*);
+    virtual ~FileRoISeedTool();
+    virtual StatusCode               initialize();
+    virtual StatusCode               finalize  ();
+
+    /** Compute RoI */
+    virtual std::vector<ZWindow> getRoIs();
+
+  protected:
+
+    /**    @name Disallow default instantiation, copy, assignment **/
+    FileRoISeedTool() = delete;
+    FileRoISeedTool(const FileRoISeedTool&) = delete;
+    FileRoISeedTool &operator=(const FileRoISeedTool&) = delete;
+
+    ///////////////////////////////////////////////////////////////////
+    // Protected data and methods
+    ///////////////////////////////////////////////////////////////////
+ 
+    std::string m_filename; //name of file
+    float m_z0Window; /// width of z0 window
+    
+  }; // FileRoISeedTool
+} //InDet namespace
+
+#endif // SiSpacePointsSeedMaker_FileRoISeedTool
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/RandomRoISeedTool.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/RandomRoISeedTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b3e86c259e3fef7bf899982d4e3b711800b08e1
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/RandomRoISeedTool.h
@@ -0,0 +1,76 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+/////////////////////////////////////////////////////////////////////////////////
+// Class for Z-window RoI from random position (excluding the HS).
+/////////////////////////////////////////////////////////////////////////////////
+
+#ifndef SiSpacePointsSeedTool_xk_RandomRoISeedTool_h
+#define SiSpacePointsSeedTool_xk_RandomRoISeedTool_h
+
+#include "InDetRecToolInterfaces/IZWindowRoISeedTool.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "AthenaKernel/IAtRndmGenSvc.h"
+
+#include <vector>
+
+class TRandom3;
+
+namespace CLHEP {
+  class RandGauss;
+}
+
+namespace InDet {
+
+  class RandomRoISeedTool : 
+   virtual public IZWindowRoISeedTool, public AthAlgTool
+  {
+
+    ///////////////////////////////////////////////////////////////////
+    // Public methods:
+    ///////////////////////////////////////////////////////////////////
+      
+  public:
+    
+    ///////////////////////////////////////////////////////////////////
+    // Standard tool methods
+    ///////////////////////////////////////////////////////////////////
+
+    RandomRoISeedTool(const std::string&,const std::string&,const IInterface*);
+    virtual ~RandomRoISeedTool();
+    virtual StatusCode               initialize();
+    virtual StatusCode               finalize  ();
+
+    /** Compute RoI */
+    virtual std::vector<ZWindow> getRoIs();
+
+  private:
+    TRandom3 *m_random;
+
+  protected:
+
+    /**    @name Disallow default instantiation, copy, assignment **/
+    RandomRoISeedTool() = delete;
+    RandomRoISeedTool(const RandomRoISeedTool&) = delete;
+    RandomRoISeedTool &operator=(const RandomRoISeedTool&) = delete;
+
+    ///////////////////////////////////////////////////////////////////
+    // Protected data and methods
+    ///////////////////////////////////////////////////////////////////
+  
+    float m_z0Window; ///< width of z0 window
+
+    ServiceHandle<IAtRndmGenSvc> m_atRndmSvc;
+    StringProperty m_randomStreamName;
+    CLHEP::RandGauss* m_chooseRandGauss;
+
+    
+  }; // RandomRoISeedTool
+} //InDet namespace
+
+#endif // SiSpacePointsSeedMaker_RandomRoISeedTool
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
index a5d699d129e6baeb2f1ce249349e259c585699d3..0331490995ba8b830b068dcc552b1fe172639cb1 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
@@ -17,6 +17,8 @@
 #define SiSpacePointsSeedMaker_LowMomentum_H
 
 #include <list>
+#include <set>
+#include <cmath>
 #include "GaudiKernel/ServiceHandle.h"
 #include "MagFieldInterfaces/IMagFieldSvc.h"
 #include "GaudiKernel/ToolHandle.h"
@@ -128,6 +130,7 @@ namespace InDet {
       bool                        m_useOverlap                    ;
       bool                        m_useassoTool                   ;
       bool                        m_trigger                       ;
+      bool                        m_isvertex                      ;
       int                         m_outputlevel                   ;
       int                         m_nprint                        ;
       int                         m_state                         ;
@@ -201,7 +204,7 @@ namespace InDet {
       InDet::SiSpacePointsSeed*                       m_OneSeeds  ;
       int                                             m_maxOneSize;
       int                                             m_nOneSeeds ;
-      std::list<float>                                l_vertex    ;
+      std::set<float>                                l_vertex    ;
  
       ///////////////////////////////////////////////////////////////////
       // Beam geometry
@@ -286,15 +289,14 @@ namespace InDet {
   inline bool SiSpacePointsSeedMaker_LowMomentum::isZCompatible  
     (float& Zv,float& R,float& T)
     {
-      if(Zv < m_zmin || Zv > m_zmax) return false;
+      if(Zv < m_zminU || Zv > m_zmaxU) return false;
+      if(!m_isvertex) return true;
 
-      std::list<float>::iterator v=l_vertex.begin(),ve=l_vertex.end(); 
-      if(v==ve) return true;      
+      std::set<float>::iterator v=l_vertex.begin(),ve=l_vertex.end(); 
 
-      float dZmin = fabs((*v)-Zv); ++v;
-
-      for(; v!=ve; ++v) {
-	float dZ = fabs((*v)-Zv); if(dZ<dZmin) dZmin=dZ;
+      float dZmin = std::abs((*v)-Zv); 
+      for(++v; v!=ve; ++v) {
+	float dZ = std::abs((*v)-Zv); if(dZ >= dZmin) break; dZmin=dZ;
       }
       return dZmin < (m_dzver+m_dzdrver*R)*sqrt(1.+T*T);
     }
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/TruthHSRoISeedTool.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/TruthHSRoISeedTool.h
new file mode 100755
index 0000000000000000000000000000000000000000..9135792ab2ef6c48929f3ae9d84b243141583b8e
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/TruthHSRoISeedTool.h
@@ -0,0 +1,62 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+/////////////////////////////////////////////////////////////////////////////////
+// Class for Z-window RoI from truth HS position.
+/////////////////////////////////////////////////////////////////////////////////
+
+#ifndef SiSpacePointsSeedTool_xk_TruthHSRoISeedTool_h
+#define SiSpacePointsSeedTool_xk_TruthHSRoISeedTool_h
+
+#include "InDetRecToolInterfaces/IZWindowRoISeedTool.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+
+#include <vector>
+
+namespace InDet {
+
+  class TruthHSRoISeedTool : 
+   virtual public IZWindowRoISeedTool, public AthAlgTool
+  {
+
+    ///////////////////////////////////////////////////////////////////
+    // Public methods:
+    ///////////////////////////////////////////////////////////////////
+      
+  public:
+      
+    ///////////////////////////////////////////////////////////////////
+    // Standard tool methods
+    ///////////////////////////////////////////////////////////////////
+
+    TruthHSRoISeedTool(const std::string&,const std::string&,const IInterface*);
+    virtual ~TruthHSRoISeedTool();
+    virtual StatusCode               initialize();
+    virtual StatusCode               finalize  ();
+
+    /** Compute RoI */
+    virtual std::vector<ZWindow> getRoIs();
+
+  protected:
+
+    /**    @name Disallow default instantiation, copy, assignment **/
+    TruthHSRoISeedTool() = delete;
+    TruthHSRoISeedTool(const TruthHSRoISeedTool&) = delete;
+    TruthHSRoISeedTool &operator=(const TruthHSRoISeedTool&) = delete;
+
+    ///////////////////////////////////////////////////////////////////
+    // Protected data and methods
+    ///////////////////////////////////////////////////////////////////
+  
+    //* Input track collection *//
+    std::string m_inputTruthEvents; ///< input truth events collection name
+    float m_z0Window; ///< width of z0 window
+    
+  }; // TruthHSRoISeedTool
+} //InDet namespace
+
+#endif // SiSpacePointsSeedMaker_TruthHSRoISeedTool
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ZWindowRoISeedTool.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ZWindowRoISeedTool.h
new file mode 100755
index 0000000000000000000000000000000000000000..df576488ff37b34d2ddd74b8cc3d2ccc1fd61c14
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ZWindowRoISeedTool.h
@@ -0,0 +1,94 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+/////////////////////////////////////////////////////////////////////////////////
+// Class for Z-window RoI from leading two track middle vertex z-.
+/////////////////////////////////////////////////////////////////////////////////
+
+#ifndef SiSpacePointsSeedTool_xk_ZWindowRoISeedTool_h
+#define SiSpacePointsSeedTool_xk_ZWindowRoISeedTool_h
+
+#include "InDetRecToolInterfaces/IZWindowRoISeedTool.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "TrkTrack/Track.h"
+
+#include <vector>
+#include <string>
+
+namespace Reco 
+{ 
+  class ITrackToVertex; 
+}
+
+namespace InDet {
+
+  class ZWindowRoISeedTool : 
+   virtual public IZWindowRoISeedTool ,public AthAlgTool
+  {
+
+    ///////////////////////////////////////////////////////////////////
+    // Public methods:
+    ///////////////////////////////////////////////////////////////////
+      
+  public:
+      
+    ///////////////////////////////////////////////////////////////////
+    // Standard tool methods
+    ///////////////////////////////////////////////////////////////////
+
+    ZWindowRoISeedTool(const std::string&,const std::string&,const IInterface*);
+    virtual ~ZWindowRoISeedTool();
+    virtual StatusCode               initialize();
+    virtual StatusCode               finalize  ();
+
+    /** Compute RoI */
+    virtual std::vector<ZWindow> getRoIs();
+
+  private:
+
+    ToolHandle< Reco::ITrackToVertex > m_trackToVertex;
+
+  protected:
+
+    /**    @name Disallow default instantiation, copy, assignment **/
+    ZWindowRoISeedTool() = delete;
+    ZWindowRoISeedTool(const ZWindowRoISeedTool&) = delete;
+    ZWindowRoISeedTool &operator=(const ZWindowRoISeedTool&) = delete;
+
+    ///////////////////////////////////////////////////////////////////
+    // Protected data and methods
+    ///////////////////////////////////////////////////////////////////
+  
+    //* Input track collection *//
+    std::string m_inputTracksCollection; ///< input tracks collection name
+
+    /** defgroup kinematic-selections 
+     * @{ */
+
+    float m_trkLeadingPt; ///< min. p_{T} of leading track
+    float m_trkSubLeadingPt; ///< min. p_{T} of sub-leading track
+    float m_trkEtaMax; ///< max |eta| for tracks consideration
+    float m_trkD0Max; ///< max |d0| for tracks consideration
+    float m_maxDeltaZ; ///< maximum delta z0 between leading tracks pair
+    float m_z0Window; /// width of z0 window
+    
+    /** @} */
+	
+    static bool tracksPtGreaterThan(const Trk::Track* const &track1, const Trk::Track* const &track2)
+      {
+	float theta1 = track1->perigeeParameters()->parameters()[Trk::theta];
+	float ptinv1 = std::abs(track1->perigeeParameters()->parameters()[Trk::qOverP]) / std::sin(theta1);
+	float theta2 = track2->perigeeParameters()->parameters()[Trk::theta];
+	float ptinv2 = std::abs(track2->perigeeParameters()->parameters()[Trk::qOverP]) / std::sin(theta2);
+	//return less than of inverse 
+	return (ptinv1 < ptinv2);
+      }
+
+  }; // ZWindowRoISeedTool
+} //InDet namespace
+
+#endif // SiSpacePointsSeedMaker_ZWindowRoISeedTool
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/cmt/requirements b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/cmt/requirements
index 03e4abdf3fed9400fd7085081945153301b95728..98b64b7f5c2a4a96369cb4b5cb1de23b883df372 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/cmt/requirements
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/cmt/requirements
@@ -4,7 +4,9 @@ author Igor Gavrilenko <Igor.Gavrilenko@cern.ch>
 
 private
 
+use xAODEventInfo                xAODEventInfo-*          Event/xAOD
 use TrkToolInterfaces      TrkToolInterfaces-*      Tracking/TrkTools   
+use AtlasCLHEP                  AtlasCLHEP-*            External
 
 public
 
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/FileRoISeedTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/FileRoISeedTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..085cbc50af0ff2703bfdebf2501b50aa0e4c048f
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/FileRoISeedTool.cxx
@@ -0,0 +1,131 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+///////////////////////////////////////////////////////////////////
+//   Implementation file for class FileRoISeedTool (get RoI for low-pt tracking from a file)
+///////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+
+
+#include "SiSpacePointsSeedTool_xk/FileRoISeedTool.h"
+#include "TVector2.h"
+#include <map>
+#include "xAODEventInfo/EventInfo.h"
+
+#include <sstream>
+#include <fstream>
+#include <string>
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+
+InDet::FileRoISeedTool::FileRoISeedTool
+(const std::string& t,const std::string& n,const IInterface* p)
+  : AthAlgTool(t,n,p),
+    m_filename("")
+{
+
+  //
+  declareInterface<IZWindowRoISeedTool>(this);
+
+  //
+  declareProperty("InputFileName", m_filename, "Input file MUST be specified with LowPtRoIFile job option" );  
+  declareProperty("TrackZ0Window", m_z0Window = 30.0);
+
+}
+
+///////////////////////////////////////////////////////////////////
+// Destructor
+///////////////////////////////////////////////////////////////////
+
+InDet::FileRoISeedTool::~FileRoISeedTool()
+{
+}
+
+///////////////////////////////////////////////////////////////////
+// Initialization
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::FileRoISeedTool::initialize()
+{
+  StatusCode sc = AlgTool::initialize();
+
+  if (FILE *file = fopen(m_filename.c_str(), "r")) {
+    fclose(file);
+    ATH_MSG_DEBUG( "RoI File Exists!");
+  } else {
+    ATH_MSG_ERROR( "RoI File DOES NOT Exist!");
+    return StatusCode::FAILURE;
+  }
+
+  return sc;
+}
+
+///////////////////////////////////////////////////////////////////
+// Finalize
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::FileRoISeedTool::finalize()
+{
+   StatusCode sc = AlgTool::finalize(); 
+   return sc;
+}
+
+/////////////////////////////////////////////////////////////////////
+// Compute RoI
+/////////////////////////////////////////////////////////////////////
+
+std::vector<InDet::IZWindowRoISeedTool::ZWindow> InDet::FileRoISeedTool::getRoIs()
+{
+
+  // prepare output
+  std::vector<InDet::IZWindowRoISeedTool::ZWindow> listRoIs;  
+  listRoIs.clear();
+
+  unsigned long long evtN = 0;
+  int runN = 0;
+
+  if(evtStore()->contains<xAOD::EventInfo>("EventInfo")){
+    const xAOD::EventInfo* eventIn;
+    evtStore()->retrieve( eventIn, "EventInfo");
+    evtN = eventIn->eventNumber();
+    runN = eventIn->runNumber();
+  }
+
+  std::string line;
+  std::ifstream inFile(m_filename);
+  if (inFile.is_open()){
+
+    while (std::getline(inFile, line)){
+      
+      std::istringstream iss(line);
+
+      int runnum;
+      unsigned long long eventnum;
+      float zref;
+
+      while( iss >> runnum >> eventnum >> zref){
+	//no need to go past the right line
+	if(runnum == runN && eventnum == evtN) break;
+      }
+
+      if(runnum == runN && eventnum == evtN){ //No need to fill if there isn't an ROI
+	InDet::IZWindowRoISeedTool::ZWindow readinref;
+	readinref.zReference = zref;
+	readinref.zWindow[0] = zref -m_z0Window;
+	readinref.zWindow[1] = zref + m_z0Window;
+	listRoIs.push_back(readinref);
+      }
+      
+    }
+  }
+
+  inFile.close();
+
+  return listRoIs;
+  
+}
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RandomRoISeedTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RandomRoISeedTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c20656bc56a341afb2c79af1127442633ffd4b26
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RandomRoISeedTool.cxx
@@ -0,0 +1,123 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+///////////////////////////////////////////////////////////////////
+//   Implementation file for class RandomRoISeedTool
+///////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+
+
+#include "SiSpacePointsSeedTool_xk/RandomRoISeedTool.h"
+#include "TVector2.h"
+#include <map>
+#include "TRandom3.h"
+#include "AthenaKernel/IAtRndmGenSvc.h"
+#include "CLHEP/Random/RandGauss.h"
+#include "InDetBeamSpotService/IBeamCondSvc.h"
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+
+InDet::RandomRoISeedTool::RandomRoISeedTool
+(const std::string& t,const std::string& n,const IInterface* p)
+  : AthAlgTool(t,n,p),
+    m_z0Window(1.0),
+  m_atRndmSvc("AtRndmGenSvc", n),
+  m_randomStreamName("MixingEventSelectorStream"),
+  m_chooseRandGauss(nullptr)
+
+{
+
+  //
+  declareInterface<IZWindowRoISeedTool>(this);
+
+  //
+  declareProperty("TrackZ0Window", m_z0Window = 1.0);
+  declareProperty("RndmGenSvc", m_atRndmSvc, "IAtRndmGenSvc controlling the order with which events are takes from streams");
+  declareProperty("RndmStreamName", m_randomStreamName, "IAtRndmGenSvc stream used as engine for our random distributions");   
+
+}
+
+///////////////////////////////////////////////////////////////////
+// Destructor
+///////////////////////////////////////////////////////////////////
+
+InDet::RandomRoISeedTool::~RandomRoISeedTool()
+{
+}
+
+///////////////////////////////////////////////////////////////////
+// Initialization
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::RandomRoISeedTool::initialize()
+{
+  StatusCode sc = AlgTool::initialize();   
+
+  //setup random stream
+  CLHEP::HepRandomEngine* collEng(m_atRndmSvc->GetEngine(m_randomStreamName.value()));
+  if(nullptr == collEng ) {
+    ATH_MSG_ERROR ("can not get random stream " << m_randomStreamName.value());
+    return StatusCode::FAILURE;
+  }
+
+  m_chooseRandGauss = new CLHEP::RandGauss(*(collEng), 0.0, 1.0); //Want to sample Gaussian with mean of 0 and sigma of 1
+
+
+  return sc;
+}
+
+///////////////////////////////////////////////////////////////////
+// Finalize
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::RandomRoISeedTool::finalize()
+{
+   StatusCode sc = AlgTool::finalize(); 
+   return sc;
+}
+
+/////////////////////////////////////////////////////////////////////
+// Compute RoI
+/////////////////////////////////////////////////////////////////////
+
+std::vector<InDet::IZWindowRoISeedTool::ZWindow> InDet::RandomRoISeedTool::getRoIs()
+{
+
+  // -----------------------------------
+  // Retrieve beamspot information
+  // -----------------------------------
+
+  float bsSigZ = 0.0;
+
+  IBeamCondSvc* iBeamCondSvc; 
+  StatusCode scBCS = service("BeamCondSvc", iBeamCondSvc);
+
+  if (scBCS.isFailure() || iBeamCondSvc == 0) {
+    iBeamCondSvc = 0;
+    ATH_MSG_ERROR ("Could not retrieve Beam Conditions Service.");
+  } else{
+    bsSigZ = iBeamCondSvc->beamSigma(2);
+  }
+
+  float zVal;
+  zVal = m_chooseRandGauss->fire() * bsSigZ; //This effectively samples from a beamspot with the correct beamspot sigma_z
+  
+  // prepare output
+  std::vector<InDet::IZWindowRoISeedTool::ZWindow> listRoIs;  
+  listRoIs.clear();
+  
+  InDet::IZWindowRoISeedTool::ZWindow RoI;
+  RoI.zReference = zVal;
+  RoI.zWindow[0] = RoI.zReference - m_z0Window; 
+  RoI.zWindow[1] = RoI.zReference + m_z0Window;
+  listRoIs.push_back(RoI);
+  ATH_MSG_DEBUG("Random RoI: " << RoI.zReference << " [" << RoI.zWindow[0] << ", " << RoI.zWindow[1] << "]");
+  
+  return listRoIs;
+  
+}
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RoISeedTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RoISeedTool.cxx
index b63cee9fd335a560710e9875dea5fe614580a83d..fa89861d6f9c945ef4583a7a364e1c4db8022b3d 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RoISeedTool.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/RoISeedTool.cxx
@@ -121,7 +121,7 @@ std::vector<Amg::Vector3D> InDet::RoISeedTool::getRoIs()
   if( m_doVtxMethod ){
     getVtxSeeds(ROISeeds);
   }
-
+  
   return ROISeeds;
 
 }
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
index c853b4bed1c06c3910df6145af0541950d9b6dc7..747af0fa495f7ed1185665f0ccec2c492c861f91 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
@@ -685,8 +685,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::findVSp (const std::list<Trk::Vertex>&
 
 MsgStream& InDet::SiSpacePointsSeedMaker_ATLxk::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint) return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -1202,8 +1201,9 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::fillLists()
 
   for(int i=r_first; i!=r_size;  ++i) {
 
-    if(!r_map[i]) continue; 
-    r = r_Sorted[i].begin(); re = r_Sorted[i].end();
+    if(!r_map[i]) continue;
+    r = r_Sorted[i].begin();
+    re = r_Sorted[i].end();
     if(!ir0) ir0 = i;
 
     if( m_iteration) {
@@ -1321,8 +1321,8 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production2Sp()
 	float X  = (*r0)->x();
 	float Y  = (*r0)->y();
 	float R  = (*r0)->radius();
-	if(R<m_r2minv) continue; 
-  if(R>m_r2maxv) break;
+	if(R<m_r2minv) continue;
+	if(R>m_r2maxv) break;
 	float Z  = (*r0)->z();
 	float ax = X/R;
 	float ay = Y/R;
@@ -1341,11 +1341,11 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production2Sp()
 	  for(; r!=re; ++r) {
 	    
 	    float Rb =(*r)->radius();
-	    if(Rb<m_r1minv) continue; 
-      if(Rb>m_r1maxv) break;
+	    if(Rb<m_r1minv) continue;
+	    if(Rb>m_r1maxv) break;
 	    float dR = R-Rb; 
-	    if(dR<m_drminv) break; 
-      if(dR>m_drmax) continue;
+	    if(dR<m_drminv) break;
+	    if(dR>m_drmax) continue;
 	    float dZ = Z-(*r)->z();
 	    float Tz = dZ/dR; 
       if(Tz<m_dzdrmin || Tz>m_dzdrmax) continue;
@@ -1368,8 +1368,8 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production2Sp()
 	    float UR = Ut*R+1.              ; if(UR == 0.) continue;
 	    float A  = Vt*R/UR              ;
 	    float B  = Vt-A*Ut              ;
-	    if(fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue; 
-      ++nseed;
+	    if(fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue;
+	    ++nseed;
 	    newSeed((*r),(*r0),Zo);
 	  }
 	}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
index 400101d7bb17d97c2c58394b63503c92156fe2a5..1dec6b7d3ba17f8e4cd963936f093fbcd3d5cef7 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
@@ -216,7 +216,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_BeamGas::finalize()
 
 void InDet::SiSpacePointsSeedMaker_BeamGas::newEvent (int)
 {
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   buildBeamFrameWork();
 
@@ -328,8 +328,7 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::newEvent (int)
 void InDet::SiSpacePointsSeedMaker_BeamGas::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT)
 {
-
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   buildBeamFrameWork();
 
@@ -524,8 +523,7 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::findVSp (const std::list<Trk::Vertex
 
 MsgStream& InDet::SiSpacePointsSeedMaker_BeamGas::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint) return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -929,8 +927,7 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::fillLists()
   
   for(int i=0; i!= r_size;  ++i) {
 
-    if(!r_map[i]) 
-      continue; 
+    if(!r_map[i]) continue;
     r = r_Sorted[i].begin();
 
     while(r!=r_Sorted[i].end()) {
@@ -1104,7 +1101,7 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::production3Sp
       }
     }
   breakb:
-    if(!Nb || Nb==m_maxsizeSP) continue;  
+    if(!Nb || Nb==m_maxsizeSP) continue;
     int Nt = Nb;
     
     // Top   links production
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
index 38c9fe66d0542576349c123cbfe293aa8a47a0b5..f9d7b22f7c90db30092ebf016ee0eb3974ea6497 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
@@ -180,7 +180,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_Cosmic::finalize()
 
 void InDet::SiSpacePointsSeedMaker_Cosmic::newEvent (int)
 {
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   i_spforseed   = l_spforseed.begin();
 
@@ -288,7 +288,7 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT)
 {
 
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   i_spforseed = l_spforseed.begin();
 
@@ -482,8 +482,7 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::findVSp (const std::list<Trk::Vertex>
 
 MsgStream& InDet::SiSpacePointsSeedMaker_Cosmic::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint) return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -766,7 +765,7 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::fillLists()
   
   for(int i=0; i!= r_size;  ++i) {
 
-    if(!r_map[i]) continue; 
+    if(!r_map[i]) continue;
     r = r_Sorted[i].begin();
 
     while(r!=r_Sorted[i].end()) {
@@ -1000,7 +999,7 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::production3Sp
     }
   breakb:
 
-    if(!Nb || Nb==m_maxsizeSP) continue;  
+    if(!Nb || Nb==m_maxsizeSP) continue;
     int Nt = Nb;
     
     // Top   links production
@@ -1132,7 +1131,7 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::production3SpWithoutField
     }
   breakb:
 
-    if(!Nb || Nb==m_maxsizeSP) continue;  
+    if(!Nb || Nb==m_maxsizeSP) continue;
     int Nt = Nb;
     
     // Top   links production
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
index 4ed98b1e825ab302c589777b0874f1b28b6aff39..20552d397f191dd25e1af21ade2f98d9fc91d29a 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
@@ -210,7 +210,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_HeavyIon::finalize()
 void InDet::SiSpacePointsSeedMaker_HeavyIon::newEvent (int)
 {
   m_trigger = false;
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   buildBeamFrameWork();
 
@@ -297,7 +297,7 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT)
 {
   m_trigger = false;
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
 
   buildBeamFrameWork();
@@ -503,8 +503,7 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::findVSp (const std::list<Trk::Verte
 
 MsgStream& InDet::SiSpacePointsSeedMaker_HeavyIon::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint)  return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -996,7 +995,7 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::fillLists()
   
   for(int i=0; i!= r_size;  ++i) {
 
-    if(!r_map[i]) continue; 
+    if(!r_map[i]) continue;
     r = r_Sorted[i].begin();
 
     while(r!=r_Sorted[i].end()) {
@@ -1099,8 +1098,8 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::production2Sp()
 	float X  = (*r0)->x();
 	float Y  = (*r0)->y();
 	float R  = (*r0)->radius();
-	if(R<m_r2minv) continue; 
-  if(R>m_r2maxv) break;
+	if(R<m_r2minv) continue;
+	if(R>m_r2maxv) break;
 	float Z  = (*r0)->z();
 	float ax = X/R;
 	float ay = Y/R;
@@ -1119,11 +1118,11 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::production2Sp()
 	  for(; r!=re; ++r) {
 	    
 	    float Rb =(*r)->radius();
-	    if(Rb<m_r1minv) continue; 
-      if(Rb>m_r1maxv) break;
+	    if(Rb<m_r1minv) continue;
+	    if(Rb>m_r1maxv) break;
 	    float dR = R-Rb; 
-	    if(dR<m_drminv) break; 
-      if(dR>m_drmax) continue;
+	    if(dR<m_drminv) break;
+	    if(dR>m_drmax) continue;
 	    float dZ = Z-(*r)->z();
 	    float Tz = dZ/dR; if(Tz<m_dzdrmin || Tz>m_dzdrmax) continue;
 	    float Zo = Z-R*Tz;	          
@@ -1145,8 +1144,8 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::production2Sp()
 	    float UR = Ut*R+1.              ; if(UR == 0.) continue;
 	    float A  = Vt*R/UR              ;
 	    float B  = Vt-A*Ut              ;
-	    if(fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue; 
-      ++nseed;
+	    if(fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue;
+	    ++nseed;
 	    newSeed((*r)->spacepoint,(*r0)->spacepoint,Zo);
 	  }
 	}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
index f070e35523e3f041dfc332c69c8e24548c319d18..64fcabc83961ba14f3ab4db03dd8981cba7723ae 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
@@ -614,8 +614,7 @@ void InDet::SiSpacePointsSeedMaker_ITK::findVSp (const std::list<Trk::Vertex>& l
 
 MsgStream& InDet::SiSpacePointsSeedMaker_ITK::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint)  return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -1124,7 +1123,8 @@ void InDet::SiSpacePointsSeedMaker_ITK::fillLists()
   for(int i=r_first; i!=r_size;  ++i) {
     
     if(!r_map[i]) continue; 
-    r = r_Sorted[i].begin(); re = r_Sorted[i].end();
+    r = r_Sorted[i].begin();
+    re = r_Sorted[i].end();
     
     if(!ir0) ir0 = i; 
     irm = i; 
@@ -1170,7 +1170,8 @@ void InDet::SiSpacePointsSeedMaker_ITK::fillLists()
    for(int i=r_first; i!=r_size;  ++i) {
      
      if(!r_map[i]) continue; 
-     r = r_Sorted[i].begin(); re = r_Sorted[i].end();
+     r = r_Sorted[i].begin();
+     re = r_Sorted[i].end();
      
      if((*r)->spacepoint->clusterList().second) break;
      
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
index f80d5e02b6ccf3c63a2c16c905bd34949cdd36b2..7d09e909b1bee13ac5660c3395291a4d21d35346 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
@@ -220,7 +220,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_LowMomentum::finalize()
 void InDet::SiSpacePointsSeedMaker_LowMomentum::newEvent (int)
 {
   m_trigger = false;
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   i_spforseed   = l_spforseed.begin();
   buildBeamFrameWork();
@@ -303,7 +303,7 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT)
 {
   m_trigger = false;
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   i_spforseed = l_spforseed.begin();
   buildBeamFrameWork();
@@ -404,6 +404,10 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::newRegion
 
 void InDet::SiSpacePointsSeedMaker_LowMomentum::find2Sp(const std::list<Trk::Vertex>& lv) 
 {
+
+  m_zminU     = m_zmin;
+  m_zmaxU     = m_zmax;
+
   int mode; lv.begin()!=lv.end() ?  mode = 1 : mode = 0;
   bool newv = newVertices(lv);
   
@@ -433,6 +437,10 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::find2Sp(const std::list<Trk::Ver
 
 void InDet::SiSpacePointsSeedMaker_LowMomentum::find3Sp(const std::list<Trk::Vertex>& lv) 
 {
+
+  m_zminU     = m_zmin;
+  m_zmaxU     = m_zmax;
+
   int mode; lv.begin()!=lv.end() ? mode = 3 : mode = 2; 
   bool newv = newVertices(lv);
 
@@ -455,9 +463,34 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::find3Sp(const std::list<Trk::Ver
   }
 }
 
-void InDet::SiSpacePointsSeedMaker_LowMomentum::find3Sp(const std::list<Trk::Vertex>& lv,const double*) 
+void InDet::SiSpacePointsSeedMaker_LowMomentum::find3Sp(const std::list<Trk::Vertex>& lv,const double* ZVertex) 
 {
-  find3Sp(lv);
+  
+  m_zminU     = std::min( (float) ZVertex[0], m_zmin);
+  m_zmaxU     = std::max( (float) ZVertex[1], m_zmax);
+
+  int mode; lv.begin()!=lv.end() ? mode = 3 : mode = 2; 
+  bool newv = newVertices(lv);
+
+  if(newv || !m_state || m_nspoint!=3 || m_mode!=mode || m_nlist) {
+
+    i_seede   = l_seeds.begin() ;
+    m_state   = 1               ;
+    m_nspoint = 3               ;
+    m_nlist   = 0               ;
+    m_mode    = mode            ;
+    m_endlist = true            ;
+    m_fNmin   = 0               ;
+    m_zMin    = 0               ;
+    production3Sp   ();
+  }
+  i_seed  = l_seeds.begin();
+
+  if(m_outputlevel<=0) {
+    m_nprint=1;
+    ATH_MSG_DEBUG((*this));
+  }
+
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -468,6 +501,10 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::find3Sp(const std::list<Trk::Ver
 
 void InDet::SiSpacePointsSeedMaker_LowMomentum::findVSp (const std::list<Trk::Vertex>& lv)
 {
+
+  m_zminU     = m_zmin;
+  m_zmaxU     = m_zmax;
+
   int mode; lv.begin()!=lv.end() ? mode = 6 : mode = 5;
   bool newv = newVertices(lv);
   
@@ -496,8 +533,7 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::findVSp (const std::list<Trk::Ve
 
 MsgStream& InDet::SiSpacePointsSeedMaker_LowMomentum::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint)  return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -746,14 +782,21 @@ bool InDet::SiSpacePointsSeedMaker_LowMomentum::newVertices(const std::list<Trk:
   unsigned int s1 = l_vertex.size(); 
   unsigned int s2 = lV      .size(); 
 
+  m_isvertex = false;
   if(s1==0 && s2==0) return false;
 
   std::list<Trk::Vertex>::const_iterator v;
-  l_vertex.erase(l_vertex.begin(),l_vertex.end());
-  
+  l_vertex.clear();
+  if(s2 == 0) return false;  
+
+  m_isvertex = true;
   for(v=lV.begin(); v!=lV.end(); ++v) {
-    l_vertex.push_back(float((*v).position().z()));
+    l_vertex.insert(float((*v).position().z()));
   }
+
+  m_zminU = (*l_vertex. begin())-20.; if( m_zminU < m_zmin) m_zminU = m_zmin;
+  m_zmaxU = (*l_vertex.rbegin())+20.; if( m_zmaxU > m_zmax) m_zmaxU = m_zmax;
+
   return false;
 }
 
@@ -943,7 +986,7 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::fillLists()
   
   for(int i=0; i!= r_size;  ++i) {
 
-    if(!r_map[i]) continue; 
+    if(!r_map[i]) continue;
     r = r_Sorted[i].begin();
 
     while(r!=r_Sorted[i].end()) {
@@ -1083,7 +1126,8 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::production3Sp
     m_nOneSeeds = 0;
     m_mapOneSeeds.erase(m_mapOneSeeds.begin(), m_mapOneSeeds.end());
 	
-    float              R    = (*r0)->radius(); if(R<m_r2min) continue; if(R>m_r2max) break;
+    float              R    = (*r0)->radius(); if(R<m_r2min) continue;
+    if(R>m_r2max) break;
 
     bool pix = true; if((*r0)->spacepoint->clusterList().second) pix = false;
     const Trk::Surface* sur0 = (*r0)->sur();
@@ -1122,7 +1166,7 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::production3Sp
       }
     }
   breakb:
-    if(!Nb || Nb==m_maxsizeSP) continue;  
+    if(!Nb || Nb==m_maxsizeSP) continue;
     int Nt = Nb;
     
     // Top   links production
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
index aab9c597610d5ed26b01160a82f5ac15597f3a57..2a6d5777975ad81df5f4bb4ab851f24d4928bb61 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
@@ -212,7 +212,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_Trigger::finalize()
 void InDet::SiSpacePointsSeedMaker_Trigger::newEvent (int)
 {
   m_trigger = false;
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
   buildBeamFrameWork();
 
@@ -328,7 +328,7 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 (const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT)
 {
   m_trigger = false;
-  if(!m_pixel && !m_sct) return; 
+  if(!m_pixel && !m_sct) return;
   erase();
 
   buildBeamFrameWork();
@@ -551,8 +551,7 @@ void InDet::SiSpacePointsSeedMaker_Trigger::findVSp (const std::list<Trk::Vertex
 
 MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dump( MsgStream& out ) const
 {
-  if(m_nprint) 
-    return dumpEvent(out); 
+  if(m_nprint) return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -1050,7 +1049,7 @@ void InDet::SiSpacePointsSeedMaker_Trigger::fillLists()
   
   for(int i=0; i!= r_size;  ++i) {
 
-    if(!r_map[i]) continue; 
+    if(!r_map[i]) continue;
     r = r_Sorted[i].begin();
 
     while(r!=r_Sorted[i].end()) {
@@ -1149,8 +1148,8 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production2Sp()
 	float X  = (*r0)->x();
 	float Y  = (*r0)->y();
 	float R  = (*r0)->radius();
-	if(R<m_r2minv) continue; 
-  if(R>m_r2maxv) break;
+	if(R<m_r2minv) continue;
+	if(R>m_r2maxv) break;
 	float Z  = (*r0)->z();
 	float ax = X/R;
 	float ay = Y/R;
@@ -1169,11 +1168,11 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production2Sp()
 	  for(; r!=re; ++r) {
 	    
 	    float Rb =(*r)->radius();
-	    if(Rb<m_r1minv) continue; 
-      if(Rb>m_r1maxv) break;
+	    if(Rb<m_r1minv) continue;
+	    if(Rb>m_r1maxv) break;
 	    float dR = R-Rb; 
-	    if(dR<m_drminv) break; 
-      if(dR>m_drmax) continue;
+	    if(dR<m_drminv) break;
+	    if(dR>m_drmax) continue;
 	    float dZ = Z-(*r)->z();
 	    float Tz = dZ/dR; if(Tz<m_dzdrmin || Tz>m_dzdrmax) continue;
 	    float Zo = Z-R*Tz;	          
@@ -1195,8 +1194,8 @@ void InDet::SiSpacePointsSeedMaker_Trigger::production2Sp()
 	    float UR = Ut*R+1.              ; if(UR == 0.) continue;
 	    float A  = Vt*R/UR              ;
 	    float B  = Vt-A*Ut              ;
-	    if(fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue; 
-      ++nseed;
+	    if(fabs(B*m_K) > m_ipt*sqrt(1.+A*A)) continue;
+	    ++nseed;
 	    newSeed((*r)->spacepoint,(*r0)->spacepoint,Zo);
 	  }
 	}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_TrkSeeded.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_TrkSeeded.cxx
index f6fb83cdb5636b085dc06dfd89eced404665d589..6a01428c2a1014bb553f0f9f3cf79a626f63f1c9 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_TrkSeeded.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_TrkSeeded.cxx
@@ -654,8 +654,7 @@ void InDet::SiSpacePointsSeedMaker_TrkSeeded::findVSp (const std::list<Trk::Vert
 
 MsgStream& InDet::SiSpacePointsSeedMaker_TrkSeeded::dump( MsgStream& out ) const
 {
-  if(m_nprint)  
-    return dumpEvent(out); 
+  if(m_nprint) return dumpEvent(out);
   return dumpConditions(out);
 }
 
@@ -1207,8 +1206,8 @@ void InDet::SiSpacePointsSeedMaker_TrkSeeded::fillLists()
 
   for(int i=r_first; i!=r_size;  ++i) {
 
-    if(!r_map[i]) continue; 
-    r = r_Sorted[i].begin(); 
+    if(!r_map[i]) continue;
+    r = r_Sorted[i].begin();
     re = r_Sorted[i].end();
     if(!ir0) ir0 = i;
 
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/TruthHSRoISeedTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/TruthHSRoISeedTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..295743692495069777b31b306567a0f02d269d69
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/TruthHSRoISeedTool.cxx
@@ -0,0 +1,105 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+///////////////////////////////////////////////////////////////////
+//   Implementation file for class TruthHSRoISeedTool
+///////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+
+
+#include "SiSpacePointsSeedTool_xk/TruthHSRoISeedTool.h"
+#include "TVector2.h"
+#include <map>
+#include "xAODTruth/TruthEvent.h"
+#include "xAODTruth/TruthEventContainer.h"
+
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+
+InDet::TruthHSRoISeedTool::TruthHSRoISeedTool
+(const std::string& t,const std::string& n,const IInterface* p)
+  : AthAlgTool(t,n,p),
+    m_inputTruthEvents("TruthEvents")
+{
+
+  //
+  declareInterface<IZWindowRoISeedTool>(this);
+
+  //
+  declareProperty("InputTruthEventsCollection", m_inputTruthEvents );  
+  declareProperty("TrackZ0Window", m_z0Window = 1.0);
+
+}
+
+///////////////////////////////////////////////////////////////////
+// Destructor
+///////////////////////////////////////////////////////////////////
+
+InDet::TruthHSRoISeedTool::~TruthHSRoISeedTool()
+{
+}
+
+///////////////////////////////////////////////////////////////////
+// Initialization
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::TruthHSRoISeedTool::initialize()
+{
+  StatusCode sc = AlgTool::initialize();   
+  return sc;
+}
+
+///////////////////////////////////////////////////////////////////
+// Finalize
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::TruthHSRoISeedTool::finalize()
+{
+   StatusCode sc = AlgTool::finalize(); 
+   return sc;
+}
+
+/////////////////////////////////////////////////////////////////////
+// Compute RoI
+/////////////////////////////////////////////////////////////////////
+
+std::vector<InDet::IZWindowRoISeedTool::ZWindow> InDet::TruthHSRoISeedTool::getRoIs()
+{
+
+  // prepare output
+  std::vector<InDet::IZWindowRoISeedTool::ZWindow> listRoIs;  
+  listRoIs.clear();
+
+  //retrieve truth collection
+  xAOD::TruthEventContainer *truthEvents;
+  if (evtStore()->retrieve(truthEvents, m_inputTruthEvents).isFailure()) {
+    ATH_MSG_WARNING("Cannot retrieve xAOD truth information. Bailing out with empty RoI list.");
+    return listRoIs;
+  }
+  ATH_MSG_DEBUG("xAOD Truth available!");
+
+  //get HS position
+  for (xAOD::TruthEvent *evt : *truthEvents) {
+    const xAOD::TruthVertex *hsPos = evt->signalProcessVertex();
+    if (hsPos == nullptr) {
+      ATH_MSG_DEBUG("Invalid signal process vertex! Trying next TruthEvent.");
+      continue;
+    }
+    InDet::IZWindowRoISeedTool::ZWindow RoI;
+    RoI.zReference = hsPos->z();
+    RoI.zWindow[0] = RoI.zReference - m_z0Window; 
+    RoI.zWindow[1] = RoI.zReference + m_z0Window;
+    listRoIs.push_back(RoI);
+    ATH_MSG_DEBUG("Found RoI: " << RoI.zReference << " [" << RoI.zWindow[0] << ", " << RoI.zWindow[1] << "]");
+    //use only the first one
+    break;
+  }
+
+  return listRoIs;
+  
+}
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ZWindowRoISeedTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ZWindowRoISeedTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c94415999d53b3e6d2308a0872455f01b7e8982e
--- /dev/null
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ZWindowRoISeedTool.cxx
@@ -0,0 +1,199 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+///////////////////////////////////////////////////////////////////
+//   Implementation file for class ZWindowRoISeedTool
+///////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+
+
+#include "TrkTrack/TrackCollection.h"
+#include "TrkTrackSummary/TrackSummary.h"
+#include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h"
+#include "SiSpacePointsSeedTool_xk/ZWindowRoISeedTool.h"
+#include "ITrackToVertex/ITrackToVertex.h"
+#include "TVector2.h"
+#include <map>
+#include <cmath>
+
+
+///////////////////////////////////////////////////////////////////
+// Constructor
+///////////////////////////////////////////////////////////////////
+
+InDet::ZWindowRoISeedTool::ZWindowRoISeedTool
+(const std::string& t,const std::string& n,const IInterface* p)
+  : AthAlgTool(t,n,p),
+    m_trackToVertex       ("Reco::TrackToVertex/TrackToVertex"),
+    m_inputTracksCollection("Tracks")
+{
+
+  //
+  declareInterface<IZWindowRoISeedTool>(this);
+
+  //
+  declareProperty("InputTracksCollection", m_inputTracksCollection );  
+  declareProperty("LeadingMinTrackPt", m_trkLeadingPt = 18000.); 
+  declareProperty("SubleadingMinTrackPt", m_trkSubLeadingPt = 12500.); 
+  declareProperty("TracksMaxEta", m_trkEtaMax = 2.5);
+  declareProperty("TracksMaxD0", m_trkD0Max = 9999.);
+  declareProperty("MaxDeltaZTracksPair", m_maxDeltaZ = 2.0);
+  declareProperty("TrackZ0Window", m_z0Window = 1.0);
+  declareProperty("TrackToVertex",            m_trackToVertex );
+
+}
+
+///////////////////////////////////////////////////////////////////
+// Destructor
+///////////////////////////////////////////////////////////////////
+
+InDet::ZWindowRoISeedTool::~ZWindowRoISeedTool()
+{
+}
+
+///////////////////////////////////////////////////////////////////
+// Initialization
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::ZWindowRoISeedTool::initialize()
+{
+  StatusCode sc = AlgTool::initialize();   
+  
+  ATH_CHECK( m_trackToVertex.retrieve() );
+  ATH_MSG_DEBUG( "Retrieved tool " << m_trackToVertex );
+  
+  return sc;
+}
+
+///////////////////////////////////////////////////////////////////
+// Finalize
+///////////////////////////////////////////////////////////////////
+
+StatusCode InDet::ZWindowRoISeedTool::finalize()
+{
+   StatusCode sc = AlgTool::finalize(); 
+   return sc;
+}
+
+/////////////////////////////////////////////////////////////////////
+// Compute RoI
+/////////////////////////////////////////////////////////////////////
+
+std::vector<InDet::IZWindowRoISeedTool::ZWindow> InDet::ZWindowRoISeedTool::getRoIs()
+{
+
+  static const float nonZeroInvP = 1e-9;
+  
+  // prepare output
+  std::vector<InDet::IZWindowRoISeedTool::ZWindow> listRoIs;
+  InDet::IZWindowRoISeedTool::ZWindow RoI;
+  listRoIs.clear();
+
+  //select tracks, then order by pT
+  const TrackCollection* tracks = 0;
+  std::vector<Trk::Track*> selectedTracks;
+  if ( evtStore()->retrieve(tracks, m_inputTracksCollection).isFailure() ) {
+    ATH_MSG_DEBUG("Could not find TrackCollection " << m_inputTracksCollection << " in StoreGate.");
+    return listRoIs;    
+  }
+  ATH_MSG_DEBUG("Input track collection size "<<tracks->size());
+  for ( Trk::Track* trk : tracks->stdcont() ) {
+    float theta = trk->perigeeParameters()->parameters()[Trk::theta];
+    float ptinv = std::abs(trk->perigeeParameters()->parameters()[Trk::qOverP]) / std::sin(theta);    
+    if (ptinv < 0.001) //1 GeV tracks
+      ATH_MSG_VERBOSE("Examining track");
+    if ( std::abs(ptinv) > nonZeroInvP ) {
+      float pt = 1. / ptinv;      
+      if (pt > 1000.) //1 GeV tracks for printout
+	ATH_MSG_VERBOSE("- pT = " << pt << " MeV");
+      if ( pt < m_trkSubLeadingPt ) continue;
+    }
+    float eta = -std::log( std::tan( 0.5*theta ) );
+    ATH_MSG_VERBOSE("- eta = " << eta);
+    if ( std::abs(eta) > m_trkEtaMax ) continue;
+    float d0 = trk->perigeeParameters()->parameters()[Trk::d0];
+    ATH_MSG_VERBOSE("- d0 = " << d0 << "mm");
+    if ( std::abs(d0) > m_trkD0Max ) continue;
+    ATH_MSG_VERBOSE("- Passed all selections");
+    selectedTracks.push_back(trk);
+  }
+  std::sort(selectedTracks.begin(), selectedTracks.end(), tracksPtGreaterThan);
+  ATH_MSG_DEBUG("Selected track collection size "<<selectedTracks.size());
+  //create all pairs that satisfy leading pT and delta z0 requirements
+  typedef std::vector<Trk::Track*>::iterator iteratorTracks;
+  for ( iteratorTracks trkItrLeading = selectedTracks.begin(); trkItrLeading != selectedTracks.end(); ++trkItrLeading ) {
+    Trk::Track *trkLeading = *trkItrLeading;
+    //kinematic requirements
+    float thetaLeading = trkLeading->perigeeParameters()->parameters()[Trk::theta];
+    float ptInvLeading = std::abs(trkLeading->perigeeParameters()->parameters()[Trk::qOverP]) / std::sin(thetaLeading);
+    ATH_MSG_VERBOSE("Examining selected track pairs");
+    if (std::abs(ptInvLeading) > nonZeroInvP) {
+      float pt = 1. / ptInvLeading;
+      ATH_MSG_VERBOSE("- pT_leading = " << pt << " MeV");
+      if ( pt < m_trkLeadingPt ) break; //tracks ordered by pT
+    }
+    //loop over sub-leading track
+    for ( iteratorTracks trkItr = (trkItrLeading + 1); trkItr != selectedTracks.end(); ++trkItr ) {
+      Trk::Track *trk = *trkItr;
+      //kinematic requirements
+      float z0Leading = trkLeading->perigeeParameters()->parameters()[Trk::z0];
+      float z0 = trk->perigeeParameters()->parameters()[Trk::z0];
+      ATH_MSG_VERBOSE("- z0Leading = " << z0Leading << " mm");
+      ATH_MSG_VERBOSE("- z0_sublead = " << z0 << " mm");
+
+      const Trk::Perigee* leadAtBeam = m_trackToVertex->perigeeAtBeamline(*trkLeading);
+      const Trk::Perigee* subleadAtBeam = m_trackToVertex->perigeeAtBeamline(*trk);
+      float z0LeadingBeam = leadAtBeam->parameters()[Trk::z0];
+      float z0Beam = subleadAtBeam->parameters()[Trk::z0];
+
+      if ( std::abs(z0LeadingBeam - z0Beam) > m_maxDeltaZ ) continue;
+      //create the pair in global coordinates 
+      float z0TrkReference = subleadAtBeam->associatedSurface().center().z();
+      float z0TrkLeadingReference = leadAtBeam->associatedSurface().center().z();
+      RoI.zReference = (z0Beam + z0TrkReference + z0LeadingBeam + z0TrkLeadingReference) / 2;
+      RoI.zWindow[0] = RoI.zReference - m_z0Window; 
+      RoI.zWindow[1] = RoI.zReference + m_z0Window; 
+      RoI.zPerigeePos[0] = z0LeadingBeam; 
+      RoI.zPerigeePos[1] = z0Beam; 
+      ATH_MSG_DEBUG("New RoI created [mm]: " << RoI.zWindow[0] << " - " << RoI.zWindow[1] << " (z-ref: " << RoI.zReference << ")");
+      listRoIs.push_back(RoI);
+    }
+  }
+
+
+  if( listRoIs.empty() ){
+    for( Trk::Track* trkItrLeading2 : selectedTracks ){
+      Trk::Track *trkLeading = trkItrLeading2;
+      //kinematic requirements
+      float thetaLeading = trkLeading->perigeeParameters()->parameters()[Trk::theta];
+      float ptInvLeading = std::abs(trkLeading->perigeeParameters()->parameters()[Trk::qOverP]) / std::sin(thetaLeading);
+      ATH_MSG_VERBOSE("Examining selected track pairs");
+      if (std::abs(ptInvLeading) > nonZeroInvP) {
+	float pt = 1. / ptInvLeading;
+	ATH_MSG_VERBOSE("- pT_leading = " << pt << " MeV");
+	if ( pt < m_trkLeadingPt ) break; //tracks ordered by pT
+	
+	const Trk::Perigee* leadAtBeam = m_trackToVertex->perigeeAtBeamline(*trkLeading);
+	float z0LeadingBeam = leadAtBeam->parameters()[Trk::z0];
+	
+	//create the pair in global coordinates 
+	float z0TrkLeadingReference = leadAtBeam->associatedSurface().center().z();
+	RoI.zReference = z0LeadingBeam + z0TrkLeadingReference;
+	RoI.zWindow[0] = RoI.zReference - m_z0Window; 
+	RoI.zWindow[1] = RoI.zReference + m_z0Window; 
+	RoI.zPerigeePos[0] = z0LeadingBeam; 
+	ATH_MSG_DEBUG("New RoI created [mm]: " << RoI.zWindow[0] << " - " << RoI.zWindow[1] << " (z-ref: " << RoI.zReference << ")");
+	listRoIs.push_back(RoI);
+	
+      }
+      
+
+    }
+  }
+
+  return listRoIs;
+  
+}
+
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/components/SiSpacePointsSeedTool_xk_entries.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/components/SiSpacePointsSeedTool_xk_entries.cxx
index 473391742c202344e44ef1bda7c506735367c6a0..b8481e3470f9a2995a14ecbf51202e16ba50cca2 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/components/SiSpacePointsSeedTool_xk_entries.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/components/SiSpacePointsSeedTool_xk_entries.cxx
@@ -1,4 +1,3 @@
-
 #include "GaudiKernel/DeclareFactoryEntries.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h"
@@ -9,6 +8,10 @@
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_TrkSeeded.h"
 #include "SiSpacePointsSeedTool_xk/RoISeedTool.h"
+#include "SiSpacePointsSeedTool_xk/FileRoISeedTool.h"
+#include "SiSpacePointsSeedTool_xk/ZWindowRoISeedTool.h"
+#include "SiSpacePointsSeedTool_xk/TruthHSRoISeedTool.h"
+#include "SiSpacePointsSeedTool_xk/RandomRoISeedTool.h"
 
 using namespace InDet;
 
@@ -21,18 +24,26 @@ DECLARE_TOOL_FACTORY( SiSpacePointsSeedMaker_Trigger    )
 DECLARE_TOOL_FACTORY( SiSpacePointsSeedMaker_ITK        )
 DECLARE_TOOL_FACTORY( SiSpacePointsSeedMaker_TrkSeeded  )
 DECLARE_TOOL_FACTORY( RoISeedTool                       )
+DECLARE_TOOL_FACTORY( FileRoISeedTool                       )
+DECLARE_TOOL_FACTORY( ZWindowRoISeedTool                )
+DECLARE_TOOL_FACTORY( TruthHSRoISeedTool                )
+DECLARE_TOOL_FACTORY( RandomRoISeedTool                )
 
 DECLARE_FACTORY_ENTRIES( SiSpacePointsSeedTool_xk )
 {
-  DECLARE_TOOL( SiSpacePointsSeedMaker_ATLxk      )
-  DECLARE_TOOL( SiSpacePointsSeedMaker_LowMomentum)
-  DECLARE_TOOL( SiSpacePointsSeedMaker_BeamGas    )
-  DECLARE_TOOL( SiSpacePointsSeedMaker_Cosmic     )
-  DECLARE_TOOL( SiSpacePointsSeedMaker_HeavyIon   )
-  DECLARE_TOOL( SiSpacePointsSeedMaker_Trigger    )
-  DECLARE_TOOL( SiSpacePointsSeedMaker_ITK        )
-  DECLARE_TOOL( SiSpacePointsSeedMaker_TrkSeeded  )
-  DECLARE_TOOL( RoISeedTool                       )
+	DECLARE_TOOL( SiSpacePointsSeedMaker_ATLxk      )
+	DECLARE_TOOL( SiSpacePointsSeedMaker_LowMomentum)
+	DECLARE_TOOL( SiSpacePointsSeedMaker_BeamGas    )
+	DECLARE_TOOL( SiSpacePointsSeedMaker_Cosmic     )
+	DECLARE_TOOL( SiSpacePointsSeedMaker_HeavyIon   )
+	DECLARE_TOOL( SiSpacePointsSeedMaker_Trigger    )
+	DECLARE_TOOL( SiSpacePointsSeedMaker_ITK        )
+        DECLARE_TOOL( SiSpacePointsSeedMaker_TrkSeeded  )
+        DECLARE_TOOL( RoISeedTool                       )
+        DECLARE_TOOL( FileRoISeedTool                       )
+        DECLARE_TOOL( ZWindowRoISeedTool                )
+	DECLARE_TOOL( TruthHSRoISeedTool                )
+	DECLARE_TOOL( RandomRoISeedTool                )
 }
 
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
index f344eafee104d356d708c4e2b0a077e7e660c7c1..18ece0ca78f513316378722ab14196ba863964a4 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
@@ -546,9 +546,7 @@ InDetPhysValMonitoringTool::fillHistograms() {
         // count duplicates
         float prev = matches[0].first;
         int nduplicates = 0;
-        const std::array<int*, 5> matchedEProbs = {
-          nullptr, nullptr, &m_twoMatchedEProb, &m_threeMatchedEProb, &m_fourMatchedEProb
-        };
+      
         for (int i = 1; i < deg_count; i++) {
           bool duplicate = std::fabs(matches[i].first - prev) < 1.e-9;
           if (duplicate) {
@@ -556,7 +554,12 @@ InDetPhysValMonitoringTool::fillHistograms() {
           }
           if (!duplicate || i == deg_count - 1) {
             if (nduplicates > 1) {
-	       (*(matchedEProbs[std::min(deg_count,4)]))++;
+                if (deg_count==2) 
+                    m_twoMatchedEProb++;
+                else if (deg_count ==3)   
+                    m_threeMatchedEProb++;  
+                else 
+                    m_fourMatchedEProb++; 
             }
             nduplicates = 0;
             prev = matches[i].first;
@@ -700,6 +703,10 @@ InDetPhysValMonitoringTool::getTruthParticles() {
       const auto& links = event->truthParticleLinks();
       tempVec.reserve(event->nTruthParticles());
       for (const auto& link : links) {
+        if (link == nullptr) {
+            ATH_MSG_WARNING("Broken link to truth in HardScatter configuration");
+            continue;
+        }
         tempVec.push_back(*link);
       }
     } else if (m_pileupSwitch == "PileUp") {
@@ -720,6 +727,10 @@ InDetPhysValMonitoringTool::getTruthParticles() {
           ATH_MSG_VERBOSE("Adding " << ntruth << " truth particles from TruthPileupEvents container");
           const auto& links = eventPileup->truthParticleLinks();
           for (const auto& link : links) {
+            if (link == nullptr) {
+                ATH_MSG_WARNING("Broken link to truth in PileUp configuration");
+                continue;
+            }
             tempVec.push_back(*link);
           }
         }
diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorFactory.h b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorFactory.h
index 497b3e31760e5b1384eea6fb430ba747dec2be63..28a8af360281d5330010805d589c4e8f41f797e7 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorFactory.h
+++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorFactory.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -25,19 +25,19 @@ namespace LArGeo {
   class LArDetectorFactory : public GeoVDetectorFactory  {
 
   public:
-  
+
     // Constructor:
     LArDetectorFactory(int testbeam, bool fullGeo);
-  
+
     // Destructor:
     virtual ~LArDetectorFactory();
-  
+
     // Creation of geometry:
     virtual void create(GeoPhysVol* world);
-  
+
     // Access to the results:
     virtual const LArDetectorManager* getDetectorManager() const;
-  
+
 
     // Set parameters:
 
@@ -46,14 +46,14 @@ namespace LArGeo {
     void setFCALVisLimit(int maxCell)       {m_fcalVisLimit   = maxCell;}
     void setBuildBarrel(bool flag)          {m_buildBarrel = flag;}
     void setBuildEndcap(bool flag)          {m_buildEndcap = flag;}
+    void setActivateFT(bool flag)           { m_activateFT = flag; }
 
+  private:
 
-  private:  
-  
     // Illegal operations:
     const LArDetectorFactory & operator=(const LArDetectorFactory &right);
     LArDetectorFactory(const LArDetectorFactory &right);
-  
+
     // The manager:
     LArDetectorManager*       m_detectorManager;
     bool                      m_barrelSagging;
@@ -66,9 +66,10 @@ namespace LArGeo {
     int                       m_testbeam;
 
     bool                       m_fullGeo;  // true->FULL, false->RECO
+    bool                      m_activateFT;
   };
 
 } // namespace LArGeo
 
-#endif 
+#endif
 
diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorToolNV.h b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorToolNV.h
index 5e3b90f17bf5d2e0316838a710fefa98ae13c320..70bb835a01acef8e17f4b831e3f16b75d22cab78 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorToolNV.h
+++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/LArGeoAlgsNV/LArDetectorToolNV.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -44,7 +44,7 @@ public:
 
     // Callback function itself
     virtual StatusCode align(IOVSVC_CALLBACK_ARGS);
-	
+
  private:
 
     bool m_barrelSaggingOn;
@@ -62,6 +62,7 @@ public:
     StoreGateSvc*        m_detStore;
 
     std::string m_geometryConfig; // FULL, SIMU, RECO
+    bool m_activateFT;
 };
 
-#endif 
+#endif
diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorFactory.cxx b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorFactory.cxx
index b985a161238d54f9a166089cc6618cf80e18dbec..51c50e2b546d691b0769bf43dcfc5c3181d33ea1 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorFactory.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorFactory.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArGeoAlgsNV/LArDetectorFactory.h"
@@ -11,13 +11,13 @@
 #include "LArGeoTBBarrel/TBBarrelCryostatConstruction.h"
 #include "LArGeoEndcap/EndcapCryostatConstruction.h"
 
-#include "GeoModelKernel/GeoPhysVol.h"  
+#include "GeoModelKernel/GeoPhysVol.h"
 #include "GeoModelKernel/GeoTransform.h"
 #include "GeoModelKernel/GeoAlignableTransform.h"
 #include "GeoModelKernel/GeoNameTag.h"
 #include "GeoModelKernel/GeoShapeUnion.h"
 
-#include "CLHEP/Geometry/Transform3D.h" 
+#include "CLHEP/Geometry/Transform3D.h"
 
 #include "LArGeoCode/LArMaterialManager.h"
 #include "GeoModelInterfaces/StoredMaterialManager.h"
@@ -61,7 +61,8 @@ LArGeo::LArDetectorFactory::LArDetectorFactory(int testbeam,bool fullGeo)
     m_buildBarrel(true),
     m_buildEndcap(true),
     m_testbeam(testbeam),
-    m_fullGeo(fullGeo)
+    m_fullGeo(fullGeo),
+    m_activateFT(false)
 {}
 
 
@@ -92,51 +93,51 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
     {
       // 26-Sep-2003 WGS: Get our LAr detector parameters via the NOVA
       // converters.
-  
-      VDetectorParameters* parameters = 
+
+      VDetectorParameters* parameters =
 	(VDetectorParameters *) new  LArGeo::RAL();
 
       VDetectorParameters::SetInstance(parameters);
-    
+
       // Get access to the material manager:
-  
+
       ISvcLocator *svcLocator = Gaudi::svcLocator();
       IMessageSvc * msgSvc;
       if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
 	throw std::runtime_error("Error in LAr::DetectorFactor, cannot access MessageSvc");
       }
 
-      MsgStream log(msgSvc, "LAr::DetectorFactory"); 
+      MsgStream log(msgSvc, "LAr::DetectorFactory");
 
       StoreGateSvc *detStore;
       if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
 	throw std::runtime_error("Error in LArDetectorFactory, cannot access DetectorStore");
       }
 
-  
+
       DataHandle<StoredMaterialManager> materialManager;
       if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) {
 	throw std::runtime_error("Error in LArDetectorFactory, cannot access Material Manager");
       }
-  
+
       IGeoModelSvc *geoModel;
       IRDBAccessSvc* rdbAccess;
 
       if(svcLocator->service ("GeoModelSvc",geoModel) == StatusCode::FAILURE)
 	throw std::runtime_error("Error in LArDetectorFactoryNV, cannot access GeoModelSvc");
-    
+
       if(svcLocator->service ("RDBAccessSvc",rdbAccess) == StatusCode::FAILURE)
 	throw std::runtime_error("Error in BarrelCryostatConstruction, cannot access RDBAccessSvc");
-    
+
       DecodeVersionKey larVersionKey(geoModel, "LAr");
       log << MSG::DEBUG << "Getting primary numbers for " << larVersionKey.node() << ", " << larVersionKey.tag() << endreq;
-    
+
       IRDBRecordset_ptr larPosition =  rdbAccess->getRecordsetPtr("LArPosition",larVersionKey.tag(),larVersionKey.node());
 
-      if(larPosition->size()==0) 
+      if(larPosition->size()==0)
       {
 	larPosition = rdbAccess->getRecordsetPtr("LArPosition", "LArPosition-00");
-	if (larPosition->size()==0) 
+	if (larPosition->size()==0)
 	  throw std::runtime_error("Error, no lar position table in database!");
       }
 
@@ -147,26 +148,26 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
       // Patch the materials list by adding special materials.  These
       // cannot be added for the moment to the standard list because they
       // are blended materials and to do the blending requires access to
-      // LAr Geometry. 
+      // LAr Geometry.
       //
 
       LArMaterialManager lArMaterialManager(detStore);
       lArMaterialManager.buildMaterials();
-    
+
       if (m_testbeam==0) {
-      
-	BarrelCryostatConstruction barrelCryostatConstruction(m_fullGeo);
+
+	BarrelCryostatConstruction barrelCryostatConstruction(m_fullGeo, m_activateFT);
 	barrelCryostatConstruction.setBarrelSagging(m_barrelSagging);
 	barrelCryostatConstruction.setBarrelCellVisLimit(m_barrelVisLimit);
-            
-	EndcapCryostatConstruction endcapCryostatConstruction(m_fullGeo);
+
+	EndcapCryostatConstruction endcapCryostatConstruction(m_fullGeo, m_activateFT);
 	endcapCryostatConstruction.setFCALVisLimit(m_fcalVisLimit);
-      
+
 	//const GeoMaterial* matAir = materialManager->getMaterial("std::Air");
-      
+
 	if(m_buildBarrel)
 	  barrelEnvelope = barrelCryostatConstruction.GetEnvelope();
-      
+
 	if(m_buildEndcap)
 	  {
 	    endcapEnvelopePos = endcapCryostatConstruction.createEnvelope(true);
@@ -176,7 +177,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	// Offset of endcaps from nominal position.
 
 	a_container->add(new GeoNameTag("LAr"));
-    
+
 	if(m_buildBarrel && m_buildEndcap)
 	  {
 	    // Typical scenario for each of the Tree Tops:
@@ -185,7 +186,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	    // 3. Store Alignable XF in SG
 
 	    // --- Barrel
-	    const IRDBRecord *barrelRec = GeoDBUtils::getTransformRecord(larPosition,"LARCRYO_B"); 
+	    const IRDBRecord *barrelRec = GeoDBUtils::getTransformRecord(larPosition,"LARCRYO_B");
 	    if(!barrelRec) throw std::runtime_error("Error, no lar position record in the database");
 	    HepGeom::Transform3D xfBarrel = GeoDBUtils::getTransform(barrelRec);
 	    GeoAlignableTransform* barrelAlXf = new GeoAlignableTransform(xfBarrel);
@@ -247,7 +248,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	else if(!m_buildEndcap)
 	  {
 	    // -- Build the Barrel only
-	    const IRDBRecord *barrelRec = GeoDBUtils::getTransformRecord(larPosition,"LARCRYO_B"); 
+	    const IRDBRecord *barrelRec = GeoDBUtils::getTransformRecord(larPosition,"LARCRYO_B");
 	    if(!barrelRec) throw std::runtime_error("Error, no lar position record in the database");
 	    HepGeom::Transform3D xfBarrel = GeoDBUtils::getTransform(barrelRec);
 	    GeoAlignableTransform* barrelAlXf = new GeoAlignableTransform(xfBarrel);
@@ -308,7 +309,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	    a_container->add(xfEndcapNeg);
 	    a_container->add( new GeoTransform(HepGeom::RotateY3D(180.0*CLHEP::deg)));
 	    a_container->add(endcapEnvelopeNeg);
-      
+
 	  }
       }
       else
@@ -316,12 +317,12 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	  TBBarrelCryostatConstruction tbbarrelCryostatConstruction;
 	  tbbarrelCryostatConstruction.setBarrelSagging(m_barrelSagging);
 	  tbbarrelCryostatConstruction.setBarrelCellVisLimit(m_barrelVisLimit);
-	
+
 	  barrelEnvelope = tbbarrelCryostatConstruction.GetEnvelope();
-	
+
 	  a_container->add(new GeoNameTag("LAr"));
 	  a_container->add(barrelEnvelope);
-	
+
 	}
     }
 
@@ -334,8 +335,8 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
   if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
     throw std::runtime_error("Error in LAr::DetectorFactor, cannot access MessageSvc");
   }
-  MsgStream log(msgSvc, "LAr::DetectorFactory"); 
-  
+  MsgStream log(msgSvc, "LAr::DetectorFactory");
+
   try
   {
     fcalDetectorManager = new FCALDetectorManager();
@@ -366,27 +367,27 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
       for (unsigned int r=0;r<2;r++) {
 	unsigned int nPhi    = r==0? 2:1;
        	for (unsigned int endcap=0;endcap<2;endcap++) {
-	  StoredPhysVol *vol;               
+	  StoredPhysVol *vol;
 	  std::string nameTag= endcap==0 ? (s<2 ? "HEC1_NEG":"HEC2_NEG") : (s<2 ? "HEC1_POS":"HEC2_POS");
 	  if(detStore->contains<StoredPhysVol>(nameTag)){
-	    if (StatusCode::SUCCESS==detStore->retrieve(vol, nameTag)) {                
-	      
-	      
+	    if (StatusCode::SUCCESS==detStore->retrieve(vol, nameTag)) {
+
+
 	      unsigned int width = 32;
 	      double startPhi =  endcap==0?  M_PI : 0;
 	      double endPhi   =  endcap==0? -M_PI : 2*M_PI ;
-	      
+
 	      CellBinning  phiBinning(startPhi, endPhi, width*nPhi);
-	      HECDetDescr *d = new HECDetDescr(hecDetectorManager,s,r,phiBinning); 
-	      
+	      HECDetDescr *d = new HECDetDescr(hecDetectorManager,s,r,phiBinning);
+
 	      HECDetectorRegion::DetectorSide side = (HECDetectorRegion::DetectorSide) endcap;
 	      HECDetectorRegion *region = new HECDetectorRegion(vol->getPhysVol(),d,side,projectivityDisplacement);
 	      hecDetectorManager->addDetectorRegion(region);
-	    }         
+	    }
 	  }
 	  else
 	    log << MSG::DEBUG << " No Stored PV for " << nameTag
-		<< " in Detector Store" << endreq;                                                 
+		<< " in Detector Store" << endreq;
 	}
       }
     }
@@ -394,39 +395,39 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
   catch (std::exception & ex) {
     log << MSG::WARNING << "Unable to build HEC detector manager. " << ex.what() << endreq;
   }
-  
-  
+
+
   try
   {
-    
-    
+
+
     emecDetectorManager  = new EMECDetectorManager();
-    
+
     // Here is a table of min and max eta for different sampling layers, radial part (i/o) and region.
-    
-    
-    
+
+
+
     for (int e=0;e<2;e++) {
-      
+
       double startPhi =  e==0?  M_PI-2*M_PI/768/2 : -2*M_PI/768/2;
       double endPhi   =  e==0? -M_PI-2*M_PI/768/2 : 2*M_PI-2*M_PI/768/2 ;
 
 
       StoredPhysVol *sPhys;
-      
+
       if(detStore->contains<StoredPhysVol>(e==0 ? "EMEC_OUTER_WHEEL_NEG" : "EMEC_OUTER_WHEEL_POS")){
-	if (detStore->retrieve(sPhys,e==0 ? "EMEC_OUTER_WHEEL_NEG" : "EMEC_OUTER_WHEEL_POS")==StatusCode::SUCCESS) 
+	if (detStore->retrieve(sPhys,e==0 ? "EMEC_OUTER_WHEEL_NEG" : "EMEC_OUTER_WHEEL_POS")==StatusCode::SUCCESS)
 	{
 	  GeoFullPhysVol *emecEnvelope=(GeoFullPhysVol *) sPhys->getPhysVol();
-	  
-	  
+
+
 	  {
 	    CellBinning phiBinning(startPhi,endPhi,64);
 	    EMECDetDescr *detDescr = new EMECDetDescr(emecDetectorManager,1,0,0,phiBinning);
 	    EMECDetectorRegion *region = new EMECDetectorRegion(emecEnvelope,detDescr,EMECDetectorRegion::DetectorSide(e),projectivityDisplacement);
 	    emecDetectorManager->addDetectorRegion(region);
 	  }
-	  
+
 	  // Outer Wheel Sampling 1 Region 1:
 	  {
 	    CellBinning phiBinning(startPhi,endPhi,64);
@@ -490,10 +491,10 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	    << " in Detector Store" << endreq;
 
       if(detStore->contains<StoredPhysVol>(e==0 ? "EMEC_INNER_WHEEL_NEG" : "EMEC_INNER_WHEEL_POS")){
-	if (detStore->retrieve(sPhys,e==0 ? "EMEC_INNER_WHEEL_NEG" : "EMEC_INNER_WHEEL_POS")==StatusCode::SUCCESS) 
+	if (detStore->retrieve(sPhys,e==0 ? "EMEC_INNER_WHEEL_NEG" : "EMEC_INNER_WHEEL_POS")==StatusCode::SUCCESS)
 	{
 	  GeoFullPhysVol *emecEnvelope=(GeoFullPhysVol *) sPhys->getPhysVol();
-	  
+
 	  // Inner Wheel Sampling 1 Region 0:
 	  {
 	    CellBinning phiBinning(startPhi,endPhi,64);
@@ -502,43 +503,43 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	    emecDetectorManager->addDetectorRegion(region);
 	  }
 	  // Inner Wheel Sampling 2 Region 0:
-	  
+
 	  {
 	    CellBinning phiBinning(startPhi,endPhi,64);
 	    EMECDetDescr *detDescr = new EMECDetDescr(emecDetectorManager,2,0,1,phiBinning);
 	    EMECDetectorRegion *region = new EMECDetectorRegion(emecEnvelope,detDescr,EMECDetectorRegion::DetectorSide(e),projectivityDisplacement);
 	    emecDetectorManager->addDetectorRegion(region);
 	  }
-	  
+
 	}
       }
       else
       	log << MSG::DEBUG << " No Stored PV for " << (e==0 ? "EMEC_INNER_WHEEL_NEG" : "EMEC_INNER_WHEEL_POS")
 	    << " in Detector Store" << endreq;
-      
-      StoredPhysVol *sPresamplerEnvelope; 
+
+      StoredPhysVol *sPresamplerEnvelope;
 
       if(detStore->contains<StoredPhysVol>(e==0 ? "PRESAMPLER_EC_NEG":"PRESAMPLER_EC_POS" )){
-	if (StatusCode::SUCCESS==detStore->retrieve(sPresamplerEnvelope, e==0 ? "PRESAMPLER_EC_NEG":"PRESAMPLER_EC_POS" )) {        
+	if (StatusCode::SUCCESS==detStore->retrieve(sPresamplerEnvelope, e==0 ? "PRESAMPLER_EC_NEG":"PRESAMPLER_EC_POS" )) {
 	  GeoFullPhysVol * PresamplerEnvelope=sPresamplerEnvelope->getPhysVol();
 	  CellBinning presamplerPhiBinning(startPhi,endPhi,64);
 	  EMECDetDescr *presamplerDetDescr = new EMECDetDescr(emecDetectorManager,0,0,0,presamplerPhiBinning);
 	  EMECDetectorRegion *presamplerRegion = new EMECDetectorRegion(PresamplerEnvelope,presamplerDetDescr,EMECDetectorRegion::DetectorSide(e),projectivityDisplacement);
 	  emecDetectorManager->addDetectorRegion(presamplerRegion);
-	}                                                            
+	}
       }
-      else      
+      else
 	log << MSG::DEBUG << " No Stored PV for " << (e==0 ? "PRESAMPLER_EC_NEG":"PRESAMPLER_EC_POS")
 	    << " in Detector Store" << endreq;
     }
-    
+
   }
   catch (std::exception & ex) {
     log << MSG::WARNING << "Unable to build EMEC detector manager. " << ex.what() << endreq;
   }
 
   try
-  { 
+  {
     embDetectorManager  = new EMBDetectorManager();
     int firstEndcap=m_testbeam==0 ? 0:1, endEndcap=2;
     for (int e= firstEndcap ;e<endEndcap;e++) {
@@ -551,14 +552,14 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	endPhi  =22.5*M_PI/180;
 	NDIV=16;
       }
-      
+
       // Sampling layer 3 region 0:
       if (1)
 	{
 	  StoredPhysVol *sPhys;
 	  if(detStore->contains<StoredPhysVol>(e==0 ? "EMB_NEG" : "EMB_POS"))
 	  {
-	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS) 
+	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS)
 	    {
 	      CellBinning phiBinning(startPhi,endPhi,256/NDIV);
 	      EMBDetDescr *detDescr = new EMBDetDescr(embDetectorManager,3,0,phiBinning);
@@ -573,11 +574,11 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
       // Sampling layer 2 region 0:
       if (1)
 	{
-	  
+
 	  StoredPhysVol *sPhys;
 	  if(detStore->contains<StoredPhysVol>(e==0 ? "EMB_NEG" : "EMB_POS"))
 	  {
-	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS) 
+	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS)
 	    {
 	      CellBinning phiBinning(startPhi,endPhi,256/NDIV);
 	      EMBDetDescr *detDescr = new EMBDetDescr(embDetectorManager,2,0,phiBinning);
@@ -595,7 +596,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	  StoredPhysVol *sPhys;
 	  if(detStore->contains<StoredPhysVol>(e==0 ? "EMB_NEG" : "EMB_POS"))
 	  {
-	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS) 
+	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS)
 	    {
 	      CellBinning phiBinning(startPhi,endPhi,256/NDIV);
 	      EMBDetDescr *detDescr = new EMBDetDescr(embDetectorManager,2,1,phiBinning);
@@ -613,7 +614,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	  StoredPhysVol *sPhys;
 	  if(detStore->contains<StoredPhysVol>(e==0 ? "EMB_NEG" : "EMB_POS"))
 	  {
-	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS) 
+	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS)
 	    {
 	      CellBinning phiBinning(startPhi,endPhi,64/NDIV);
 	      EMBDetDescr *detDescr = new EMBDetDescr(embDetectorManager,1,0,phiBinning);
@@ -631,7 +632,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	  StoredPhysVol *sPhys;
 	  if(detStore->contains<StoredPhysVol>(e==0 ? "EMB_NEG" : "EMB_POS"))
 	  {
-	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS) 
+	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS)
 	    {
 	      CellBinning phiBinning(startPhi,endPhi,256/NDIV);
 	      EMBDetDescr *detDescr = new EMBDetDescr(embDetectorManager,1,1,phiBinning);
@@ -649,7 +650,7 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
 	  StoredPhysVol *sPhys;
 	  if(detStore->contains<StoredPhysVol>(e==0 ? "EMB_NEG" : "EMB_POS"))
 	  {
-	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS) 
+	    if (detStore->retrieve(sPhys,e==0 ? "EMB_NEG" : "EMB_POS")==StatusCode::SUCCESS)
 	    {
 	      CellBinning phiBinning(startPhi,endPhi,64/NDIV);
 	      EMBDetDescr *detDescr = new EMBDetDescr(embDetectorManager,0,0,phiBinning);
@@ -672,30 +673,30 @@ void LArGeo::LArDetectorFactory::create( GeoPhysVol* a_container )
   if (barrelEnvelope)    m_detectorManager->addTreeTop(barrelEnvelope);
   if (endcapEnvelopePos) m_detectorManager->addTreeTop(endcapEnvelopePos);
   if (endcapEnvelopeNeg) m_detectorManager->addTreeTop(endcapEnvelopeNeg);
-  
+
   StatusCode sc;
-  if (embDetectorManager)  
+  if (embDetectorManager)
   {
     sc = detStore->record(embDetectorManager,  embDetectorManager->getName());
     if(sc.isFailure())
       log << MSG::ERROR << "Unable to record embDetectorManager" << endreq;
   }
 
-  if (emecDetectorManager) 
+  if (emecDetectorManager)
   {
     sc = detStore->record(emecDetectorManager, emecDetectorManager->getName());
     if(sc.isFailure())
       log << MSG::ERROR << "Unable to record emecDetectorManager" << endreq;
   }
 
-  if (hecDetectorManager)    
+  if (hecDetectorManager)
   {
     sc = detStore->record(hecDetectorManager,  hecDetectorManager->getName());
     if(sc.isFailure())
       log << MSG::ERROR << "Unable to record hecDetectorManager" << endreq;
   }
 
-  if (fcalDetectorManager)     
+  if (fcalDetectorManager)
   {
     sc = detStore->record(fcalDetectorManager, fcalDetectorManager->getName());
     if(sc.isFailure())
diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorTool.cxx b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorTool.cxx
index 26f3e7e6dbc4005c4057150fec0f055803b9bfc0..6303322948bece91426de9dd9a4568ee0d3285b7 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorTool.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/src/LArDetectorTool.cxx
@@ -1,11 +1,11 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArReadoutGeometry/FCAL_ChannelMap.h"
 
 #include "LArGeoAlgsNV/LArDetectorToolNV.h"
-#include "LArGeoAlgsNV/LArDetectorFactory.h" 
+#include "LArGeoAlgsNV/LArDetectorFactory.h"
 #include "LArGeoCode/VDetectorParameters.h"
 #include "GeoModelUtilities/GeoModelExperiment.h"
 #include "GaudiKernel/IService.h"
@@ -41,10 +41,10 @@
 #define LAR_ALIGN "/LAR/Align"
 
 
-LArDetectorToolNV::LArDetectorToolNV(const std::string& type, 
-				     const std::string& name, 
+LArDetectorToolNV::LArDetectorToolNV(const std::string& type,
+				     const std::string& name,
 				     const IInterface* parent)
-  : GeoModelTool(type,name,parent), 
+  : GeoModelTool(type,name,parent),
     m_barrelSaggingOn(false),
     m_barrelVisLimit(-1),
     m_fcalVisLimit(-1),
@@ -52,7 +52,7 @@ LArDetectorToolNV::LArDetectorToolNV(const std::string& type,
     m_buildEndcap(true),
     m_applyAlignments(false),
     m_detStore(0),
-    m_geometryConfig("FULL")
+    m_geometryConfig("FULL"), m_activateFT(false)
 {
   declareProperty("SaggingBarrelAccordeon",m_barrelSaggingOn);
   declareProperty("BarrelCellVisLimit",    m_barrelVisLimit);
@@ -62,6 +62,7 @@ LArDetectorToolNV::LArDetectorToolNV(const std::string& type,
   declareProperty("BuildEndcap",           m_buildEndcap);
   declareProperty("ApplyAlignments",       m_applyAlignments);
   declareProperty("GeometryConfig",        m_geometryConfig);
+  declareProperty("ActivateFeedThrougs",   m_activateFT);
   m_manager = 0;
 
 }
@@ -73,7 +74,7 @@ LArDetectorToolNV::~LArDetectorToolNV()
 }
 
 StatusCode LArDetectorToolNV::create(StoreGateSvc* detStore)
-{ 
+{
   IMessageSvc* msgSvc;
   if(StatusCode::FAILURE==service ("MessageSvc",msgSvc))
   {
@@ -94,14 +95,14 @@ StatusCode LArDetectorToolNV::create(StoreGateSvc* detStore)
   LArHVManager *hvManager= new LArHVManager(embHV,emecHVI, emecHVO, hecHV, fcalHV,embPSHV, emecPSHV);
 
 
-  MsgStream log(msgSvc, name()); 
+  MsgStream log(msgSvc, name());
   m_detStore = detStore;
 
   if (StatusCode::SUCCESS != detStore->record(hvManager,"LArHVManager")) {
      log << MSG::ERROR << "Unable to record LArHVManager in detector store " << endreq;
      return StatusCode::FAILURE;
   }
-  
+
 
   // Get the detector configuration.
   IGeoModelSvc *geoModel;
@@ -110,10 +111,10 @@ StatusCode LArDetectorToolNV::create(StoreGateSvc* detStore)
     log << MSG::ERROR << "Unable to get GeoModel service" <<  endreq;
     return StatusCode::FAILURE;
   }
-  
+
   std::string AtlasVersion = geoModel->atlasVersion();
   std::string LArVersion   = geoModel->LAr_VersionOverride();
-  
+
   IRDBAccessSvc *accessSvc;
   if(StatusCode::FAILURE==service("RDBAccessSvc",accessSvc))
   {
@@ -124,27 +125,27 @@ StatusCode LArDetectorToolNV::create(StoreGateSvc* detStore)
   std::string detectorKey  = LArVersion.empty() ? AtlasVersion : LArVersion;
   std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
   log << MSG::INFO << "Keys for LAr are "  << detectorKey  << "  " << detectorNode << endreq;
-  log << MSG::INFO << "Building LAr version " << geoModel->LAr_Version() 
+  log << MSG::INFO << "Building LAr version " << geoModel->LAr_Version()
       << " while ATLAS version is " <<  AtlasVersion << endreq;
 
-  if(LArVersion=="CUSTOM") 
+  if(LArVersion=="CUSTOM")
   {
-    log << MSG::WARNING << "LArDetectorToolNV:  Detector Information coming from a custom configuration!!" 
+    log << MSG::WARNING << "LArDetectorToolNV:  Detector Information coming from a custom configuration!!"
 	<< endreq;
-  } 
-  else 
+  }
+  else
   {
     IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("LArSwitches", detectorKey, detectorNode);
     if ((*switchSet).size()==0) return StatusCode::FAILURE;
     const IRDBRecord    *switches   = (*switchSet)[0];
-    
+
     m_barrelSaggingOn           = switches->getInt("SAGGING");
 
     try
     {
       if (!switches->isFieldNull("BARREL_ON"))
 	m_buildBarrel = switches->getInt("BARREL_ON");
-      
+
       if (!switches->isFieldNull("ENDCAP_ON"))
 	m_buildEndcap = switches->getInt("ENDCAP_ON");
     }
@@ -159,13 +160,13 @@ StatusCode LArDetectorToolNV::create(StoreGateSvc* detStore)
   log << MSG::INFO  << "  Barrel            = "  << (m_buildBarrel ? "ON" : "OFF") << endreq;
   log << MSG::INFO  << "  Endcap            = "  << (m_buildEndcap ? "ON" : "OFF") << endreq;
 
-  // Locate the top level experiment node 
-  DataHandle<GeoModelExperiment> theExpt; 
-  if (StatusCode::SUCCESS != detStore->retrieve( theExpt, "ATLAS" )) 
-  { 
-    log << MSG::ERROR << "Could not find GeoModelExperiment ATLAS" << endreq; 
-    return (StatusCode::FAILURE); 
-  } 
+  // Locate the top level experiment node
+  DataHandle<GeoModelExperiment> theExpt;
+  if (StatusCode::SUCCESS != detStore->retrieve( theExpt, "ATLAS" ))
+  {
+    log << MSG::ERROR << "Could not find GeoModelExperiment ATLAS" << endreq;
+    return (StatusCode::FAILURE);
+  }
 
   // determine the geometry layout - Atlas/Testbeam
   std::string geometryLayout = "Atlas";
@@ -195,20 +196,20 @@ StatusCode LArDetectorToolNV::create(StoreGateSvc* detStore)
   theLArFactory.setFCALVisLimit        (m_fcalVisLimit);
   theLArFactory.setBuildBarrel(m_buildBarrel);
   theLArFactory.setBuildEndcap(m_buildEndcap);
+  theLArFactory.setActivateFT(m_activateFT);
 
 
-
-  if (0 == m_detector) 
+  if (0 == m_detector)
   {
     GeoPhysVol *world=&*theExpt->getPhysVol();
     theLArFactory.create(world);
     m_manager = theLArFactory.getDetectorManager();
     if (StatusCode::SUCCESS != detStore->record(theLArFactory.getDetectorManager(),
-						theLArFactory.getDetectorManager()->getName())) 
-      { 
-	log << MSG::ERROR << "Could not record" << endreq; 
-	return (StatusCode::FAILURE); 
-      } 
+						theLArFactory.getDetectorManager()->getName()))
+      {
+	log << MSG::ERROR << "Could not record" << endreq;
+	return (StatusCode::FAILURE);
+      }
 
     theExpt->addManager(theLArFactory.getDetectorManager());
 
@@ -278,7 +279,7 @@ StatusCode LArDetectorToolNV::registerCallback(StoreGateSvc* detStore)
 {
   // Return FAILURE if no callbacks have been registered
   MsgStream log(msgSvc(), name());
- 
+
   if(!m_applyAlignments)
   {
     log << MSG::DEBUG << "LAr alignments switched OFF" << endreq;
@@ -289,7 +290,7 @@ StatusCode LArDetectorToolNV::registerCallback(StoreGateSvc* detStore)
 
   const DataHandle<DetCondKeyTrans> dckt;
   log << MSG::DEBUG << "Registering callback on DetCondKeyTrans with folder " << folderName << endreq;
-  StatusCode sc = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), dckt, folderName); 
+  StatusCode sc = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), dckt, folderName);
   if(sc.isSuccess())
     log << MSG::DEBUG << " Successfully registered " << endreq;
   else
@@ -300,7 +301,7 @@ StatusCode LArDetectorToolNV::registerCallback(StoreGateSvc* detStore)
 
 StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
 {
-  MsgStream log(msgSvc(), name()); 
+  MsgStream log(msgSvc(), name());
 
   if(!m_applyAlignments)
   {
@@ -339,7 +340,7 @@ StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
 
   // <--- !!! To Do
 
-  if(0 == m_manager) 
+  if(0 == m_manager)
   {
     log << MSG::WARNING << " LArDetDescrManager not created yet, cannot align !" << endreq;
     return StatusCode::FAILURE;
@@ -349,14 +350,14 @@ StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
   if(m_detStore->contains<DetCondKeyTrans>(LAR_ALIGN))
   {
     StatusCode sc = m_detStore->retrieve(align, LAR_ALIGN);
-  
+
     if(sc.isFailure())
     {
       log << MSG::WARNING << " Could not retrieve LAr DetCondKeyTrans " << endreq;
       return sc;
     }
 
-    if(0 == align) 
+    if(0 == align)
     {
       log << MSG::WARNING <<" LAr DetCondKeyTrans ptr is 0" << endreq;
       return StatusCode::FAILURE;
@@ -393,7 +394,7 @@ StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
     GeoAlignableTransform *hec1GatNeg = hec1AlxPos ? hec1AlxNeg->getAlignX(): NULL;
     GeoAlignableTransform *hec2GatPos = hec2AlxPos ? hec2AlxPos->getAlignX(): NULL;
     GeoAlignableTransform *hec2GatNeg = hec2AlxPos ? hec2AlxNeg->getAlignX(): NULL;
-    
+
     // loop over align names
     // if the transform presented alter its delta
     // if the transform is not presented clear its delta
@@ -471,7 +472,7 @@ StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
   else
     log << MSG::DEBUG << " No LAr DetCondKeyTrans in SG, skipping align() " << endreq;
 
-  
+
   // debug printout of global positions:
   for(unsigned int i=0; i<alignNames.size(); i++)
   {
diff --git a/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelCryostatConstruction.h b/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelCryostatConstruction.h
index 718cdee81d518f9bae0b3311d40334c0790c95ec..3c12c33e9f9a510965b9db409b62b15ea2d4cde3 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelCryostatConstruction.h
+++ b/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelCryostatConstruction.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -19,25 +19,25 @@ class StoreGateSvc;
 
 namespace LArGeo {
 
-  /** @class LArGeo::BarrelCryostatConstruction 
+  /** @class LArGeo::BarrelCryostatConstruction
       @brief Builds GeoModel description of the LAr Electromagnetic Barrel.
       Descriptions of the presampler and dad material in the crack region are
       implemented in separate classes
    */
-  class BarrelCryostatConstruction 
+  class BarrelCryostatConstruction
   {
   public:
-    
-    BarrelCryostatConstruction(bool fullGeo);
+
+    BarrelCryostatConstruction(bool fullGeo, bool activateFT = false);
     virtual ~BarrelCryostatConstruction();
-    
+
     // Get the envelope containing this detector.
     virtual GeoFullPhysVol* GetEnvelope();
-    
+
 
     void setBarrelSagging(bool flag)        {m_barrelSagging  = flag;}
     void setBarrelCellVisLimit(int maxCell) {m_barrelVisLimit = maxCell;}
-    
+
   private:
 
     bool                    m_barrelSagging;
@@ -45,6 +45,7 @@ namespace LArGeo {
     GeoFullPhysVol          *m_cryoMotherPhysical;
 
     bool                    m_fullGeo;  // true->FULL, false->RECO
+    bool                    m_activateFT;
   };
 
 } // namespace LArGeo
diff --git a/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelDMConstruction.h b/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelDMConstruction.h
index 0d687b2418a488077f2aa40422d64ea32f3159b8..c75a5054ab621c766f5c401e2c11c50e73f28141 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelDMConstruction.h
+++ b/LArCalorimeter/LArGeoModel/LArGeoBarrel/LArGeoBarrel/BarrelDMConstruction.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -26,7 +26,7 @@ namespace LArGeo {
   public:
 
     // Constructor;
-    BarrelDMConstruction();
+    BarrelDMConstruction(bool activateFT = false);
 
     // Destructor:
     virtual ~BarrelDMConstruction();
@@ -34,7 +34,7 @@ namespace LArGeo {
     // Add passive materials to the barrel envelope
     void create(GeoFullPhysVol* envelope);
 
-  private: 
+  private:
 
     // It is illegal to copy a BarrelDMConstruction:
     BarrelDMConstruction (const BarrelDMConstruction &);
@@ -42,9 +42,10 @@ namespace LArGeo {
     // It is illegal to assign a BarrelDMConstruction:
     BarrelDMConstruction & operator= (const BarrelDMConstruction &);
 
-  };
+    bool m_activateFT;
+   };
+
 
- 
 
 }  // namespace LArGeo
 
diff --git a/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelCryostatConstruction.cxx b/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelCryostatConstruction.cxx
index da3195af4b4a690596f621a95a2146ccbddc076e..528e4b592038961d5d0d226b8b98ab9beaa02661 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelCryostatConstruction.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelCryostatConstruction.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // BarrelCryostatConstruction
@@ -12,20 +12,21 @@
 #include "LArGeoBarrel/BarrelPresamplerConstruction.h"
 #include "LArGeoBarrel/BarrelDMConstruction.h"
 
-#include "GeoModelKernel/GeoElement.h"  
-#include "GeoModelKernel/GeoMaterial.h"  
-#include "GeoModelKernel/GeoFullPhysVol.h"  
-#include "GeoModelKernel/GeoPhysVol.h"  
-#include "GeoModelKernel/GeoVPhysVol.h"  
-#include "GeoModelKernel/GeoLogVol.h"  
-#include "GeoModelKernel/GeoPcon.h"  
-#include "GeoModelKernel/GeoTubs.h"  
-#include "GeoModelKernel/GeoBox.h"  
-#include "GeoModelKernel/GeoCons.h"  
-#include "GeoModelKernel/GeoTransform.h"  
-#include "GeoModelKernel/GeoNameTag.h"  
-#include "GeoModelKernel/GeoAlignableTransform.h"  
-#include "GeoModelKernel/GeoIdentifierTag.h"  
+#include "GeoModelKernel/GeoElement.h"
+#include "GeoModelKernel/GeoMaterial.h"
+#include "GeoModelKernel/GeoFullPhysVol.h"
+#include "GeoModelKernel/GeoPhysVol.h"
+#include "GeoModelKernel/GeoVPhysVol.h"
+#include "GeoModelKernel/GeoLogVol.h"
+#include "GeoModelKernel/GeoPcon.h"
+#include "GeoModelKernel/GeoTubs.h"
+#include "GeoModelKernel/GeoTube.h"
+#include "GeoModelKernel/GeoBox.h"
+#include "GeoModelKernel/GeoCons.h"
+#include "GeoModelKernel/GeoTransform.h"
+#include "GeoModelKernel/GeoNameTag.h"
+#include "GeoModelKernel/GeoAlignableTransform.h"
+#include "GeoModelKernel/GeoIdentifierTag.h"
 #include "GeoModelKernel/GeoShapeIntersection.h"
 #include "GeoModelKernel/GeoShapeSubtraction.h"
 #include "GeoModelKernel/GeoShapeShift.h"
@@ -48,11 +49,11 @@
 #include "RDBAccessSvc/IRDBAccessSvc.h"
 
 // For transforms:
-#include "CLHEP/Geometry/Transform3D.h" 
+#include "CLHEP/Geometry/Transform3D.h"
 // For units:
 #include "CLHEP/Units/PhysicalConstants.h"
 // For Transformation Fields:
-#include "CLHEP/GenericFunctions/Abs.hh" 
+#include "CLHEP/GenericFunctions/Abs.hh"
 #include "CLHEP/GenericFunctions/Mod.hh"
 #include "CLHEP/GenericFunctions/Rectangular.hh"
 #include "CLHEP/GenericFunctions/Variable.hh"
@@ -72,11 +73,12 @@ using namespace Genfun;
 // in RDBRecordset
 typedef std::map<int, unsigned int, std::less<int> > planeIndMap;
 
-LArGeo::BarrelCryostatConstruction::BarrelCryostatConstruction(bool fullGeo):
+LArGeo::BarrelCryostatConstruction::BarrelCryostatConstruction(bool fullGeo, bool ft):
   m_barrelSagging(0),
   m_barrelVisLimit(-1),
   m_cryoMotherPhysical(NULL),
-  m_fullGeo(fullGeo)
+  m_fullGeo(fullGeo),
+  m_activateFT(ft)
 {}
 
 LArGeo::BarrelCryostatConstruction::~BarrelCryostatConstruction() {}
@@ -87,21 +89,15 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   if (m_cryoMotherPhysical) return m_cryoMotherPhysical;
 
  // Get access to the material manager:
-  
+
   ISvcLocator *svcLocator = Gaudi::svcLocator();
   IMessageSvc * msgSvc;
   if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
     throw std::runtime_error("Error in EMBConstruction, cannot access MessageSvc");
   }
 
-  MsgStream log(msgSvc, "LAr::DetectorFactory"); 
-
-  log  << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
-  log << "+                                                   +" << std::endl;
-  log << "+   HELLO from LArGeo::BarrelCryostatConstruction   +" << std::endl;
-  log << "+                                                   +" << std::endl;
-  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
-
+  MsgStream log(msgSvc, "LAr::BarrelCryostatConstruction");
+  log << MSG::DEBUG << "started" << endmsg;
 
   StoreGateSvc *detStore;
   if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
@@ -136,14 +132,14 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   }
 
 
-  // ----- ----- ------ Get primary numbers from the GeomDB ----- ----- ----- 
+  // ----- ----- ------ Get primary numbers from the GeomDB ----- ----- -----
   IGeoModelSvc *geoModel;
   IRDBAccessSvc* rdbAccess;
   planeIndMap innerWallPlanes, innerEndWallPlanes, outerWallPlanes, cryoMotherPlanes, totalLarPlanes, halfLarPlanes, sctEcCoolingPlanes;
   planeIndMap::const_iterator iter;
   const IRDBRecord* currentRecord;
 
-  
+
   if(svcLocator->service ("GeoModelSvc",geoModel) == StatusCode::FAILURE)
     throw std::runtime_error("Error in BarrelCryostatConstruction, cannot access GeoModelSvc");
   if(svcLocator->service ("RDBAccessSvc",rdbAccess) == StatusCode::FAILURE)
@@ -158,7 +154,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   std::string names[]={"EMB_POS","EMB_NEG","SOLENOID"};
   GeoAlignableTransform *xf[]={NULL,NULL,NULL};
   for (int n=0;n<3;n++) {
-    
+
     IRDBRecordset_ptr larPosition =   rdbAccess->getRecordsetPtr("LArPosition",larVersionKey.tag(), larVersionKey.node());
 
     if (larPosition->size()==0 ) {
@@ -176,24 +172,24 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
     StoredAlignX *sAlignX = new StoredAlignX(xf[n]);
     StatusCode status=detStore->record(sAlignX,names[n]);
     if(!status.isSuccess()) throw std::runtime_error (("Cannot store " + names[n]).c_str() );
-  }  
+  }
 
   GeoAlignableTransform *xfHalfLArPos=xf[0],  *xfHalfLArNeg=xf[1], *xfSolenoid=xf[2];
 
 
 
-  
+
   IRDBRecordset_ptr cryoEars        = rdbAccess->getRecordsetPtr("CryoEars", larVersionKey.tag(),larVersionKey.node());
   IRDBRecordset_ptr idSupportRails  = rdbAccess->getRecordsetPtr("IdSupportRail", larVersionKey.tag(), larVersionKey.node());
-  IRDBRecordset_ptr cryoCylinders   = rdbAccess->getRecordsetPtr("CryoCylinders", 
-								 larVersionKey.tag(), 
+  IRDBRecordset_ptr cryoCylinders   = rdbAccess->getRecordsetPtr("CryoCylinders",
+								 larVersionKey.tag(),
 								 larVersionKey.node());
   if(cryoCylinders->size()==0)
     cryoCylinders = rdbAccess->getRecordsetPtr("CryoCylinders","CryoCylinders-00");
 
 
-  IRDBRecordset_ptr cryoPcons = rdbAccess->getRecordsetPtr("CryoPcons", 
-							   larVersionKey.tag(), 
+  IRDBRecordset_ptr cryoPcons = rdbAccess->getRecordsetPtr("CryoPcons",
+							   larVersionKey.tag(),
 							   larVersionKey.node());
   if(cryoPcons->size()==0)
     cryoPcons = rdbAccess->getRecordsetPtr("CryoPcons","CryoPcons-00");
@@ -205,7 +201,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
     std::string pconName = (*cryoPcons)[ind]->getString("PCON");
     if(pconName=="Barrel::InnerWall")
       innerWallPlanes[key] = ind;
-    if (pconName=="Barrel::InnerEndWall") 
+    if (pconName=="Barrel::InnerEndWall")
       innerEndWallPlanes[key] = ind;
     else if(pconName=="Barrel::OuterWall")
       outerWallPlanes[key] = ind;
@@ -218,7 +214,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
     else if(pconName=="Barrel::SctEcCooling")
       sctEcCoolingPlanes[key] = ind;
   }
-  // ----- ----- ------ Get primary numbers from the GeomDB ----- ----- ----- 
+  // ----- ----- ------ Get primary numbers from the GeomDB ----- ----- -----
 
   //////////////////////////////////////////////////////////////////
   // Define geometry
@@ -245,7 +241,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   // accordingly.
 
   //  double cryoMotherRin[]   = {1149.8*CLHEP::mm, 1149.8*CLHEP::mm,1149.8*CLHEP::mm,1149.8*CLHEP::mm,1149.8*CLHEP::mm,1149.8*CLHEP::mm};
-  //  double cryoMotherRout[]  = {2890. *CLHEP::mm, 2890. *CLHEP::mm,2250. *CLHEP::mm,2250. *CLHEP::mm,2890. *CLHEP::mm,2890. *CLHEP::mm};  
+  //  double cryoMotherRout[]  = {2890. *CLHEP::mm, 2890. *CLHEP::mm,2250. *CLHEP::mm,2250. *CLHEP::mm,2890. *CLHEP::mm,2890. *CLHEP::mm};
   //  double cryoMotherZplan[] = {-3490.*CLHEP::mm,-2850.*CLHEP::mm,-2849.*CLHEP::mm, 2849.*CLHEP::mm, 2850.*CLHEP::mm, 3490.*CLHEP::mm};
 
   // Access source of detector parameters.
@@ -299,7 +295,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   //--------------------------------------------------------------------------------------------------//
   // Cylindrical layers for the cryo mother:                                                          //
   //
-  for (unsigned int ind=0; ind < cryoCylinders->size(); ind++) 
+  for (unsigned int ind=0; ind < cryoCylinders->size(); ind++)
   {
     currentRecord = (*cryoCylinders)[ind];
 
@@ -308,7 +304,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
       GeoMaterial *material  = materialManager->getMaterial(currentRecord->getString("MATERIAL"));
 
-      if (!material) 
+      if (!material)
       {
 	std::ostringstream errorMessage;
 	errorMessage << "Error in BarrelCrysostat Construction" << std::endl;
@@ -316,7 +312,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	throw std::runtime_error(errorMessage.str().c_str());
       }
 
-      
+
       std::ostringstream cylStream;
       int cylID = currentRecord->getInt("CYL_ID");
       cylStream << "LAr::Barrel::Cryostat::Cylinder::#" << cylID;
@@ -326,7 +322,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
       double zMin = currentRecord->getDouble("ZMIN")*CLHEP::cm;
       double dZ   = currentRecord->getDouble("DZ")*CLHEP::cm;
       double zInCryostat = zMin + dZ / 2.;
-      
+
       if(m_fullGeo){
 	if ((*cryoEars).size()>0 && cylID==1) {
 	  const IRDBRecord * record = (*cryoEars)[0];
@@ -339,9 +335,9 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 				       zthick/ 2.,
 				       (double) 0.,
 				       dphi_all);
-	  
+
 	  GeoBox *box = new GeoBox( rmax, yvert/2, rmax);
-	  
+
 	  const GeoShape & shape = tubs->intersect(*box);
 	  const GeoLogVol *logVol = new GeoLogVol ("LAr::Barrel::Cryostat::Sector::Ear",&shape, material);
 	  GeoPhysVol *earPhysVol = new GeoPhysVol(logVol);
@@ -354,9 +350,9 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	  m_cryoMotherPhysical->add(new GeoNameTag(cylName+std::string("CryostatEarBackward")));
 	  m_cryoMotherPhysical->add(new GeoIdentifierTag(cylNumber));
 	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(-zInCryostat)));
-	  m_cryoMotherPhysical->add(earPhysVol);                
+	  m_cryoMotherPhysical->add(earPhysVol);
 	}
-      
+
 	if ((*cryoEars).size() > 0  && cylID==6) {
 	  const IRDBRecord * record = (*cryoEars)[0];
 	  double rmin   =  record->getDouble("LEGRMIN");
@@ -374,25 +370,25 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	  HepGeom::TranslateY3D  offset(rmax-yvert);
 	  GeoBox * box =  new GeoBox(rmax,rmax, rmax);
 	  const GeoShape & shape = tubs->subtract((*box)<<offset);
-	  
+
 	  const GeoLogVol *logVol = new GeoLogVol ("LAr::Barrel::Cryostat::Sector::Leg",&shape, material);
 	  GeoPhysVol *legPhysVol = new GeoPhysVol(logVol);
-	
+
 	  m_cryoMotherPhysical->add(new GeoNameTag(std::string("CryostatLegForward")));
 	  m_cryoMotherPhysical->add(new GeoIdentifierTag(cylNumber));
 	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zInCryostat+zthick)));
 	  m_cryoMotherPhysical->add(legPhysVol);
-	  
+
 	  m_cryoMotherPhysical->add(new GeoNameTag(cylName+std::string("CryostatLegBackward")));
 	  m_cryoMotherPhysical->add(new GeoIdentifierTag(cylNumber));
 	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(-zInCryostat-zthick)));
-	  m_cryoMotherPhysical->add(legPhysVol);                
+	  m_cryoMotherPhysical->add(legPhysVol);
 	}
       }
 
-      GeoTubs* solidBarrelCylinder = 0;
+      const GeoShape* solidBarrelCylinder = 0;
       const GeoLogVol* logicBarrelCylinder = 0;
-    
+
       // For Reco Geometry construct only solenoid cylinders
       if(m_fullGeo || (10<=cylID && cylID<=14)) {
 	solidBarrelCylinder
@@ -402,10 +398,70 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 			(double) 0.,
 			dphi_all);
 
-	logicBarrelCylinder
-	  = new GeoLogVol(cylName,solidBarrelCylinder,material);      
+      if(m_activateFT){
+        if(cylID == 7){ // Cut holes for feedthroughs in warm wall
+          log << MSG::DEBUG << "Cut holes for feedthroughs in warm wall "
+              << cylName
+              << endmsg;
+          const double rmin = currentRecord->getDouble("RMIN")*CLHEP::cm;
+          const double rmax = currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm;
+          const double bellow_Router = 0.5*299.*CLHEP::mm; // from DMconstruction
+          const double warmhole_radius = bellow_Router;
+          const double warmhole_pos = 4.*CLHEP::cm;
+          GeoTube *warmhole = new GeoTube(0., warmhole_radius, (rmax - rmin) * 2);
+          const GeoShapeShift &h1 = (*warmhole) << HepGeom::RotateX3D(90*CLHEP::deg);
+          const double r = (rmin + rmax) * 0.5;
+          const GeoShape *warmwall = solidBarrelCylinder;
+          const double dphi = 4.*CLHEP::deg;
+          const int NCrates = 16;
+          auto put = [&warmwall, &warmhole_pos, &r, &h1](double pos){
+            const double x = r*cos(pos);
+            const double y = r*sin(pos);
+            warmwall = &(warmwall->subtract(
+              h1 << HepGeom::Translate3D(x, y, warmhole_pos)
+                   *HepGeom::RotateZ3D(pos + 90*CLHEP::deg)
+            ));
+          };
+          for(int i = 0; i < NCrates; ++ i){
+            const double phi = 360.*CLHEP::deg * i / NCrates;
+            put(phi - dphi);
+            put(phi + dphi);
+          }
+          solidBarrelCylinder = warmwall;
+        } else if(cylID == 2){ // Cut holes for feedthroughs in cold wall
+          log << MSG::DEBUG << "Cut holes for feedthroughs in cold wall "
+              << cylName
+              << endmsg;
+          const double rmin = currentRecord->getDouble("RMIN")*CLHEP::cm;
+          const double rmax = currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm;
+          const double coldhole_radius = 0.5*150.*CLHEP::mm; // see DMconstruction
+          const double coldhole_pos = 27.5*CLHEP::mm;
+          GeoTube *coldhole = new GeoTube(0., coldhole_radius, (rmax - rmin) * 2);
+          const GeoShapeShift &h1 = (*coldhole) << HepGeom::RotateX3D(90*CLHEP::deg);
+          const double r = (rmin + rmax) * 0.5;
+          const GeoShape *coldwall = solidBarrelCylinder;
+          const double dphi = 4.*CLHEP::deg;
+          const int NCrates = 16;
+          for(int i = 0; i < NCrates; ++ i){
+            const double phi = 360.*CLHEP::deg * i / NCrates;
+            auto put = [&coldwall, &coldhole_pos, &r, &h1](double pos){
+              const double x = r*cos(pos);
+              const double y = r*sin(pos);
+              coldwall = &(coldwall->subtract(
+                h1 << HepGeom::Translate3D(x, y, coldhole_pos)
+                     *HepGeom::RotateZ3D(pos + 90*CLHEP::deg)
+              ));
+            };
+            put(phi - dphi);
+            put(phi + dphi);
+          }
+          solidBarrelCylinder = coldwall;
+        }
       }
 
+      logicBarrelCylinder = new GeoLogVol(cylName,solidBarrelCylinder,material);
+    }
+
       if(logicBarrelCylinder) {
 	// If ZMIN < 0 place the cylinder onse
 	// If ZMIN >=0 place each cylinder twice, at +z and -z.
@@ -422,9 +478,9 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zInCryostat)));
 	  m_cryoMotherPhysical->add(physBarrelCylinder);
 
-	  
+
 	  // NOTE: there are 5 volumes for solenoid with NO common direct parent
-	  // I'm storing the first one #10. (FIXME) 
+	  // I'm storing the first one #10. (FIXME)
 	  // NOTE:  Pretty soon there will
 	  // be no need at all to store physical volumes in the manager or in storegate!
 	  if(cylID==10) {
@@ -434,18 +490,23 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	  }
 	}else{
 	  GeoPhysVol* physBarrelCylinder = new GeoPhysVol(logicBarrelCylinder);
-	  
+
 	  m_cryoMotherPhysical->add(new GeoNameTag(cylName+std::string("PhysForward")));
 	  m_cryoMotherPhysical->add(new GeoIdentifierTag(cylNumber));
 	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zInCryostat)));
 	  m_cryoMotherPhysical->add(physBarrelCylinder);
-	  
+
 	  m_cryoMotherPhysical->add(new GeoNameTag(cylName+std::string("PhysBackward")));
 	  m_cryoMotherPhysical->add(new GeoIdentifierTag(cylNumber));
-	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(-zInCryostat)));
-	  m_cryoMotherPhysical->add(physBarrelCylinder);                
-	}           
-      }                           
+      if(m_activateFT && (cylID == 2 || cylID == 7)){
+          m_cryoMotherPhysical->add(new GeoTransform(HepGeom::RotateY3D(180.*CLHEP::deg)));
+          m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zInCryostat)));
+      } else {
+          m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(-zInCryostat)));
+      }
+	  m_cryoMotherPhysical->add(physBarrelCylinder);
+	}
+      }
     }
   }                                                                                                   //
   //--------------------------------------------------------------------------------------------------//
@@ -453,10 +514,10 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   if(m_fullGeo) {
     // Make a Polycon for the outer wall:
     GeoPcon *outerWallPcon = new GeoPcon(0,dphi_all);
-    
+
     for(unsigned int ind=0; ind<outerWallPlanes.size(); ind++) {
       iter = outerWallPlanes.find(ind);
-      
+
       if(iter==outerWallPlanes.end())
 	throw std::runtime_error("Error in BarrelCryostatConstruction, missing plane in OuterWall");
       else {
@@ -471,13 +532,13 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
     m_cryoMotherPhysical->add(new GeoNameTag(std::string("Barrel Cryo OuterWall Phys")));
     GeoPhysVol *outerWallPhys = new GeoPhysVol(outerWallLog);
     m_cryoMotherPhysical->add(outerWallPhys);
-  
+
     // Make a Polycon for the inner wall:
     GeoPcon *innerWallPcon = new GeoPcon(0,dphi_all);
 
     for(unsigned int ind=0; ind<innerWallPlanes.size(); ind++) {
       iter = innerWallPlanes.find(ind);
-      
+
       if(iter==innerWallPlanes.end())
 	throw std::runtime_error("Error in BarrelCryostatConstruction, missing plane in InnerWall");
       else {
@@ -533,17 +594,17 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
           double xxVis=((double)(Nvis));
           double ZposB=0.5*(z1+z2);
           double twopi128 = 2.*M_PI/xxVis;
-          Genfun::Variable      i;                                                        
-          Genfun::Mod Mod1(1.0),Mod128(xxVis),Mod2(2.0);                                  
-          Genfun::GENFUNCTION  PhiPos = PhiPos0 + twopi128*Mod128(i);                
+          Genfun::Variable      i;
+          Genfun::Mod Mod1(1.0),Mod128(xxVis),Mod2(2.0);
+          Genfun::GENFUNCTION  PhiPos = PhiPos0 + twopi128*Mod128(i);
           Genfun::GENFUNCTION Int = i - Mod1;
           Genfun::Cos  Cos;
           Genfun::Sin  Sin;
-          GeoXF::TRANSFUNCTION TX =                                                       
-            GeoXF::Pow(HepGeom::TranslateX3D(1.0),RhoPosB*Cos(PhiPos))*                         
-            GeoXF::Pow(HepGeom::TranslateY3D(1.0),RhoPosB*Sin(PhiPos))*                         
+          GeoXF::TRANSFUNCTION TX =
+            GeoXF::Pow(HepGeom::TranslateX3D(1.0),RhoPosB*Cos(PhiPos))*
+            GeoXF::Pow(HepGeom::TranslateY3D(1.0),RhoPosB*Sin(PhiPos))*
             GeoXF::Pow(HepGeom::TranslateZ3D(2*ZposB),Int(i/128))*
-            HepGeom::TranslateZ3D(-ZposB);                                         
+            HepGeom::TranslateZ3D(-ZposB);
           GeoSerialTransformer *st = new GeoSerialTransformer(phys_vis, &TX, 2*Nvis);
           innerWallPhys->add(st);
         }
@@ -552,10 +613,10 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
         log << MSG::INFO << " old description withut bold in the geometry database " << endreq;
      }
 
-    
+
     // extra Cone for systematics in upstream matter
-    IRDBRecordset_ptr extraCones = rdbAccess->getRecordsetPtr("LArCones", 
-							      larVersionKey.tag(), 
+    IRDBRecordset_ptr extraCones = rdbAccess->getRecordsetPtr("LArCones",
+							      larVersionKey.tag(),
 							      larVersionKey.node());
     if (extraCones->size() > 0 ) {
       int nextra=0;
@@ -581,16 +642,16 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	  //                 << extra_dphi << " " << extra_zpos << std::endl;
 	  GeoCons* extraCons
 	    = new GeoCons(extra_rmin1,extra_rmin2,extra_rmax1,extra_rmax2,extra_dz,extra_phi0,extra_dphi);
-	  
+
 	  std::ostringstream extraStream;
 	  extraStream << "LAr::Barrel::Cryostat::ExtraMat" << nextra;
 	  std::string extraName= extraStream.str();
 	  //      std::cout << " extraName " << extraName << std::endl;
-	  
+
 	  GeoLogVol* extraLog = new GeoLogVol(extraName,extraCons,Aluminium);
 	  GeoPhysVol* extraPhys = new GeoPhysVol(extraLog);
 	  m_cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(extra_zpos)));
-	  m_cryoMotherPhysical->add(extraPhys); 
+	  m_cryoMotherPhysical->add(extraPhys);
 	}
       }
     }
@@ -640,12 +701,12 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
       if (r>0.) {
 
-      
+
       // Make one block:
         GeoBox *box = new GeoBox(length/2.0, height/2.0, width/2.0);
         GeoLogVol *logVol = new GeoLogVol("LAr::Barrel::Cryostat::Sector::TitaniumBlock", box,myMaterial);
         GeoPhysVol *physVol = new GeoPhysVol(logVol);
-      
+
         double angle=pairSeparation/r;
         double pos  = -z+width/2 + distFromRidge;
 // position of bumpers in new description
@@ -655,8 +716,8 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
           Genfun::GENFUNCTION Truncate = i - Mod1(i);                                     //
           Genfun::GENFUNCTION AngleZ = -angle/2.+angle*Truncate(Mod2(i/2))+ 2.*M_PI/(1.0*nPairTot)*Truncate(i/4) + 2*M_PI/(2.*nPairTot);
           Genfun::GENFUNCTION TransZ = -pos + 2.*pos*Mod2(i);
-      
-          TRANSFUNCTION tx = 
+
+          TRANSFUNCTION tx =
             GeoXF::Pow(HepGeom::TranslateZ3D(1.0),TransZ)*
             GeoXF::Pow(HepGeom::RotateZ3D(1.0),AngleZ)*
             HepGeom::Translate3D(0.,r+height/2,0.);
@@ -668,8 +729,8 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
           Genfun::Variable      i;                                                        //
           Genfun::Mod Mod1(1.0),Mod2(2.0);                                                //
           Genfun::GENFUNCTION Truncate = i - Mod1(i);                                     //
-      
-          TRANSFUNCTION tx = 
+
+          TRANSFUNCTION tx =
            Pow(HepGeom::RotateZ3D(2*M_PI/nPairTot),Truncate(i/4))*
            Pow(HepGeom::RotateZ3D(angle),Mod2(i/2))*
            HepGeom::RotateZ3D(-angle/2)*
@@ -686,14 +747,14 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
     }  // end of coil supports
 
-    
+
     // Make a Polycon for the inner endwall:
     if(innerEndWallPlanes.size() > 0) {
       GeoPcon *innerEndWallPcon = new GeoPcon(0,dphi_all);
 
       for(unsigned int ind=0; ind<innerEndWallPlanes.size(); ind++) {
 	iter = innerEndWallPlanes.find(ind);
-      
+
 	if(iter==innerEndWallPlanes.end())
 	  throw std::runtime_error("Error in BarrelCryostatConstruction, missing plane in InnerEndWall");
 	else {
@@ -724,9 +785,9 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
   // routine.
 
   //  double totalLArRin[]   = { 1565.5*CLHEP::mm, 1385.*CLHEP::mm, 1385.*CLHEP::mm, 1565.5*CLHEP::mm };
-  //  double totalLArRout[]  = { 2140. *CLHEP::mm, 2140.*CLHEP::mm, 2140.*CLHEP::mm, 2140. *CLHEP::mm };  
+  //  double totalLArRout[]  = { 2140. *CLHEP::mm, 2140.*CLHEP::mm, 2140.*CLHEP::mm, 2140. *CLHEP::mm };
   //  double totalLArZplan[] = {-3267. *CLHEP::mm,-3101.*CLHEP::mm, 3101.*CLHEP::mm, 3267. *CLHEP::mm };
-    
+
   GeoPcon* totalLArShape =
     new GeoPcon(0.,                     // starting phi
 		dphi_all);               // total phi
@@ -748,17 +809,17 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
   std::string totalLArName = "LAr::Barrel::Cryostat::TotalLAr";
   const GeoLogVol* totalLArLogical = new GeoLogVol(totalLArName, totalLArShape, LAr);
-    
+
     // When you place a polycone inside another polycone, the z=0
     // co-ordinates will be the same.  (Let's hope this is still true
     // in GeoModel.)
   m_cryoMotherPhysical->add(new GeoNameTag("Total LAR Volume"));
   GeoPhysVol* totalLArPhysical = new GeoPhysVol(totalLArLogical);
   m_cryoMotherPhysical->add(totalLArPhysical);
-  //                                                                                                //    
+  //                                                                                                //
 
   // 19-Feb-2003 ML: mother volumes for halfBarrels
-    
+
   // To allow for mis-alignments, provide a 3mm gap at low z.  (This
   // is just a first pass; we may want to introduce other adjustments
   // to this shape to allow for mis-alignments in other dimensions.)
@@ -768,8 +829,8 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
   //  double halfLArZplan[] = { 3.0 *CLHEP::mm, 3101.*CLHEP::mm, 3267. *CLHEP::mm };
   //  double halfLArRin[]   = {1385.*CLHEP::mm + rInShift, 1385.*CLHEP::mm + rInShift, 1565.5*CLHEP::mm  + rInShift};
-  //  double halfLArRout[]  = {2140.*CLHEP::mm, 2140.*CLHEP::mm, 2140. *CLHEP::mm };  
-    
+  //  double halfLArRout[]  = {2140.*CLHEP::mm, 2140.*CLHEP::mm, 2140. *CLHEP::mm };
+
   std::string halfLArName = "LAr::Barrel::Cryostat::HalfLAr";
   GeoPcon* halfLArShape =
     new GeoPcon(
@@ -791,39 +852,39 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 			     currentRecord->getDouble("RMAX"));
     }
   }
-    
+
   // Define logical volumes for both halves of the barrel.
   const GeoLogVol* halfLArLogicalPos =
     new GeoLogVol(halfLArName + "::Pos", halfLArShape, LAr);
   GeoPhysVol* halfLArPhysicalPos = new GeoPhysVol(halfLArLogicalPos);
-  
+
   const GeoLogVol* halfLArLogicalNeg =
     new GeoLogVol(halfLArName + "::Neg", halfLArShape, LAr);
   GeoPhysVol* halfLArPhysicalNeg = new GeoPhysVol(halfLArLogicalNeg);
-  
+
   totalLArPhysical->add(new GeoNameTag(halfLArName + "::PosPhysical"));
 
   // add alignable transform
   totalLArPhysical->add(xfHalfLArPos);
   totalLArPhysical->add(halfLArPhysicalPos);
-  
+
   totalLArPhysical->add(new GeoNameTag(halfLArName + "::NegPhysical"));
 
   // add alignable transform
   totalLArPhysical->add(xfHalfLArNeg);
   totalLArPhysical->add( new GeoTransform(HepGeom::RotateY3D(180.*CLHEP::deg)) );
   totalLArPhysical->add(halfLArPhysicalNeg);
-  
+
   {
 
     // 27-Nov-2001 WGS: Place the barrel LAr and detector inside the cryostat.
     // There are two placements: one for the z>0 section, one for the z<0 section.
-    
-    
+
+
     BarrelConstruction barrelConstruction(m_fullGeo);
     barrelConstruction.setBarrelSagging(m_barrelSagging);
     barrelConstruction.setBarrelCellVisLimit(m_barrelVisLimit);
-    
+
 
     // The "envelope" determined by the EMB should be a GeoFullPhysVol.
     GeoFullPhysVol* barrelPosEnvelope = barrelConstruction.GetPositiveEnvelope();
@@ -841,13 +902,13 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
       //
       for (unsigned int ind=0; ind < cryoCylinders->size(); ind++) {
 	currentRecord = (*cryoCylinders)[ind];
-	
+
 	if(currentRecord->getString("CYL_LOCATION")=="Barrel::HalfLAr"||
 	   currentRecord->getString("CYL_LOCATION")=="Barrel::TotalLAr") {
 	  bool isHalfLar = currentRecord->getString("CYL_LOCATION")=="Barrel::HalfLAr";
 
 	  GeoMaterial *material  = materialManager->getMaterial(currentRecord->getString("MATERIAL"));
-	
+
 	  if (!material) {
 	    std::ostringstream errorMessage;
 	    errorMessage << "Error in BarrelCrysostat Construction" << std::endl;
@@ -857,31 +918,31 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
 	  std::ostringstream cylStream;
 	  cylStream << "LAr::Barrel::Cryostat::";
-	
+
 	  if (!currentRecord->isFieldNull("QUALIFIER")) {
 	    std::string qualifier = currentRecord->getString("QUALIFIER");
 	    if (qualifier.size()) cylStream << qualifier << "::";
 	  }
 	  cylStream <<  "Cylinder::#" << currentRecord->getInt("CYL_ID");
-	  std::string cylName= cylStream.str(); 
+	  std::string cylName= cylStream.str();
 
-	  GeoTubs* solidBarrelCylinder 
+	  GeoTubs* solidBarrelCylinder
 	  = new GeoTubs(currentRecord->getDouble("RMIN")*CLHEP::cm,
 			currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm,
 			currentRecord->getDouble("DZ")*CLHEP::cm / 2.,
 			(double) 0.,
 			dphi_all);
-    
+
 	  const GeoLogVol* logicBarrelCylinder
 	    = new GeoLogVol(cylName,solidBarrelCylinder,material);
-	  
+
 	  GeoPhysVol* physBarrelCylinder = new GeoPhysVol(logicBarrelCylinder);
-	  
+
 	  double zInCryostat = currentRecord->getDouble("ZMIN")*CLHEP::cm + currentRecord->getDouble("DZ")*CLHEP::cm / 2.;
-	  
+
 	  int cylNumber = currentRecord->getInt("CYL_NUMBER");
-	  
-	  
+
+
 	  if(isHalfLar) {
 	    // Place each cylinder twice, once in each half-barrel:
 	    halfLArPhysicalPos->add(new GeoNameTag(cylName+std::string("PhysForward")));
@@ -889,7 +950,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 	    //	  halfLArPhysicalPos->add(xfPos);
 	    halfLArPhysicalPos->add(new GeoTransform(HepGeom::TranslateZ3D(zInCryostat)));
 	    halfLArPhysicalPos->add(physBarrelCylinder);
-	    
+
 	    halfLArPhysicalNeg->add(new GeoNameTag(cylName+std::string("PhysBackward")));
 	    halfLArPhysicalNeg->add(new GeoIdentifierTag(cylNumber));
 	    //	  halfLArPhysicalNeg->add(xfNeg);
@@ -910,14 +971,14 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
       }                                                                                                 //
       //--------------------------------------------------------------------------------------------------//
     }
-    
+
   }
   {
-    // ----- Presampler ------    
+    // ----- Presampler ------
     double PresamplerMother_length = 1549.0*CLHEP::mm;  // Copied from PresParameterDef.icc
     double presamplerShift = 3.*CLHEP::mm;
     BarrelPresamplerConstruction barrelPSConstruction(m_fullGeo);
-    
+
     // The "envelope" determined by the EMB should be a GeoFullPhysVol.
     GeoFullPhysVol* barrelPSPosEnvelope = barrelPSConstruction.GetPositiveEnvelope();
     GeoTransform *xfPos = new GeoTransform(HepGeom::Transform3D(HepGeom::TranslateZ3D(PresamplerMother_length+presamplerShift)));
@@ -942,11 +1003,11 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
       StatusCode status=detStore->record(sPhysVol,"PRESAMPLER_B_NEG");
       if(!status.isSuccess()) throw std::runtime_error ("Cannot store PRESAMPLER_B_NEG");
     }
-    
-  }						     
+
+  }
 
   // SCT-EC Cooling
-  IRDBRecordset_ptr cryoPconPhiSect = rdbAccess->getRecordsetPtr("CryoPconPhiSect", larVersionKey.tag(),larVersionKey.node());  
+  IRDBRecordset_ptr cryoPconPhiSect = rdbAccess->getRecordsetPtr("CryoPconPhiSect", larVersionKey.tag(),larVersionKey.node());
   for(unsigned i=0; i<cryoPconPhiSect->size(); ++i) {
     double startPhi = (*cryoPconPhiSect)[i]->getDouble("STARTPHI");
     double dPhi     = (*cryoPconPhiSect)[i]->getDouble("DPHI");
@@ -962,10 +1023,10 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
     for(unsigned int ii=0; ii<sctEcCoolingPlanes.size(); ii++) {
       iter = sctEcCoolingPlanes.find(ii);
-      
+
       if(iter==sctEcCoolingPlanes.end()) {
 	std::ostringstream stream;
-	stream << "Error in BarrelCryostatConstruction, missing plane " << ii <<" in SCT-EC cooling"; 
+	stream << "Error in BarrelCryostatConstruction, missing plane " << ii <<" in SCT-EC cooling";
 	throw std::runtime_error(stream.str().c_str());
       }
       else {
@@ -983,7 +1044,7 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
     GeoTransform* xfPos2 = new GeoTransform(HepGeom::RotateZ3D(180*CLHEP::deg));
     GeoTransform* xfNeg1 = new GeoTransform(HepGeom::RotateZ3D((180+2*centerPhi)*CLHEP::deg)*HepGeom::RotateY3D(180*CLHEP::deg));
     GeoTransform* xfNeg2 = new GeoTransform(HepGeom::RotateZ3D(2*centerPhi*CLHEP::deg)*HepGeom::RotateY3D(180*CLHEP::deg));
-    
+
     m_cryoMotherPhysical->add(xfPos1);
     m_cryoMotherPhysical->add(sctCiCoolingPhys);
     m_cryoMotherPhysical->add(xfPos2);
@@ -998,9 +1059,9 @@ GeoFullPhysVol* LArGeo::BarrelCryostatConstruction::GetEnvelope()
 
   if(rdbAccess->getChildTag("LArBarrelDM",larVersionKey.tag(),larVersionKey.node(),false)!="" && m_fullGeo) {
     // Dead material in barrel
-    BarrelDMConstruction barrelDMConstruction;
+    BarrelDMConstruction barrelDMConstruction(m_activateFT);
     barrelDMConstruction.create (m_cryoMotherPhysical);
-  }  
+  }
 
   return m_cryoMotherPhysical;
 }
diff --git a/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelDMConstruction.cxx b/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelDMConstruction.cxx
index e2ff5d82da3e71ce7518f21d4de9b82b83d8de1b..a67fe9dac8b3cc3648bde098c4e1996f9adf0f59 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelDMConstruction.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoBarrel/src/BarrelDMConstruction.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -16,7 +16,7 @@
 #include "GeoModelKernel/GeoNameTag.h"
 #include "GeoModelKernel/GeoSerialIdentifier.h"
 #include "GeoModelKernel/GeoSerialTransformer.h"
-#include "GeoModelKernel/GeoSerialDenominator.h"  
+#include "GeoModelKernel/GeoSerialDenominator.h"
 #include "GeoModelKernel/GeoXF.h"
 
 #include "GeoModelKernel/GeoTube.h"
@@ -72,15 +72,16 @@ using namespace GeoXF;
 
 
 // Constructor;
-LArGeo::BarrelDMConstruction ::BarrelDMConstruction()
+LArGeo::BarrelDMConstruction ::BarrelDMConstruction(bool ft) :
+  m_activateFT(ft)
 {
 }
 
 // Destructor:
 LArGeo::BarrelDMConstruction::~BarrelDMConstruction() {
 }
-  
-void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope) 
+
+void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 {
   // Various initializations - Detector Store, Material Manager
 
@@ -89,17 +90,10 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
     throw std::runtime_error("Error in BarrelDMConstruction, cannot access MessageSvc");
   }
-  MsgStream log(msgSvc, "BarrelDMConstruction"); 
-    
-  
-  log << MSG::INFO;
-  
-  log << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
-  log << "+                                                  +" << std::endl;
-  log << "+         Start of Barrel DM GeoModel definition   +" << std::endl;
-  log << "+                                                  +" << std::endl;
-  log << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
-    
+
+  MsgStream log(msgSvc, "BarrelDMConstruction");
+  log << MSG::DEBUG << "started" << endmsg;
+
   StoreGateSvc *detStore;
   if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
     throw std::runtime_error("Error in BarrelDMConstruction, cannot access DetectorStore");
@@ -107,14 +101,14 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 
   IGeoModelSvc *geoModel;
   IRDBAccessSvc* rdbAccess;
-  
+
   if(svcLocator->service ("GeoModelSvc",geoModel) == StatusCode::FAILURE)
     throw std::runtime_error("Error in BarrelDMConstruction, cannot access GeoModelSvc");
   if(svcLocator->service ("RDBAccessSvc",rdbAccess) == StatusCode::FAILURE)
     throw std::runtime_error("Error in BarrelDMConstruction, cannot access RDBAccessSvc");
 
   DecodeVersionKey larVersionKey(geoModel, "LAr");
-  
+
   DataHandle<StoredMaterialManager> materialManager;
   if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) {
     throw std::runtime_error("Error in BarrelDMConstruction, stored MaterialManager is not found.");
@@ -127,7 +121,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   // version of the description with hardwired numbers
   //
   // 2. LArBarrelDM-01 and -02 are dummy tags as well.
-  // 
+  //
   // 3. The first DB tag which is actually used by this code is LArBarrelDM-03
   //
   //   .... Hope that future tags will be used in a 'normal' way
@@ -147,22 +141,22 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoMaterial *matXeCO2O2 = materialManager->getMaterial("trt::XeCO2O2");
     GeoMaterial *shieldSteel = materialManager->getMaterial("shield::ShieldSteel");
     GeoMaterial *matRubber = materialManager->getMaterial("sct::Rubber");
-    
+
     // Get required elements
     GeoElement* silicon = materialManager->getElement("Silicon");
     GeoElement* oxygen = materialManager->getElement("Oxygen");
     GeoElement* hydrogen = materialManager->getElement("Hydrogen");
     GeoElement* carbon = materialManager->getElement("Carbon");
     GeoElement* copper = materialManager->getElement("Copper");
-    
-    
+
+
     // Define some custom materials - That will move to the GeomDB
     //Fiberglass
     GeoMaterial *matFiberglass = new GeoMaterial("SiO2",2.20*CLHEP::gram/CLHEP::cm3);
     matFiberglass->add(silicon,silicon->getA()/(silicon->getA()+2*oxygen->getA()));
     matFiberglass->add(oxygen,2*oxygen->getA()/(silicon->getA()+2*oxygen->getA()));
     matFiberglass->lock();
-    
+
     //Epoxy Resin
     GeoMaterial *matEpoxyResin = new GeoMaterial("Epoxy", 1.9*CLHEP::gram/CLHEP::cm3);
     matEpoxyResin->add(hydrogen,     14*hydrogen->getA()   / (14*hydrogen->getA() + 4*oxygen->getA()+ 8*carbon->getA()));
@@ -177,15 +171,15 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     matFEBBoards->add(copper, 0.28);
     matFEBBoards->add(matEpoxyResin, 0.20);
     matFEBBoards->lock();
-    
+
     //SERVICES:CABLES, TUBES ETC...//
-    
+
     //Water
     GeoMaterial *matWater = new GeoMaterial("Water", 1*CLHEP::gram/CLHEP::cm3);
     matWater->add(hydrogen,     2*hydrogen->getA()   / (2*hydrogen->getA() + 1*oxygen->getA()));
     matWater->add(oxygen,       1*oxygen->getA()     / (2*hydrogen->getA() + 1*oxygen->getA()));
     matWater->lock();
-    
+
     //InDetServices
     GeoMaterial* matLArServices = new GeoMaterial("LArServices", 4.03*CLHEP::gram/CLHEP::cm3);
     matLArServices->add(shieldSteel, 0.20);
@@ -195,74 +189,74 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     matLArServices->add(matXeCO2O2, 0.03); //new gas mixture from TRT
     matLArServices->add(matWater, 0.05);
     matLArServices->lock();
-    
+
     //----------
-    
+
     //----------- Building Front-end crates --------------------
-    
+
     GeoBox     *Pedestal = new GeoBox(71, 400.05, 248.65);
     GeoBox     *Ped1     = new GeoBox(67, 397.05, 245.65);
     GeoTube    *Ped2     = new GeoTube(0, 150, 75);
     GeoTube    *Ped3     = new GeoTube(0, 2775, 300);   //, -75*CLHEP::deg, 150*CLHEP::deg); // 0, 2775, 300, -8.2*CLHEP::deg, 16.4*CLHEP::deg)
-    
+
     //GeoLogVol  *lvped3   = new GeoLogVol("LAr::DM::PED3",Ped3,air);
     //GeoPhysVol *ped3   = new GeoPhysVol(lvped3);
     //envelope->add(ped3);
-    
+
     const GeoShape & CratePed=((*Pedestal).subtract(*Ped1).
 			       subtract((*Ped2)  <<HepGeom::TranslateY3D(-200.025)*HepGeom::RotateY3D(90*CLHEP::deg)).
 			       subtract((*Ped3)  <<HepGeom::TranslateX3D(-2815)).
 			       subtract((*Ped2)  <<HepGeom::TranslateY3D(200.025)*HepGeom::RotateY3D(90*CLHEP::deg)));
-    
-    
+
+
     GeoLogVol  *lvped   = new GeoLogVol("LAr::DM::PED",&CratePed,air);
     GeoPhysVol *pedestal   = new GeoPhysVol(lvped);
     //envelope->add(pedestal);
-    
+
     GeoBox     *Crate1   = new GeoBox(244.5, 400.05, 255.05);
     GeoBox     *Crate2   = new GeoBox(250, 396.87, 245.55);
     GeoBox     *Crate3   = new GeoBox(186.5, 3.175, 245.55);
     const GeoShape & FEBCrate=(*Crate1).subtract(*Crate2).add((*Crate3)  <<HepGeom::TranslateX3D(-6.7));
-    
-    
+
+
     GeoLogVol  *lvcrate = new GeoLogVol("LAr::DM::CRATE",&FEBCrate,alu);
     GeoPhysVol *crate   = new GeoPhysVol(lvcrate);
-    
-    
+
+
     //---------- Build Boards and Cooling plates--------
-    
+
     GeoBox     *Boxb1   = new GeoBox(205.472, 396.87, 245.55);
     GeoBox     *Boxb2   = new GeoBox(205.472, 3.175, 245.55);
     const GeoShape & BoardEnvelope= (*Boxb1).subtract(*Boxb2);
     GeoLogVol  *lvbenv = new GeoLogVol("LAr::DM::BOARDENVELOPE",&BoardEnvelope,air);
     GeoPhysVol *boardenvelope   = new GeoPhysVol(lvbenv);
-    
-    
+
+
     GeoBox     *Board   = new GeoBox(204.472, 1.0287, 244.475);
     GeoLogVol  *lvboard = new GeoLogVol("LAr::DM::FEBBOARD",Board,matFEBBoards); //Board Material go here
     GeoPhysVol *board   = new GeoPhysVol(lvboard);
-    
+
     GeoBox     *Plate1   = new GeoBox(197, 7.5, 240);
     GeoBox     *Plate2   = new GeoBox(200, 5.5, 250);
     const GeoShape & CoolPlates= (*Plate1).subtract(*Plate2);
     GeoLogVol  *lvplate = new GeoLogVol("LAr::DM::COOLPLATE",&CoolPlates,alu);
     GeoPhysVol *plate   = new GeoPhysVol(lvplate);
-    
+
     GeoBox     *BoardPannel  = new GeoBox(0.5, 9.5925, 244.475);
     GeoLogVol  *lvboardp     = new GeoLogVol("LAr::DM::BOARDPANNEL",BoardPannel,alu);
     GeoPhysVol *pannel       = new GeoPhysVol(lvboardp);
-    
+
     const unsigned int NCrates=16;
     Variable       i;
     GENFUNCTION    f = (360*CLHEP::deg/NCrates)*i;
     GENFUNCTION    f1 = (360*CLHEP::deg/NCrates)*i+315*CLHEP::deg;
     GENFUNCTION    f2 = (360*CLHEP::deg/NCrates)*i+157.5*CLHEP::deg;
     GENFUNCTION    g = i*19.685;
-    
+
     //(f=22.5|| f=45|| f=67.5|| f=180|| f=203.5|| f=225|| f=247.5|| f=270|| f=337.5|| f=360)
-    
+
     //-------------- Place volumes in envelope ----------------------------
-    
+
     //boards
     TRANSFUNCTION xfb1 = Pow(HepGeom::TranslateY3D(1.0),g)*HepGeom::TranslateY3D(19.685);
     TRANSFUNCTION xfb2 = Pow(HepGeom::TranslateY3D(1.0),-g)*HepGeom::TranslateY3D(-19.685);
@@ -270,7 +264,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *stb2 = new GeoSerialTransformer(board,&xfb2, (NCrates+3));
     boardenvelope->add(stb1);
     boardenvelope->add(stb2);
-    
+
     //coolingplates
     TRANSFUNCTION xfcp1 = Pow(HepGeom::TranslateY3D(1.0),g)*HepGeom::TranslateY3D(19.685);
     TRANSFUNCTION xfcp2 = Pow(HepGeom::TranslateY3D(1.0),-g)*HepGeom::TranslateY3D(-19.685);
@@ -278,7 +272,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *stcp2 = new GeoSerialTransformer(plate,&xfcp2, (NCrates+3));
     boardenvelope->add(stcp1);
     boardenvelope->add(stcp2);
-    
+
     //boardpannels
     TRANSFUNCTION xfp1 = Pow(HepGeom::TranslateY3D(1.0),g)*HepGeom::TranslateY3D(19.685)*HepGeom::TranslateX3D(204.972);
     TRANSFUNCTION xfp2 = Pow(HepGeom::TranslateY3D(1.0),-g)*HepGeom::TranslateY3D(-19.685)*HepGeom::TranslateX3D(204.972);
@@ -286,23 +280,23 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *stp2 = new GeoSerialTransformer(pannel,&xfp2, (NCrates+3));
     boardenvelope->add(stp1);
     boardenvelope->add(stp2);
-    
+
     //crates
-    TRANSFUNCTION xfc1 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3141.25)*HepGeom::TranslateZ3D(3135.05); 
+    TRANSFUNCTION xfc1 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3141.25)*HepGeom::TranslateZ3D(3135.05);
     TRANSFUNCTION xfc2 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3141.25)*HepGeom::TranslateZ3D(-3135.05);
     GeoSerialTransformer *stc1 = new GeoSerialTransformer(crate,&xfc1, NCrates);
     GeoSerialTransformer *stc2 = new GeoSerialTransformer(crate,&xfc2, NCrates);
     envelope->add(stc1);
     envelope->add(stc2);
-    
+
     //pedestal
-    TRANSFUNCTION xfped1 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(2825.75)*HepGeom::TranslateZ3D(3135.05); 
+    TRANSFUNCTION xfped1 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(2825.75)*HepGeom::TranslateZ3D(3135.05);
     TRANSFUNCTION xfped2 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(2825.75)*HepGeom::TranslateZ3D(-3135.05);
     GeoSerialTransformer *stped1 = new GeoSerialTransformer(pedestal,&xfped1, NCrates);
     GeoSerialTransformer *stped2 = new GeoSerialTransformer(pedestal,&xfped2, NCrates);
     envelope->add(stped1);
     envelope->add(stped2);
-    
+
     //boardenvelopes
     TRANSFUNCTION xfe1 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3180.278)*HepGeom::TranslateZ3D(3135.05);
     TRANSFUNCTION xfe2 = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3180.278)*HepGeom::TranslateZ3D(-3135.05);
@@ -310,44 +304,44 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *ste2 = new GeoSerialTransformer(boardenvelope,&xfe2, NCrates);
     envelope->add(ste1);
     envelope->add(ste2);
-    
-    
+
+
     //----------- Building envelope for Cables and Tubes --------------
-    
+
     GeoTrd   *Trd1air  = new GeoTrd(123.5, 123.5, 167, 245.43, 117.65);
     GeoTrap  *Trapair  = new GeoTrap(178.33, 39.596*CLHEP::deg, 0, 167, 53.5, 53.5, 0, 167, 123.5, 123.5, 0);
-    GeoTrd   *Trd2air  = new GeoTrd(53.5, 53.5, 280, 548, 677.5); 
-    GeoBox   *Box   = new GeoBox(280, 280, 100); 
-    
+    GeoTrd   *Trd2air  = new GeoTrd(53.5, 53.5, 280, 548, 677.5);
+    GeoBox   *Box   = new GeoBox(280, 280, 100);
+
     GeoTrd   *Trd1alu  = new GeoTrd(5, 5, 167, 245.43, 117.65);
     GeoTrap  *Trapalu  = new GeoTrap(178.33, 45.5*CLHEP::deg, 0, 167, 5, 5, 0, 167, 5, 5, 0);
     GeoTrd   *Trd2alu  = new GeoTrd(5, 5, 280, 548, 677.5);
-    
+
     HepGeom::Transform3D Cut1Box  = HepGeom::Translate3D(-295.5, 500, -473.563)*HepGeom::RotateX3D(-20*CLHEP::deg);
     HepGeom::Transform3D Cut2Box  = HepGeom::Translate3D(-295.5, -500, -473.563)*HepGeom::RotateX3D(20*CLHEP::deg);
-    
-    
-    
+
+
+
     const GeoShape & Envelopes= (*Trd1air).
       // add((*Trapair)  <<HepGeom::Translate3D(-147.5, 0, -295.25)).
-      add((*Trd2air)  <<HepGeom::Translate3D(-295.5, 0,  -1151.063)). 
+      add((*Trd2air)  <<HepGeom::Translate3D(-295.5, 0,  -1151.063)).
       subtract((*Box)  <<HepGeom::Transform3D(Cut1Box)).
       subtract((*Box)  <<HepGeom::Transform3D(Cut2Box)).
       add((*Trapair)  <<HepGeom::Translate3D(-147.5, 0, -295.25));
     GeoLogVol  *lv          = new GeoLogVol("LAr::DM::Envelopes",&Envelopes,matLArServices); // Services material go here
     GeoPhysVol *envelopes    = new GeoPhysVol(lv);
-    
+
     const GeoShape & Baseplates= (*Trd1alu).add((*Trapalu)  <<HepGeom::Translate3D(-180.5, 0, -295.25));
     GeoLogVol  *lvbis          = new GeoLogVol("LAr::DM::Baseplates",&Baseplates,alu);
     GeoPhysVol *baseplates    = new GeoPhysVol(lvbis);
-    
+
     const GeoShape & SectorPlates= ((*Trd2alu)  <<HepGeom::Translate3D(-366, 0, -1151.063)).
       subtract((*Box)  <<HepGeom::Transform3D(Cut1Box)).
       subtract((*Box)  <<HepGeom::Transform3D(Cut2Box));
     GeoLogVol  *lvbiss          = new GeoLogVol("LAr::DM::Sectorplates",&SectorPlates,alu);
     GeoPhysVol *sectorplates    = new GeoPhysVol(lvbiss);
-    
-    
+
+
     //envelopes
     TRANSFUNCTION xf3a = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateY3D(-631.63)*HepGeom::TranslateX3D(3175.44)*HepGeom::TranslateZ3D(3165.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION xf4a = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateY3D(631.63)*HepGeom::TranslateX3D(-3175.44)*HepGeom::TranslateZ3D(-3165.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg);
@@ -355,7 +349,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *st4 = new GeoSerialTransformer(envelopes,&xf4a, NCrates);
     envelope->add(st3);
     envelope->add(st4);
-    
+
     //baseplates
     TRANSFUNCTION xf3b = Pow(HepGeom::RotateZ3D(1.0),f1)*HepGeom::TranslateY3D(-631.63)*HepGeom::TranslateX3D(3175.44)*HepGeom::TranslateZ3D(3044.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION xf4b = Pow(HepGeom::RotateZ3D(1.0),(f1+22.5*CLHEP::deg))*HepGeom::TranslateY3D(631.63)*HepGeom::TranslateX3D(-3175.44)*HepGeom::TranslateZ3D(-3044.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg);
@@ -363,14 +357,14 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *st4bis = new GeoSerialTransformer(baseplates,&xf4b, (NCrates-11));
     envelope->add(st3bis);
     envelope->add(st4bis);
-    
+
     TRANSFUNCTION xf5b = Pow(HepGeom::RotateZ3D(1.0),f2)*HepGeom::TranslateY3D(-631.63)*HepGeom::TranslateX3D(3175.44)*HepGeom::TranslateZ3D(3044.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION xf6b = Pow(HepGeom::RotateZ3D(1.0),(f2-22.5*CLHEP::deg))*HepGeom::TranslateY3D(631.63)*HepGeom::TranslateX3D(-3175.44)*HepGeom::TranslateZ3D(-3044.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg);
     GeoSerialTransformer *st5bis = new GeoSerialTransformer(baseplates,&xf5b, (NCrates-11));
     GeoSerialTransformer *st6bis = new GeoSerialTransformer(baseplates,&xf6b, (NCrates-11));
     envelope->add(st5bis);
     envelope->add(st6bis);
-    
+
     //sectorplates
     TRANSFUNCTION xf3bb = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateY3D(-631.63)*HepGeom::TranslateX3D(3175.44)*HepGeom::TranslateZ3D(3044.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION xf4bb = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateY3D(631.63)*HepGeom::TranslateX3D(-3175.44)*HepGeom::TranslateZ3D(-3044.5)*HepGeom::RotateZ3D(-11.25*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg);
@@ -395,18 +389,18 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   GeoElement* hydrogen = materialManager->getElement("Hydrogen");
   GeoElement* carbon = materialManager->getElement("Carbon");
   GeoElement* copper = materialManager->getElement("Copper");
-  GeoElement* nitrogen = materialManager->getElement("Nitrogen"); 
+  GeoElement* nitrogen = materialManager->getElement("Nitrogen");
   GeoElement* fluorine = materialManager->getElement("Fluorine");
 
   // Define some custom materials - That will move to the GeomDB
 
-  
+
   //C6F14
   GeoMaterial *matC6F14 = new GeoMaterial("C6F14",1.68*CLHEP::gram/CLHEP::cm3);
   matC6F14->add(carbon,   6*carbon->getA()   / (6*carbon->getA() + 14*fluorine->getA()));
   matC6F14->add(fluorine, 14*fluorine->getA() / (6*carbon->getA() + 14*fluorine->getA()));
   matC6F14->lock();
-    
+
   //Water
   GeoMaterial *matWater = new GeoMaterial("Water", 1*CLHEP::gram/CLHEP::cm3);
   matWater->add(hydrogen,     2*hydrogen->getA()   / (2*hydrogen->getA() + 1*oxygen->getA()));
@@ -446,7 +440,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   matBoardsEnvelope->add(air, 0.0008);
   matBoardsEnvelope->add(alu,0.5109 );
   matBoardsEnvelope->lock();
-  
+
   //InDetServices !!! Provisoire !!!
   double density1 = 1.*CLHEP::gram/CLHEP::cm3;
   if (strDMTopTag=="LArBarrelDM-02") density1 = 1.7*CLHEP::gram/CLHEP::cm3;
@@ -479,7 +473,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 //     << matLArServices1->getRadLength() << " " << matLArServices1->getIntLength() << std::endl;
 //  std::cout << " -- LArServices2 density,x0,lambda " << matLArServices2->getDensity()/(g/cm3) << " "
 //     << matLArServices2->getRadLength() << " " << matLArServices2->getIntLength() << std::endl;
-  
+
   const unsigned int NCrates=16;
   const double Alfa=360*CLHEP::deg/NCrates;
   const double Enda=1155;
@@ -490,7 +484,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   const double DYc=2771.6*tan(Alfa/2);
   Variable       i;
   GENFUNCTION    f = Alfa*i;
- 
+
   ////----------- Building Front-end crates --------------------
 
 
@@ -498,42 +492,42 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   GeoBox     *Pedestal = new GeoBox(71, 383.18, 248.65);
   GeoBox     *Ped1     = new GeoBox(67, 380.18, 245.65);
   GeoTube    *Ped2     = new GeoTube(0, 150, 75);
-  GeoTube    *Ped3     = new GeoTube(0, 2775, 300);  
+  GeoTube    *Ped3     = new GeoTube(0, 2775, 300);
   const GeoShape & CratePed=((*Pedestal).subtract(*Ped1).
 			     subtract((*Ped2)  <<HepGeom::TranslateY3D(-200.025)*HepGeom::RotateY3D(90*CLHEP::deg)).
 			     subtract((*Ped3)  <<HepGeom::TranslateX3D(-2800)).
 		             subtract((*Ped2)  <<HepGeom::TranslateY3D(200.025)*HepGeom::RotateY3D(90*CLHEP::deg)));
-  
+
   GeoLogVol  *lvped   = new GeoLogVol("LAr::DM::Ped",&CratePed,alu);
   GeoPhysVol *pedestal   = new GeoPhysVol(lvped);
-			
+
   // ----- build crates -----
   GeoBox     *Crate1   = new GeoBox(244.5, 400.05, 255.05);
   GeoBox     *Crate2   = new GeoBox(250, 396.87, 245.55);
   GeoBox     *Crate3   = new GeoBox(186.5, 3.175, 245.55);
   const GeoShape & FEBCrate=(*Crate1).subtract(*Crate2).add((*Crate3)  <<HepGeom::TranslateX3D(-6.7));
-  
+
   GeoLogVol  *lvcrate = new GeoLogVol("LAr::DM::Crate",&FEBCrate,alu);
   GeoPhysVol *crate   = new GeoPhysVol(lvcrate);
-  
+
   // ----- build boardenvelopes -----
   GeoBox     *BoardEnvelope   = new GeoBox(204, 194, 244);
   GeoLogVol  *lvbenv = new GeoLogVol("LAr::DM::FEBoard",BoardEnvelope,matBoardsEnvelope);
   GeoPhysVol *boardenvelope   = new GeoPhysVol(lvbenv);
-  
-   
+
+
   //-------------- Place volumes in envelope ----------------------------
 
   //Crates
-  TRANSFUNCTION crA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3141.25)*HepGeom::TranslateZ3D(3135.05); 
+  TRANSFUNCTION crA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3141.25)*HepGeom::TranslateZ3D(3135.05);
   TRANSFUNCTION crC = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(3141.25)*HepGeom::TranslateZ3D(-3135.05);
   GeoSerialTransformer *crtA = new GeoSerialTransformer(crate,&crA, NCrates);
   GeoSerialTransformer *crtC = new GeoSerialTransformer(crate,&crC, NCrates);
   envelope->add(crtA);
   envelope->add(crtC);
-  
+
   //Pedestals
-  TRANSFUNCTION pedA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(2825.75)*HepGeom::TranslateZ3D(3135.05); 
+  TRANSFUNCTION pedA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(2825.75)*HepGeom::TranslateZ3D(3135.05);
   TRANSFUNCTION pedC = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(2825.75)*HepGeom::TranslateZ3D(-3135.05);
   GeoSerialTransformer *pedtA = new GeoSerialTransformer(pedestal,&pedA, NCrates);
   GeoSerialTransformer *pedtC = new GeoSerialTransformer(pedestal,&pedC, NCrates);
@@ -553,19 +547,19 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   envelope->add(febt1C);
   envelope->add(febt2A);
   envelope->add(febt2C);
-  
+
   ////----------- Building envelopes and support plates for Cables and Tubes --------------
- 
+
   // transforms
   GeoBox   *Box   = new GeoBox(280, 280, 100);
- 
+
   HepGeom::Transform3D Cut3Boxe  = HepGeom::Translate3D(0, 548, 711)*HepGeom::RotateX3D(-20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
   HepGeom::Transform3D Cut4Boxe  = HepGeom::Translate3D(0, -548,711)*HepGeom::RotateX3D(20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
   HepGeom::Transform3D Cut3Boxp  = HepGeom::Translate3D(0, 548, 850)*HepGeom::RotateX3D(-20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
   HepGeom::Transform3D Cut4Boxp  = HepGeom::Translate3D(0, -548,850)*HepGeom::RotateX3D(20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
 
   // ----- build base envelopes -----
-  GeoTrd   *Trd1air  = new GeoTrd(123.5, 123.5, 167, 305, 287.5); 
+  GeoTrd   *Trd1air  = new GeoTrd(123.5, 123.5, 167, 305, 287.5);
   GeoLogVol  *lvbe          = new GeoLogVol("LAr::DM::BaseEnvelopes",Trd1air,matLArServices1);
   GeoPhysVol *baseenvelopes    = new GeoPhysVol(lvbe);
 
@@ -577,7 +571,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   // ----- build sector envelopes -----
   GeoTrd   *Trdair1  = new GeoTrd(52.95, 52.95, DYa, DYb, (Endb-Enda)/2);// (52.95, 52.95, 229.7, 335.83, 269.6)
   GeoLogVol  *lvse1          = new GeoLogVol("LAr::DM::SectorEnvelopes1",Trdair1,matLArServices2);
-  GeoPhysVol *sectorenvelopes1    = new GeoPhysVol(lvse1); 
+  GeoPhysVol *sectorenvelopes1    = new GeoPhysVol(lvse1);
 
 
   GeoTrd   *Trdair2  = new GeoTrd(52.95, 52.95, DYb, DYc, (Endc-Endb)/2);//(52.95, 52.95, 335.83, 548.5, 538.2)
@@ -586,14 +580,14 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 				     subtract((*Box)  <<HepGeom::Transform3D(Cut4Boxe)));
 
   const GeoShape & SectorEnvelopes= ((SectorEnvelope).
-                                    add(SectorEnvelope  << HepGeom::TranslateY3D(-(DYb+DYc)*cos(Alfa/2)*cos(Alfa/2))*HepGeom::TranslateZ3D(-(DYb+DYc)*0.5*sin(Alfa))*HepGeom::RotateX3D(Alfa))); 
+                                    add(SectorEnvelope  << HepGeom::TranslateY3D(-(DYb+DYc)*cos(Alfa/2)*cos(Alfa/2))*HepGeom::TranslateZ3D(-(DYb+DYc)*0.5*sin(Alfa))*HepGeom::RotateX3D(Alfa)));
 
   GeoLogVol  *lvse2r          = new GeoLogVol("LAr::DM::SectorEnvelopes2r",&SectorEnvelopes,matLArServices1);
   GeoPhysVol *sectorenvelopes2r    = new GeoPhysVol(lvse2r);  // for right-handed splice boxes sideA
-  
+
   GeoLogVol  *lvse2l          = new GeoLogVol("LAr::DM::SectorEnvelopes2l",&SectorEnvelopes,matLArServices1);
   GeoPhysVol *sectorenvelopes2l    = new GeoPhysVol(lvse2l);  // for left-handed splice boxes
-  
+
   GeoLogVol  *lvse2          = new GeoLogVol("LAr::DM::SectorEnvelopes2",&SectorEnvelopes,matLArServices1);
   GeoPhysVol *sectorenvelopes2    = new GeoPhysVol(lvse2);  // no splice boxes
 
@@ -603,10 +597,10 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   GeoPhysVol *baseplates    = new GeoPhysVol(lvbp);
 
   // ----- build bridge plates -----
-  GeoTrap  *Trapalu  = new GeoTrap(201.70, 49.92*CLHEP::deg, 0, 160, 5, 5, 0, 160, 5, 5, 0); 
+  GeoTrap  *Trapalu  = new GeoTrap(201.70, 49.92*CLHEP::deg, 0, 160, 5, 5, 0, 160, 5, 5, 0);
   GeoLogVol  *lvbrp          = new GeoLogVol("LAr::DM::BridgePlates",Trapalu,alu);
   GeoPhysVol *bridgeplates    = new GeoPhysVol(lvbrp);
-  
+
 
   // ----- build sector plates -----
   GeoTrd   *Trd2alu  = new GeoTrd(5, 5, 280, 548, 677.5);
@@ -617,30 +611,30 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   GeoPhysVol *sectorplates    = new GeoPhysVol(lvsp);
 
   //---------- Build Splice boxes for InDet optical fibers--------
-   
+
   GeoTrap  *GeoTrap1  = new GeoTrap(237.5, 0, 0, 307, 47.5, 47.5, 0, 259.17, 47.5, 47.5, 0);
-  GeoBox   *Box1   = new GeoBox(50, 244.80, 150);  
+  GeoBox   *Box1   = new GeoBox(50, 244.80, 150);
   const GeoShape & SpliceBox = ((*GeoTrap1).
 				subtract(*Box1 << HepGeom::TranslateZ3D(193.88)*HepGeom::TranslateY3D(-223.49)*HepGeom::RotateX3D(41.592*CLHEP::deg)));
 
   GeoTransform *xtr = new GeoTransform (HepGeom::TranslateZ3D(39.57)*HepGeom::TranslateY3D(-452.12)*HepGeom::TranslateX3D(5.40)*HepGeom::RotateX3D(191.25*CLHEP::deg));
   sectorenvelopes2r->add(xtr);
-  GeoLogVol  *lvspbr     = new GeoLogVol("LAr::DM::SPliceBoxr",&SpliceBox,alu); 
+  GeoLogVol  *lvspbr     = new GeoLogVol("LAr::DM::SPliceBoxr",&SpliceBox,alu);
   GeoPhysVol *spliceboxr       = new GeoPhysVol(lvspbr);
   sectorenvelopes2r->add(spliceboxr);
-  
+
   GeoTransform *xtl = new GeoTransform (HepGeom::TranslateZ3D(39.57)*HepGeom::TranslateY3D(-452.12)*HepGeom::TranslateX3D(5.40)*HepGeom::RotateY3D(-180*CLHEP::deg)*HepGeom::RotateX3D(-(Alfa/2)));
   sectorenvelopes2l->add(xtl);
-  GeoLogVol  *lvspbl     = new GeoLogVol("LAr::DM::SpliceBoxl",&SpliceBox,alu);  
+  GeoLogVol  *lvspbl     = new GeoLogVol("LAr::DM::SpliceBoxl",&SpliceBox,alu);
   GeoPhysVol *spliceboxl       = new GeoPhysVol(lvspbl);
   sectorenvelopes2l->add(spliceboxl);
-  
-  
+
+
   ////
   GeoTrd   *Trd1  = new GeoTrd(44.5, 44.5, 0, 214.72, 94.20);
   GeoTrap  *GeoTrap2  = new GeoTrap(149, 0, 0, 126.215, 44.5, 44.5, 0, 95, 44.5, 44.5, 0);
   GeoTrap  *GeoTrap3  = new GeoTrap(72, 0, 0, 294.5, 44.5, 44.5, 0, 279.396, 44.5, 44.5, 0);
-  
+
   GeoTransform *xt1 = new GeoTransform (HepGeom::TranslateY3D(-53)*HepGeom::RotateX3D(42.25*CLHEP::deg));
   spliceboxr->add(xt1);
   spliceboxl->add(xt1);
@@ -648,7 +642,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   GeoPhysVol *tbox1       = new GeoPhysVol(lt1);
   spliceboxr->add(tbox1);
   spliceboxl->add(tbox1);
-  
+
   GeoTransform *xt2 = new GeoTransform (HepGeom::TranslateZ3D(78)*HepGeom::TranslateY3D(154));
   spliceboxr->add(xt2);
   spliceboxl->add(xt2);
@@ -656,8 +650,8 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   GeoPhysVol *tbox2       = new GeoPhysVol(lt2);
   spliceboxr->add(tbox2);
   spliceboxl->add(tbox2);
-  
-  GeoTransform *xt3 = new GeoTransform (HepGeom::TranslateZ3D(-155.81)); 
+
+  GeoTransform *xt3 = new GeoTransform (HepGeom::TranslateZ3D(-155.81));
   spliceboxr->add(xt3);
   spliceboxl->add(xt3);
   GeoLogVol  *lt3     = new GeoLogVol("LAr::DM::TBox3",GeoTrap3,air);
@@ -667,7 +661,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 
 
   //-------------- Place volumes in LAr Envelope -------------------
- 
+
   //sectorPlates
   TRANSFUNCTION spA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(2095)*HepGeom::TranslateZ3D(3410.1)*HepGeom::RotateY3D(90*CLHEP::deg);
   TRANSFUNCTION spC = Pow(HepGeom::RotateZ3D(1.0),f+(Alfa/2))*HepGeom::TranslateX3D(2095)*HepGeom::TranslateZ3D(-3410.1)*HepGeom::RotateY3D(90*CLHEP::deg);
@@ -678,7 +672,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 
   //bridgePlates
   TRANSFUNCTION brpA1 = Pow(HepGeom::RotateZ3D(1.0),f-(5*Alfa/2))*HepGeom::TranslateX3D(2974.5)*HepGeom::TranslateZ3D(3170.1)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg);
-  TRANSFUNCTION brpA2 = Pow(HepGeom::RotateZ3D(1.0),f+(13*Alfa/2))*HepGeom::TranslateX3D(2974.5)*HepGeom::TranslateZ3D(3170.1)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg); 
+  TRANSFUNCTION brpA2 = Pow(HepGeom::RotateZ3D(1.0),f+(13*Alfa/2))*HepGeom::TranslateX3D(2974.5)*HepGeom::TranslateZ3D(3170.1)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg);
   TRANSFUNCTION brpC1 = Pow(HepGeom::RotateZ3D(1.0),f-(5*Alfa/2))*HepGeom::TranslateX3D(2974.5)*HepGeom::TranslateZ3D(-3170.1)*HepGeom::RotateZ3D(-90*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg)*HepGeom::RotateX3D(-90*CLHEP::deg);
   TRANSFUNCTION brpC2 = Pow(HepGeom::RotateZ3D(1.0),f+(13*Alfa/2))*HepGeom::TranslateX3D(2974.5)*HepGeom::TranslateZ3D(-3170.1)*HepGeom::RotateZ3D(-90*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg)*HepGeom::RotateX3D(-90*CLHEP::deg);   GeoSerialTransformer *brptA1 = new GeoSerialTransformer(bridgeplates,&brpA1, 5);
   GeoSerialTransformer *brptA2 = new GeoSerialTransformer(bridgeplates,&brpA2, 5);
@@ -690,7 +684,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   envelope->add(brptC2);
 
   //basePlates
-  TRANSFUNCTION bpA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(3464)*HepGeom::TranslateZ3D(2930.6)*HepGeom::RotateY3D(90*CLHEP::deg); 
+  TRANSFUNCTION bpA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(3464)*HepGeom::TranslateZ3D(2930.6)*HepGeom::RotateY3D(90*CLHEP::deg);
   TRANSFUNCTION bpC = Pow(HepGeom::RotateZ3D(1.0),f+(Alfa/2))*HepGeom::TranslateX3D(3464)*HepGeom::TranslateZ3D(-2930.6)*HepGeom::RotateY3D(90*CLHEP::deg);
   GeoSerialTransformer *bptA = new GeoSerialTransformer(baseplates,&bpA, NCrates);
   GeoSerialTransformer *bptC = new GeoSerialTransformer(baseplates,&bpC, NCrates);
@@ -702,9 +696,9 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   TRANSFUNCTION seC1 = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D((Endb+Enda)/2)*HepGeom::TranslateZ3D(-3468.05)*HepGeom::RotateY3D(90*CLHEP::deg);
   GeoSerialTransformer *setA1 = new GeoSerialTransformer(sectorenvelopes1,&seA1, NCrates);
   GeoSerialTransformer *setC1 = new GeoSerialTransformer(sectorenvelopes1,&seC1, NCrates);
-  envelope->add(setA1); 
+  envelope->add(setA1);
   envelope->add(setC1);
-  
+
   TRANSFUNCTION seA2r = Pow(HepGeom::RotateZ3D(1.0),8*f-(3*Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(3468.05)*HepGeom::RotateY3D(90*CLHEP::deg);
   TRANSFUNCTION seA2l = Pow(HepGeom::RotateZ3D(1.0),8*f+(5*Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(3468.05)*HepGeom::RotateY3D(90*CLHEP::deg);
   TRANSFUNCTION seA2 = Pow(HepGeom::RotateZ3D(1.0),4*f+(Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(3468.05)*HepGeom::RotateY3D(90*CLHEP::deg);
@@ -733,14 +727,14 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   envelope->add(bretC);
 
   //baseEnvelopes
-  TRANSFUNCTION beA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(3464)*HepGeom::TranslateZ3D(3059.2)*HepGeom::RotateY3D(90*CLHEP::deg); 
+  TRANSFUNCTION beA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(3464)*HepGeom::TranslateZ3D(3059.2)*HepGeom::RotateY3D(90*CLHEP::deg);
   TRANSFUNCTION beC = Pow(HepGeom::RotateZ3D(1.0),f+(Alfa/2))*HepGeom::TranslateX3D(3464)*HepGeom::TranslateZ3D(-3059.2)*HepGeom::RotateY3D(90*CLHEP::deg);
   GeoSerialTransformer *betA = new GeoSerialTransformer(baseenvelopes,&beA, NCrates);
   GeoSerialTransformer *betC = new GeoSerialTransformer(baseenvelopes,&beC, NCrates);
   envelope->add(betA);
   envelope->add(betC);
 
-  
+
   // GeoMaterial::add(GeoMaterial*) does not take ownership of the
   // material passed as a parameter.  Thus, something like
   //   mat1* = new GeoMaterial (...);
@@ -756,7 +750,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
   matEpoxyResin->ref();  matEpoxyResin->unref();
   matFiberglass->ref();  matFiberglass->unref();
   matN2->ref();          matN2->unref();
-  } 
+  }
   else
   {
     // Use Geometry Database
@@ -766,33 +760,33 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     IRDBRecordset_ptr BarrelDMTubes = rdbAccess->getRecordsetPtr("BarrelDMTubes",keyLAr.tag(),keyLAr.node());
     IRDBRecordset_ptr BarrelDMBoxes = rdbAccess->getRecordsetPtr("BarrelDMBoxes",keyLAr.tag(),keyLAr.node());
 
-    std::map<std::string, unsigned int> tubeMap;  
-    for (unsigned int i=0; i<BarrelDMTubes->size(); i++)     
+    std::map<std::string, unsigned int> tubeMap;
+    for (unsigned int i=0; i<BarrelDMTubes->size(); i++)
     {
       std::string key = (*BarrelDMTubes)[i]->getString("TUBENAME");
       tubeMap[key] = i;
     }
-    std::map<std::string, unsigned int> boxMap;  
-    for (unsigned int j=0; j<BarrelDMBoxes->size(); j++)     
+    std::map<std::string, unsigned int> boxMap;
+    for (unsigned int j=0; j<BarrelDMBoxes->size(); j++)
     {
       std::string key = (*BarrelDMBoxes)[j]->getString("BOXNAME");
       boxMap[key] = j;
     }
-    std::map<std::string, unsigned int> trdMap;  
-    for (unsigned int k=0; k<BarrelDMTrds->size(); k++)     
+    std::map<std::string, unsigned int> trdMap;
+    for (unsigned int k=0; k<BarrelDMTrds->size(); k++)
     {
       std::string key = (*BarrelDMTrds)[k]->getString("TRDNAME");
       trdMap[key] = k;
     }
-    std::map<std::string, unsigned int> trapMap;  
-    for (unsigned int l=0; l<BarrelDMTraps->size(); l++)     
+    std::map<std::string, unsigned int> trapMap;
+    for (unsigned int l=0; l<BarrelDMTraps->size(); l++)
     {
       std::string key = (*BarrelDMTraps)[l]->getString("TRAPNAME");
       trapMap[key] = l;
     }
 
     unsigned int recordIndex;
-    
+
     // Get materials
     GeoMaterial *air               = materialManager->getMaterial("std::Air"); //0.001214 CLHEP::g/CLHEP::cm3
     GeoMaterial *alu               = materialManager->getMaterial("std::Aluminium"); //2.7 CLHEP::g/CLHEP::cm3
@@ -807,7 +801,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoMaterial* matLArServices8   = materialManager->getMaterial("LAr::LArServices8");// 1.070*CLHEP::gram/CLHEP::cm3
     GeoMaterial* matLArServices9   = materialManager->getMaterial("LAr::LArServices9");// 1.020*CLHEP::gram/CLHEP::cm3
     GeoMaterial* matLArServices10  = materialManager->getMaterial("LAr::LArServices10");// 0.995*CLHEP::gram/CLHEP::cm3
-    GeoMaterial* matLArServices11  = materialManager->getMaterial("LAr::LArServices11");// 0.835*CLHEP::gram/CLHEP::cm3 
+    GeoMaterial* matLArServices11  = materialManager->getMaterial("LAr::LArServices11");// 0.835*CLHEP::gram/CLHEP::cm3
     GeoMaterial* matLArServices12  = materialManager->getMaterial("LAr::LArServices12");// 0.640*CLHEP::gram/CLHEP::cm3
     GeoMaterial* matLArServices13  = materialManager->getMaterial("LAr::LArServices13");// 0.690*CLHEP::gram/CLHEP::cm3
     GeoMaterial* matLArServices14  = materialManager->getMaterial("LAr::LArServices14");// 0.825*CLHEP::gram/CLHEP::cm3
@@ -829,7 +823,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     const double DYc=2771.6*tan(Alfa/2);
     Variable       i;
     GENFUNCTION    f = Alfa*i;
-    
+
     ////----------- Building Front-end crates --------------------
 
     recordIndex = tubeMap["Ped2"];
@@ -842,7 +836,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     double ped3minr = (*BarrelDMTubes)[recordIndex]->getDouble("MINR");
     double ped3maxr = (*BarrelDMTubes)[recordIndex]->getDouble("MAXR");
     double ped3xtr = (*BarrelDMTubes)[recordIndex]->getDouble("XTR");
-    
+
     recordIndex = boxMap["Pedest"];
     double pedesthlen = (*BarrelDMBoxes)[recordIndex]->getDouble("HLEN");
     double pedesthwdt = (*BarrelDMBoxes)[recordIndex]->getDouble("HWDT");
@@ -890,52 +884,52 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     double SplBoxytr = (*BarrelDMBoxes)[recordIndex]->getDouble("YTR");
     double SplBoxztr = (*BarrelDMBoxes)[recordIndex]->getDouble("ZTR");
     double SplBoxxrot = (*BarrelDMBoxes)[recordIndex]->getDouble("XROT");
-  
+
     // ----- build pedestal -----
     GeoBox     *Pedestal = new GeoBox(pedesthlen, pedesthwdt, pedesthhgt);
     GeoBox     *Ped1     = new GeoBox(ped1hlen, ped1hwdt, ped1hhgt);
     GeoTube    *Ped2     = new GeoTube(ped2minr, ped2maxr, ped2zhlen);
-    GeoTube    *Ped3     = new GeoTube(ped3minr,ped3maxr , ped3zhlen);  
+    GeoTube    *Ped3     = new GeoTube(ped3minr,ped3maxr , ped3zhlen);
     const GeoShape & CratePed=((*Pedestal).subtract(*Ped1).
 			       subtract((*Ped2)  <<HepGeom::TranslateY3D(-ped2ytr)*HepGeom::RotateY3D(90*CLHEP::deg)).
 			       subtract((*Ped3)  <<HepGeom::TranslateX3D(-ped3xtr)).
 			       subtract((*Ped2)  <<HepGeom::TranslateY3D(ped2ytr)*HepGeom::RotateY3D(90*CLHEP::deg)));
-  
+
     GeoLogVol  *lvped   = new GeoLogVol("LAr::DM::Ped",&CratePed,alu);
     GeoPhysVol *pedestal   = new GeoPhysVol(lvped);
-    
+
     // ----- build crates -----
     GeoBox     *Crate1   = new GeoBox(crate1hlen, crate1hwdt, crate1hhgt);
     GeoBox     *Crate2   = new GeoBox(crate2hlen, crate2hwdt, crate2hhgt);
     GeoBox     *Crate3   = new GeoBox(crate3hlen, crate3hwdt, crate3hhgt);
     const GeoShape & FEBCrate=(*Crate1).subtract(*Crate2).add((*Crate3)  <<HepGeom::TranslateX3D(-crate3xtr));
-    
+
     GeoLogVol  *lvcrate = new GeoLogVol("LAr::DM::Crate",&FEBCrate,alu);
     GeoPhysVol *crate   = new GeoPhysVol(lvcrate);
-    
+
     // ----- build boardenvelopes -----
     GeoBox     *BoardEnvelope   = new GeoBox(BoardEhlen, BoardEhwdt, BoardEhhgt);
     GeoLogVol  *lvbenv = new GeoLogVol("LAr::DM::FEBoard",BoardEnvelope,matBoardsEnvelope);
     GeoPhysVol *boardenvelope   = new GeoPhysVol(lvbenv);
-    
+
     //-------------- Place volumes in envelope ----------------------------
-    
+
     //Crates
-    TRANSFUNCTION crA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(crate1xtr)*HepGeom::TranslateZ3D(crate1ztr); 
+    TRANSFUNCTION crA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(crate1xtr)*HepGeom::TranslateZ3D(crate1ztr);
     TRANSFUNCTION crC = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(crate1xtr)*HepGeom::TranslateZ3D(-crate1ztr);
     GeoSerialTransformer *crtA = new GeoSerialTransformer(crate,&crA, NCrates);
     GeoSerialTransformer *crtC = new GeoSerialTransformer(crate,&crC, NCrates);
     envelope->add(crtA);
     envelope->add(crtC);
-    
+
     //Pedestals
-    TRANSFUNCTION pedA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(pedestxtr)*HepGeom::TranslateZ3D(pedestztr); 
+    TRANSFUNCTION pedA = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(pedestxtr)*HepGeom::TranslateZ3D(pedestztr);
     TRANSFUNCTION pedC = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateX3D(pedestxtr)*HepGeom::TranslateZ3D(-pedestztr);
     GeoSerialTransformer *pedtA = new GeoSerialTransformer(pedestal,&pedA, NCrates);
     GeoSerialTransformer *pedtC = new GeoSerialTransformer(pedestal,&pedC, NCrates);
     envelope->add(pedtA);
     envelope->add(pedtC);
-    
+
     //FEBoards
     TRANSFUNCTION feb1A = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateY3D(BoardEytr)*HepGeom::TranslateX3D(BoardExtr)*HepGeom::TranslateZ3D(BoardEztr);
     TRANSFUNCTION feb2A = Pow(HepGeom::RotateZ3D(1.0),f)*HepGeom::TranslateY3D(-BoardEytr)*HepGeom::TranslateX3D(BoardExtr)*HepGeom::TranslateZ3D(BoardEztr);
@@ -949,7 +943,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     envelope->add(febt1C);
     envelope->add(febt2A);
     envelope->add(febt2C);
-    
+
     ////----------- Building envelopes and support plates for Cables and Tubes --------------
     recordIndex = trdMap["SecP"];
     double SecPxhlen1 = (*BarrelDMTrds)[recordIndex]->getDouble("XHLEN1");
@@ -1065,14 +1059,14 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 
     // transforms
     GeoBox   *Box   = new GeoBox(Boxhlen, Boxhwdt, Boxhhgt);
- 
+
     HepGeom::Transform3D Cut3Boxe  = HepGeom::Translate3D(Boxxtr, Boxytr, Boxztr)*HepGeom::RotateX3D(-20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     HepGeom::Transform3D Cut4Boxe  = HepGeom::Translate3D(Boxxtr, -Boxytr,Boxztr)*HepGeom::RotateX3D(20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     HepGeom::Transform3D Cut3Boxp  = HepGeom::Translate3D(Boxxtr, Boxytr, Boxxrot)*HepGeom::RotateX3D(-20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
     HepGeom::Transform3D Cut4Boxp  = HepGeom::Translate3D(Boxxtr, -Boxytr,Boxxrot)*HepGeom::RotateX3D(20*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg);
-    
+
     // ----- build base envelopes -----
-    GeoTrd   *Trd1air  = new GeoTrd(BaseExhlen1, BaseExhlen2, BaseEyhlen1, BaseEyhlen2, BaseEzhlen); 
+    GeoTrd   *Trd1air  = new GeoTrd(BaseExhlen1, BaseExhlen2, BaseEyhlen1, BaseEyhlen2, BaseEzhlen);
     GeoLogVol  *lvbe          = new GeoLogVol("LAr::DM::BaseEnvelopes",Trd1air,matLArServices8); //In the end Density at least >= than SE1 because of Cryo Pipes
     GeoPhysVol *baseenvelopes    = new GeoPhysVol(lvbe);
 
@@ -1084,56 +1078,56 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     // ----- build sector envelopes -----
     // build 16 instances of SectorEnvelopes1 each with its own material!
     GeoTrd   *Trdair1  = new GeoTrd(SecE1xhlen1, SecE1xhlen2, DYa, DYb, (Endb-Enda)/2);
-    
+
     GeoLogVol  *lvse1g1          = new GeoLogVol("LAr::DM::SectorEnvelopes1g1",Trdair1,matLArServices1);
-    GeoPhysVol *sectorenvelopes1g1    = new GeoPhysVol(lvse1g1); 
-    
+    GeoPhysVol *sectorenvelopes1g1    = new GeoPhysVol(lvse1g1);
+
     GeoLogVol  *lvse1g2          = new GeoLogVol("LAr::DM::SectorEnvelopes1g3",Trdair1,matLArServices2);
-    GeoPhysVol *sectorenvelopes1g2    = new GeoPhysVol(lvse1g2); 
-    
+    GeoPhysVol *sectorenvelopes1g2    = new GeoPhysVol(lvse1g2);
+
     GeoLogVol  *lvse1g3          = new GeoLogVol("LAr::DM::SectorEnvelopes1g3",Trdair1,matLArServices3);
-    GeoPhysVol *sectorenvelopes1g3    = new GeoPhysVol(lvse1g3); 
-    
+    GeoPhysVol *sectorenvelopes1g3    = new GeoPhysVol(lvse1g3);
+
     GeoLogVol  *lvse1g4          = new GeoLogVol("LAr::DM::SectorEnvelopes1g4",Trdair1,matLArServices4);
     GeoPhysVol *sectorenvelopes1g4    = new GeoPhysVol(lvse1g4);
-    
+
     GeoLogVol  *lvse1g5          = new GeoLogVol("LAr::DM::SectorEnvelopes1g5",Trdair1,matLArServices5);
-    GeoPhysVol *sectorenvelopes1g5    = new GeoPhysVol(lvse1g5); 
-    
+    GeoPhysVol *sectorenvelopes1g5    = new GeoPhysVol(lvse1g5);
+
     GeoLogVol  *lvse1g6          = new GeoLogVol("LAr::DM::SectorEnvelopes1g6",Trdair1,matLArServices6);
-    GeoPhysVol *sectorenvelopes1g6    = new GeoPhysVol(lvse1g6); 
-    
+    GeoPhysVol *sectorenvelopes1g6    = new GeoPhysVol(lvse1g6);
+
     GeoLogVol  *lvse1g7          = new GeoLogVol("LAr::DM::SectorEnvelopes1g7",Trdair1,matLArServices7);
-    GeoPhysVol *sectorenvelopes1g7    = new GeoPhysVol(lvse1g7); 
-    
+    GeoPhysVol *sectorenvelopes1g7    = new GeoPhysVol(lvse1g7);
+
     GeoLogVol  *lvse1g8          = new GeoLogVol("LAr::DM::SectorEnvelopes1g8",Trdair1,matLArServices8);
-    GeoPhysVol *sectorenvelopes1g8    = new GeoPhysVol(lvse1g8); 
-    
+    GeoPhysVol *sectorenvelopes1g8    = new GeoPhysVol(lvse1g8);
+
     GeoLogVol  *lvse1g9          = new GeoLogVol("LAr::DM::SectorEnvelopes1g9",Trdair1,matLArServices9);
-    GeoPhysVol *sectorenvelopes1g9    = new GeoPhysVol(lvse1g9); 
-    
+    GeoPhysVol *sectorenvelopes1g9    = new GeoPhysVol(lvse1g9);
+
     GeoLogVol  *lvse1g10          = new GeoLogVol("LAr::DM::SectorEnvelopes1g10",Trdair1,matLArServices10);
-    GeoPhysVol *sectorenvelopes1g10    = new GeoPhysVol(lvse1g10); 
-    
+    GeoPhysVol *sectorenvelopes1g10    = new GeoPhysVol(lvse1g10);
+
     GeoLogVol  *lvse1g11          = new GeoLogVol("LAr::DM::SectorEnvelopes1g11",Trdair1,matLArServices11);
-    GeoPhysVol *sectorenvelopes1g11    = new GeoPhysVol(lvse1g11); 
-    
+    GeoPhysVol *sectorenvelopes1g11    = new GeoPhysVol(lvse1g11);
+
     GeoLogVol  *lvse1g12          = new GeoLogVol("LAr::DM::SectorEnvelopes1g12",Trdair1,matLArServices12);
-    GeoPhysVol *sectorenvelopes1g12    = new GeoPhysVol(lvse1g12); 
-    
+    GeoPhysVol *sectorenvelopes1g12    = new GeoPhysVol(lvse1g12);
+
     GeoLogVol  *lvse1g13          = new GeoLogVol("LAr::DM::SectorEnvelopes1g13",Trdair1,matLArServices13);
-    GeoPhysVol *sectorenvelopes1g13    = new GeoPhysVol(lvse1g13); 
-    
+    GeoPhysVol *sectorenvelopes1g13    = new GeoPhysVol(lvse1g13);
+
     GeoLogVol  *lvse1g14          = new GeoLogVol("LAr::DM::SectorEnvelopes1g14",Trdair1,matLArServices14);
-    GeoPhysVol *sectorenvelopes1g14    = new GeoPhysVol(lvse1g14); 
-    
+    GeoPhysVol *sectorenvelopes1g14    = new GeoPhysVol(lvse1g14);
+
     GeoLogVol  *lvse1g15          = new GeoLogVol("LAr::DM::SectorEnvelopes1g15",Trdair1,matLArServices15);
-    GeoPhysVol *sectorenvelopes1g15    = new GeoPhysVol(lvse1g15); 
-    
+    GeoPhysVol *sectorenvelopes1g15    = new GeoPhysVol(lvse1g15);
+
     GeoLogVol  *lvse1g16          = new GeoLogVol("LAr::DM::SectorEnvelopes1g16",Trdair1,matLArServices16);
-    GeoPhysVol *sectorenvelopes1g16    = new GeoPhysVol(lvse1g16); 
-    
-    
+    GeoPhysVol *sectorenvelopes1g16    = new GeoPhysVol(lvse1g16);
+
+
     std::vector<GeoPhysVol*> se1List;
     se1List.push_back(sectorenvelopes1g1);
     se1List.push_back(sectorenvelopes1g2);
@@ -1224,43 +1218,43 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
       }
     }
 
-    
+
     // build 5 instances of SectorEnvelopes1 with 3 different materials!
     GeoTrd   *Trdair2  = new GeoTrd(SecE2xhlen1, SecE2xhlen2, DYb, DYc, (Endc-Endb)/2);
     const GeoShape & SectorEnvelope= ((*Trdair2).
 				      subtract((*Box)  <<HepGeom::Transform3D(Cut3Boxe)).
 				      subtract((*Box)  <<HepGeom::Transform3D(Cut4Boxe)));
-    
+
     const GeoShape & SectorEnvelopes= ((SectorEnvelope).
-				       add(SectorEnvelope  << HepGeom::TranslateY3D(-(DYb+DYc)*cos(Alfa/2)*cos(Alfa/2))*HepGeom::TranslateZ3D(-(DYb+DYc)*0.5*sin(Alfa))*HepGeom::RotateX3D(Alfa))); 
-    
+				       add(SectorEnvelope  << HepGeom::TranslateY3D(-(DYb+DYc)*cos(Alfa/2)*cos(Alfa/2))*HepGeom::TranslateZ3D(-(DYb+DYc)*0.5*sin(Alfa))*HepGeom::RotateX3D(Alfa)));
+
     GeoLogVol  *lvse2r          = new GeoLogVol("LAr::DM::SectorEnvelopes2r",&SectorEnvelopes,matLArServices20);
-    GeoPhysVol *sectorenvelopes2r    = new GeoPhysVol(lvse2r);  // for right-handed splice boxes 
-    
+    GeoPhysVol *sectorenvelopes2r    = new GeoPhysVol(lvse2r);  // for right-handed splice boxes
+
     GeoLogVol  *lvse2l          = new GeoLogVol("LAr::DM::SectorEnvelopes2l",&SectorEnvelopes,matLArServices20);
     GeoPhysVol *sectorenvelopes2l    = new GeoPhysVol(lvse2l);  // for left-handed splice boxes
-    
+
     GeoLogVol  *lvse2h          = new GeoLogVol("LAr::DM::SectorEnvelopes2h",&SectorEnvelopes,matLArServices19);
     GeoPhysVol *sectorenvelopes2h    = new GeoPhysVol(lvse2h);  // no splice boxes horizontal at 0 & 180 CLHEP::deg.
-    
+
     GeoLogVol  *lvse2vup          = new GeoLogVol("LAr::DM::SectorEnvelopes2vup",&SectorEnvelopes,matLArServices17);
     GeoPhysVol *sectorenvelopes2vup    = new GeoPhysVol(lvse2vup);  // no splice boxes vertical up at 90 CLHEP::deg
-    
+
     GeoLogVol  *lvse2vd          = new GeoLogVol("LAr::DM::SectorEnvelopes2Vd",&SectorEnvelopes,matLArServices18);
     GeoPhysVol *sectorenvelopes2vd    = new GeoPhysVol(lvse2vd);  // no splice boxes vertical down at 270 CLHEP::deg
-    
-    
+
+
     // ----- build base plates -----
     GeoTrd   *Trd1alu  = new GeoTrd(BasePxhlen1, BasePxhlen2, BasePyhlen1, BasePyhlen2, BasePzhlen);
     GeoLogVol  *lvbp          = new GeoLogVol("LAr::DM::BasePlates",Trd1alu,alu);
     GeoPhysVol *baseplates    = new GeoPhysVol(lvbp);
-    
+
     // ----- build bridge plates -----
-    GeoTrap  *Trapalu  = new GeoTrap(BridgePzhlen, BridgePtheta*CLHEP::deg, BridgePphi, BridgePyzn, BridgePxynzn, BridgePxypzn, BridgePangn, BridgePyzp, BridgePxynzp, BridgePxypzp, BridgePangp); 
+    GeoTrap  *Trapalu  = new GeoTrap(BridgePzhlen, BridgePtheta*CLHEP::deg, BridgePphi, BridgePyzn, BridgePxynzn, BridgePxypzn, BridgePangn, BridgePyzp, BridgePxynzp, BridgePxypzp, BridgePangp);
     GeoLogVol  *lvbrp          = new GeoLogVol("LAr::DM::BridgePlates",Trapalu,alu);
     GeoPhysVol *bridgeplates    = new GeoPhysVol(lvbrp);
-    
-    
+
+
     // ----- build sector plates -----
     GeoTrd   *Trd2alu  = new GeoTrd(SecPxhlen1, SecPxhlen2, SecPyhlen1, SecPyhlen2, SecPzhlen );///
     const GeoShape & SectorPlates= ((*Trd2alu).
@@ -1268,31 +1262,31 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 				    subtract((*Box)  <<HepGeom::Transform3D(Cut4Boxp)));
     GeoLogVol  *lvsp          = new GeoLogVol("LAr::DM::SectorPlates",&SectorPlates,alu);
     GeoPhysVol *sectorplates    = new GeoPhysVol(lvsp);
-    
+
     //---------- Build Splice boxes for InDet optical fibers--------
-    
+
     GeoTrap  *GeoTrap1  = new GeoTrap(Spb1zhlen, Spb1theta, Spb1phi, Spb1yzn, Spb1xynzn, Spb1xypzn, Spb1angn, Spb1yzp, Spb1xynzp, Spb1xypzp, Spb1angp);
-    GeoBox   *Box1   = new GeoBox(SplBoxhlen, SplBoxhwdt, SplBoxhhgt);  
+    GeoBox   *Box1   = new GeoBox(SplBoxhlen, SplBoxhwdt, SplBoxhhgt);
     const GeoShape & SpliceBox = ((*GeoTrap1).
 				  subtract(*Box1 << HepGeom::TranslateZ3D(SplBoxztr)*HepGeom::TranslateY3D(-SplBoxytr)*HepGeom::RotateX3D(SplBoxxrot*CLHEP::deg)));
-    
+
     GeoTransform *xtr = new GeoTransform (HepGeom::TranslateZ3D(Spb1ztr)*HepGeom::TranslateY3D(-Spb1ytr)*HepGeom::TranslateX3D(Spb1xtr)*HepGeom::RotateX3D(Spb1xrot*CLHEP::deg));
     sectorenvelopes2r->add(xtr);
-    GeoLogVol  *lvspbr     = new GeoLogVol("LAr::DM::SPliceBoxr",&SpliceBox,alu); 
+    GeoLogVol  *lvspbr     = new GeoLogVol("LAr::DM::SPliceBoxr",&SpliceBox,alu);
     GeoPhysVol *spliceboxr       = new GeoPhysVol(lvspbr);
     sectorenvelopes2r->add(spliceboxr);
-    
+
     GeoTransform *xtl = new GeoTransform (HepGeom::TranslateZ3D(Spb1ztr)*HepGeom::TranslateY3D(-Spb1ytr)*HepGeom::TranslateX3D(Spb1xtr)*HepGeom::RotateY3D(-180*CLHEP::deg)*HepGeom::RotateX3D(-(Alfa/2)));
     sectorenvelopes2l->add(xtl);
-    GeoLogVol  *lvspbl     = new GeoLogVol("LAr::DM::SpliceBoxl",&SpliceBox,alu);  
+    GeoLogVol  *lvspbl     = new GeoLogVol("LAr::DM::SpliceBoxl",&SpliceBox,alu);
     GeoPhysVol *spliceboxl       = new GeoPhysVol(lvspbl);
     sectorenvelopes2l->add(spliceboxl);
-    
+
     ////
     GeoTrd   *Trd1  = new GeoTrd(Spb0xhlen1, Spb0xhlen2, Spb0yhlen1, Spb0yhlen2, Spb0zhlen);
     GeoTrap  *GeoTrap2  = new GeoTrap(Spb2zhlen, Spb2theta, Spb2phi, Spb2yzn, Spb2xynzn, Spb2xypzn, Spb2angn, Spb2yzp, Spb2xynzp, Spb2xypzp, Spb2angp);
     GeoTrap  *GeoTrap3  = new GeoTrap(Spb3zhlen, Spb3theta, Spb3phi, Spb3yzn, Spb3xynzn, Spb3xypzn, Spb3angn, Spb3yzp, Spb3xynzp, Spb3xypzp, Spb3angp);
-    
+
     GeoTransform *xt1 = new GeoTransform (HepGeom::TranslateY3D(-Spb0ytr)*HepGeom::RotateX3D(Spb0xrot*CLHEP::deg));
     spliceboxr->add(xt1);
     spliceboxl->add(xt1);
@@ -1300,7 +1294,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoPhysVol *tbox1       = new GeoPhysVol(lt1);
     spliceboxr->add(tbox1);
     spliceboxl->add(tbox1);
-    
+
     GeoTransform *xt2 = new GeoTransform (HepGeom::TranslateZ3D(Spb2ztr)*HepGeom::TranslateY3D(Spb2ytr));
     spliceboxr->add(xt2);
     spliceboxl->add(xt2);
@@ -1308,17 +1302,17 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoPhysVol *tbox2       = new GeoPhysVol(lt2);
     spliceboxr->add(tbox2);
     spliceboxl->add(tbox2);
-    
-    GeoTransform *xt3 = new GeoTransform (HepGeom::TranslateZ3D(-Spb3ztr)); 
+
+    GeoTransform *xt3 = new GeoTransform (HepGeom::TranslateZ3D(-Spb3ztr));
     spliceboxr->add(xt3);
     spliceboxl->add(xt3);
     GeoLogVol  *lt3     = new GeoLogVol("LAr::DM::TBox3",GeoTrap3,air);
     GeoPhysVol *tbox3       = new GeoPhysVol(lt3);
     spliceboxr->add(tbox3);
     spliceboxl->add(tbox3);
-    
+
     //-------------- Place volumes in LAr Envelope -------------------
-    
+
     //sectorPlates
     TRANSFUNCTION spA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(SecPxtr)*HepGeom::TranslateZ3D(SecPztr)*HepGeom::RotateY3D(90*CLHEP::deg);///
     TRANSFUNCTION spC = Pow(HepGeom::RotateZ3D(1.0),f+(Alfa/2))*HepGeom::TranslateX3D(SecPxtr)*HepGeom::TranslateZ3D(-SecPztr)*HepGeom::RotateY3D(90*CLHEP::deg);///
@@ -1326,10 +1320,10 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *sptC = new GeoSerialTransformer(sectorplates,&spC, NCrates);
     envelope->add(sptA);
     envelope->add(sptC);
-    
+
     //bridgePlates
     TRANSFUNCTION brpA1 = Pow(HepGeom::RotateZ3D(1.0),f-(5*Alfa/2))*HepGeom::TranslateX3D(BridgePxtr)*HepGeom::TranslateZ3D(BridgePztr)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg);
-    TRANSFUNCTION brpA2 = Pow(HepGeom::RotateZ3D(1.0),f+(13*Alfa/2))*HepGeom::TranslateX3D(BridgePxtr)*HepGeom::TranslateZ3D(BridgePztr)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg); 
+    TRANSFUNCTION brpA2 = Pow(HepGeom::RotateZ3D(1.0),f+(13*Alfa/2))*HepGeom::TranslateX3D(BridgePxtr)*HepGeom::TranslateZ3D(BridgePztr)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg);
     TRANSFUNCTION brpC1 = Pow(HepGeom::RotateZ3D(1.0),f-(5*Alfa/2))*HepGeom::TranslateX3D(BridgePxtr)*HepGeom::TranslateZ3D(-BridgePztr)*HepGeom::RotateZ3D(-90*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg)*HepGeom::RotateX3D(-90*CLHEP::deg);
     TRANSFUNCTION brpC2 = Pow(HepGeom::RotateZ3D(1.0),f+(13*Alfa/2))*HepGeom::TranslateX3D(BridgePxtr)*HepGeom::TranslateZ3D(-BridgePztr)*HepGeom::RotateZ3D(-90*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg)*HepGeom::RotateX3D(-90*CLHEP::deg);   GeoSerialTransformer *brptA1 = new GeoSerialTransformer(bridgeplates,&brpA1, 5);
     GeoSerialTransformer *brptA2 = new GeoSerialTransformer(bridgeplates,&brpA2, 5);
@@ -1339,15 +1333,15 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     envelope->add(brptA2);
     envelope->add(brptC1);
     envelope->add(brptC2);
-    
+
     //basePlates
-    TRANSFUNCTION bpA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(BasePxtr)*HepGeom::TranslateZ3D(BasePztr)*HepGeom::RotateY3D(90*CLHEP::deg); 
+    TRANSFUNCTION bpA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(BasePxtr)*HepGeom::TranslateZ3D(BasePztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION bpC = Pow(HepGeom::RotateZ3D(1.0),f+(Alfa/2))*HepGeom::TranslateX3D(BasePxtr)*HepGeom::TranslateZ3D(-BasePztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     GeoSerialTransformer *bptA = new GeoSerialTransformer(baseplates,&bpA, NCrates);
     GeoSerialTransformer *bptC = new GeoSerialTransformer(baseplates,&bpC, NCrates);
     envelope->add(bptA);
     envelope->add(bptC);
-    
+
     //sectorEnvelopes1
     //counter-clockwise from top if taking sideA for reference (clockwise for sideC)
     TRANSFUNCTION seA1G5 = Pow(HepGeom::RotateZ3D(1.0),f+(9*Alfa/2))*HepGeom::TranslateX3D((Endb+Enda)/2)*HepGeom::TranslateZ3D(SecE1ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
@@ -1383,7 +1377,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     TRANSFUNCTION seC1G14 = Pow(HepGeom::RotateZ3D(1.0),f-(5*Alfa/2))*HepGeom::TranslateX3D((Endb+Enda)/2)*HepGeom::TranslateZ3D(-SecE1ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION seA1G13 = Pow(HepGeom::RotateZ3D(1.0),f-(7*Alfa/2))*HepGeom::TranslateX3D((Endb+Enda)/2)*HepGeom::TranslateZ3D(SecE1ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION seC1G13 = Pow(HepGeom::RotateZ3D(1.0),f-(7*Alfa/2))*HepGeom::TranslateX3D((Endb+Enda)/2)*HepGeom::TranslateZ3D(-SecE1ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
-    
+
     GeoSerialTransformer *setA1G5 = new GeoSerialTransformer(sectorenvelopes1g5,&seA1G5, 1);
     GeoSerialTransformer *setC1G5 = new GeoSerialTransformer(sectorenvelopes1g5,&seC1G5, 1);
     GeoSerialTransformer *setA1G6 = new GeoSerialTransformer(sectorenvelopes1g6,&seA1G6, 1);
@@ -1400,7 +1394,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *setC1G11 = new GeoSerialTransformer(sectorenvelopes1g11,&seC1G11, 1);
     GeoSerialTransformer *setA1G12 = new GeoSerialTransformer(sectorenvelopes1g12,&seA1G12, 1);
     GeoSerialTransformer *setC1G12 = new GeoSerialTransformer(sectorenvelopes1g12,&seC1G12, 1);
-    
+
     GeoSerialTransformer *setA1G4 = new GeoSerialTransformer(sectorenvelopes1g4,&seA1G4, 1);
     GeoSerialTransformer *setC1G4 = new GeoSerialTransformer(sectorenvelopes1g4,&seC1G4, 1);
     GeoSerialTransformer *setA1G3 = new GeoSerialTransformer(sectorenvelopes1g3,&seA1G3, 1);
@@ -1417,7 +1411,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *setC1G14 = new GeoSerialTransformer(sectorenvelopes1g14,&seC1G14, 1);
     GeoSerialTransformer *setA1G13 = new GeoSerialTransformer(sectorenvelopes1g13,&seA1G13, 1);
     GeoSerialTransformer *setC1G13 = new GeoSerialTransformer(sectorenvelopes1g13,&seC1G13, 1);
-  
+
     envelope->add(setA1G5);
     envelope->add(setC1G5);
     envelope->add(setA1G6);
@@ -1434,7 +1428,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     envelope->add(setC1G11);
     envelope->add(setA1G12);
     envelope->add(setC1G12);
-    
+
     envelope->add(setA1G4);
     envelope->add(setC1G4);
     envelope->add(setA1G3);
@@ -1451,7 +1445,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     envelope->add(setC1G14);
     envelope->add(setA1G13);
     envelope->add(setC1G13);
-    
+
     //sectorEnvelopes2
     TRANSFUNCTION seA2r = Pow(HepGeom::RotateZ3D(1.0),8*f-(3*Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(SecE2ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION seA2l = Pow(HepGeom::RotateZ3D(1.0),8*f+(5*Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(SecE2ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
@@ -1463,18 +1457,18 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     TRANSFUNCTION seC2Vup = Pow(HepGeom::RotateZ3D(1.0),f+(9*Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(-SecE2ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION seC2Vd = Pow(HepGeom::RotateZ3D(1.0),f-(7*Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(-SecE2ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION seC2H = Pow(HepGeom::RotateZ3D(1.0),8*f+(Alfa/2))*HepGeom::TranslateX3D((Endb+Endc)/2)*HepGeom::TranslateZ3D(-SecE2ztr)*HepGeom::RotateY3D(90*CLHEP::deg);
-    
+
     GeoSerialTransformer *setA2r = new GeoSerialTransformer(sectorenvelopes2r,&seA2r, 2);
     GeoSerialTransformer *setA2l = new GeoSerialTransformer(sectorenvelopes2l,&seA2l, 2);
     GeoSerialTransformer *setC2r = new GeoSerialTransformer(sectorenvelopes2r,&seC2r, 2);
     GeoSerialTransformer *setC2l = new GeoSerialTransformer(sectorenvelopes2l,&seC2l, 2);
     GeoSerialTransformer *setA2Vup = new GeoSerialTransformer(sectorenvelopes2vup,&seA2Vup, 1);
     GeoSerialTransformer *setA2Vd = new GeoSerialTransformer(sectorenvelopes2vd,&seA2Vd, 1);
-    GeoSerialTransformer *setA2H = new GeoSerialTransformer(sectorenvelopes2h,&seA2H, 2); 
+    GeoSerialTransformer *setA2H = new GeoSerialTransformer(sectorenvelopes2h,&seA2H, 2);
     GeoSerialTransformer *setC2Vup = new GeoSerialTransformer(sectorenvelopes2vup,&seC2Vup, 1);
     GeoSerialTransformer *setC2Vd = new GeoSerialTransformer(sectorenvelopes2vd,&seC2Vd, 1);
     GeoSerialTransformer *setC2H = new GeoSerialTransformer(sectorenvelopes2h,&seC2H, 2);
-    
+
     envelope->add(setA2r);
     envelope->add(setA2l);
     envelope->add(setC2r);
@@ -1485,7 +1479,7 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     envelope->add(setC2Vup);
     envelope->add(setC2Vd);
     envelope->add(setC2H);
-    
+
     //bridgeEnvelopes
     TRANSFUNCTION breA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(BridgeExtr)*HepGeom::TranslateZ3D(BridgeEztr)*HepGeom::RotateZ3D(90*CLHEP::deg)*HepGeom::RotateY3D(90*CLHEP::deg)*HepGeom::RotateX3D(90*CLHEP::deg);
     TRANSFUNCTION breC = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(BridgeExtr)*HepGeom::TranslateZ3D(-BridgeEztr)*HepGeom::RotateZ3D(-90*CLHEP::deg)*HepGeom::RotateY3D(-90*CLHEP::deg)*HepGeom::RotateX3D(-90*CLHEP::deg);
@@ -1493,15 +1487,15 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
     GeoSerialTransformer *bretC = new GeoSerialTransformer(bridgeenvelopes,&breC, NCrates);
     envelope->add(bretA);
     envelope->add(bretC);
-    
+
     //baseEnvelopes
-    TRANSFUNCTION beA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(BaseExtr)*HepGeom::TranslateZ3D(BaseEztr)*HepGeom::RotateY3D(90*CLHEP::deg); 
+    TRANSFUNCTION beA = Pow(HepGeom::RotateZ3D(1.0),f-(Alfa/2))*HepGeom::TranslateX3D(BaseExtr)*HepGeom::TranslateZ3D(BaseEztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     TRANSFUNCTION beC = Pow(HepGeom::RotateZ3D(1.0),f+(Alfa/2))*HepGeom::TranslateX3D(BaseExtr)*HepGeom::TranslateZ3D(-BaseEztr)*HepGeom::RotateY3D(90*CLHEP::deg);
     GeoSerialTransformer *betA = new GeoSerialTransformer(baseenvelopes,&beA, NCrates);
     GeoSerialTransformer *betC = new GeoSerialTransformer(baseenvelopes,&beC, NCrates);
     envelope->add(betA);
     envelope->add(betC);
-    
+
 //     matFEBoards->ref();    matFEBoards->unref();
 //     matC6F14->ref();       matC6F14->unref();
 //     matWater->ref();       matWater->unref();
@@ -1509,8 +1503,192 @@ void LArGeo::BarrelDMConstruction::create(GeoFullPhysVol* envelope)
 //     matFiberglass->ref();  matFiberglass->unref();
 //     matN2->ref();          matN2->unref();
   }
+
+  if(m_activateFT){
+    std::string name = "LAr::Barrel::SignalFT::";
+    log << MSG::DEBUG << "creating " << name << " volumes" << endmsg;
+
+    const GeoMaterial* iron = materialManager->getMaterial("std::Iron");
+
+    const double wflange_height = 37.*CLHEP::mm;
+    const double wflange_R = 0.5*360.*CLHEP::mm;
+    const GeoMaterial* wflange_mat = materialManager->getMaterial("LAr::FT::WarmFlange");
+
+    GeoShape* wflange = new GeoTube(0., wflange_R, wflange_height/2);
+    GeoLogVol* wflangeLV = new GeoLogVol(name + "WarmFlange", wflange, wflange_mat);
+    GeoPhysVol* wflangePV = new GeoPhysVol(wflangeLV);
+
+    const double bellow_height = 225.*CLHEP::mm;
+    const double bellow_Router = 0.5*299.*CLHEP::mm; // this also to be cut in warm wall
+    const double bellow_wall = 15.*CLHEP::mm;
+    const GeoMaterial* bellow_mat = materialManager->getMaterial("LAr::FT::Bellow");
+
+    const double bellow_Rinner = bellow_Router - bellow_wall;
+    GeoShape* bellow = new GeoTube(bellow_Rinner, bellow_Router, bellow_height/2);
+    GeoLogVol* bellowLV = new GeoLogVol(name + "Bellow", bellow, bellow_mat);
+    GeoPhysVol* bellowPV = new GeoPhysVol(bellowLV);
+
+    const GeoMaterial* vcables_mat = materialManager->getMaterial("LAr::FT::VacuumCables");
+
+    GeoShape* vcables = new GeoTube(0., bellow_Rinner, bellow_height/2);
+    GeoLogVol* vcablesLV = new GeoLogVol(name + "VacuumCables", vcables, vcables_mat);
+    GeoPhysVol* vcablesPV = new GeoPhysVol(vcablesLV);
+
+    const double cflange_height = 35.*CLHEP::mm;
+    const double cflange_Router = 0.5*283.*CLHEP::mm;
+    const GeoMaterial* cflange_mat = materialManager->getMaterial("LAr::FT::ColdFlange");
+    GeoShape* cflange = new GeoTube(0., cflange_Router, cflange_height/2);
+    GeoLogVol* cflangeLV = new GeoLogVol(name + "ColdFlange", cflange, cflange_mat);
+    GeoPhysVol* cflangePV = new GeoPhysVol(cflangeLV);
+
+    const double coldbox1_Router = cflange_Router;
+    const double coldbox1_wall = 0.134*2.54*CLHEP::cm;
+    const double coldbox1_height = 90.*CLHEP::mm;
+    const double coldbox2_height = 16.*CLHEP::mm;
+    const double hole_r = 0.5*133.*CLHEP::mm;
+    const double hole_shift = -31.*CLHEP::mm;
+    const double coldbox3_Router = 0.5*140.*CLHEP::mm; // this also to be cut in cold wall
+    const double barrel_dist_from_outer_warm_wall_to_inner_cold_wall =
+        500.*CLHEP::mm;
+    const double coldbox3_height = // adjust to match dist between cryo walls
+        barrel_dist_from_outer_warm_wall_to_inner_cold_wall
+        - bellow_height - coldbox1_height - coldbox2_height;
+    log << MSG::DEBUG << "funnel tube len = "
+        << coldbox3_height / CLHEP::mm
+        << " mm " << endmsg;
+    const GeoMaterial* coldbox_mat = iron;
+    GeoShape* coldbox1 = new GeoTube(coldbox1_Router - coldbox1_wall, coldbox1_Router, coldbox1_height/2); // wide part
+    GeoShape* coldbox11 = new GeoTube(0., coldbox1_Router, coldbox1_height/2); // wide part for FTenvelope
+    GeoLogVol* coldbox1LV = new GeoLogVol(name + "ColdBox1", coldbox1, coldbox_mat);
+    GeoPhysVol* coldbox1PV = new GeoPhysVol(coldbox1LV);
+    GeoShape* coldbox21 = new GeoTube(0., coldbox1_Router, coldbox2_height/2); // plate
+    GeoShape* coldbox22 = new GeoTube(0., hole_r, coldbox2_height); // hole in the plate
+    const GeoShape& coldbox2 = coldbox21->subtract((*coldbox22) << HepGeom::TranslateY3D(hole_shift));
+    GeoLogVol* coldbox2LV = new GeoLogVol(name + "ColdBox2", &coldbox2, coldbox_mat);
+    GeoPhysVol* coldbox2PV = new GeoPhysVol(coldbox2LV);
+    GeoShape* coldbox3 = new GeoTube(hole_r, coldbox3_Router, coldbox3_height/2); // narrow part
+    GeoShape* coldbox31 = new GeoTube(0., coldbox3_Router, coldbox3_height/2); // narrow part for FTenvelope
+    GeoLogVol* coldbox3LV = new GeoLogVol(name + "ColdBox3", coldbox3, coldbox_mat);
+    GeoPhysVol* coldbox3PV = new GeoPhysVol(coldbox3LV);
+
+    HepGeom::TranslateZ3D bellow_pos(-wflange_height/2 - bellow_height/2);
+    HepGeom::TranslateZ3D cflange_pos(-wflange_height/2 - bellow_height - cflange_height/2);
+    HepGeom::TranslateZ3D coldbox1_pos(-wflange_height/2 - bellow_height - cflange_height - coldbox1_height/2);
+    HepGeom::TranslateZ3D coldbox2_pos(-wflange_height/2 - bellow_height - cflange_height - coldbox1_height - coldbox2_height/2);
+    HepGeom::Translate3D coldbox2hole_pos(
+        0., hole_shift,
+        -wflange_height/2 - bellow_height - cflange_height - coldbox1_height - coldbox2_height/2
+    );
+    HepGeom::Translate3D coldbox3_pos(
+        0., hole_shift,
+        -wflange_height/2 - bellow_height - cflange_height - coldbox1_height - coldbox2_height - coldbox3_height/2
+    );
+
+    const GeoShape& FTenvelope = wflange->add(
+        (*bellow) << bellow_pos
+    ).add(
+        (*cflange) << cflange_pos
+    ).add(
+        (*coldbox11) << coldbox1_pos
+    ).add(
+        (*coldbox21) << coldbox2_pos
+    ).add(
+        (*coldbox31) << coldbox3_pos
+    );
+
+    GeoLogVol* FTLV = new GeoLogVol(name + "Envelope",
+        &FTenvelope,
+        materialManager->getMaterial("std::Air")
+    );
+    GeoPhysVol* FTPV = new GeoPhysVol(FTLV);
+
+    FTPV->add(wflangePV);
+    GeoTransform *bellow_trf = new GeoTransform(bellow_pos);
+    FTPV->add(bellow_trf);
+    FTPV->add(bellowPV);
+    FTPV->add(bellow_trf);
+    FTPV->add(vcablesPV);
+    GeoTransform *cflange_trf = new GeoTransform(cflange_pos);
+    FTPV->add(cflange_trf);
+    FTPV->add(cflangePV);
+    GeoTransform *coldbox1_trf = new GeoTransform(coldbox1_pos);
+    FTPV->add(coldbox1_trf);
+    FTPV->add(coldbox1PV);
+    GeoTransform *coldbox2_trf = new GeoTransform(coldbox2_pos);
+    FTPV->add(coldbox2_trf);
+    FTPV->add(coldbox2PV);
+    GeoTransform *coldbox3_trf = new GeoTransform(coldbox3_pos);
+    FTPV->add(coldbox3_trf);
+    FTPV->add(coldbox3PV);
+
+    const GeoMaterial* lar_mat = materialManager->getMaterial("std::LiquidArgon");
+    GeoShape* lar1 = new GeoTube(0., coldbox1_Router - coldbox1_wall, coldbox1_height/2);
+    GeoShape* lar2 = new GeoTube(0., hole_r, coldbox1_height);
+    const GeoShape& lar = lar1->subtract((*lar2) << HepGeom::TranslateY3D(hole_shift));
+    GeoLogVol* larLV = new GeoLogVol(name + "LAr", &lar, lar_mat);
+    GeoPhysVol* larPV = new GeoPhysVol(larLV);
+    FTPV->add(coldbox1_trf);
+    FTPV->add(larPV);
+
+    const GeoMaterial *pigtail_mat = materialManager->getMaterial("LAr::FT::Pigtail");
+
+    const double pth = (coldbox1_height + coldbox2_height + coldbox3_height) / 2;
+    GeoTransform *pigtail_trf = new GeoTransform(
+        HepGeom::Translate3D(0, hole_shift,
+        -wflange_height/2 - bellow_height - cflange_height - pth
+    ));
+    GeoShape* pigtail = new GeoTube(0., hole_r, pth);
+    GeoLogVol* pigtailLV = new GeoLogVol(name + "Pigtail", pigtail, pigtail_mat);
+    GeoPhysVol* pigtailPV = new GeoPhysVol(pigtailLV);
+    FTPV->add(pigtail_trf);
+    FTPV->add(pigtailPV);
+
+    // total lenght should be 28.5 cm
+    const double ocable_len = 10.*CLHEP::cm;
+    const double ocable_R = (1.1/2)*sqrt(1920*2.85)*CLHEP::mm;
+    const GeoMaterial* ocable_mat = materialManager->getMaterial("LAr::FT::Cable");
+    GeoShape* ocable = new GeoTube(0., ocable_R, ocable_len / 2);
+    GeoLogVol* ocableLV = new GeoLogVol("LAr::Barrel::FTCables", ocable, ocable_mat);
+    GeoPhysVol* ocablePV = new GeoPhysVol(ocableLV);
+
+    // todo: take cryostat parameters from DB
+    const double r0 = 277.5*CLHEP::cm // cryo warm wall outer radius
+                    + wflange_height/2; // warm flange is abobe the wall
+    const double r2 = r0 + wflange_height/2 + ocable_len/2;
+    const double z_pos = 3170.*CLHEP::mm;
+    const int NCrates = 16;
+    const double dphi = 4.*CLHEP::deg;
+
+    auto put1 = [&envelope](GeoPhysVol *object, double r, double phi, double z)
+    {
+        envelope->add(new GeoTransform(
+            HepGeom::Translate3D(r*cos(phi), r*sin(phi), z) *
+            HepGeom::RotateX3D(90.*CLHEP::deg) *
+            HepGeom::RotateY3D(phi + 90.*CLHEP::deg)
+        ));
+        if(z < 0){
+            envelope->add(new GeoTransform(HepGeom::RotateZ3D(180.*CLHEP::deg)));
+        }
+        envelope->add(object);
+    };
+
+    auto put = [&put1, &FTPV, &ocablePV, r0, r2](double phi, double z)
+    {
+        put1(FTPV, r0, phi, z);
+        put1(ocablePV, r2, phi, z);
+    };
+
+    for(int i = 0; i < 16; ++ i){
+        const double phi = 360.*CLHEP::deg / NCrates * i;
+        put(phi - dphi, z_pos);
+        put(phi + dphi, z_pos);
+        put(phi - dphi, -z_pos);
+        put(phi + dphi, -z_pos);
+    }
+  }
+
 }
 
 
 
-         
+
diff --git a/LArCalorimeter/LArGeoModel/LArGeoCode/src/LArMaterialManager.cxx b/LArCalorimeter/LArGeoModel/LArGeoCode/src/LArMaterialManager.cxx
index a5845b83d96fbcc89f68fbd1bb3d10bfc0c29c32..7f2d978abd7039395862ad54474bafdfe92e7021 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoCode/src/LArMaterialManager.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoCode/src/LArMaterialManager.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "LArGeoCode/LArMaterialManager.h"
@@ -504,5 +504,138 @@ void LArMaterialManager::buildMaterials()
   msg << MSG::INFO<< "EMEC G10FeInner radiation length " << G10FeInner->getRadLength() << endreq;
 #endif
 
+
+  // Materials for Barrel and Endcap Signal Feedthroughs
+  {
+    GeoMaterial* myIron   = m_storedManager->getMaterial("std::Iron");
+    GeoMaterial* myCopper = m_storedManager->getMaterial("std::Copper");
+    GeoMaterial* myKapton = m_storedManager->getMaterial("std::Kapton");
+    GeoMaterial* myAlu    = m_storedManager->getMaterial("std::Aluminium");
+    GeoMaterial* myLAr    = m_storedManager->getMaterial("std::LiquidArgon");
+    GeoElement* O  = m_storedManager->getElement("Oxygen");
+    GeoElement* Na = m_storedManager->getElement("Potassium");
+    GeoElement* Si = m_storedManager->getElement("Silicon");
+    GeoElement* Ca = m_storedManager->getElement("Calcium");
+
+    GeoMaterial* myGlass = new GeoMaterial("PinCarrierGlas",2.40*CLHEP::g/CLHEP::cm3);
+    myGlass->add(O ,0.459800);
+    myGlass->add(Na,0.096441);
+    myGlass->add(Si,0.336553);
+    myGlass->add(Ca,0.107205);
+    myGlass->lock();
+    m_storedManager->addMaterial("LAr",myGlass);
+
+    // Average material for Warm Flange
+    /* contains
+     * bolt ring 1.88 kg Al
+     * seal ring 5.84 kg Fe
+     * heater    1.00 kg Al
+     * plate     8.67 kg - 2*(0.478+0.540) kg = 6.634 kg Fe
+     * pin carr. 2.036 kg mixture Fe+ glass (36g) + Cu (170g)
+     *
+     * hardcoded volume = 37*170^2*pi = 3766141 mm^3
+     */
+    const double wflange_total = 1.88 + 5.84 + 1.0 + 6.634 + 2.036;
+    GeoMaterial* warm_flange = new GeoMaterial("FT::WarmFlange",
+        wflange_total*CLHEP::kg / (3766141.*CLHEP::mm3)
+    );
+    warm_flange->add(myAlu, 2.88 / wflange_total);
+    warm_flange->add(myIron, (5.84 + 6.634 + 1.83) / wflange_total);
+    warm_flange->add(myCopper, 0.17 / wflange_total);
+    warm_flange->add(myGlass, 0.036 / wflange_total);
+    warm_flange->lock();
+    m_storedManager->addMaterial("LAr", warm_flange);
+
+    // Average material for Cold Flange
+    /* contains
+     * plate     11.21 kg - 2*(0.478+0.540) kg = 9.174 kg Fe
+     * pin carr. 2.036 kg mixture Fe+ glass (36g) + Cu (170g)
+     *
+     * hardcoded volume = 35*141.5^2*pi = 2201561 mm^3
+     */
+  {
+    const double m = 11.21;
+    const double mGlass = 0.036;
+    const double mCopper = 0.170;
+    const double mFe = m - mGlass - mCopper;
+    GeoMaterial* cold_flange = new GeoMaterial("FT::ColdFlange",
+        m*CLHEP::kg / (2201561.*CLHEP::mm3)
+    );
+    cold_flange->add(myIron, mFe / m);
+    cold_flange->add(myCopper, mCopper / m);
+    cold_flange->add(myGlass, mGlass / m);
+    cold_flange->lock();
+    m_storedManager->addMaterial("LAr", cold_flange);
+  }
+
+    /*  bellow is iron + vacuum
+        as geometry described in DMConstruction,
+        bellow also includes cuff ring and some part of seal ring
+        0.511 kg bellow
+        0.840 kg cuff ring
+        0        seal ring (sum whole ring to warm flange)
+        hardcoded volume is 225*pi*(229^2 - (229 - 15)^2)/4 = 1253790 mm^3
+    */
+    GeoMaterial* bellow_mat = new GeoMaterial("FT::Bellow",
+      1.351*CLHEP::kg / (1253790.*CLHEP::mm3)
+    );
+    bellow_mat->add(myIron, 1.);
+    bellow_mat->lock();
+    m_storedManager->addMaterial("LAr", bellow_mat);
+
+    /* vacuum cables are kapton+copper placed in vacuum,
+       insulation is ignored yet (btw different for barrel and EC)
+       3.928 kg Cu       (0.5657)
+       3.015 kg Polymide (0.4343)
+       ------------------
+       6.943 kg total
+       hardcoded volume is 225*pi*(229 - 15)^2/4 = 8092821 mm^3
+
+    */
+    GeoMaterial* vacuum_cables_mat = new GeoMaterial("FT::VacuumCables",
+      6.943*CLHEP::kg / (8092821.*CLHEP::mm3)
+    );
+    vacuum_cables_mat->add(myCopper, 0.5657);
+    vacuum_cables_mat->add(myKapton, 0.4343);
+    vacuum_cables_mat->lock();
+    m_storedManager->addMaterial("LAr", vacuum_cables_mat);
+
+    /* cables
+     * 0.215 cm^3 per 1m copper
+     * 0.735 cm^3 per 1m kapton
+     * 2.90 g per 1m = 100*pi*(0.11/2)^2 = 0.95 cm^3
+     */
+    const double vCopper = 0.215;
+    const double vKapton = 0.735;
+    const double mCopper = vCopper*8.96;
+    const double mKapton = vKapton*1.3;
+    const double m = mCopper + mKapton;
+    GeoMaterial* cable_mat = new GeoMaterial("FT::Cable",
+        m*CLHEP::g / ((vCopper + vKapton)*CLHEP::cm3)
+    );
+    cable_mat->add(myCopper, mCopper / m);
+    cable_mat->add(myKapton, mKapton / m);
+    cable_mat->lock();
+    m_storedManager->addMaterial("LAr", cable_mat);
+
+    /* pigtail cables are cables + LAr
+     *
+     */
+    const double v = M_PI*(13.3/2)*(13.3/2);
+    const double vc = M_PI*(.11/2)*(.11/2)*1920;
+    const double va = v - vc;
+    const double mc = vc * 2.9/0.95;
+    const double ma = va * 1.392;
+    GeoMaterial* pigtail_mat = new GeoMaterial("FT::Pigtail",
+        (mc + ma)*CLHEP::g / (v*CLHEP::cm3)
+    );
+    msg << MSG::DEBUG << pigtail_mat->getName() << " "
+        << pigtail_mat->getDensity() / (CLHEP::g/CLHEP::cm3)
+        << endmsg;
+    pigtail_mat->add(cable_mat, mc / (mc + ma));
+    pigtail_mat->add(myLAr, ma / (mc + ma));
+    pigtail_mat->lock();
+    m_storedManager->addMaterial("LAr", pigtail_mat);
+  }
   }
 }
diff --git a/LArCalorimeter/LArGeoModel/LArGeoEndcap/LArGeoEndcap/EndcapCryostatConstruction.h b/LArCalorimeter/LArGeoModel/LArGeoEndcap/LArGeoEndcap/EndcapCryostatConstruction.h
index 09fa51ffa48c4324c4ab4a749474fda7aec5174b..9b2727f23a39d6c0d32b45376e69061328c899a9 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoEndcap/LArGeoEndcap/EndcapCryostatConstruction.h
+++ b/LArCalorimeter/LArGeoModel/LArGeoEndcap/LArGeoEndcap/EndcapCryostatConstruction.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -31,18 +31,18 @@ namespace LArGeo {
   /** @class LArGeo::EndcapCryostatConstruction
       @brief Description of the LAr End Cap cryostat, including MBTS description
    */
-  class EndcapCryostatConstruction 
+  class EndcapCryostatConstruction
     {
     public:
-    
-    EndcapCryostatConstruction(bool fullGeo);
+
+    EndcapCryostatConstruction(bool fullGeo, bool activateFT = false);
     virtual ~EndcapCryostatConstruction();
-    
+
     // Get the envelope containing one endcap (pos/neg)
     GeoFullPhysVol*     createEnvelope(bool bPos);
 
     virtual GeoVPhysVol* GetEnvelope() {return 0;};
-    
+
 
     // Set a vis limit for the FCAL
     void setFCALVisLimit(int limit) {m_fcalVisLimit=limit;}
@@ -59,8 +59,9 @@ namespace LArGeo {
     EMECConstruction          m_emec;
     HEC2WheelConstruction     m_hec2;
     FCALConstruction*         m_fcal;
-    
+
     bool                      m_fullGeo;  // true->FULL, false->RECO
+    bool m_activateFT;
 
     friend class ::LArDetectorToolNV;
 
diff --git a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx
index 3de9832a7473798e171baa0324707eb9e6e7cbb6..6b7f9fed25b65c312c7c0dc4b13a026c008035b7 100755
--- a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapCryostatConstruction.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // EndcapCryostatConstruction
@@ -15,21 +15,22 @@
 #include "LArGeoHec/HECWheelConstruction.h"
 
 
-#include "GeoModelKernel/GeoElement.h"  
-#include "GeoModelKernel/GeoMaterial.h"  
-#include "GeoModelKernel/GeoFullPhysVol.h"  
-#include "GeoModelKernel/GeoPhysVol.h"  
-#include "GeoModelKernel/GeoVPhysVol.h"  
-#include "GeoModelKernel/GeoLogVol.h"  
-#include "GeoModelKernel/GeoPcon.h"  
-#include "GeoModelKernel/GeoTubs.h"  
-#include "GeoModelKernel/GeoTube.h"  
-#include "GeoModelKernel/GeoTrd.h"  
-#include "GeoModelKernel/GeoNameTag.h"  
-#include "GeoModelKernel/GeoTransform.h"  
-#include "GeoModelKernel/GeoAlignableTransform.h"  
-#include "GeoModelKernel/GeoIdentifierTag.h"  
+#include "GeoModelKernel/GeoElement.h"
+#include "GeoModelKernel/GeoMaterial.h"
+#include "GeoModelKernel/GeoFullPhysVol.h"
+#include "GeoModelKernel/GeoPhysVol.h"
+#include "GeoModelKernel/GeoVPhysVol.h"
+#include "GeoModelKernel/GeoLogVol.h"
+#include "GeoModelKernel/GeoPcon.h"
+#include "GeoModelKernel/GeoTubs.h"
+#include "GeoModelKernel/GeoTube.h"
+#include "GeoModelKernel/GeoTrd.h"
+#include "GeoModelKernel/GeoNameTag.h"
+#include "GeoModelKernel/GeoTransform.h"
+#include "GeoModelKernel/GeoAlignableTransform.h"
+#include "GeoModelKernel/GeoIdentifierTag.h"
 #include "GeoModelKernel/GeoSerialIdentifier.h"
+#include "GeoModelKernel/GeoShapeSubtraction.h"
 #include "GeoModelKernel/GeoXF.h"
 #include "GeoModelKernel/GeoSerialTransformer.h"
 #include "StoreGate/StoreGateSvc.h"
@@ -46,7 +47,7 @@
 
 // For transforms:
 
-#include "CLHEP/Geometry/Transform3D.h" 
+#include "CLHEP/Geometry/Transform3D.h"
 // For units:
 #include "CLHEP/Units/PhysicalConstants.h"
 
@@ -85,12 +86,13 @@ using namespace GeoXF;
 typedef std::map<int, unsigned int, std::less<int> > planeIndMap;
 
 
-LArGeo::EndcapCryostatConstruction::EndcapCryostatConstruction(bool fullGeo):
+LArGeo::EndcapCryostatConstruction::EndcapCryostatConstruction(bool fullGeo, bool activateFT):
   //  cryoEnvelopePhysical(NULL),
   m_fcalVisLimit(-1),
   m_pAccessSvc(NULL),
   m_geoModelSvc(NULL),
-  m_fullGeo(fullGeo)
+  m_fullGeo(fullGeo),
+  m_activateFT(activateFT)
 {
 
   m_fcal = new FCALConstruction();
@@ -117,21 +119,15 @@ LArGeo::EndcapCryostatConstruction::~EndcapCryostatConstruction()
 GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 {
   // Get access to the material manager:
-  
+
   ISvcLocator *svcLocator = Gaudi::svcLocator();
   IMessageSvc * msgSvc;
   if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
     throw std::runtime_error("Error in EndcapCryostatConstruction, cannot access MessageSvc");
   }
 
-  MsgStream log(msgSvc, "LArGeo::EndcapCryostatConstruction"); 
-
-  log  << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
-  log << "+                                                   +" << std::endl;
-  log << "+    HELLO from LArGeo::EndcapCryostatConstruction  +" << std::endl;
-  log << "+                                                   +" << std::endl;
-  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
-
+  MsgStream log(msgSvc, "LArGeo::EndcapCryostatConstruction");
+  log << MSG::DEBUG << "started" << endmsg;
 
   StoreGateSvc *detStore;
   if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
@@ -147,12 +143,12 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
   if (!Lead) {
     throw std::runtime_error("Error in EndcapCryostatConstruction, std::Lead is not found.");
   }
-  
+
   GeoMaterial *Air  = materialManager->getMaterial("std::Air");
   if (!Air) {
     throw std::runtime_error("Error in EndcapCryostatConstruction, std::Air is not found.");
   }
-  
+
   GeoMaterial *Al  = materialManager->getMaterial("std::Aluminium");
   if (!Al) {
     throw std::runtime_error("Error in EndcapCryostatConstruction, std::Aluminium is not found.");
@@ -168,7 +164,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 
   GeoMaterial *Copper  = materialManager->getMaterial("std::Copper");
   if (!Copper) throw std::runtime_error("Error in EndcapCryostatConstruction, std::Copper is not found.");
-  
+
   GeoMaterial *Iron  = materialManager->getMaterial("std::Iron");
   if (!Iron) throw std::runtime_error("Error in EndcapCryostatConstruction, std::Iron is not found.");
 
@@ -251,20 +247,33 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 
   double zStartCryoMother = 0.; // This variable is needed to calculate local transform of the MBTS mother
 
-  for(unsigned int ind=0; ind<cryoMotherPlanes.size(); ind++) 
+  for(unsigned int ind=0; ind<cryoMotherPlanes.size(); ind++)
   {
     iter = cryoMotherPlanes.find(ind);
 
     if(iter==cryoMotherPlanes.end())
       throw std::runtime_error("Error in EndcapCryostatConstruction, missing plane in Endcap Cryo Mother");
-    else 
+    else
     {
       const IRDBRecord *currentRecord = (*cryoPcons)[(*iter).second];
-      cryoMotherShape->addPlane(currentRecord->getDouble("ZPLANE"),
-			        currentRecord->getDouble("RMIN"),
-			        currentRecord->getDouble("RMAX"));
-      if(ind==0)
-	zStartCryoMother = currentRecord->getDouble("ZPLANE");
+      double zplane = currentRecord->getDouble("ZPLANE");
+      double rmin = currentRecord->getDouble("RMIN");
+      double rmax =  currentRecord->getDouble("RMAX");
+      /* This sould be corrected in the DB, but we have no time */
+      if(m_activateFT){
+        if(zplane == 0.){
+          zplane = 12.;
+          log << MSG::DEBUG << "Put cryoMother zplane " << ind
+		          << " at " << zplane << " to accomodate FEC" << endmsg;
+        }
+        if(rmax == 2476.){
+          rmax = 2506.;
+          log << MSG::DEBUG << "Put cryoMother rmax " << ind
+		          << " at " << rmax << " to accomodate FT Chimney" << endmsg;
+        }
+      }
+      cryoMotherShape->addPlane(zplane, rmin, rmax);
+      if(ind == 0) zStartCryoMother = zplane;
     }
   }
 
@@ -370,7 +379,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 
     // end of inserting extra lead plate before PS
 
-
+  IRDBRecordset_ptr LArEndcapCratePhiPos = m_pAccessSvc->getRecordsetPtr("LArEndcapCratePhiPos",detectorKey, detectorNode);
 
   for (unsigned int layer = 0; layer < cryoCylinders->size(); layer++) {
 
@@ -380,84 +389,150 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     if(m_fullGeo || cylNumber==14 || cylNumber==100) { // 100 - is the piece of Shielding. We need to build it for minimal geo too
 
       if(currentRecord->getString("CYL_LOCATION")=="Endcap") {
-      
-	std::ostringstream cylStream;
-	//int cylID = currentRecord->getInt("CYL_ID");
-	//cylStream << baseName << "::Cylinder::#" << cylID;
-	cylStream << baseName << "::Cylinder";
-	std::string cylName = (cylNumber==100?"JDSH_AddShield_Inner":cylStream.str());
-
-	if (!currentRecord->isFieldNull("QUALIFIER")) {
-	  std::string qualifier = currentRecord->getString("QUALIFIER");
-	  if (qualifier.size()) cylName = cylName + "::" + qualifier;
-	}
-      
-	GeoTubs* solidCyl
-	  = new GeoTubs(currentRecord->getDouble("RMIN")*CLHEP::cm,
-			currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm,
-			currentRecord->getDouble("DZ")*CLHEP::cm / 2.,
-			(double) 0.,
-			(double) 2.*M_PI*CLHEP::rad);
-	GeoMaterial *material  = materialManager->getMaterial(currentRecord->getString("MATERIAL"));
-      
-	if (!material) {
-	  std::ostringstream errorMessage;
-	  errorMessage << "Error in EndcapCrysostat Construction" << std::endl;
-	  errorMessage << "Material " << currentRecord->getString("MATERIAL") << " is not found" << std::endl;
-	  throw std::runtime_error(errorMessage.str().c_str());
-	}
-      
-	const GeoLogVol* logicCyl
-	  = new GeoLogVol(cylName,solidCyl,material);
-      
-	GeoPhysVol* physCyl = new GeoPhysVol(logicCyl);
-      
+        std::ostringstream cylStream;
+        //int cylID = currentRecord->getInt("CYL_ID");
+        //cylStream << baseName << "::Cylinder::#" << cylID;
+        cylStream << baseName << "::Cylinder";
+        std::string cylName = (cylNumber == 100?"JDSH_AddShield_Inner":cylStream.str());
+
+        if(!currentRecord->isFieldNull("QUALIFIER")){
+          std::string qualifier = currentRecord->getString("QUALIFIER");
+          if (qualifier.size()) cylName = cylName + "::" + qualifier;
+        }
+
+        const GeoShape* solidCyl = new GeoTubs(
+          currentRecord->getDouble("RMIN")*CLHEP::cm,
+          currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm,
+          currentRecord->getDouble("DZ")*CLHEP::cm / 2.,
+          (double) 0.,
+          (double) 2.*M_PI*CLHEP::rad
+        );
+        const GeoMaterial *material = materialManager->getMaterial(currentRecord->getString("MATERIAL"));
+
+        if(!material){
+          std::ostringstream errorMessage;
+          errorMessage << "Error in EndcapCrysostat Construction" << std::endl;
+          errorMessage << "Material " << currentRecord->getString("MATERIAL") << " is not found" << std::endl;
+          throw std::runtime_error(errorMessage.str().c_str());
+        }
+
+        if(m_activateFT){ // need to cut holes in cryostat walls for FT
+          if(cylNumber == 13){ // warm wall
+            log << MSG::DEBUG << "Cut holes for feedthroughs in warm wall "
+                << cylName
+                << endmsg;
+            const double rmin = currentRecord->getDouble("RMIN")*CLHEP::cm;
+            const double rmax = currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm;
+            const double dz = currentRecord->getDouble("DZ")*CLHEP::cm / 2.;
+            const double warmhole_radius = 0.5*340.*CLHEP::mm;
+            const double warmhole_pos = dz - 247.*CLHEP::mm;
+            GeoTube *warmhole = new GeoTube(0., warmhole_radius, (rmax - rmin) * 4);
+            const GeoShapeShift &h1 = (*warmhole) << HepGeom::RotateX3D(90*CLHEP::deg);
+            const double r = (rmin + rmax) * 0.5;
+            const GeoShape* warmwall = solidCyl;
+            const double dphi = 5.*CLHEP::deg;
+            auto put = [&warmwall, &warmhole_pos, &r, &h1, &dz](double pos){
+              const double x = r*cos(pos), y = r*sin(pos);
+              warmwall = &(warmwall->subtract(
+                h1 << HepGeom::Translate3D(x, y, warmhole_pos)
+                     *HepGeom::RotateZ3D(pos + 90*CLHEP::deg)
+              ));
+            };
+            for(unsigned int i{0}; i < LArEndcapCratePhiPos->size(); ++ i){
+              const int num = (*LArEndcapCratePhiPos)[i]->getInt("CRATENUM");
+              const double phi = (*LArEndcapCratePhiPos)[i]->getDouble("PHIPOS")*CLHEP::deg;
+              if(num == 10){ // topmost crate has one FT
+                put(phi + dphi); // asymmetric, see DMConstruction
+              } else {
+                put(phi - dphi);
+                put(phi + dphi);
+              }
+            }
+            solidCyl = warmwall;
+          } else if(cylNumber == 20){ // cold wall
+            log << MSG::DEBUG << "Cut holes for feedthroughs in cold wall "
+                << cylName
+                << endmsg;
+            const double rmin = currentRecord->getDouble("RMIN")*CLHEP::cm;
+            const double rmax = currentRecord->getDouble("RMIN")*CLHEP::cm + currentRecord->getDouble("DR")*CLHEP::cm;
+            const double dz = currentRecord->getDouble("DZ")*CLHEP::cm / 2.;
+            const double coldhole_radius = 0.5*150.*CLHEP::mm;
+            const double coldhole_pos = 21.5*CLHEP::mm;
+            GeoTube *coldhole = new GeoTube(0., coldhole_radius, (rmax - rmin) * 4);
+            const GeoShapeShift &h1 = (*coldhole) << HepGeom::RotateX3D(90*CLHEP::deg);
+            const double r = (rmin + rmax) * 0.5;
+            const GeoShape *coldwall = solidCyl;
+            const double dphi = 5.*CLHEP::deg;
+            auto put = [&coldwall, &coldhole_pos, &r, &h1, &dz](double pos){
+              const double x = r*cos(pos), y = r*sin(pos);
+              coldwall = &(coldwall->subtract(
+                h1 << HepGeom::Translate3D(x, y, coldhole_pos)
+                     *HepGeom::RotateZ3D(pos + 90*CLHEP::deg)
+              ));
+            };
+            for(unsigned int i{0}; i < LArEndcapCratePhiPos->size(); ++ i){
+              const int num = (*LArEndcapCratePhiPos)[i]->getInt("CRATENUM");
+              const double phi = (*LArEndcapCratePhiPos)[i]->getDouble("PHIPOS")*CLHEP::deg;
+              if(num == 10){ // topmost crate has one FT
+                put(phi + dphi); // asymmetric, see DMConstruction
+              } else {
+                put(phi - dphi);
+                put(phi + dphi);
+              }
+            }
+            solidCyl = coldwall;
+          }
+        }
+
+        const GeoLogVol* logicCyl = new GeoLogVol(cylName,solidCyl,material);
+        GeoPhysVol* physCyl = new GeoPhysVol(logicCyl);
+
 	double zInCryostat = currentRecord->getDouble("ZMIN")*CLHEP::cm + currentRecord->getDouble("DZ")*CLHEP::cm / 2.;
 	// Don't move the pump even if the rest of the cryostat moves.
 
 	//if ( cylNumber == 33 ) zInCryostat -= zEmec;
-      
+
 	// Place each cylinder.
-      
+
 	cryoMotherPhysical->add(new GeoIdentifierTag(cylNumber));
 	cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zInCryostat)));
-      
-	// Front cold wall of Cryostat is a mother for Endcap Presampler 
+
+	// Front cold wall of Cryostat is a mother for Endcap Presampler
 	if ( cylNumber == 14 ) {
-	  // its PhysicalVolume has a special name 
+	  // its PhysicalVolume has a special name
 	  cryoMotherPhysical->add( new GeoNameTag(cylName + "::PresamplerMother") );
-	  
+
 	  EndcapPresamplerConstruction endcapPresamplerConstruction;
-	  
+
 	  GeoFullPhysVol* emecPSEnvelope = endcapPresamplerConstruction.Envelope();
 	  if ( emecPSEnvelope != 0 ) {
 	    // Get the position of the presampler from the geometry helper.
-	    double Zpos = 30.5*CLHEP::mm; 
-	    
-	    // It is highly debateable whether the endcap presampler is 
+	    double Zpos = 30.5*CLHEP::mm;
+
+	    // It is highly debateable whether the endcap presampler is
 	    // alignable, but in any case we shall not align it here because
 	    // we need to completely redo it, anyway, since it does  not
 	    // even live  "in" this volume, not in real life anyway.
 	    GeoTransform *xfPs = new GeoTransform(HepGeom::TranslateZ3D(Zpos));
-	    
+
 	    physCyl->add(xfPs);
 	    physCyl->add( emecPSEnvelope );
-	    
+
 	    std::string tag = bPos? std::string("PRESAMPLER_EC_POS") : std::string("PRESAMPLER_EC_NEG");
 	    StatusCode status;
-	    
+
 	    StoredPhysVol *sPhysVol = new StoredPhysVol(emecPSEnvelope);
 	    status=detStore->record(sPhysVol,tag);
 	    if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
 	  }
 	}
-      
+
 	// After we've added any additional sub-volumes, add the cylinder.
 	cryoMotherPhysical->add(physCyl);
       }
     }
   }
-  
+
   // g.p., 3-Apr-2006
   // placing Pcones for FCAL nose, instead of cylinders 34,28,29
   if(m_fullGeo)
@@ -465,7 +540,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
       GeoPcon *fcalNosePcon = new GeoPcon(0,2*M_PI);
       for(unsigned int ind=0; ind<fcalNosePlanes.size(); ind++) {
 	iter = fcalNosePlanes.find(ind);
-	
+
 	if(iter==fcalNosePlanes.end()) {
 	  throw std::runtime_error("Error in BarrelCryostatConstruction, missing plane in InnerWall");
 	} else {
@@ -495,13 +570,13 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
   std::string totalEMHLArName = baseName + "::EmecHecLAr";
   GeoPcon* totalEMHLArShape = new GeoPcon(0.,2.*M_PI);
 
-  for(unsigned int ind=0; ind<emhPlanes.size(); ind++) 
+  for(unsigned int ind=0; ind<emhPlanes.size(); ind++)
   {
     iter = emhPlanes.find(ind);
 
     if(iter==emhPlanes.end())
       throw std::runtime_error("Error in EndcapCryostatConstruction, missing plane in EMH");
-    else 
+    else
     {
       const IRDBRecord *currentRecord = (*cryoPcons)[(*iter).second];
       totalEMHLArShape->addPlane(currentRecord->getDouble("ZPLANE"),
@@ -544,6 +619,27 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     }
   }
 
+  if(m_activateFT){
+  // this ring emulates signal cables concentration area
+  // nearby the theedtrougs inside the cryostat
+    const double rcoldwall = 2155.*CLHEP::mm;
+    const double coldhole_radius = 0.5*150.*CLHEP::mm; // copied from above
+    const double icable_dz = coldhole_radius;
+    const double icable_dr =
+      (1920./LArEndcapCratePhiPos->size()) *
+      M_PI * 1.1*1.1/4. * CLHEP::mm2
+      / (icable_dz*2);
+    log << MSG::DEBUG << "adding " << icable_dr/CLHEP::mm << " mm"
+        << " of cables inside EC cryostat in front of FT" << endmsg;
+    const double z_pos = -249.*CLHEP::mm - icable_dz;
+    const GeoMaterial* icable_mat = materialManager->getMaterial("LAr::FT::Cable");
+    GeoShape* icable = new GeoTube(rcoldwall - icable_dr, rcoldwall, icable_dz);
+    GeoLogVol* icableLV = new GeoLogVol("LAr::Endcap::InnerFTCables", icable, icable_mat);
+    GeoPhysVol* icablePV = new GeoPhysVol(icableLV);
+    totalEMHLArPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(z_pos)));
+    totalEMHLArPhysical->add(icablePV);
+  }
+
   cryoMotherPhysical->add( totalEMHLArPhysical );
 
   {
@@ -558,11 +654,11 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 
     std::string tag = bPos? std::string("EMEC_POS") : std::string("EMEC_NEG");
     StatusCode status;
-    
+
     StoredPhysVol *sPhysVol = new StoredPhysVol(envelope);
     status=detStore->record(sPhysVol,tag);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
-    
+
     StoredAlignX *sAlignX = new StoredAlignX(xfEmec);
     status=detStore->record(sAlignX,tag);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
@@ -572,16 +668,16 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     totalEMHLArPhysical->add(xfEmec);
     totalEMHLArPhysical->add( envelope );
   }
-  
+
   {
 
     std::string wheelType="front";
     bool threeBoards= false;
     HECWheelConstruction frontHEC(m_fullGeo,wheelType,threeBoards,bPos) ;
     GeoFullPhysVol* EnvelopeF = frontHEC.GetEnvelope();
-    
+
     StatusCode status;
-    
+
 
     //--- Make the Front Wheel alignable:
 
@@ -590,54 +686,54 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     GeoAlignableTransform *xfHec1 = new GeoAlignableTransform(xfPosHec1);
 
     std::string tag1 = bPos? std::string("HEC1_POS") : std::string("HEC1_NEG");
-    
+
     StoredPhysVol *sPhysVol1 = new StoredPhysVol(EnvelopeF);
     status=detStore->record(sPhysVol1,tag1);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag1).c_str());
-    
+
     StoredAlignX *sAlignX1 = new StoredAlignX(xfHec1);
     status=detStore->record(sAlignX1,tag1);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag1).c_str());
-    
+
     totalEMHLArPhysical->add( xfHec1);
     totalEMHLArPhysical->add(new GeoIdentifierTag(0));
     totalEMHLArPhysical->add( EnvelopeF );
-    
-    
-    
+
+
+
     wheelType="rear";
     threeBoards= false;
     HECWheelConstruction rearHEC(m_fullGeo,wheelType,threeBoards,bPos) ;
     GeoFullPhysVol* EnvelopeR = rearHEC.GetEnvelope();
-    
+
     const IRDBRecord *posHec2 = GeoDBUtils::getTransformRecord(larPosition, bPos ? "HEC2_POS":"HEC2_NEG");
     HepGeom::Transform3D xfPosHec2 = posHec2 ? GeoDBUtils::getTransform(posHec2) : HepGeom::Translate3D(0.,0.,-1566.0);
     GeoAlignableTransform *xfHec2 = new GeoAlignableTransform(xfPosHec2);
 
     std::string tag2 = bPos? std::string("HEC2_POS") : std::string("HEC2_NEG");
-    
+
     StoredPhysVol *sPhysVol2 = new StoredPhysVol(EnvelopeR);
     status=detStore->record(sPhysVol2,tag2);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag2).c_str());
-    
+
     StoredAlignX *sAlignX2 = new StoredAlignX(xfHec2);
     status=detStore->record(sAlignX2,tag2);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag2).c_str());
-    
+
     totalEMHLArPhysical->add( xfHec2);
     totalEMHLArPhysical->add(new GeoIdentifierTag(1));
     totalEMHLArPhysical->add( EnvelopeR );
-    
-    
+
+
   }
-  
+
 
 
   // 13-Mar-2002 WGS: Place the FCAL detector inside the cryostat.
   m_fcal->setFCALVisLimit(m_fcalVisLimit);
   m_fcal->setFullGeo(m_fullGeo);
   {
-    
+
     // The "envelope" determined by the EMB should be a GeoFullPhysVol.
     GeoVFullPhysVol* fcalEnvelope = m_fcal->GetEnvelope(bPos);
 
@@ -646,8 +742,8 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
        2) Reconstruction needs each FCAL module to have a
        separate alignable envelope.  We'll work out t hese
        issues later. */
-    
-    
+
+
     // From FCALConstruction.cxx: */
    //
 
@@ -662,7 +758,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     StoredAlignX *sAlignX = new StoredAlignX(fcalXF);
     status=detStore->record(sAlignX,tag);
     if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
-    
+
 
     const GeoLogVol *envVol = fcalEnvelope->getLogVol();
     const GeoShape  *envShape = envVol->getShape();
@@ -676,8 +772,8 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     cryoMotherPhysical->add(fcalXF);
     cryoMotherPhysical->add( new GeoTransform( HepGeom::TranslateZ3D(tubs->getZHalfLength()) ) );
     cryoMotherPhysical->add( fcalEnvelope );
-    
-    
+
+
   }
 
   //_________________________ Mini FCAL ___________________________________________________
@@ -698,7 +794,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
     IRDBRecordset_ptr mbtsPcons  = m_pAccessSvc->getRecordsetPtr("MBTSPcons",detectorKey, detectorNode);
     IRDBRecordset_ptr mbtsGen    = m_pAccessSvc->getRecordsetPtr("MBTSGen",  detectorKey, detectorNode);
     IRDBRecordset_ptr mbtsTrds   = m_pAccessSvc->getRecordsetPtr("MBTSTrds", detectorKey, detectorNode);
-    
+
     double zposMM = 0.;
     std::map<std::string,unsigned> trdMap;  // Used in the new description only
     for(unsigned indTrd(0);indTrd<mbtsTrds->size();++indTrd) {
@@ -715,7 +811,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 
       // Mother volume
       GeoPhysVol* pvMM = 0;
-      
+
       if(mbtsPcons->size()==0) {
 	// ****
 	// In this description the Moderator and the JM tube are constructed as separate volumes (both of them are tubes)
@@ -732,21 +828,21 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	}
 
 	// Build mother volume
-	double rminMM = (*itMother)->getDouble("RMIN")*CLHEP::mm; 
+	double rminMM = (*itMother)->getDouble("RMIN")*CLHEP::mm;
 	double rmaxMM = (*itMother)->getDouble("RMAX")*CLHEP::mm;
 	double dzMM = (*itMother)->getDouble("DZ")*CLHEP::mm;
 	zposMM = (*itMother)->getDouble("ZPOS")*CLHEP::mm;
-	
+
 	GeoMaterial *matMM  = materialManager->getMaterial((*itMother)->getString("MATERIAL"));
-	
+
 	GeoTube  *tubeMM = new GeoTube(rminMM,rmaxMM,dzMM);
-	
+
 	GeoTube *tubeJM=NULL;
 	const GeoShape *solidMM=NULL;
 	if (itTube!=mbtsTubs->end()) {
 	  double dzMod   = (*itTube)->getDouble("DZ")*CLHEP::mm;
 	  double rMaxMod = (*itTube)->getDouble("RMAX")*CLHEP::mm;
-	  
+
 	  GeoPcon *pcon = new GeoPcon(0,2*M_PI);
 	  pcon->addPlane(-dzMM,rminMM,rmaxMM);
 	  pcon->addPlane( dzMM,rminMM,rmaxMM);
@@ -755,34 +851,34 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	  tubeJM = new GeoTube(rminMM,rMaxMod,dzMod);
 	  solidMM=pcon;
 	}
-	
+
 	if (!solidMM)  solidMM = new GeoTube(rminMM,rmaxMM,dzMM);
-	
+
 	GeoLogVol* lvMM = new GeoLogVol("MBTS_mother",solidMM,matMM);
 	pvMM = new GeoPhysVol(lvMM);
-	
+
 	cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zposMM)));
 	cryoMotherPhysical->add(pvMM);
 
 	// Moderator cylinder
-	//double rminMod  = (*itModerator)->getDouble("RMIN")*CLHEP::mm; 
+	//double rminMod  = (*itModerator)->getDouble("RMIN")*CLHEP::mm;
 	//double rmaxMod = (*itModerator)->getDouble("RMAX")*CLHEP::mm;
 	double dzMod = (*itModerator)->getDouble("DZ")*CLHEP::mm;
 	double zposMod = (*itModerator)->getDouble("ZPOS")*CLHEP::mm;
-	
+
 	GeoMaterial *matMod  = materialManager->getMaterial((*itModerator)->getString("MATERIAL"));
-	
+
 	GeoTube* solidMod = new GeoTube(rminMM,rmaxMM,dzMod);
 	GeoLogVol* lvMod = new GeoLogVol("Moderator",solidMod, matMod);
 	GeoPhysVol* pvMod = new GeoPhysVol(lvMod);
-	
+
 	pvMM->add(new GeoTransform(HepGeom::TranslateZ3D(zposMod)));
 	pvMM->add(pvMod);
-      
+
 	if (tubeJM) {
 	  GeoLogVol* lvMod  = new GeoLogVol("ModeratorTube",tubeJM, matMod);
 	  GeoPhysVol* pvMod = new GeoPhysVol(lvMod);
-	  
+
 	  pvMM->add(new GeoTransform(HepGeom::TranslateZ3D(tubeMM->getZHalfLength()+tubeJM->getZHalfLength())));
 	  pvMM->add(pvMod);
 	}
@@ -840,12 +936,12 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 
 	// Construct volumes:
 
-	// Mother 
+	// Mother
 	GeoLogVol* lvMM = new GeoLogVol("MBTS_mother",solidMM,Air);
 	pvMM = new GeoPhysVol(lvMM);
-	
+
 	zposMM = zStartCryoMother - zStartMM;
-	cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zposMM))); 
+	cryoMotherPhysical->add(new GeoTransform(HepGeom::TranslateZ3D(zposMM)));
 	cryoMotherPhysical->add(pvMM);
 
 	// Extra tube for the moderator:
@@ -873,7 +969,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	// The "old" description: just scintillators, no aluminum envelopes
 	for(unsigned int scinId=0; scinId<mbtsScin->size(); scinId++) {
 	  const IRDBRecord* curScin = (*mbtsScin)[scinId];
-	
+
 	  int nScin = curScin->getInt("SCINNUM");
 	  double dx1Scin = curScin->getDouble("DX1")*CLHEP::mm;
 	  double dx2Scin = curScin->getDouble("DX2")*CLHEP::mm;
@@ -889,13 +985,13 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	      startPhi = curScin->getDouble("STARTPHI");
 	  }
 	  catch(std::runtime_error&) {}
-	
+
 	  GeoMaterial *matScin  = materialManager->getMaterial(curScin->getString("MATERIAL"));
-	
+
 	  std::ostringstream ostr;
 	  ostr << curScin->getInt("SCIN_ID");
 	  std::string scinName = std::string("MBTS")+ostr.str();
-	
+
 	  GeoTrd* solidScin = new GeoTrd(dx1Scin,dx2Scin,dy1Scin,dy2Scin,dzScin);
 	  GeoLogVol* lvScin = new GeoLogVol(scinName,solidScin,matScin);
 	  GeoPhysVol* pvScin = new GeoPhysVol(lvScin);
@@ -904,7 +1000,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	  double deltaPhi = 360./nScin;
 	  Variable varInd;
 	  GeoSerialTransformer* stScin = 0;
-	  
+
 	  if(bPos) {
 	    GENFUNCTION phiInd = deltaPhi*(varInd + startPhi)*CLHEP::deg;
 	    TRANSFUNCTION xfScin = Pow(HepGeom::RotateZ3D(1.0),phiInd)*HepGeom::TranslateZ3D(zposScin)*HepGeom::TranslateX3D(rposScin)*HepGeom::RotateY3D(90*CLHEP::deg);
@@ -914,10 +1010,10 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	    TRANSFUNCTION xfScin = Pow(HepGeom::RotateZ3D(1.0),phiInd)*HepGeom::TranslateZ3D(zposScin)*HepGeom::TranslateX3D(rposScin)*HepGeom::RotateY3D(90*CLHEP::deg);
 	    stScin = new GeoSerialTransformer(pvScin,&xfScin,nScin);
 	  }
-	  
+
 	  pvMM->add(new GeoSerialIdentifier(0));
 	  pvMM->add(stScin);
-	}    
+	}
       }
       else {
 	// The "new" description: scintillators + aluminum envelopes + plastic plugs + aluminum press bars (only for RUN1)
@@ -962,7 +1058,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	// Build direct children of the 'air-in-aluminum'
 	for(itTrdMap=trdMap.begin();itTrdMap!=trdMap.end();++itTrdMap) {
 	  rec = (*mbtsTrds)[itTrdMap->second];
-	  if(rec->getString("PARENT")=="MBTSAirInAlu") 
+	  if(rec->getString("PARENT")=="MBTSAirInAlu")
 	     buildMbtsTrd(rec,materialManager,pvAirInAlu);
 	}
 
@@ -1013,11 +1109,11 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	  for(unsigned int scinId=0; scinId<2; scinId++) {
 	      int nScin(0), eta(0);
 	      double dx1Scin(0.), dzScin(0.), zposScin(0.), rposScin(0.), scineta(0.), scindeta(0.), deltaPhi(0.), startPhi(0.);
-	      
+
 	      if(mbtsGen->size()==0) {
 		// The "old" description:
 		const IRDBRecord* curScin = (*mbtsScin)[scinId];
-	
+
 		nScin = curScin->getInt("SCINNUM");
 		eta = curScin->getInt("SCIN_ID")-1;
 		dx1Scin = curScin->getDouble("DX1")*CLHEP::mm;
@@ -1056,7 +1152,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
 	      MbtsDetectorElement* mbtsDDE = new MbtsDetectorElement();
 	      // Construct Identifier
 	      mbtsDDE->set_id(tileTBID->channel_id(sidesign,phi,eta));
- 	      mbtsDDE->set_z((globalZMM + zposScin)*sidesign); 
+ 	      mbtsDDE->set_z((globalZMM + zposScin)*sidesign);
 	      mbtsDDE->set_dz(dx1Scin);
 	      mbtsDDE->set_r(rposScin);
 	      mbtsDDE->set_dr(dzScin);
@@ -1079,7 +1175,7 @@ GeoFullPhysVol* LArGeo::EndcapCryostatConstruction::createEnvelope(bool bPos)
   }
 
   // Build endcap electronics crates
-  EndcapDMConstruction crateBuilder;
+  EndcapDMConstruction crateBuilder(m_activateFT);
   crateBuilder.create(cryoMotherPhysical);
 
   return cryoMotherPhysical;
diff --git a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.cxx b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.cxx
index cb4d51fa701232b72aa5b23702a316cfb1907ca3..bd5602e3333bb0eddf6892d312f16e1ff651614f 100644
--- a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.cxx
+++ b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "EndcapDMConstruction.h"
@@ -18,6 +18,7 @@
 #include "GeoModelKernel/GeoSerialTransformer.h"
 #include "GeoModelKernel/GeoTube.h"
 #include "GeoModelKernel/GeoBox.h"
+#include "GeoModelKernel/GeoPcon.h"
 #include "GeoModelKernel/GeoTrd.h"
 #include "GeoModelKernel/GeoShape.h"
 #include "GeoModelKernel/GeoShapeUnion.h"
@@ -39,12 +40,13 @@
 // ***********************************************************************
 //
 // Construction of passive materials in the LAr EC cryostate.
-// Initial implementation consists of the lectronics crates 
+// Initial implementation consists of the lectronics crates
 // copied over from the Barrel DM description.
 //
 // ***********************************************************************
 
-LArGeo::EndcapDMConstruction::EndcapDMConstruction()
+LArGeo::EndcapDMConstruction::EndcapDMConstruction(bool ft) :
+  m_activateFT(ft)
 {
 
 }
@@ -57,13 +59,13 @@ void LArGeo::EndcapDMConstruction::create(GeoFullPhysVol* envelope)
 {
   ISvcLocator* svcLocator = Gaudi::svcLocator();
   IMessageSvc* msgSvc(0);
-  if(svcLocator->service("MessageSvc", msgSvc, true)==StatusCode::FAILURE) 
+  if(svcLocator->service("MessageSvc", msgSvc, true)==StatusCode::FAILURE)
     throw std::runtime_error("Error in EndcapDMConstruction, cannot access MessageSvc");
   MsgStream log(msgSvc, "EndcapDMConstruction");
   log << MSG::INFO << "Start building EC electronics geometry" << endreq;
 
   StoreGateSvc* detStore(0);
-  if(svcLocator->service("DetectorStore", detStore, false)==StatusCode::FAILURE) 
+  if(svcLocator->service("DetectorStore", detStore, false)==StatusCode::FAILURE)
     throw std::runtime_error("Error in EndcapDMConstruction, cannot access DetectorStore");
 
   IGeoModelSvc* geoModel(0);
@@ -76,7 +78,7 @@ void LArGeo::EndcapDMConstruction::create(GeoFullPhysVol* envelope)
 
   DecodeVersionKey keyLAr(geoModel, "LAr");
   DataHandle<StoredMaterialManager> materialManager;
-  if(StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) 
+  if(StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS")))
     throw std::runtime_error("Error in EndcapDMConstruction, stored MaterialManager is not found");
 
   IRDBRecordset_ptr LArEndcapCrate = rdbAccess->getRecordsetPtr("LArEndcapCrate",keyLAr.tag(),keyLAr.node());
@@ -157,29 +159,45 @@ void LArGeo::EndcapDMConstruction::create(GeoFullPhysVol* envelope)
   double BoardEytr = (*BarrelDMBoxes)[recordIndex]->getDouble("YTR");
   double BoardEztr = (*BarrelDMBoxes)[recordIndex]->getDouble("ZTR");
 
-  // For endcap cryostat overwrite some values 
+  // For endcap cryostat overwrite some values
   std::map<std::string, unsigned int>::const_iterator it = ecCrateMap.find("Crate1");
   if(it!=ecCrateMap.end()) {
     recordIndex = ecCrateMap["Crate1"];
     double ztrEC = (*LArEndcapCrate)[recordIndex]->getDouble("ZTR");
-    double xtrEC = (*LArEndcapCrate)[recordIndex]->getDouble("XTR");
+    /* FEC position sould be corrected in the DB, but we have no time */
+    if(m_activateFT && ztrEC == -249.05){
+       ztrEC += 6.;
+       log << MSG::DEBUG << "FEC position corrected to " << ztrEC
+           << " to fit mother volume" << endmsg;
+    }
     crate1ztr = ztrEC;
     pedestztr = ztrEC;
-    BoardEztr = ztrEC;    
-    crate1xtr = xtrEC;
-  }
-  it = ecCrateMap.find("Pedest");
-  if(it!=ecCrateMap.end()) {
-    recordIndex = ecCrateMap["Pedest"];
-    pedestxtr = (*LArEndcapCrate)[recordIndex]->getDouble("XTR");
+    BoardEztr = ztrEC;
+    if(m_activateFT){
+      // keep crate at same height as in Barrel - there is no difference
+    } else {
+      // keep the old behavoir
+      double xtrEC = (*LArEndcapCrate)[recordIndex]->getDouble("XTR");
+      crate1xtr = xtrEC;
+    }
   }
-  it = ecCrateMap.find("BoardE");
-  if(it!=ecCrateMap.end()) {
-    recordIndex = ecCrateMap["BoardE"];
-    BoardExtr = (*LArEndcapCrate)[recordIndex]->getDouble("XTR");
+  if(m_activateFT){
+  // do not move Pedest and BoardE in r - they are also like in the barrel
+  } else {
+  // keep the old behavior
+    it = ecCrateMap.find("Pedest");
+    if(it!=ecCrateMap.end()) {
+      recordIndex = ecCrateMap["Pedest"];
+      pedestxtr = (*LArEndcapCrate)[recordIndex]->getDouble("XTR");
+    }
+    it = ecCrateMap.find("BoardE");
+    if(it!=ecCrateMap.end()) {
+      recordIndex = ecCrateMap["BoardE"];
+      BoardExtr = (*LArEndcapCrate)[recordIndex]->getDouble("XTR");
+    }
   }
 
-  double epsilon(6.); // Squeeze boxes in EC, as there is not enough room
+  const double epsilon = m_activateFT? 0.: 6.;
 
   // ----- build pedestal -----
   GeoBox     *Pedestal = new GeoBox(pedesthlen, pedesthwdt, pedesthhgt-epsilon);
@@ -235,16 +253,215 @@ void LArGeo::EndcapDMConstruction::create(GeoFullPhysVol* envelope)
     envelope->add(boardenvelope);
   }
 
-  // Build services
-  IRDBRecordset_ptr EndcapDMTubes = rdbAccess->getRecordsetPtr("LArEndcapDMTubes",keyLAr.tag(),keyLAr.node());
-  if(EndcapDMTubes->size()) {
-    GeoMaterial* matECServices = materialManager->getMaterial("LAr::LArECServices");    
-    for(unsigned i(0); i<EndcapDMTubes->size(); ++i) {
-      GeoTube* endcapTube = new GeoTube((*EndcapDMTubes)[i]->getDouble("RMIN"),(*EndcapDMTubes)[i]->getDouble("RMAX"),(*EndcapDMTubes)[i]->getDouble("DZ"));
-      GeoLogVol* endcapTubeLv = new GeoLogVol((*EndcapDMTubes)[i]->getString("TUBENAME"),endcapTube,matECServices);
-      GeoPhysVol* endcapTubePv = new GeoPhysVol(endcapTubeLv);
-      envelope->add(new GeoTransform(HepGeom::TranslateZ3D((*EndcapDMTubes)[i]->getDouble("ZPOS"))));
-      envelope->add(endcapTubePv);
+  if(m_activateFT){
+    std::string name = "LAr::Endcap::SignalFT::";
+    log << MSG::INFO << "creating " << name << " volumes" << endmsg;
+
+    const GeoMaterial* iron = materialManager->getMaterial("std::Iron");
+
+    const double wflange_height = 37.*CLHEP::mm;
+    const double wflange_R = 0.5*360.*CLHEP::mm;
+    const GeoMaterial* wflange_mat = materialManager->getMaterial("LAr::FT::WarmFlange");
+
+    GeoShape* wflange = new GeoTube(0., wflange_R, wflange_height/2);
+    GeoLogVol* wflangeLV = new GeoLogVol(name + "WarmFlange", wflange, wflange_mat);
+    GeoPhysVol* wflangePV = new GeoPhysVol(wflangeLV);
+
+    const double bellow_height = 225.*CLHEP::mm;
+    const double bellow_Router = 0.5*299.*CLHEP::mm; // this also to be cut in warm wall
+    const double bellow_wall = 15.*CLHEP::mm;
+    const GeoMaterial* bellow_mat = materialManager->getMaterial("LAr::FT::Bellow");
+
+    const double bellow_Rinner = bellow_Router - bellow_wall;
+    GeoShape* bellow = new GeoTube(bellow_Rinner, bellow_Router, bellow_height/2);
+    GeoLogVol* bellowLV = new GeoLogVol(name + "Bellow", bellow, bellow_mat);
+    GeoPhysVol* bellowPV = new GeoPhysVol(bellowLV);
+
+    const GeoMaterial* vcables_mat = materialManager->getMaterial("LAr::FT::VacuumCables");
+
+    GeoShape* vcables = new GeoTube(0., bellow_Rinner, bellow_height/2);
+    GeoLogVol* vcablesLV = new GeoLogVol(name + "VacuumCables", vcables, vcables_mat);
+    GeoPhysVol* vcablesPV = new GeoPhysVol(vcablesLV);
+
+    const double cflange_height = 35.*CLHEP::mm;
+    const double cflange_Router = 0.5*283.*CLHEP::mm;
+    const GeoMaterial* cflange_mat = materialManager->getMaterial("LAr::FT::ColdFlange");
+    GeoShape* cflange = new GeoTube(0., cflange_Router, cflange_height/2);
+    GeoLogVol* cflangeLV = new GeoLogVol(name + "ColdFlange", cflange, cflange_mat);
+    GeoPhysVol* cflangePV = new GeoPhysVol(cflangeLV);
+
+    const double coldbox1_Router = cflange_Router;
+    const double coldbox1_wall = 0.134*2.54*CLHEP::cm;
+    const double coldbox1_height = 90.*CLHEP::mm;
+    const double coldbox2_height = 16.*CLHEP::mm;
+    const double hole_r = 0.5*133.*CLHEP::mm;
+    const double hole_shift = -31.*CLHEP::mm;
+    const double coldbox3_Router = 0.5*140.*CLHEP::mm; // this also to be cut in cold wall
+    const double coldbox3_height = 220.*CLHEP::mm;
+    const GeoMaterial* coldbox_mat = iron;
+    GeoShape* coldbox1 = new GeoTube(coldbox1_Router - coldbox1_wall, coldbox1_Router, coldbox1_height/2); // wide part
+    GeoShape* coldbox11 = new GeoTube(0., coldbox1_Router, coldbox1_height/2); // wide part for FTenvelope
+    GeoLogVol* coldbox1LV = new GeoLogVol(name + "ColdBox1", coldbox1, coldbox_mat);
+    GeoPhysVol* coldbox1PV = new GeoPhysVol(coldbox1LV);
+    GeoShape* coldbox21 = new GeoTube(0., coldbox1_Router, coldbox2_height/2); // plate
+    GeoShape* coldbox22 = new GeoTube(0., hole_r, coldbox2_height); // hole in the plate
+    const GeoShape& coldbox2 = coldbox21->subtract((*coldbox22) << HepGeom::TranslateY3D(hole_shift));
+    GeoLogVol* coldbox2LV = new GeoLogVol(name + "ColdBox2", &coldbox2, coldbox_mat);
+    GeoPhysVol* coldbox2PV = new GeoPhysVol(coldbox2LV);
+    GeoShape* coldbox3 = new GeoTube(hole_r, coldbox3_Router, coldbox3_height/2); // narrow part
+    GeoShape* coldbox31 = new GeoTube(0., coldbox3_Router, coldbox3_height/2); // narrow part for FTenvelope
+    GeoLogVol* coldbox3LV = new GeoLogVol(name + "ColdBox3", coldbox3, coldbox_mat);
+    GeoPhysVol* coldbox3PV = new GeoPhysVol(coldbox3LV);
+
+    HepGeom::TranslateZ3D bellow_pos(-wflange_height/2 - bellow_height/2);
+    HepGeom::TranslateZ3D cflange_pos(-wflange_height/2 - bellow_height - cflange_height/2);
+    HepGeom::TranslateZ3D coldbox1_pos(-wflange_height/2 - bellow_height - cflange_height - coldbox1_height/2);
+    HepGeom::TranslateZ3D coldbox2_pos(-wflange_height/2 - bellow_height - cflange_height - coldbox1_height - coldbox2_height/2);
+    HepGeom::Translate3D coldbox2hole_pos(
+      0., hole_shift,
+      -wflange_height/2 - bellow_height - cflange_height - coldbox1_height - coldbox2_height/2
+    );
+    HepGeom::Translate3D coldbox3_pos(
+      0., hole_shift,
+      -wflange_height/2 - bellow_height - cflange_height - coldbox1_height - coldbox2_height - coldbox3_height/2
+    );
+
+    const GeoShape& FTenvelope = wflange->add(
+      (*bellow) << bellow_pos
+    ).add(
+      (*cflange) << cflange_pos
+    ).add(
+      (*coldbox11) << coldbox1_pos
+    ).add(
+      (*coldbox21) << coldbox2_pos
+    ).add(
+      (*coldbox31) << coldbox3_pos
+    );
+
+    GeoLogVol* FTLV = new GeoLogVol(name + "Envelope",
+      &FTenvelope,
+      materialManager->getMaterial("std::Air")
+    );
+    GeoPhysVol* FTPV = new GeoPhysVol(FTLV);
+
+    FTPV->add(wflangePV);
+    GeoTransform *bellow_trf = new GeoTransform(bellow_pos);
+    FTPV->add(bellow_trf);
+    FTPV->add(bellowPV);
+    FTPV->add(bellow_trf);
+    FTPV->add(vcablesPV);
+    GeoTransform *cflange_trf = new GeoTransform(cflange_pos);
+    FTPV->add(cflange_trf);
+    FTPV->add(cflangePV);
+    GeoTransform *coldbox1_trf = new GeoTransform(coldbox1_pos);
+    FTPV->add(coldbox1_trf);
+    FTPV->add(coldbox1PV);
+    GeoTransform *coldbox2_trf = new GeoTransform(coldbox2_pos);
+    FTPV->add(coldbox2_trf);
+    FTPV->add(coldbox2PV);
+    GeoTransform *coldbox3_trf = new GeoTransform(coldbox3_pos);
+    FTPV->add(coldbox3_trf);
+    FTPV->add(coldbox3PV);
+
+    const GeoMaterial* lar_mat = materialManager->getMaterial("std::LiquidArgon");
+    GeoShape* lar1 = new GeoTube(0., coldbox1_Router - coldbox1_wall, coldbox1_height/2);
+    GeoShape* lar2 = new GeoTube(0., hole_r, coldbox1_height);
+    const GeoShape& lar = lar1->subtract((*lar2) << HepGeom::TranslateY3D(hole_shift));
+    GeoLogVol* larLV = new GeoLogVol(name + "LAr", &lar, lar_mat);
+    GeoPhysVol* larPV = new GeoPhysVol(larLV);
+    FTPV->add(coldbox1_trf);
+    FTPV->add(larPV);
+
+    const GeoMaterial *pigtail_mat = materialManager->getMaterial("LAr::FT::Pigtail");
+
+    const double pth = (coldbox1_height + coldbox2_height + coldbox3_height) / 2;
+    GeoTransform *pigtail_trf = new GeoTransform(
+      HepGeom::Translate3D(0, hole_shift,
+      -wflange_height/2 - bellow_height - cflange_height - pth
+    ));
+    GeoShape* pigtail = new GeoTube(0., hole_r, pth);
+    GeoLogVol* pigtailLV = new GeoLogVol(name + "Pigtails", pigtail, pigtail_mat);
+    GeoPhysVol* pigtailPV = new GeoPhysVol(pigtailLV);
+    FTPV->add(pigtail_trf);
+    FTPV->add(pigtailPV);
+
+    // total lenght should be 28.5 cm
+    const double ocable_len = 10.*CLHEP::cm;
+    const double ocable_R = (1.1/2)*sqrt(1920*2.85)*CLHEP::mm;
+    const GeoMaterial* ocable_mat = materialManager->getMaterial("LAr::FT::Cable");
+    GeoShape* ocable = new GeoTube(0., ocable_R, ocable_len / 2);
+    GeoLogVol* ocableLV = new GeoLogVol("LAr::Endcap::FTCables", ocable, ocable_mat);
+    GeoPhysVol* ocablePV = new GeoPhysVol(ocableLV);
+
+    const double chimney_height = 277.*CLHEP::mm;
+    const double chimney_wall = 5.*CLHEP::mm;
+    const double chimney_Router = 0.5*351.*CLHEP::mm;
+    const GeoMaterial* chimney_mat = iron;
+    GeoShape* chimney1 = new GeoTube(chimney_Router - chimney_wall, chimney_Router, chimney_height/2);
+    const double ch_lowring_h = 30.*CLHEP::mm;
+    const double ch_lowring_r = 20.*CLHEP::mm;
+    GeoShape* chimney2 = new GeoTube(chimney_Router, chimney_Router + ch_lowring_r, ch_lowring_h/2);
+    const double ch_upring_r = 5.*CLHEP::mm;
+    const double ch_upring_h = 20.*CLHEP::mm;
+    GeoShape* chimney3 = new GeoTube(bellow_Router, chimney_Router + ch_upring_r, ch_upring_h/2);
+    const GeoShape& chimney = chimney1->add(
+      (*chimney2) << HepGeom::TranslateZ3D(-chimney_height/2 + ch_lowring_h/2)
+    ).add(
+      (*chimney3) << HepGeom::TranslateZ3D(chimney_height/2 - ch_upring_h/2)
+    );
+    GeoLogVol* chimneyLV = new GeoLogVol("LAr::Endcap::FTChimney", &chimney, chimney_mat);
+    GeoPhysVol* chimneyPV = new GeoPhysVol(chimneyLV);
+
+    // todo: take cryostat parameters from DB
+    const double cryo_Router = 2475.*CLHEP::mm; // cryo warm wall outer radius
+    const double z_pos = -(472 - 412 + 247)*CLHEP::mm;
+    const double r0 = cryo_Router + chimney_height + wflange_height/2;
+    const double r1 = cryo_Router + chimney_height/2;
+    const double r2 = cryo_Router + chimney_height + wflange_height + ocable_len/2;
+    auto put1 = [&envelope, z_pos](GeoPhysVol *object, double r, double phi)
+    {
+      envelope->add(new GeoTransform(
+        HepGeom::Translate3D(r*cos(phi), r*sin(phi), z_pos) *
+        HepGeom::RotateX3D(90.*CLHEP::deg) *
+        HepGeom::RotateY3D(phi + 90.*CLHEP::deg)
+      ));
+      envelope->add(object);
+    };
+
+    auto put = [&put1, &FTPV, &chimneyPV, &ocablePV, r0, r1, r2](double phi)
+    {
+      put1(FTPV, r0, phi);
+      put1(chimneyPV, r1, phi);
+      put1(ocablePV, r2, phi);
+    };
+
+    const double dphi = 5.*CLHEP::deg;
+    for(unsigned int i{0}; i < LArEndcapCratePhiPos->size(); ++ i){
+      const int num = (*LArEndcapCratePhiPos)[i]->getInt("CRATENUM");
+      const double phi = (*LArEndcapCratePhiPos)[i]->getDouble("PHIPOS")*CLHEP::deg;
+      if(num == 10){ // the topmost crate has one FT, positioned assymetrically
+          put(phi + dphi);
+      } else {
+          put(phi - dphi);
+          put(phi + dphi);
+      }
+    }
+  } else { // No FTs, old LArServices variant
+/*
+   S.M. Feb 2020: these services are located between FEC and TileFingers.
+                  In this area is mostly air and a few cables. It was
+                  probably intended to go below the FEC
+*/
+    IRDBRecordset_ptr EndcapDMTubes = rdbAccess->getRecordsetPtr("LArEndcapDMTubes",keyLAr.tag(),keyLAr.node());
+    if(EndcapDMTubes->size()) {
+      const GeoMaterial* matECServices = materialManager->getMaterial("LAr::LArECServices");
+      for(unsigned i(0); i<EndcapDMTubes->size(); ++i) {
+        GeoTube* endcapTube = new GeoTube((*EndcapDMTubes)[i]->getDouble("RMIN"),(*EndcapDMTubes)[i]->getDouble("RMAX"),(*EndcapDMTubes)[i]->getDouble("DZ"));
+        GeoLogVol* endcapTubeLv = new GeoLogVol((*EndcapDMTubes)[i]->getString("TUBENAME"),endcapTube,matECServices);
+        GeoPhysVol* endcapTubePv = new GeoPhysVol(endcapTubeLv);
+        envelope->add(new GeoTransform(HepGeom::TranslateZ3D((*EndcapDMTubes)[i]->getDouble("ZPOS"))));
+        envelope->add(endcapTubePv);
+      }
     }
   }
 
diff --git a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.h b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.h
index 307de66ecf9ad3d7f6576c772217a3ac1a211249..ef92127b9f57086a9d6c114b59c057fd7b2019cd 100644
--- a/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.h
+++ b/LArCalorimeter/LArGeoModel/LArGeoEndcap/src/EndcapDMConstruction.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef __EndcapDMConstruction_H__
@@ -12,7 +12,7 @@ namespace LArGeo {
   class EndcapDMConstruction
   {
   public:
-    EndcapDMConstruction();
+    EndcapDMConstruction(bool);
     ~EndcapDMConstruction();
 
     void create(GeoFullPhysVol* envelope);
@@ -20,6 +20,8 @@ namespace LArGeo {
   private:
     EndcapDMConstruction(const EndcapDMConstruction&);
     EndcapDMConstruction& operator=(const EndcapDMConstruction&);
+
+    bool m_activateFT;
   };
 
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/mm_readoutHandler.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/mm_readoutHandler.cxx
index 84a2cbc2dfc656dfe923191236d1ff367b3cb879..9a31e27c8eea4b910c3471ddcdd8a8c541a92086 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/mm_readoutHandler.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/mm_readoutHandler.cxx
@@ -89,5 +89,8 @@ void mm_readoutHandler::ElementHandle()
     MM->roParameters.tStrips             = getAttributeAsInt    ("totalStrips", ret);
     if (! ret) std::cout << "WARNING: totalStrips is missing" << std::endl;
 
+    MM->roParameters.offset             = getAttributeAsDouble    ("offset", ret);
+    if (! ret) std::cout << "WARNING: offset is missing" << std::endl;
+
 
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h
index dd9d24e4679c01c670b7ff9928f78354107c92de..3832307fb5668cb72a986e69ed28b5143dbf5a11 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h
@@ -38,6 +38,9 @@ struct MMReadoutParameters {
     double dlStereoTop;
     double dlStereoBottom;
     int tStrips; //total strips per module (disconnected strips are included)
+    double offset; //Small MM chambers: offset from the center RASNIK mask is needed to define the strips positions. (slide 5: https://indico.cern.ch/event/903900/contributions/3850544/attachments/2031637/3400335/MMStrips_Software_4May2020.pdf)
+                   //The strips positions of MM modules with even total active strips should be shifted by 0.5*pitch. 
+                   //in order the transformation from local to global coords be applied correctly
 };
 
 class MMDetectorDescription: public AGDDDetector {
diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h
index 8143bce4ca69290fe5464582c6b232f19f14f402..d4a7ff737ad7d2ce56542bd4be02164a57a1dccf 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonChannelDesign.h
@@ -64,6 +64,9 @@ namespace MuonGM {
     double dlStereoTop; // length between the first eta and stereo
     double dlStereoBottom;
     int totalStrips; //total strips per MM module
+    double offset; //Small MM chambers: offset from the center RASNIK mask is needed to define the strips positions. (slide 5: https://indico.cern.ch/event/903900/contributions/3850544/attachments/2031637/3400335/MMStrips_Software_4May2020.pdf)
+                   //The strips positions of MM modules with even total active strips should be shifted by 0.5*pitch. 
+                   //in order the transformation from local to global coords be applied correctly   
       
     /** channel transform */
     //HepGeom::Transform3D  channelTransform( int channel ) const;
diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx
index 0ea6b174a57c5286d63d13803ac64dcc8a47ab68..4b523c505ead0f3cea8c38aec06c1e88ec1050bb 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx
@@ -219,12 +219,13 @@ namespace MuonGM {
       m_etaDesign[il].maxYPhi = roParam.maxYPhi;
       m_etaDesign[il].totalStrips = roParam.tStrips;
       m_etaDesign[il].sAngle = (roParam.stereoAngle).at(il);
+      m_etaDesign[il].offset = roParam.offset;
       if (m_ml < 1 || m_ml > 2)
         reLog()<<MSG::WARNING <<"MMReadoutElement -- Unexpected Multilayer: m_ml= " << m_ml <<endmsg;
       
       if (m_etaDesign[il].sAngle == 0.) {    // eta layers
 
-        m_etaDesign[il].firstPos = -0.5*m_etaDesign[il].xSize + pitch;
+        m_etaDesign[il].firstPos = -0.5*m_etaDesign[il].xSize + pitch + m_etaDesign[il].offset;
         m_etaDesign[il].signY  = 1 ;
         m_etaDesign[il].nch = ((int) std::round( (m_etaDesign[il].xSize/pitch))) + 1; // Total number of active strips
 	
@@ -249,11 +250,11 @@ namespace MuonGM {
 
         m_etaDesign[il].nch = ((int)std::round( (lPos - fPos)/pitch )) + 1;
 
-        m_etaDesign[il].firstPos = ( -0.5*m_etaDesign[il].xSize + (m_etaDesign[il].nMissedBottomStereo - m_etaDesign[il].nMissedBottomEta)*pitch) + pitch;
+        m_etaDesign[il].firstPos = ( -0.5*m_etaDesign[il].xSize + (m_etaDesign[il].nMissedBottomStereo - m_etaDesign[il].nMissedBottomEta)*pitch) + pitch + m_etaDesign[il].offset;
 
       }
       m_nStrips.push_back(m_etaDesign[il].totalStrips);
-        
+
       reLog()<<MSG::DEBUG
 	     <<"initDesign:" << getStationName()<< " layer " << il << ", strip pitch " << m_etaDesign[il].inputPitch << ", nstrips " << m_etaDesign[il].nch << " stereo " <<  m_etaDesign[il].sAngle << endmsg;
 
@@ -316,7 +317,6 @@ namespace MuonGM {
     Amg::Vector3D  locP = (m_Xlg[gg-1])*locPos;
     reLog()<<MSG::DEBUG<<"locPos in the gg      r.f. "<<locPos<<endmsg;
     reLog()<<MSG::DEBUG<<"locP in the multilayer r.f. "<<locP<<endmsg;
-    
     return absTransform()*locP;
   }
 
diff --git a/MuonSpectrometer/MuonG4/NSW_Sim/data/stations.v2.08.xml b/MuonSpectrometer/MuonG4/NSW_Sim/data/stations.v2.08.xml
new file mode 100644
index 0000000000000000000000000000000000000000..82cf3f7eefcc7b98a3781f0d8f4c11838b972e4c
--- /dev/null
+++ b/MuonSpectrometer/MuonG4/NSW_Sim/data/stations.v2.08.xml
@@ -0,0 +1,1843 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AGDD>
+
+<section name="NSW_Parameters" version="1" top_volume="useless" date="December 16 2014" author="S.Chen" >
+<!-- Global variables-->
+<var name="NSW_NbrOfLayers" value="4"/>
+<var name="NSW_NbrOfDriftPcb" value="3"/>
+<var name="NSW_NbrOfROPcb" value="2"/>
+<!--Center between the large sectors and the small sectors-->
+<var name="ZCenter_Global" value="7409"/>
+</section>
+
+<section name="NSW_sTGC_Parameters" version="13.7" top_volume="useless" date=" June 30, 2016 " author="Daniel Lellouch">
+<!-- ================ Global Variables ================= -->
+
+<!-- Thickness of a quadruplet -->
+<var name="NSW_sTGC_Tck" value="49.34"/>
+<!-- Gas Gap inside one layer -->
+<var name="NSW_sTGC_GasTck" value="2.85"/>
+<!-- G10 thickness per layer -->
+<var name="NSW_sTGC_pcbTck" value="3"/>
+<!-- Number of layers in a quaduplet -->
+<var name="NSW_sTGC_NbrOfLayers" value="4"/>
+<!-- Wire pitch -->
+<var name="NSW_sTGC_WirePitch" value="1.8"/>
+<!-- Strip pitch -->
+<var name="NSW_sTGC_StripPitch" value="3.2"/>
+<!-- Strip width -->
+<var name="NSW_sTGC_StripWidth" value="2.7"/>
+<!-- Width of G10 frame besides gas volume -->
+<var name="NSW_sTGC_SideFrame" value="28.5"/>
+<!-- Width of G10 frame in base w/o capacitor -->
+<var name="NSW_sTGC_hFrameNoCapacitor" value="11"/>
+<!-- Width of G10 frame in base with capacitor -->
+<var name="NSW_sTGC_hFrameCapacitor" value="14"/>
+<!-- Opening (in degrees) of trapezes in small wedges -->
+<var name="NSW_sTGC_SmallOpening" value="17"/>
+<!-- Opening (in degrees) of trapezes in large wedges -->
+<var name="NSW_sTGC_LargeOpening" value="28"/>
+<!-- Z center of small Pivot -->
+<var name="NSW_sTGC_ZSmallPivot" value="ZCenter_Global-65"/>
+<!-- Z center of small Confirm -->
+<var name="NSW_sTGC_ZSmallConfirm" value="ZCenter_Global-399"/>
+<!-- Z center of Large Pivot -->
+<var name="NSW_sTGC_ZLargePivot" value="ZCenter_Global+65"/>
+<!-- Z center of Large Confirm -->
+<var name="NSW_sTGC_ZLargeConfirm" value="ZCenter_Global+399"/>
+<!-- Z of each volume, relative to center of quadruplet -->
+<array name="NSW_sTGC_LayerDeltaZ" values="-16.45;-5.48;5.49;16.46"/>
+<!-- Side of the Pad readout -->
+<array name="NSW_sTGC_PadSide" values="-1;1;-1;1"/>
+<!-- Side of the Strip readout -->
+<array name="NSW_sTGC_StripSide" values="1;-1;1;-1"/>
+</section>
+
+<!-- ================ sTGC ========================= -->
+
+
+<section name="NewSmallWheels_sTGC" version="22.1" top_volume="NSW_sTGC" date=" June 22, 2018 " author="Daniel Lellouch">
+
+<composition name="NSW_sTGC">
+
+<sTGC_Tech type="sTGC_1" geometryLevel="1" nLayers="NSW_sTGC_NbrOfLayers" gasTck="NSW_sTGC_GasTck" pcbTck="NSW_sTGC_pcbTck" Tck="NSW_sTGC_Tck" f4="NSW_sTGC_hFrameNoCapacitor" f5="NSW_sTGC_hFrameNoCapacitor" f6="NSW_sTGC_SideFrame"/>
+
+<!-- ================ small Pivot ========================= -->
+
+<sTGC type="sTG1-QS1P" tech="sTGC_1" subType="QS1P" sWidth="346.93" lWidth="743.15" Length="1325.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="279.32" lPadWidth="667.18" padH="80;80;80.24;80.24" rankPadPhi="4;3;2;1" nPadPhi="4;4;3;3" anglePadPhi="5" firstPadPhiDivision_C="-5;-5;-2.5;-2.5" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-5;-5;-2.5;-2.5" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="17;17;17;17" firstPadH="65.8;65.8;28.61;28.61" firstPadRow="1;1;1;1" sStripWidth="293.48" lStripWidth="681.33" wireCutout="802.8;829.8;856.8;883.8" nWires="371;370;370;370" firstWire="-333;-331.65;-332.55;-332.1" wireGroupWidth="20" nStrips="406" firstTriggerBand="6;6;6;6" nTriggerBands="28;28;28;28" firstStripInTrigger="73;73;73;73" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="13;12;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;9" StripsInBandsLayer2="13;12;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;9" StripsInBandsLayer3="14;14;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;6" StripsInBandsLayer4="14;14;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;6" nWireGroups="19;20;19;19" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS1P" type="ENDCAP" chamberType="sTGS" radius="1563" zPos="NSW_sTGC_ZSmallPivot" phi0="22.5"/>
+
+<sTGC type="sTG1-QS2P" tech="sTGC_1" subType="QS2P" sWidth="746.14" lWidth="1102.25" Length="1191.4" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="677.64" lPadWidth="1026.28" padH="80;80;80.24;80.24" rankPadPhi="2;1;4;3" nPadPhi="2;2;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="0;0;-3.75;-3.75" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="0;0;-3.75;-3.75" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="15;15;15;15" firstPadH="93.2;93.2;60.09;60.09" firstPadRow="18;18;18;18" sStripWidth="691.8" lStripWidth="1040.43" wireCutout="0;0;0;0" nWires="569;570;570;570" firstWire="-511.2;-511.65;-512.55;-512.1" wireGroupWidth="20" nStrips="365" firstTriggerBand="34;34;34;34" nTriggerBands="29;29;29;29" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="14;14;14;13;12;12;13;12;13;12; 12;13;12;13;12;13;12;13;13;12; 13;12;13;12;13;12;13;12;11" StripsInBandsLayer2="14;14;14;13;12;12;13;12;13;12; 12;13;12;13;12;13;12;13;13;12; 13;12;13;12;13;12;13;12;11" StripsInBandsLayer3="14;14;14;13;12;12;13;12;13;12; 12;13;12;13;12;13;12;13;13;12; 13;12;13;12;13;12;13;12;10" StripsInBandsLayer4="14;14;14;13;12;12;13;12;13;12; 13;13;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;10" nWireGroups="29;30;29;29" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS2P" type="ENDCAP" chamberType="sTGS" radius="2831.5" zPos="NSW_sTGC_ZSmallPivot" phi0="22.5"/>
+
+<sTGC type="sTG1-QS3P" tech="sTGC_1" subType="QS3P" sWidth="1105.96" lWidth="1406.59" Length="1005.8" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1037.46" lPadWidth="1330.62" padH="80;80;80.24;80.24" rankPadPhi="2;1;4;3" nPadPhi="2;2;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="0;0;-3.75;-3.75" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="0;0;-3.75;-3.75" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="12;12;13;13" firstPadH="89.4;89.4;59.88;59.88" firstPadRow="33;33;33;33" sStripWidth="1051.61" lStripWidth="1344.78" wireCutout="0;0;0;0" nWires="739;739;739;738" firstWire="-664.2;-664.65;-663.75;-663.3" wireGroupWidth="20" nStrips="307" firstTriggerBand="64;64;64;64" nTriggerBands="25;25;25;25" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="3;13;13;10;13;13;13;13;13;13;13; 13;12;12;13;12;13;12;13;12;12; 13;13;13;14" StripsInBandsLayer2="3;13;13;10;13;13;13;13;13;13;13; 13;12;12;13;12;13;12;13;12;12; 13;13;13;14" StripsInBandsLayer3="6;13;12;11;14;12;13;12;13;13;13; 13;13;12;13;12;13;12;13;12;13; 13;12;13;11" StripsInBandsLayer4="6;13;12;11;14;12;13;12;13;13;13; 13;13;12;13;12;13;12;13;12;13; 13;12;13;11" nWireGroups="37;38;38;38" firstWireGroup="20;14;10;3"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS3P" type="ENDCAP" chamberType="sTGS" radius="3942.5" zPos="NSW_sTGC_ZSmallPivot" phi0="22.5"/>
+
+
+<!-- ================ small confirm =============== -->
+
+<sTGC type="sTG1-QS1C" tech="sTGC_1" subType="QS1C" sWidth="346.93" lWidth="743.15" Length="1325.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="293.48" lPadWidth="681.33" padH="76.35;76.35;76.59;76.59" rankPadPhi="1;4;2;3" nPadPhi="4;4;4;4" anglePadPhi="5" firstPadPhiDivision_C="-3.75;-6.25;-3.75;-6.25" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-6.25;-3.75;-6.25;-3.75" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="17;17;18;18" firstPadH="78.4;78.4;43.21;43.21" firstPadRow="2;2;2;2" sStripWidth="293.48" lStripWidth="681.33" wireCutout="883.8;856.8;829.8;802.8" nWires="370;370;370;371" firstWire="-332.1;-332.55;-331.65;-333" wireGroupWidth="20" nStrips="406" firstTriggerBand="7;7;8;8" nTriggerBands="29;29;29;29" firstStripInTrigger="73;73;73;73" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="13;12;12;12;12;12;12;12;12;12;11;12;12;12;12;12;12;12;12;12;12;12;12; 12;11;12;12;12;12;12;12;14;10;11" StripsInBandsLayer2="13;12;12;12;12;12;12;12;12;12;11;12;12;12;12;12;12;12;12;12;12;12;12; 12;11;12;12;12;12;12;12;14;10;11" StripsInBandsLayer3="8;12;12;12;12;12;12;12;12;12;12;12; 12;12;12;12;12;11;12;12;12;12; 12;12;12;12;12;12;12;12;12;13;14" StripsInBandsLayer4="8;12;12;12;12;12;12;12;12;12;12;12; 12;12;12;12;12;11;12;12;12;12; 12;12;12;12;12;12;12;12;12;13;14" nWireGroups="19;19;20;19" firstWireGroup="15;10;5;20"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS1C" type="ENDCAP" chamberType="sTGS" radius="1563" zPos="NSW_sTGC_ZSmallConfirm" phi0="22.5"/>
+
+<sTGC type="sTG1-QS2C" tech="sTGC_1" subType="QS2C" sWidth="746.14" lWidth="1102.25" Length="1191.4" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="691.8" lPadWidth="1040.43" padH="76.35;76.35;76.59;76.59" rankPadPhi="3;2;4;1" nPadPhi="3;3;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-1.87;-5.62;-1.87" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-1.87;-5.62;-1.87;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="16;16;15;15" firstPadH="43.8;43.8;89.29;89.29" firstPadRow="19;19;20;20" sStripWidth="691.8" lStripWidth="1040.43" wireCutout="0;0;0;0" nWires="570;570;570;569" firstWire="-512.1;-512.55;-511.65;-511.2" wireGroupWidth="20" nStrips="365" firstTriggerBand="36;36;36;36" nTriggerBands="31;31;31;31" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="7;12;12;12;11;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;12;12; 12;12;12;12;12;12;12;12;12" StripsInBandsLayer2="7;12;12;12;11;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;12;12; 12;12;12;12;12;12;12;12;12" StripsInBandsLayer3="9;12;12;12;12;12;12;12;12;12;12;11; 12;12;11;12;12;12;12;12;12;12; 12;12;12;12;12;12;11;11;11" StripsInBandsLayer4="9;12;12;12;12;12;12;12;12;12;12;11; 12;12;12;12;12;12;12;12;12;12; 12;12;12;12;12;12;11;11;11" nWireGroups="29;29;30;29" firstWireGroup="15;10;5;20"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS2C" type="ENDCAP" chamberType="sTGS" radius="2831.5" zPos="NSW_sTGC_ZSmallConfirm" phi0="22.5"/>
+
+<sTGC type="sTG1-QS3C" tech="sTGC_1" subType="QS3C" sWidth="1105.96" lWidth="1406.59" Length="1005.8" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1051.61" lPadWidth="1344.78" padH="76.35;76.35;76.59;76.59" rankPadPhi="3;2;4;1" nPadPhi="3;3;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-1.87;-5.62;-1.87" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-1.87;-5.62;-1.87;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="13;13;14;14" firstPadH="61.66;61.66;34.38;34.38" firstPadRow="35;35;35;35" sStripWidth="1051.61" lStripWidth="1344.78" wireCutout="0;0;0;0" nWires="738;739;739;739" firstWire="-663.3;-663.75;-664.65;-664.2" wireGroupWidth="20" nStrips="307" firstTriggerBand="67;67;67;67" nTriggerBands="21;21;21;21" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="3;12;12;12;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;11;12;13;13;13;13;14" StripsInBandsLayer2="3;12;12;12;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;11;12;13;13;13;13;14" StripsInBandsLayer3="5;13;12;12;12;12;12;12;12;12;12; 11;12;12;12;12;12;12;12;12;12;12;12;12;12;14" StripsInBandsLayer4="5;13;12;12;12;12;12;12;12;12;12; 11;12;12;12;12;12;12;12;12;12;12;12;12;12;14" nWireGroups="38;38;38;37" firstWireGroup="3;10;14;20"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS3C" type="ENDCAP" chamberType="sTGS" radius="3942.5" zPos="NSW_sTGC_ZSmallConfirm" phi0="22.5"/>
+
+
+<!-- ================ Large Pivot ==================== -->
+
+<sTGC type="sTG1-QL1P" tech="sTGC_1" subType="QL1P" sWidth="542.61" lWidth="1206.82" Length="1332" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="476.42" lPadWidth="1126.66" padH="81.42;81.42;81.66;81.66" rankPadPhi="4;3;2;1" nPadPhi="6;6;7;7" anglePadPhi="5" firstPadPhiDivision_C="-10;-10;-12.5;-12.5" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-10;-10;-12.5;-12.5" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="17;17;16;16" firstPadH="54.39;54.39;98.15;98.15" firstPadRow="1;1;2;2" sStripWidth="490.84" lStripWidth="1141.09" wireCutout="808;835;862;889" nWires="621;620;620;620" firstWire="-558;-556.65;-557.55;-557.1" wireGroupWidth="20" nStrips="408" firstTriggerBand="7;7;7;7" nTriggerBands="28;28;28;28" firstStripInTrigger="73;73;73;73" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="11;12;13;13;13;12;13;13;12;13;13;12;13;13;13;12;13;13;12;13;13;12;13; 13;13;12;13;13;12;9;13;12;8" StripsInBandsLayer2="11;12;13;13;13;12;13;13;12;13;13;12;13;13;13;12;13;13;12;13;13;12;13; 13;13;12;13;13;12;9;13;12;8" StripsInBandsLayer3="12;12;13;13;13;12;13;13;13;12;13;13;13;12;13;13;12;13;13;13;12;13;13; 13;12;13;13;13;12;9;13;12;6" StripsInBandsLayer4="12;12;13;13;13;12;13;13;13;12;13;13;13;12;13;13;12;13;13;13;12;13;13; 13;12;13;13;13;12;9;13;12;6" nWireGroups="32;32;32;32" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL1P" type="ENDCAP" chamberType="sTGL" radius="1595" zPos="NSW_sTGC_ZLargePivot" phi0="0.0"/>
+
+<sTGC type="sTG1-QL2P" tech="sTGC_1" subType="QL2P" sWidth="1211.81" lWidth="1807.5" Length="1194.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1144.12" lPadWidth="1727.34" padH="81.42;81.42;81.66;81.66" rankPadPhi="2;1;4;3" nPadPhi="4;4;5;5" anglePadPhi="7.5" firstPadPhiDivision_C="-7.5;-7.5;-11.25;-11.25" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-7.5;-7.5;-11.25;-11.25" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="14;14;15;15" firstPadH="99.51;99.51;65.69;65.69" firstPadRow="18;18;18;18" sStripWidth="1158.55" lStripWidth="1741.77" wireCutout="0;0;0;0" nWires="953;954;954;954" firstWire="-856.8;-857.25;-858.15;-857.7" wireGroupWidth="20" nStrips="366" firstTriggerBand="35;35;35;35" nTriggerBands="29;29;29;29" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="11;13;13;13;12;13;13;12;13;13; 13;12;13;13;12;13;13;12;13;13;13; 12;13;13;11;13;13;13;12" StripsInBandsLayer2="11;13;13;13;12;13;13;12;13;13; 13;12;13;13;12;13;13;12;13;13;13; 12;13;13;11;13;13;13;12" StripsInBandsLayer3="14;12;13;13;13;12;13;13;13;12; 13;13;13;12;13;13;12;13;13;13;12; 13;13;13;11;13;13;13;9" StripsInBandsLayer4="14;12;13;13;13;12;13;13;13;12; 13;13;13;12;13;13;12;13;13;13;12; 13;13;13;11;13;13;13;9" nWireGroups="48;49;49;48" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL2P" type="ENDCAP" chamberType="sTGL" radius="2868.3" zPos="NSW_sTGC_ZLargePivot" phi0="0.0"/>
+
+<sTGC type="sTG1-QL3P" tech="sTGC_1" subType="QL3P" sWidth="1813.68" lWidth="2111" Length="1153" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="545.3" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode="539.26">
+
+<sTGC_readout sPadWidth="1745.99" lPadWidth="2054" padH="81.42;81.42;81.66;81.66"
+ rankPadPhi="2;1;4;3" nPadPhi="4;4;5;5" anglePadPhi="7.5" firstPadPhiDivision_C="-7.5;-7.5;-11.25;-11.25" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-7.5;-7.5;-11.25;-11.25" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="15;15;14;14" firstPadH="32.38;32.38;83.57;83.57" firstPadRow="32;32;33;33" sStripWidth="1760.42" lStripWidth="2054" wireCutout="0;0;0;0" nWires="1133;1134;1134;1134" firstWire="-1018.8;-1019.25;-1020.15;-1019.7" wireGroupWidth="20" nStrips="353" firstTriggerBand="64;64;64;64" nTriggerBands="24;24;24;24" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="11;11;13;13;12;13;13;13;12; 13;13;12;13;13;13;12;13;13;13; 12;13;12;13;12;11;11;10;10;10" StripsInBandsLayer2="11;11;13;13;12;13;13;13;12; 13;13;12;13;13;13;12;13;13;13; 12;13;12;13;12;11;11;10;10;10" StripsInBandsLayer3="13;13;12;13;13;13;13;13;12; 13;13;13;12;13;13;13;13;12;13; 13;13;12;13;13;13;13;13;7" StripsInBandsLayer4="13;13;12;13;13;13;13;13;12; 13;13;13;12;13;13;13;13;12;13; 13;13;12;13;13;13;13;13;7" nWireGroups="57;58;58;57" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL3P" type="ENDCAP" chamberType="sTGL" radius="4054.5" zPos="NSW_sTGC_ZLargePivot" phi0="0.0"/>
+
+<!-- =============== Large Confirm ===================== -->
+
+<sTGC type="sTG1-QL1C" tech="sTGC_1" subType="QL1C" sWidth="542.61" lWidth="1206.82" Length="1332" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="490.84" lPadWidth="1141.09" padH="85.07;85.07;85.31;85.31" rankPadPhi="4;3;2;1" nPadPhi="6;6;6;6" anglePadPhi="5" firstPadPhiDivision_C="-8.75;-11.25;-8.75;-11.25" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-11.25;-8.75;-11.25;-8.75" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="16;16;16;16" firstPadH="77.79;77.79;38.01;38.01" firstPadRow="1;1;1;1" sStripWidth="490.84" lStripWidth="1141.09" wireCutout="889;862;835;808" nWires="620;620;620;621" firstWire="-557.1;-556.65;-557.55;-558" wireGroupWidth="20" nStrips="408" firstTriggerBand="6;6;6;6" nTriggerBands="26;26;26;26" firstStripInTrigger="73;73;73;73" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="13;11;14;13;13;13;14;13;13;14;13;13; 13;14;13;13;13;14;13;13;14;13; 13;13;14;13;13;13;14;14;11" StripsInBandsLayer2="13;11;14;13;13;13;14;13;13;14;13;13; 13;14;13;13;13;14;13;13;14;13; 13;13;14;13;13;13;14;14;11" StripsInBandsLayer3="14;11;14;13;13;14;13;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;14;13;10" StripsInBandsLayer4="14;11;14;13;13;14;13;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;14;13;10" nWireGroups="32;32;32;32" firstWireGroup="15;10;5;20"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL1C" type="ENDCAP" chamberType="sTGL" radius="1595" zPos="NSW_sTGC_ZLargeConfirm" phi0="0.0"/>
+
+<sTGC type="sTG1-QL2C" tech="sTGC_1" subType="QL2C" sWidth="1211.81" lWidth="1807.5" Length="1194.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1158.55" lPadWidth="1741.77" padH="85.07;85.07;85.31;85.31" rankPadPhi="3;2;4;1" nPadPhi="4;4;4;4" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-9.37;-5.62;-9.37" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-9.37;-5.62;-9.37;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="14;14;14;14" firstPadH="99.84;99.84;63.9;63.9" firstPadRow="17;17;17;17" sStripWidth="1158.55" lStripWidth="1741.77" wireCutout="0;0;0;0" nWires="954;954;954;953" firstWire="-857.7;-857.25;-858.15;-856.8" wireGroupWidth="20" nStrips="366" firstTriggerBand="32;32;32;32" nTriggerBands="29;29;29;29" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="10;10;11;13;13;14;13;13;14; 13;13;14;13;14;13;13;13;13;14; 13;13;13;14;13;13;14;13;13;3" StripsInBandsLayer2="10;10;11;13;13;14;13;13;14; 13;13;14;13;14;13;13;13;13;14; 13;13;13;14;13;13;14;13;13;3" StripsInBandsLayer3="11;11;12;12;13;14;13;13;14; 13;13;14;13;13;13;14;13;13;14; 13;13;14;13;13;14;13;13;12;2" StripsInBandsLayer4="11;11;12;12;13;14;13;13;14; 13;13;14;13;13;13;14;13;13;14; 13;13;14;13;13;14;13;13;12;2" nWireGroups="48;49;49;48" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL2C" type="ENDCAP" chamberType="sTGL" radius="2868.3" zPos="NSW_sTGC_ZLargeConfirm" phi0="0.0"/>
+
+<sTGC type="sTG1-QL3C" tech="sTGC_1" subType="QL3C" sWidth="1813.68" lWidth="2111" Length="1153" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="545.3" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode="539.26">
+
+<sTGC_readout sPadWidth="1760.42" lPadWidth="2054" padH="85.07;85.07;85.31;85.31" rankPadPhi="3;2;4;1" nPadPhi="4;4;4;4" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-9.37;-5.62;-9.37" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-9.37;-5.62;-9.37;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="13;13;14;14" firstPadH="83.76;83.76;51.17;51.17" firstPadRow="31;31;31;31" sStripWidth="1760.42" lStripWidth="2054" wireCutout="0;0;0;0" nWires="1134;1134;1134;1133" firstWire="-1019.7;-1019.25;-1020.15;-1018.8" wireGroupWidth="20" nStrips="353" firstTriggerBand="61;61;61;61" nTriggerBands="27;27;27;27" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="12;12;12;12;11;14;13;13;14;13; 13;14;13;13;14;13;13;13;14;13; 13;13;14;13;13;14;14" StripsInBandsLayer2="12;12;12;12;11;14;13;13;14;13; 13;14;13;13;14;13;13;13;14;13; 13;13;14;13;13;14;14" StripsInBandsLayer3="13;13;13;14;10;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;11" StripsInBandsLayer4="13;13;13;14;10;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;11" nWireGroups="57;58;58;57" firstWireGroup="20;5;10;15"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL3C" type="ENDCAP" chamberType="sTGL" radius="4054.5" zPos="NSW_sTGC_ZLargeConfirm" phi0="0.0"/>
+
+</composition>
+</section>
+
+
+<!-- ========== MicroMegas ============================== -->
+
+<section name="NSW_MM_Parameters" version="1" top_volume="useless" date="December 16 2014" author="S.Chen" >
+
+<!-- Frames. "f1": frame width close to the trapezium large side. "f2": frame width close to the trapezium small side. "f3": frame width close to the trapezium oblique side  -->
+
+<!-- Distance from IP, labeled zmin_MM in Parameter Book -->
+<var name="NSW_MM_LM_distanceFromIP" value="7536"/>
+<var name="NSW_MM_SM_distanceFromIP" value="7072"/>
+<!-- Thickness of Multilayer and the subcomponent (mm)-->
+<var name="NSW_MM_GasTck" value="5.04"/>
+<var name="NSW_MM_ROPcbTck" value="11.69"/>
+<var name="NSW_MM_DriftPcbTck" value="11.284"/>
+<var name="NSW_MM_MultilayerTck" value="NSW_NbrOfLayers* NSW_MM_GasTck + (NSW_NbrOfDriftPcb) * NSW_MM_DriftPcbTck+ ( NSW_NbrOfROPcb) * NSW_MM_ROPcbTck" /> <!-- Thickness of one multilayer -->
+
+<!-- Large sector modules (LM1" LM2). Modules are all trapezoid. ""Height"": radial envelope" ""base/top Width"": upper/lower side of the trapezoid-->
+<var name="NSW_MM_LM1_InnerRadius" value="923" />
+<var name="NSW_MM_LM1_Length" value="2310" />
+<var name="NSW_MM_LM1_outerRadius" value="NSW_MM_LM1_InnerRadius+NSW_MM_LM1_Length" />
+<var name="NSW_MM_LM1_f1" value="30"/>
+<var name="NSW_MM_LM1_f2" value="30"/>
+<var name="NSW_MM_LM1_f3" value="100"/>
+<var name="NSW_MM_LMGap_Length" value="5" /> <!-- Radial gap between LM1 and LM2 -->
+<var name="NSW_MM_LM2_InnerRadius" value="NSW_MM_LM1_outerRadius+NSW_MM_LMGap_Length" />
+<var name="NSW_MM_LM2_Length" value="1410" />
+<var name="NSW_MM_LM2_outerRadius" value="NSW_MM_LM2_InnerRadius+NSW_MM_LM2_Length" />
+<var name="NSW_MM_LM1_baseWidth" value="640" />
+<var name="NSW_MM_LM1_topWidth" value="2008.5" />
+<var name="NSW_MM_LM2_baseWidth" value="2022.8" />
+<var name="NSW_MM_LM2_topWidth" value="2220" />
+<var name="NSW_MM_LM2_f1" value="30"/>
+<var name="NSW_MM_LM2_f2" value="30"/>
+<var name="NSW_MM_LM2_f3" value="100"/>
+<!-- These lines added by Alexandre Laurier to fix MM active Geometry / updated values by Chara Kitsaki -->
+<!-- *_activeBottom: bottom length -->
+<!-- *_activeTop: top length -->
+<!-- *_activeH: radial distance -->
+<var name="NSW_MM_LM1_activeBottom" value="426.73"/>
+<var name="NSW_MM_LM1_activeTop" value="1753.0"/>
+<var name="NSW_MM_LM1_activeH" value="2238.75"/>
+<var name="NSW_MM_LM2_activeBottom" value="1802.5"/>
+<var name="NSW_MM_LM2_activeTop" value="1990.0"/>
+<var name="NSW_MM_LM2_activeH" value="1339.2"/>
+<!-- These lines added by Chara Kitsaki to implement all the parameters needed for the strips description -->
+<!-- *_etaMissedTop: the #of eta strips that are not connected to the FE boards (top part of the module) -->
+<!-- *_etaMissedBottom: the #of eta strips that are not connected to the FE boards (bottom part of the module) -->
+<!-- *_stereoMissedBottom: the #of stereo strips that are not connected to the FE boards (bottom part of the module) -->
+<!-- *_stereoMissedTop: the #of stereo strips that are not connected to the FE boards (top part of the module) -->
+<!-- *_stereoRoutedTop: the #of stereo strips that are shorter in length due to geometry restrictions (top part of the module) -->
+<!-- *_stereoRoutedBottom: the #of stereo strips that are shorter in length due to geometry restrictions (bottom part of the module) -->
+<var name="NSW_MM_LM1_etaMissedTop" value="72"/>
+<var name="NSW_MM_LM1_etaMissedBottom" value="72"/>
+<var name="NSW_MM_LM1_stereoMissedTop" value="36"/>
+<var name="NSW_MM_LM1_stereoMissedBottom" value="86"/>
+<var name="NSW_MM_LM1_stereoRoutedTop" value="88"/>
+<var name="NSW_MM_LM1_stereoRoutedBottom" value="0"/>
+<var name="NSW_MM_LM2_etaMissedTop" value="48"/>
+<var name="NSW_MM_LM2_etaMissedBottom" value="47"/>
+<var name="NSW_MM_LM2_stereoMissedTop" value="43"/>
+<var name="NSW_MM_LM2_stereoMissedBottom" value="42"/>
+<var name="NSW_MM_LM2_stereoRoutedTop" value="64"/>
+<var name="NSW_MM_LM2_stereoRoutedBottom" value="58"/>
+<!-- Small sector modules (SM1" SM2). Modules are all trapezoids. ""Height"": radial envelope" ""base/top Width"": upper/lower side -->
+<var name="NSW_MM_SM1_InnerRadius" value="895" />
+<var name="NSW_MM_SM1_Length" value="2210" />
+<var name="NSW_MM_SM1_outerRadius" value="NSW_MM_SM1_InnerRadius+NSW_MM_SM1_Length" />
+<var name="NSW_MM_SMGap_Length" value="5" /> <!-- Radial gap between SM1 and SM2 -->
+<var name="NSW_MM_SM1_f1" value="30"/>
+<var name="NSW_MM_SM1_f2" value="30"/>
+<var name="NSW_MM_SM1_f3" value="100"/>
+<var name="NSW_MM_SM2_InnerRadius" value="NSW_MM_SM1_outerRadius+NSW_MM_SMGap_Length" />
+<var name="NSW_MM_SM2_Length" value="1350" />
+<var name="NSW_MM_SM2_outerRadius" value="NSW_MM_SM2_InnerRadius+NSW_MM_SM2_Length" />
+<var name="NSW_MM_SM1_baseWidth" value="500" />
+<var name="NSW_MM_SM1_topWidth" value="1319.2" />
+<var name="NSW_MM_SM2_baseWidth" value="1321.1" />
+<var name="NSW_MM_SM2_topWidth" value="1821.5" />
+<var name="NSW_MM_SM2_f1" value="30"/>
+<var name="NSW_MM_SM2_f2" value="30"/>
+<var name="NSW_MM_SM2_f3" value="100"/>
+<!-- These lines added by Alexandre Laurier to fix MM active Geometry / updated values by Chara Kitsaki -->
+<var name="NSW_MM_SM1_activeBottom" value="284.0"/>
+<var name="NSW_MM_SM1_activeTop" value="1078.4"/>
+<var name="NSW_MM_SM1_activeH" value="2140.3"/>
+<var name="NSW_MM_SM2_activeBottom" value="1103.05"/>
+<var name="NSW_MM_SM2_activeTop" value="1579.6"/>
+<var name="NSW_MM_SM2_activeH" value="1279.675"/>
+<!-- These lines added by Chara Kitsaki to implement all the parameters needed for the strips description -->
+<var name="NSW_MM_SM1_etaMissedTop" value="41"/>
+<var name="NSW_MM_SM1_etaMissedBottom" value="42"/>
+<var name="NSW_MM_SM1_stereoMissedTop" value="11"/>
+<var name="NSW_MM_SM1_stereoMissedBottom" value="35"/>
+<var name="NSW_MM_SM1_stereoRoutedTop" value="66"/>
+<var name="NSW_MM_SM1_stereoRoutedBottom" value="18"/>
+<var name="NSW_MM_SM2_etaMissedTop" value="31"/>
+<var name="NSW_MM_SM2_etaMissedBottom" value="29"/>
+<var name="NSW_MM_SM2_stereoMissedTop" value="1"/>
+<var name="NSW_MM_SM2_stereoMissedBottom" value="1"/>
+<var name="NSW_MM_SM2_stereoRoutedTop" value="79"/>
+<var name="NSW_MM_SM2_stereoRoutedBottom" value="64"/>
+
+<var name="NSW_MM_LargeSector_ZCENTER" value="ZCenter_Global+232."/>
+<var name="NSW_MM_SmallSector_ZCENTER" value="ZCenter_Global-232."/>
+
+
+<!-- Thickness of inter-multilayer spacers -->
+<var name="NSW_MM_SpacerThickness" value="50" />
+
+<!-- Global z-coordinate for the sector center -->
+<!--  <var name="NSW_MM_LargeSector_ZCENTER" value="NSW_MM_LM_distanceFromIP + 4.*NSW_MM_DriftPcbTck + 4.*NSW_MM_ROPcbTck + 4.*NSW_MM_GasTck + NSW_MM_SpacerThickness/2."/>
+<var name="NSW_MM_SmallSector_ZCENTER" value="NSW_MM_SM_distanceFromIP + 4.*NSW_MM_DriftPcbTck + 4.*NSW_MM_ROPcbTck + 4.*NSW_MM_GasTck + NSW_MM_SpacerThickness/2."/>  -->
+
+</section>
+
+<section name="NewSmallWheelsMM" version="1" top_volume="NSW_MM" date="December 16 2014" author="S.Chen" >
+
+
+<!-- Technologies  -->
+<mm_Tech type="MM_1" geometryLevel="1" nLayers="NSW_NbrOfLayers" gasTck="NSW_MM_GasTck" driftPcbTck="NSW_MM_DriftPcbTck" ROPcbTck="NSW_MM_ROPcbTck" Tck="NSW_MM_MultilayerTck" />
+<!--Chilufya<mmSpacer_Tech type="Spa_1" Tck="NSW_MM_SpacerThickness" />Chilufya-->
+
+<!-- large wheel -->
+<!-- These lines are modified by Chara Kitsaki -->
+<!-- minYPhiL minYPhiR: the (radial)distance kept (left and right part of the module) between the first active stereo and eta strips -->
+<!-- dlStereoTop, dlStereoBottom: the distance between the first stereo and eta strip that is kept starting from the corner-->
+<!-- Some strips are not connected to the FE boards these we call missed strips -->
+<!-- At the corners of the module some strips are shorter in length and they are routed to the FE boards (routed strips). These areas are of low efficiency. LM1 is the special case (there is not much space to route any strips at the module's bottom part) -->
+
+<micromegas type="sMD1-1-1" tech="MM_1" subType="M1L1" sWidth="NSW_MM_LM1_baseWidth" lWidth="NSW_MM_LM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM1_Length" ylFrame="NSW_MM_LM1_f1" ysFrame="NSW_MM_LM1_f2" xFrame="NSW_MM_LM1_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM1_InnerRadius" roLength="NSW_MM_LM1_Length" activeBottomLength="NSW_MM_LM1_activeBottom" activeTopLength="NSW_MM_LM1_activeTop" activeH="NSW_MM_LM1_activeH" minYPhiR="12" minYPhiL="0.69" maxYPhi="6.69" nMissedTopEta="NSW_MM_LM1_etaMissedTop" nMissedBottomEta="NSW_MM_LM1_etaMissedBottom" nMissedTopStereo="NSW_MM_LM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM1_stereoMissedBottom" nRoutedTop="NSW_MM_LM1_stereoRoutedTop" nRoutedBottom="NSW_MM_LM1_stereoRoutedBottom" dlStereoTop="257.61" dlStereoBottom="426.73" totalStrips="5120" offset="0.225"/>
+</micromegas>
+<micromegas type="sMD1-2-1" tech="MM_1" subType="M2L1" sWidth="NSW_MM_LM2_baseWidth" lWidth="NSW_MM_LM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM2_Length" ylFrame="NSW_MM_LM2_f1" ysFrame="NSW_MM_LM2_f2" xFrame="NSW_MM_LM2_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM2_InnerRadius" roLength="NSW_MM_LM2_Length" activeBottomLength="NSW_MM_LM2_activeBottom" activeTopLength="NSW_MM_LM2_activeTop" activeH="NSW_MM_LM2_activeH" minYPhiR="21.39" minYPhiL="0" maxYPhi="23.77" nMissedTopEta="NSW_MM_LM2_etaMissedTop" nMissedBottomEta="NSW_MM_LM2_etaMissedBottom" nMissedTopStereo="NSW_MM_LM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM2_stereoMissedBottom" nRoutedTop="NSW_MM_LM2_stereoRoutedTop" nRoutedBottom="NSW_MM_LM2_stereoRoutedBottom" dlStereoTop="909.4" dlStereoBottom="815.32" totalStrips="3072" offset="0."/>
+</micromegas>
+<micromegas type="sMD1-1-2" tech="MM_1" subType="M1L2" sWidth="NSW_MM_LM1_baseWidth" lWidth="NSW_MM_LM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM1_Length" ylFrame="NSW_MM_LM1_f1" ysFrame="NSW_MM_LM1_f2" xFrame="NSW_MM_LM1_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM1_InnerRadius" roLength="NSW_MM_LM1_Length" activeBottomLength="NSW_MM_LM1_activeBottom" activeTopLength="NSW_MM_LM1_activeTop" activeH="NSW_MM_LM1_activeH" minYPhiR="12" minYPhiL="0.69" maxYPhi="6.69" nMissedTopEta="NSW_MM_LM1_etaMissedTop" nMissedBottomEta="NSW_MM_LM1_etaMissedBottom" nMissedTopStereo="NSW_MM_LM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM1_stereoMissedBottom" nRoutedTop="NSW_MM_LM1_stereoRoutedTop" nRoutedBottom="NSW_MM_LM1_stereoRoutedBottom" dlStereoTop="257.61" dlStereoBottom="426.73" totalStrips="5120" offset="0.225"/>
+</micromegas>
+<micromegas type="sMD1-2-2" tech="MM_1" subType="M2L2" sWidth="NSW_MM_LM2_baseWidth" lWidth="NSW_MM_LM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM2_Length" ylFrame="NSW_MM_LM2_f1" ysFrame="NSW_MM_LM2_f2" xFrame="NSW_MM_LM2_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM2_InnerRadius" roLength="NSW_MM_LM2_Length" activeBottomLength="NSW_MM_LM2_activeBottom" activeTopLength="NSW_MM_LM2_activeTop" activeH="NSW_MM_LM2_activeH" minYPhiR="21.39" minYPhiL="0" maxYPhi="23.77" nMissedTopEta="NSW_MM_LM2_etaMissedTop" nMissedBottomEta="NSW_MM_LM2_etaMissedBottom" nMissedTopStereo="NSW_MM_LM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM2_stereoMissedBottom" nRoutedTop="NSW_MM_LM2_stereoRoutedTop" nRoutedBottom="NSW_MM_LM2_stereoRoutedBottom" dlStereoTop="909.4" dlStereoBottom="815.32" totalStrips="3072" offset="0."/>
+</micromegas>
+
+<!--Chilufya<mmSpacer type="spa1-1" tech="Spa_1" sWidth="NSW_MM_LM1_baseWidth" lWidth="NSW_MM_LM1_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_LM1_Length" />
+<mmSpacer type="spa1-2" tech="Spa_1" sWidth="NSW_MM_LM2_baseWidth" lWidth="NSW_MM_LM2_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_LM2_Length" />Chilufya-->
+
+
+<!-- small wheel -->
+<micromegas type="sMD3-1-1" tech="MM_1" subType="M1S1" sWidth="NSW_MM_SM1_baseWidth" lWidth="NSW_MM_SM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM1_Length" ylFrame="NSW_MM_SM1_f1" ysFrame="NSW_MM_SM1_f2" xFrame="NSW_MM_SM1_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM1_InnerRadius" roLength="NSW_MM_SM1_Length" activeBottomLength="NSW_MM_SM1_activeBottom" activeTopLength="NSW_MM_SM1_activeTop" activeH="NSW_MM_SM1_activeH" minYPhiR="0.75" minYPhiL="0" maxYPhi="1.36" nMissedTopEta="NSW_MM_SM1_etaMissedTop" nMissedBottomEta="NSW_MM_SM1_etaMissedBottom" nMissedTopStereo="NSW_MM_SM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM1_stereoMissedBottom" nRoutedTop="NSW_MM_SM1_stereoRoutedTop" nRoutedBottom="NSW_MM_SM1_stereoRoutedBottom" dlStereoTop="52.15" dlStereoBottom="28.41" totalStrips="5120" offset="0.025"/>
+</micromegas>
+<micromegas type="sMD3-2-1" tech="MM_1" subType="M2S1" sWidth="NSW_MM_SM2_baseWidth" lWidth="NSW_MM_SM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM2_Length" ylFrame="NSW_MM_SM2_f1" ysFrame="NSW_MM_SM2_f2" xFrame="NSW_MM_SM2_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM2_InnerRadius" roLength="NSW_MM_SM2_Length" activeBottomLength="NSW_MM_SM2_activeBottom" activeTopLength="NSW_MM_SM2_activeTop" activeH="NSW_MM_SM2_activeH" minYPhiR="2.53" minYPhiL="0" maxYPhi="7.92" nMissedTopEta="NSW_MM_SM2_etaMissedTop" nMissedBottomEta="NSW_MM_SM2_etaMissedBottom" nMissedTopStereo="NSW_MM_SM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM2_stereoMissedBottom" nRoutedTop="NSW_MM_SM2_stereoRoutedTop" nRoutedBottom="NSW_MM_SM2_stereoRoutedBottom" dlStereoTop="303.86" dlStereoBottom="96.14" totalStrips="3072" offset="0.2375"/>
+</micromegas>
+<micromegas type="sMD3-1-2" tech="MM_1" subType="M1S2" sWidth="NSW_MM_SM1_baseWidth" lWidth="NSW_MM_SM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM1_Length" ylFrame="NSW_MM_SM1_f1" ysFrame="NSW_MM_SM1_f2" xFrame="NSW_MM_SM1_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM1_InnerRadius" roLength="NSW_MM_SM1_Length" activeBottomLength="NSW_MM_SM1_activeBottom" activeTopLength="NSW_MM_SM1_activeTop" activeH="NSW_MM_SM1_activeH" minYPhiR="0.75" minYPhiL="0" maxYPhi="1.36" nMissedTopEta="NSW_MM_SM1_etaMissedTop" nMissedBottomEta="NSW_MM_SM1_etaMissedBottom" nMissedTopStereo="NSW_MM_SM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM1_stereoMissedBottom" nRoutedTop="NSW_MM_SM1_stereoRoutedTop" nRoutedBottom="NSW_MM_SM1_stereoRoutedBottom" dlStereoTop="52.15" dlStereoBottom="28.41" totalStrips="5120" offset="0.025"/>
+</micromegas>
+<micromegas type="sMD3-2-2" tech="MM_1" subType="M2S2" sWidth="NSW_MM_SM2_baseWidth" lWidth="NSW_MM_SM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM2_Length" ylFrame="NSW_MM_SM2_f1" ysFrame="NSW_MM_SM2_f2" xFrame="NSW_MM_SM2_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM2_InnerRadius" roLength="NSW_MM_SM2_Length" activeBottomLength="NSW_MM_SM2_activeBottom" activeTopLength="NSW_MM_SM2_activeTop" activeH="NSW_MM_SM2_activeH" minYPhiR="2.53" minYPhiL="0" maxYPhi="7.92" nMissedTopEta="NSW_MM_SM2_etaMissedTop" nMissedBottomEta="NSW_MM_SM2_etaMissedBottom" nMissedTopStereo="NSW_MM_SM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM2_stereoMissedBottom" nRoutedTop="NSW_MM_SM2_stereoRoutedTop" nRoutedBottom="NSW_MM_SM2_stereoRoutedBottom" dlStereoTop="303.86" dlStereoBottom="96.14" totalStrips="3072" offset="0.2375"/>
+</micromegas>
+<!--Chilufya<mmSpacer type="spa3-1" tech="Spa_1" sWidth="NSW_MM_SM1_baseWidth" lWidth="NSW_MM_SM1_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_SM1_Length" />
+<mmSpacer type="spa3-2" tech="Spa_1" sWidth="NSW_MM_SM2_baseWidth" lWidth="NSW_MM_SM2_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_SM2_Length" />Chilufya-->
+
+<composition name="NSW_MM" >
+<!-- A-SIDE -->
+
+<!-- LARGE SECTOR -->
+
+<!-- MM multilayer 1 -->
+<chamberPosition volume="sMD1-1-1" radius="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" />
+<chamberPosition volume="sMD1-2-1" radius="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" />
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa1-1" ncopy="8" R_Z="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2;NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 270.; 90." />
+<mposPhi volume="spa1-2" ncopy="8" R_Z="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2;NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 270.; 90." />Chilufya-->
+
+<!-- MM multilayer 2 -->
+<chamberPosition volume="sMD1-1-2" radius="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" />
+<chamberPosition volume="sMD1-2-2" radius="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" />
+
+<!-- SMALL SECTOR -->
+
+<!-- MM multilayer 1 -->
+<chamberPosition volume="sMD3-1-1" radius="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" />
+<chamberPosition volume="sMD3-2-1" radius="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" />
+
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa3-1" ncopy="8" R_Z="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2;NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 270.; 90." />
+<mposPhi volume="spa3-2" ncopy="8" R_Z="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2;NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 270.; 90." />Chilufya-->
+
+<!-- MM multilayer 2 -->
+<chamberPosition volume="sMD3-1-2" radius="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" />
+<chamberPosition volume="sMD3-2-2" radius="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" />
+
+<!-- C-SIDE -->
+<!-- LARGE SECTOR -->
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa1-1" ncopy="8" R_Z="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2;-NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 90.; 90." />
+<mposPhi volume="spa1-2" ncopy="8" R_Z="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2;-NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 90.; 90." />Chilufya-->
+
+<!-- SMALL SECTOR -->
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa3-1" ncopy="8" R_Z="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2;-NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 90.; 90." />
+<mposPhi volume="spa3-2" ncopy="8" R_Z="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2;-NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 90.; 90." />Chilufya-->
+
+</composition>
+
+</section>
+
+
+
+
+
+
+
+<!--====================================SPACER FRAME===============================================-->
+
+<section name       = "LS and SS Spacer Frames"
+         version    = "0.0"
+         date       = "25-07-2017"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "NSW_Spacer">
+
+<!-- LS Spacer Ftame -->
+<gvxy name="LS_StructuralPlate_Main" material="Aluminium" dZ="5.9">
+  <gvxy_point X_Y="226.; 958."/>
+  <gvxy_point X_Y="914.15; 3281."/>
+  <gvxy_point X_Y="1007.3; 4613."/>
+  <gvxy_point X_Y="0.01; 4613."/>
+  <gvxy_point X_Y="0.01; 958."/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut1" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="902.87; 4123."/>
+  <gvxy_point X_Y="932.24; 4543."/>
+  <gvxy_point X_Y="40.; 4543."/>
+  <gvxy_point X_Y="40.; 4123."/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut2" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="774.41; 3913.25"/>
+  <gvxy_point X_Y="770.86; 3963."/>
+  <gvxy_point X_Y="135.; 3963."/>
+  <gvxy_point X_Y="135.; 3821.33"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut3" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="778.83; 3639.29"/>
+  <gvxy_point X_Y="792.52; 3835.04"/>
+  <gvxy_point X_Y="203.42; 3750.35"/>
+  <gvxy_point X_Y="203.46; 3720.65"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut4" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="477.15; 3586.36"/>
+  <gvxy_point X_Y="477.24; 3606.18"/>
+  <gvxy_point X_Y="135.; 3654.58"/>
+  <gvxy_point X_Y="135.; 3541.07"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut5" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="762.41; 3404.48"/>
+  <gvxy_point X_Y="772.57; 3549.82"/>
+  <gvxy_point X_Y="286.06; 3485.41"/>
+  <gvxy_point X_Y="286.1; 3465.58"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut6" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="600.; 3314.58"/>
+  <gvxy_point X_Y="602.55; 3354.42"/>
+  <gvxy_point X_Y="60.; 3424.01"/>
+  <gvxy_point X_Y="60.; 3314.58"/>
+</gvxy>
+
+<box  name="LS_StructuralPlate_Cut7" material="Aluminium"  X_Y_Z="138.; 70.; 7. " />
+
+<gvxy name="LS_StructuralPlate_Cut8" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="678.71; 2838.18"/>
+  <gvxy_point X_Y="772.71; 3155.5"/>
+  <gvxy_point X_Y="63.52; 3155.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut9" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="533.6; 2715.5"/>
+  <gvxy_point X_Y="551.94; 2791.05"/>
+  <gvxy_point X_Y="40.; 3055.11"/>
+  <gvxy_point X_Y="40.; 2715.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut10" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="459.9; 2169.9"/>
+  <gvxy_point X_Y="585.97; 2595.5"/>
+  <gvxy_point X_Y="117.42; 2595.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut11" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="391.41; 2095.5"/>
+  <gvxy_point X_Y="135.; 2414.15"/>
+  <gvxy_point X_Y="135.; 2095.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut12" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="344.91; 1865.18"/>
+  <gvxy_point X_Y="389.44; 2015.5"/>
+  <gvxy_point X_Y="258.79; 2015.5"/>
+</gvxy>
+<gvxy name="LS_StructuralPlate_Cut13" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="275.45; 1825.5"/>
+  <gvxy_point X_Y="172.35; 2005.44"/>
+  <gvxy_point X_Y="135.; 1995.5"/>
+  <gvxy_point X_Y="135.; 1825.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut14" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="173.8; 1028."/>
+  <gvxy_point X_Y="380.41; 1725.5"/>
+  <gvxy_point X_Y="40.; 1725.5"/>
+  <gvxy_point X_Y="40.; 1028."/>
+</gvxy>
+
+<subtraction  name="LS_StructuralPlateSub" >
+  <posXYZ   volume="LS_StructuralPlate_Main"   />
+  <posXYZ   volume="LS_StructuralPlate_Cut1" />
+  <posXYZ   volume="LS_StructuralPlate_Cut2" />
+  <posXYZ   volume="LS_StructuralPlate_Cut3" />
+  <posXYZ   volume="LS_StructuralPlate_Cut4" />
+  <posXYZ   volume="LS_StructuralPlate_Cut5" />
+  <posXYZ   volume="LS_StructuralPlate_Cut6" />
+  <posXYZ   volume="LS_StructuralPlate_Cut7" X_Y_Z="589.; 3235.5; 0." />
+  <posXYZ   volume="LS_StructuralPlate_Cut8" />
+  <posXYZ   volume="LS_StructuralPlate_Cut9" />
+  <posXYZ   volume="LS_StructuralPlate_Cut10" />
+  <posXYZ   volume="LS_StructuralPlate_Cut11" />
+  <posXYZ   volume="LS_StructuralPlate_Cut12" />
+  <posXYZ   volume="LS_StructuralPlate_Cut13" />
+  <posXYZ   volume="LS_StructuralPlate_Cut14" />
+</subtraction>
+
+<composition  name="LS_StructuralPlate" >
+  <posXYZ  volume="LS_StructuralPlateSub" />
+  <posXYZ  volume="LS_StructuralPlateSub" rot="0. ; 180. ; 0." />
+</composition>
+
+<box  name="LS_Central_reference_bar" material="Aluminium"  X_Y_Z="1704.; 100.; 27.8 " />
+
+<box  name="LS_Channel_section_L2000_Main" material="Aluminium"  X_Y_Z="50.; 2000.; 30. " />
+<box  name="LS_Channel_section_L2000_Cut" material="Aluminium"  X_Y_Z="40.; 2050.; 20. " />
+<subtraction  name="LS_Channel_section_L2000" >
+  <posXYZ   volume="LS_Channel_section_L2000_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_Channel_section_L1200_Main" material="Aluminium"  X_Y_Z="50.; 1200.; 30. " />
+<subtraction  name="LS_Channel_section_L1200" >
+  <posXYZ   volume="LS_Channel_section_L1200_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_Channel_section_L850_Main" material="Aluminium"  X_Y_Z="50.; 850.; 30. " />
+<subtraction  name="LS_Channel_section_L850" >
+  <posXYZ   volume="LS_Channel_section_L850_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_Channel_section_L1000_Main" material="Aluminium"  X_Y_Z="50.; 1000.; 30. " />
+<subtraction  name="LS_Channel_section_L1000" >
+  <posXYZ   volume="LS_Channel_section_L1000_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_UProfile_L1460_Main" material="Aluminium"  X_Y_Z="20.; 1460.; 30. " />
+<box  name="LS_UProfile_L1460_Cut" material="Aluminium"  X_Y_Z="20.; 1500.; 24. " />
+<subtraction  name="LS_UProfile_L1460" >
+  <posXYZ   volume="LS_UProfile_L1460_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="LS_UProfile_L750_Main" material="Aluminium"  X_Y_Z="20.; 750.; 30. " />
+<subtraction  name="LS_UProfile_L750" >
+  <posXYZ   volume="LS_UProfile_L750_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="3.; 0.; 0." />
+</subtraction>
+
+<gvxy name="LS_Top_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="914.3; 3484.44"/>
+  <gvxy_point X_Y="1146.47; 3571.68"/>
+  <gvxy_point X_Y="1141.27; 3656.86"/>
+  <gvxy_point X_Y="1054.98; 3656.86"/>
+  <gvxy_point X_Y="1054.98; 4070."/>
+  <gvxy_point X_Y="813.64; 4070."/>
+  <gvxy_point X_Y="774.65; 3494.2"/>
+</gvxy>
+
+<gvxy name="LS_Bottom_Grabber_interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="-801.54; 2552.21"/>
+  <gvxy_point X_Y="-858.34; 2743.97"/>
+  <gvxy_point X_Y="-591.97; 2822.88"/>
+  <gvxy_point X_Y="-535.17; 2631.11"/>
+</gvxy>
+
+<gvxy name="LS_Bottom_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="-558.42; 1731.46"/>
+  <gvxy_point X_Y="-616.93; 1928.98"/>
+  <gvxy_point X_Y="-678.34; 1910.78"/>
+  <gvxy_point X_Y="-727.9; 1985.99"/>
+  <gvxy_point X_Y="-570.48; 2124.21"/>
+  <gvxy_point X_Y="-437.49; 2163.6"/>
+  <gvxy_point X_Y="-329.56; 1799.25"/>
+</gvxy>
+
+<box  name="LS_MM_Connectors" material="Aluminium"  X_Y_Z="76.; 40.; 30. " />
+<composition  name="LS_MM_Connectors_Assembly" >
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="323.24; 1278.98; 0." rot="0. ; 0. ; -16.5" />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="596.23; 2200.58; 0." rot="0. ; 0. ; -16.5" />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="800.97; 2891.78; 0." rot="0. ; 0. ; -16.5" />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="922.31; 3368.81; 0." rot="0. ; 0. ; -4." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="986.76; 4290.41; 0." rot="0. ; 0. ; -4." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="824.; 4615.; 0." rot="0. ; 0. ; 90." />
+</composition>
+
+<box  name="LS_KM_Joint" material="ShieldSteel"  X_Y_Z="150.; 118.; 48. " />
+
+<composition  name="LS_Spacer_Frame_Assembly" >
+  <posXYZ  volume="LS_StructuralPlate" X_Y_Z="0.; 0.; 18." />
+  <posXYZ  volume="LS_StructuralPlate" X_Y_Z="0.; 0.; -18." />
+  <posXYZ  volume="LS_Central_reference_bar" X_Y_Z="0.; 3235.5; 0." />
+  <posXYZ  volume="LS_Channel_section_L2000" X_Y_Z="0.; 2185.49; 0." />
+  <posXYZ  volume="LS_Channel_section_L1200" X_Y_Z="0.; 3885.51; 0." />
+  <posXYZ  volume="LS_Channel_section_L850" X_Y_Z="130.5; 3710.51; 0." />
+  <posXYZ  volume="LS_Channel_section_L850" X_Y_Z="-130.5; 3710.51; 0." />
+  <posXYZ  volume="LS_Channel_section_L1000" X_Y_Z="130.5; 2223.; 0." />
+  <posXYZ  volume="LS_Channel_section_L1000" X_Y_Z="-130.5; 2223.; 0." />
+  <posXYZ  volume="LS_UProfile_L1460" X_Y_Z="252.; 2455.49; 0." />
+  <posXYZ  volume="LS_UProfile_L1460" X_Y_Z="-252.; 2455.49; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="252.; 3760.5; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-252.; 3760.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="465.; 3760.5; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-465.; 3760.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="678.; 3760.5; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-678.; 3760.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="465.; 2551.; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-465.; 2551.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_Top_Interface" X_Y_Z="0.; 0.; 0." />
+  <posXYZ  volume="LS_Top_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="0.; 956.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="0.; 4615.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="LS_KM_Joint" X_Y_Z="-1130.01; 3970.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_KM_Joint" X_Y_Z="1130.01; 3970.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_KM_Joint" X_Y_Z="656.6; 1798.8; 0." rot="0. ; 0. ; -16.5" />
+</composition>
+
+<composition  name="LS" >
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 315." />
+</composition>
+<!-- LS Spacer Ftame -->
+
+<!-- SS Spacer Ftame -->
+<gvxy name="SS_StructuralPlate_Main" material="Aluminium" dZ="5.9">
+  <gvxy_point X_Y="154.8; 930."/>
+  <gvxy_point X_Y="745.; 4114.46"/>
+  <gvxy_point X_Y="745.; 4425."/>
+  <gvxy_point X_Y="0.01; 4425."/>
+  <gvxy_point X_Y="0.01; 930."/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut1" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="685.; 4242.5"/>
+  <gvxy_point X_Y="685.; 4375."/>
+  <gvxy_point X_Y="25.; 4375."/>
+  <gvxy_point X_Y="25.; 4242.5"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut2" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="449.11; 4102.75"/>
+  <gvxy_point X_Y="446.87; 4122.5"/>
+  <gvxy_point X_Y="125.; 4122.5"/>
+  <gvxy_point X_Y="125.; 4028.36"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut3" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="577.21; 3867.18"/>
+  <gvxy_point X_Y="620.57; 4101.07"/>
+  <gvxy_point X_Y="131.86; 3988.9"/>
+  <gvxy_point X_Y="131.86; 3969.4"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut4" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="395.9; 3847.5"/>
+  <gvxy_point X_Y="398.14; 3867.25"/>
+  <gvxy_point X_Y="125.; 3929.94"/>
+  <gvxy_point X_Y="125.; 3847.5"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut5" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="495.98; 3705.39"/>
+  <gvxy_point X_Y="495.98; 3747.5"/>
+  <gvxy_point X_Y="25.; 3747.5"/>
+  <gvxy_point X_Y="25.; 3475.7"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut6" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="488.74; 3225.16"/>
+  <gvxy_point X_Y="576.8; 3700.3"/>
+  <gvxy_point X_Y="45.63; 3441.26"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut7" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="408.58; 3177.5"/>
+  <gvxy_point X_Y="417.35; 3215.48"/>
+  <gvxy_point X_Y="25.; 3406.82"/>
+  <gvxy_point X_Y="25.; 3177.5"/>
+</gvxy>
+
+<box  name="SS_StructuralPlate_Cut8" material="Aluminium"  X_Y_Z="92.; 70.; 7. " />
+
+<gvxy name="SS_StructuralPlate_Cut9" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="429.19; 3037.5"/>
+  <gvxy_point X_Y="25.; 3037.5"/>
+  <gvxy_point X_Y="25.; 2483.96"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut10" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="342.44; 2435.8"/>
+  <gvxy_point X_Y="445.53; 2992.05"/>
+  <gvxy_point X_Y="50.98; 2451.7"/>
+  <gvxy_point X_Y="59.05; 2435.8"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut11" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="275.17; 2072.87"/>
+  <gvxy_point X_Y="330.64; 2372.16"/>
+  <gvxy_point X_Y="310.98; 2395.8"/>
+  <gvxy_point X_Y="39.37; 2395.8"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut12" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="245.39; 2045.82"/>
+  <gvxy_point X_Y="25.; 2347.65"/>
+  <gvxy_point X_Y="25.; 2045.82"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut13" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="144.83; 1534.74"/>
+  <gvxy_point X_Y="203.73; 1852.5"/>
+  <gvxy_point X_Y="125.; 1852.5"/>
+  <gvxy_point X_Y="125.; 1536.56"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut14" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="123.38; 980."/>
+  <gvxy_point X_Y="201.04; 1399."/>
+  <gvxy_point X_Y="25.; 1399."/>
+  <gvxy_point X_Y="25.; 980."/>
+</gvxy>
+
+<subtraction  name="SS_StructuralPlateSub" >
+  <posXYZ   volume="SS_StructuralPlate_Main"   />
+  <posXYZ   volume="SS_StructuralPlate_Cut1" />
+  <posXYZ   volume="SS_StructuralPlate_Cut2" />
+  <posXYZ   volume="SS_StructuralPlate_Cut3" />
+  <posXYZ   volume="SS_StructuralPlate_Cut4" />
+  <posXYZ   volume="SS_StructuralPlate_Cut5" />
+  <posXYZ   volume="SS_StructuralPlate_Cut6" />
+  <posXYZ   volume="SS_StructuralPlate_Cut7" />
+  <posXYZ   volume="SS_StructuralPlate_Cut8" X_Y_Z="-340.5; 3107.5; 0." />
+  <posXYZ   volume="SS_StructuralPlate_Cut9" />
+  <posXYZ   volume="SS_StructuralPlate_Cut10" />
+  <posXYZ   volume="SS_StructuralPlate_Cut11" />
+  <posXYZ   volume="SS_StructuralPlate_Cut12" />
+  <posXYZ   volume="SS_StructuralPlate_Cut13" />
+  <posXYZ   volume="SS_StructuralPlate_Cut14" />
+</subtraction>
+
+<composition  name="SS_StructuralPlate" >
+  <posXYZ  volume="SS_StructuralPlateSub" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_StructuralPlateSub" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+</composition>
+
+<box  name="SS_Central_reference_bar" material="Aluminium"  X_Y_Z="1012.; 100.; 28. " />
+
+<box  name="SS_Channel_section_L1100_Main" material="Aluminium"  X_Y_Z="50.; 1100.; 30. " />
+<subtraction  name="SS_Channel_section_L1100" >
+  <posXYZ   volume="SS_Channel_section_L1100_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+
+<box  name="SS_Channel_section_L650_Main" material="Aluminium"  X_Y_Z="50.; 650.; 30. " />
+<subtraction  name="SS_Channel_section_L650" >
+  <posXYZ   volume="SS_Channel_section_L650_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="SS_UProfile_L1000_Main" material="Aluminium"  X_Y_Z="20.; 1000.; 30. " />
+<subtraction  name="SS_UProfile_L1000" >
+  <posXYZ   volume="SS_UProfile_L1000_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="SS_UProfile_L920_Main" material="Aluminium"  X_Y_Z="20.; 920.; 30. " />
+<subtraction  name="SS_UProfile_L920" >
+  <posXYZ   volume="SS_UProfile_L920_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="SS_UProfile_L1200_Main" material="Aluminium"  X_Y_Z="20.; 1200.; 30. " />
+<subtraction  name="SS_UProfile_L1200" >
+  <posXYZ   volume="SS_UProfile_L1200_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="SS_UProfile_L700_Main" material="Aluminium"  X_Y_Z="20.; 700.; 30. " />
+<subtraction  name="SS_UProfile_L700" >
+  <posXYZ   volume="SS_UProfile_L700_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<gvxy name="SS_Top_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="849.99; 3705.17"/>
+  <gvxy_point X_Y="849.99; 4260."/>
+  <gvxy_point X_Y="627.69; 4260."/>
+  <gvxy_point X_Y="627.69; 4106.34"/>
+  <gvxy_point X_Y="564.77; 3758.03"/>
+</gvxy>
+
+<gvxy name="SS_Bottom_Grabber_interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="454.99; 1875."/>
+  <gvxy_point X_Y="454.99; 2075."/>
+  <gvxy_point X_Y="255.; 2075."/>
+  <gvxy_point X_Y="255.; 1875."/>
+</gvxy>
+
+<gvxy name="SS_Bottom_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="442.2; 1397.5"/>
+  <gvxy_point X_Y="442.2; 1560.65"/>
+  <gvxy_point X_Y="397.; 1560.65"/>
+  <gvxy_point X_Y="397.; 1792.5"/>
+  <gvxy_point X_Y="194.29; 1792.5"/>
+  <gvxy_point X_Y="149.53; 1434.71"/>
+  <gvxy_point X_Y="204.54; 1397.5"/>
+</gvxy>
+
+<box  name="SS_MM_Connectors" material="Aluminium"  X_Y_Z="76.; 40.; 30. " />
+<box  name="SS_MM_Connectors_Lar" material="Aluminium"  X_Y_Z="120.; 40.; 30. " />
+<composition  name="SS_MM_Connectors_Assembly" >
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="214.86; 1243.14; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="376.17; 2113.54; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="497.16; 2766.34; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="626.36; 3463.34; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors_Lar" X_Y_Z="766.02; 4337.75; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="624.; 4427.; 0." rot="0. ; 0. ; 90." />
+</composition>
+
+<box  name="SS_KM_Joint" material="ShieldSteel"  X_Y_Z="154.; 101.; 48. " />
+
+<composition  name="SS_Spacer_Frame_Assembly" >
+  <posXYZ  volume="SS_StructuralPlate" X_Y_Z="0.; 0.; 18." />
+  <posXYZ  volume="SS_StructuralPlate" X_Y_Z="0.; 0.; -18." />
+  <posXYZ  volume="SS_Central_reference_bar" X_Y_Z="0.; 3107.5; 0." />
+  <posXYZ  volume="LS_Channel_section_L2000" X_Y_Z="0.; 2057.49; 0." />
+  <posXYZ  volume="SS_Channel_section_L1100" X_Y_Z="0.; 3707.51; 0." />
+  <posXYZ  volume="SS_Channel_section_L1100" X_Y_Z="-110.5; 3707.51; 0." />
+  <posXYZ  volume="SS_Channel_section_L1100" X_Y_Z="110.5; 3707.51; 0." />
+  <posXYZ  volume="SS_Channel_section_L650" X_Y_Z="-110.5; 1722.; 0." />
+  <posXYZ  volume="SS_Channel_section_L650" X_Y_Z="110.5; 1722.; 0." />
+  <posXYZ  volume="SS_UProfile_L1000" X_Y_Z="-345.; 3742.5; 0." />
+  <posXYZ  volume="SS_UProfile_L1000" X_Y_Z="345.; 3742.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_UProfile_L920" X_Y_Z="-195.; 3782.5; 0." />
+  <posXYZ  volume="SS_UProfile_L920" X_Y_Z="195.; 3782.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_UProfile_L1200" X_Y_Z="-195.; 2457.49; 0." />
+  <posXYZ  volume="SS_UProfile_L1200" X_Y_Z="195.; 2457.49; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_UProfile_L700" X_Y_Z="-360.; 2587.5; 0." />
+  <posXYZ  volume="SS_UProfile_L700" X_Y_Z="360.; 2587.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_Top_Interface" X_Y_Z="0.; 0.; 0." />
+  <posXYZ  volume="SS_Top_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="0.; 928.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="0.; 4427.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="SS_KM_Joint" X_Y_Z="-927.01; 4160.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_KM_Joint" X_Y_Z="927.01; 4160.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_KM_Joint" X_Y_Z="-532.01; 1975.; 0." rot="0. ; 0. ; 0." />
+</composition>
+
+<composition  name="SS_AssemblyRot" >
+  <posXYZ  volume="SS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 22.5" />
+</composition>
+
+<composition  name="SS" >
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 315." />
+</composition>
+<!-- End SS Spacer_Frame-->
+
+<composition  name="LS_and_SS_SideA" >
+  <posXYZ  volume="LS"  X_Y_Z="0.; 0.; 7641." rot=" 0. ; 0. ; 0." />
+  <posXYZ  volume="SS"  X_Y_Z="0.; 0.; 7177." rot=" 0. ; 0. ; 0." />
+</composition>
+
+<composition  name="LS_and_SS_SideC" >
+  <posXYZ  volume="LS"  X_Y_Z="0.; 0.; -7641." rot=" 0. ; 0. ; 0." />
+  <posXYZ  volume="SS"  X_Y_Z="0.; 0.; -7177." rot=" 0. ; 0. ; 0." />
+</composition>
+
+<composition  name="NSW_Spacer" >
+  <posXYZ  volume="LS_and_SS_SideA" />
+  <posXYZ  volume="LS_and_SS_SideC" />
+</composition>
+
+</section>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<!--====================================Support Structures and Hub===============================================-->
+
+<section name       = "NSW Aluminum Structure and HUB"
+         version    = "0.0"
+         date       = "25-04-2017"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "NSW_Aluminum_Structure_and_HUB">
+
+<!-- ********************************************** New Hub ************************************************** -->
+
+<!-- Horizontal Shielding -->
+<gvxysx name="Hub_Outer_Plate1" material="Lead" dZ="517.5">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+ <gvxysx name="Hub_Outer_Plate2" material="PolyBoron207HD5" dZ="517.5">
+  <gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate3" material="Lead" dZ="504.">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate4" material="PolyBoron207HD5" dZ="545.">
+  <gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate5" material="Lead" dZ="30.">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate6" material="PolyBoron207HD5" dZ="30.">
+  <gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate7" material="Lead" dZ="85.">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate8" material="PolyBoron207HD5" dZ="126.">
+<gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<composition  name="Horizontal_Shielding_ForRot_Spec" >
+  <posXYZ  volume="Hub_Outer_Plate5"  X_Y_Z="0.; 0.; 908.2" />
+  <posXYZ  volume="Hub_Outer_Plate6"  X_Y_Z="0.; 0.; 908.2" />
+</composition>
+
+<composition  name="Horizontal_Shielding_ForRot_Spec2" >
+  <posXYZ  volume="Hub_Outer_Plate3"  X_Y_Z="0.; 0.; 248.7" rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="Hub_Outer_Plate4"  X_Y_Z="0.; 0.; 228.2" rot="   0. ; 0. ; 22.5" />
+</composition>
+
+<composition  name="Horizontal_Shielding_ForRot" >
+  <posXYZ  volume="Hub_Outer_Plate1"  X_Y_Z="0.; 0.; 643.45" />
+  <posXYZ  volume="Hub_Outer_Plate2"  X_Y_Z="0.; 0.; 643.45" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec2" />
+  <posXYZ  volume="Hub_Outer_Plate7"  X_Y_Z="0.; 0.; 39.2" />
+  <posXYZ  volume="Hub_Outer_Plate8"  X_Y_Z="0.; 0.; 18.7" />
+</composition>
+
+<composition  name="Horizontal_Shielding" >
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 315." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; 67.5" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; -22.5" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; -67.5" />
+</composition>
+<!-- End Horizontal Shielding (New Hub) -->
+
+<!-- Other Parts of New Hub -->
+<pcon name="HUB_Extension_inner_tube" material="ShieldSteel" nbPhi="20">
+  <polyplane Rio_Z="172.; 225.; 997.75"/>
+  <polyplane Rio_Z=" 152.3; 225.; 0."/>
+</pcon>
+<tubs   name="HUB_Extension_plate_HO_side"      material="ShieldSteel"   Rio_Z="172.5; 530.; 59.2" />
+<tubs   name="Copper_disk_Extension"      material="Copper"   Rio_Z="225.5; 454.5; 998." />
+<tubs   name="HUB_Extension_outer_tube"      material="ShieldSteel"   Rio_Z="455.5; 530.; 998.7" />
+
+<pcon name="HUB_Main_part_inner_tube" material="ShieldSteel" nbPhi="20">
+  <polyplane Rio_Z="148.7; 225.; 858.5"/>
+  <polyplane Rio_Z=" 137.; 225.; 0."/>
+</pcon>
+
+<tubs   name="Copper_disk_Main_part"      material="Copper"   Rio_Z="225.5; 699.5; 760." />
+
+<gvxysxy name="Plate_IP_Main" material="ShieldSteel" dZ="91.6">
+  <gvxy_point X_Y="769.95; 153.16"/>
+  <gvxy_point X_Y="652.77; 436.16"/>
+  <gvxy_point X_Y="436.16; 652.77"/>
+  <gvxy_point X_Y="153.16; 769.95"/>
+</gvxysxy>
+
+<tubs   name="Plate_IP_Cut_Tube"      material="ShieldSteel"   Rio_Z="0.; 226.; 95." />
+
+<subtraction  name="Plate_IP" >
+  <posXYZ   volume="Plate_IP_Main"   />
+  <posXYZ   volume="Plate_IP_Cut_Tube" />
+</subtraction>
+
+<gvxysxy name="HUB_Main_part_outer_tube_Main" material="ShieldSteel" dZ="767.7">
+  <gvxy_point X_Y="769.95; 153.16"/>
+  <gvxy_point X_Y="652.77; 436.16"/>
+  <gvxy_point X_Y="436.16; 652.77"/>
+  <gvxy_point X_Y="153.16; 769.95"/>
+</gvxysxy>
+
+<tubs   name="HUB_Main_part_outer_tube_Cut_Tube"      material="ShieldSteel"   Rio_Z="0.; 700.; 770." />
+
+<subtraction  name="HUB_Main_part_outer_tube" >
+  <posXYZ   volume="HUB_Main_part_outer_tube_Main"   />
+  <posXYZ   volume="HUB_Main_part_outer_tube_Cut_Tube" />
+</subtraction>
+
+<gvxysxy name="Plate_HO_Main" material="ShieldSteel" dZ="78.">
+  <gvxy_point X_Y="769.95; 153.16"/>
+  <gvxy_point X_Y="652.77; 436.16"/>
+  <gvxy_point X_Y="436.16; 652.77"/>
+  <gvxy_point X_Y="153.16; 769.95"/>
+</gvxysxy>
+
+<tubs   name="Plate_HO_Cut_Tube"      material="ShieldSteel"   Rio_Z="0.; 150.5; 80." />
+
+<subtraction  name="Plate_HO" >
+  <posXYZ   volume="Plate_HO_Main"   />
+  <posXYZ   volume="Plate_HO_Cut_Tube" />
+</subtraction>
+
+<tubs name="Plate_HO_SupportTube" material="ShieldSteel" Rio_Z="585.; 770.; 21.4" profile="-15.; 210." nbPhi="20"/>
+
+<tubs   name="Disque_shileding_ext"      material="PolyBoron207HD5"   Rio_Z="532.5; 800.; 40." />
+<tubs   name="Plaque_polyboron_droite_v2"      material="PolyBoron207HD5"   Rio_Z="532.5; 582.5; 200." />
+
+<composition  name="Hub_Other_Parts_Assembly" >
+  <posXYZ  volume="HUB_Extension_plate_HO_side"  X_Y_Z="0.; 0.; 1920.6" />
+  <posXYZ  volume="HUB_Extension_inner_tube"  X_Y_Z="0.; 0.; 892.25" />
+  <posXYZ  volume="Copper_disk_Extension"  X_Y_Z="0.; 0.; 1391.95" />
+  <posXYZ  volume="HUB_Extension_outer_tube"  X_Y_Z="0.; 0.; 1391.6" />
+  <posXYZ  volume="HUB_Main_part_inner_tube"  X_Y_Z="0.; 0.; -45.8" />
+  <posXYZ  volume="Copper_disk_Main_part"  X_Y_Z="0.; 0.; 434.2" />
+  <posXYZ  volume="Plate_IP" />
+  <posXYZ  volume="HUB_Main_part_outer_tube"  X_Y_Z="0.; 0.; 430.3" />
+  <posXYZ  volume="Disque_shileding_ext"  X_Y_Z="0.; 0.; 944.2" />
+  <posXYZ  volume="Plaque_polyboron_droite_v2"  X_Y_Z="0.; 0.; 1064.25" />
+  <posXYZ  volume="Plate_HO"  X_Y_Z="0.; 0.; 853.2" />
+  <posXYZ  volume="Plate_HO_SupportTube"  X_Y_Z="0.; 0.; 902.95" />
+</composition>
+<!-- End Other Parts of New Hub -->
+
+<composition  name="New_Hub" >
+  <posXYZ  volume="Hub_Other_Parts_Assembly" />
+  <posXYZ  volume="Horizontal_Shielding" />
+</composition>
+<!-- ************************************************************************************** End New Hub *********************************************** -->
+
+<!-- **************************************************** Inner Spoke ******************************************************************* -->
+<gvxysx name="Base_Leg" material="Aluminium" dZ="390.">
+  <gvxy_point X_Y="40.; 531.5"/>
+  <gvxy_point X_Y=" 40.; -501.5"/>
+  <gvxy_point X_Y="150.; -501.5"/>
+  <gvxy_point X_Y=" 150.; -531.5"/>
+</gvxysx>
+
+<gvxy name="JOINING_BAR3" material="Aluminium" dZ="150.">
+  <gvxy_point X_Y="75.; 23."/>
+  <gvxy_point X_Y="75.; 7."/>
+  <gvxy_point X_Y="640.; 7."/>
+  <gvxy_point X_Y="640.; -23."/>
+  <gvxy_point X_Y="-640.; -23."/>
+  <gvxy_point X_Y="-640.; 7."/>
+  <gvxy_point X_Y="-75.; 7."/>
+  <gvxy_point X_Y="-75.; 23."/>
+</gvxy>
+
+<box  name="LATERAL_PLATE_L"      material="Aluminium"  X_Y_Z="21.; 1680.; 390. " />
+
+<gvxysx name="Front_plate2" material="Aluminium" dZ="14.">
+  <gvxy_point X_Y="98.65; 2867.18"/>
+  <gvxy_point X_Y=" 89.94; 2805.19"/>
+  <gvxy_point X_Y="89.94; 2587.18"/>
+</gvxysx>
+
+<gvxysx name="LS_OUTER3_MainBox" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="323.7; 450."/>
+  <gvxy_point X_Y=" 197.21; -450."/>
+</gvxysx>
+
+<box  name="LS_OUTER3_CutBox"      material="Aluminium"  X_Y_Z="250.; 600.; 35. " />
+
+<subtraction  name="LS_OUTER3" >
+  <posXYZ   volume="LS_OUTER3_MainBox"  />
+  <posXYZ   volume="LS_OUTER3_CutBox"  X_Y_Z=" 0.; -50.; 0. " />
+</subtraction>
+
+<gvxysx name="REAR_PLATE1" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="176.95; 309.25"/>
+  <gvxy_point X_Y=" 90.03; -309.25"/>
+</gvxysx>
+
+<gvxy name="REAR_PLATE2" material="Aluminium" dZ="30.">
+ <gvxy_point X_Y="273.95; 174.5"/>
+  <gvxy_point X_Y="224.9; -174.5"/>
+  <gvxy_point X_Y="125.; -174.5"/>
+  <gvxy_point X_Y="125.; -154.5"/>
+  <gvxy_point X_Y="-125.; -154.5"/>
+  <gvxy_point X_Y="-125.; -174.5"/>
+  <gvxy_point X_Y="-224.9; -174.5"/>
+  <gvxy_point X_Y="-273.95; 174.5"/>
+</gvxy>
+
+<box  name="SHIM1"      material="Aluminium"  X_Y_Z="700.; 150.; 21.6 " />
+<box  name="SHIM2"      material="Aluminium"  X_Y_Z="350.; 150.; 21.6 " />
+
+<gvxysx name="REAR_PLATE3" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="323.7; 80."/>
+  <gvxy_point X_Y=" 301.21; -80."/>
+</gvxysx>
+
+<box  name="KM_FRONT_PLATE1"      material="ShieldSteel"  X_Y_Z="34.; 160.; 250. " />
+<box  name="KM_LOCKING_PLATE1"      material="ShieldSteel"  X_Y_Z="20.; 120.; 200. " />
+
+<gvxy name="JOINING_BAR2" material="Aluminium" dZ="29.">
+  <gvxy_point X_Y="175.; 75."/>
+  <gvxy_point X_Y="964.81; -64.27"/>
+  <gvxy_point X_Y="938.77; -211.99"/>
+  <gvxy_point X_Y="161.88; -75."/>
+  <gvxy_point X_Y="-161.88; -75."/>
+  <gvxy_point X_Y="-938.77; -211.99"/>
+  <gvxy_point X_Y="-964.81; -64.27"/>
+  <gvxy_point X_Y="-175.; 75."/>
+</gvxy>
+
+<gvxy name="JOINING_BAR1" material="Aluminium" dZ="29.">
+  <gvxy_point X_Y="350.; 75."/>
+  <gvxy_point X_Y="1196.93; -74.34"/>
+  <gvxy_point X_Y="1170.88; -222.06"/>
+  <gvxy_point X_Y="336.88; -75."/>
+  <gvxy_point X_Y="-336.88; -75."/>
+  <gvxy_point X_Y="-1170.88; -222.06"/>
+  <gvxy_point X_Y="-1196.93; -74.34"/>
+  <gvxy_point X_Y="-350.; 75."/>
+</gvxy>
+
+<composition  name="Inner_Spoke_Assembly" >
+  <posXYZ  volume="Base_Leg"  X_Y_Z="0.; 1301.5; 0." />
+  <posXYZ  volume="JOINING_BAR1"  X_Y_Z="0.; 4385.; -231.2" />
+  <posXYZ  volume="JOINING_BAR2"  X_Y_Z="0.; 3065.; -231.2" />
+  <posXYZ  volume="JOINING_BAR3"  X_Y_Z="0.; 1715.; -218.05" rot="   90. ; 0. ; 0." />
+  <posXYZ  volume="LATERAL_PLATE_L"  X_Y_Z="-217.3; 3635.56; 0." rot="   0. ; 0. ; 8." />
+  <posXYZ  volume="LATERAL_PLATE_L"  X_Y_Z="217.3; 3635.56; 0." rot="   0. ; 0. ; -8." />
+  <posXYZ  volume="Front_plate2"  X_Y_Z="0.; 0.; 188." />
+  <posXYZ  volume="LS_OUTER3"  X_Y_Z="0.; 4018.41; 180." />
+  <posXYZ  volume="REAR_PLATE1"  X_Y_Z="0.; 3114.99; -180." />
+  <posXYZ  volume="REAR_PLATE2"  X_Y_Z="0.; 3939.93; -180." />
+  <posXYZ  volume="REAR_PLATE3"  X_Y_Z="0.; 4388.42; -180." />
+  <posXYZ  volume="SHIM1"  X_Y_Z="0.; 4385.; -205.85" />
+  <posXYZ  volume="SHIM2"  X_Y_Z="0.; 3065.; -205.85" />
+  <posXYZ  volume="KM_FRONT_PLATE1"  X_Y_Z="318.34; 4156.56; 25." rot="   0. ; 0. ; -8." />
+  <posXYZ  volume="KM_FRONT_PLATE1"  X_Y_Z="-318.34; 4156.56; 25." rot="   0. ; 0. ; 8." />
+  <posXYZ  volume="KM_LOCKING_PLATE1"  X_Y_Z="270.71; 4163.26; 0." rot="   0. ; 0. ; -8." />
+  <posXYZ  volume="KM_LOCKING_PLATE1"  X_Y_Z="-270.71; 4163.26; 0." rot="   0. ; 0. ; 8." />
+</composition>
+
+<composition  name="Inner_Spoke" >
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 67.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 112.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 157.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 202.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 247.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 292.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 337.5" />
+</composition>
+
+<!-- *********************************************************************************** End Inner Spoke **************************************************\
+************************************* -->
+
+<!-- *********************************************************************************** Outer Spoke ******************************************************\
+************************************* -->
+
+<box  name="NSW_F1_spoke_MainBox"      material="Aluminium"  X_Y_Z="135.; 1060.; 185. " />
+<box  name="NSW_F1_spoke_CutBox"      material="Aluminium"  X_Y_Z="111.; 1070.; 161. " />
+
+<subtraction  name="NSW_F1_spoke" >
+  <posXYZ  volume="NSW_F1_spoke_MainBox" />
+  <posXYZ  volume="NSW_F1_spoke_CutBox" />
+</subtraction>
+<box  name="NSW_F1_spoke_Bot_Plate"      material="Aluminium"  X_Y_Z="300.; 48.; 300. " />
+
+<gvxysx name="Plaque_interface2" material="Aluminium" dZ="37.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<gvxysx name="Plaque_interface2.1" material="Aluminium" dZ="45.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<box  name="NSW_SS_spoke_Pillar_MainBox"      material="Aluminium"  X_Y_Z="135.; 2683.25; 185. " />
+<box  name="NSW_SS_spoke_Pillar_CutBox"      material="Aluminium"  X_Y_Z="113.; 2685.; 163. " />
+
+<subtraction  name="NSW_SS_spoke_Pillar" >
+  <posXYZ  volume="NSW_SS_spoke_Pillar_MainBox" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar_CutBox" />
+</subtraction>
+
+<box  name="Spoke_Joint"      material="ShieldSteel"  X_Y_Z="75.; 85.; 124.4 " />
+
+<gvxysx name="Manifolds_Support_Main" material="Aluminium" dZ="150.">
+  <gvxy_point X_Y="585.; 75."/>
+  <gvxy_point X_Y=" 551.74; -75."/>
+</gvxysx>
+
+<box  name="Manifolds_Support_CutBox1"      material="Aluminium"  X_Y_Z="1180.; 140.; 140. " />
+<box  name="Manifolds_Support_CutBox2"      material="Aluminium"  X_Y_Z="160.; 90.; 160. " />
+
+<subtraction  name="Manifolds_Support" >
+  <posXYZ  volume="Manifolds_Support_Main" />
+  <posXYZ  volume="Manifolds_Support_CutBox1" />
+  <posXYZ  volume="Manifolds_Support_CutBox2"  X_Y_Z="135.; -45.; 0." />
+</subtraction>
+
+<box  name="Cale"      material="Aluminium"  X_Y_Z="135.; 280.; 52. " />
+<box  name="JD_JOINT2.1_Plate1"      material="Aluminium"  X_Y_Z="250.; 270.; 20. " />
+<box  name="Shim_JD"      material="Aluminium"  X_Y_Z="250.; 270.; 29. " />
+<box  name="JD_JOINT1_Pipe_MainBox" material="Aluminium"  X_Y_Z="1300.; 120.; 80." />
+<box  name="JD_JOINT1_Pipe_CutBox"      material="Aluminium"  X_Y_Z="1305.; 100.; 60. " />
+
+<subtraction  name="JD_JOINT1_Pipe" >
+  <posXYZ  volume="JD_JOINT1_Pipe_MainBox"  />
+  <posXYZ  volume="JD_JOINT1_Pipe_CutBox"  />
+</subtraction>
+
+<box  name="JD_JOINT2_Pipe_MainBox" material="Aluminium"  X_Y_Z="900.; 120.; 80." />
+
+<subtraction  name="JD_JOINT2_Pipe" >
+  <posXYZ  volume="JD_JOINT2_Pipe_MainBox" />
+  <posXYZ  volume="JD_JOINT1_Pipe_CutBox"  />
+</subtraction>
+
+<box  name="KM_FRONT_PLATE.1.1"      material="ShieldSteel"  X_Y_Z="27.; 272.; 120. " />
+<box  name="Manifolds_Support_Plate"      material="Aluminium"  X_Y_Z="9.8; 275.; 175. " />
+<box  name="AL_BAR_KM_INCLINED_PLATE"      material="Aluminium"  X_Y_Z="290.; 38.; 67. " />
+
+<composition  name="Outer_Spoke_Assembly" >
+  <posXYZ  volume="NSW_F1_spoke"  X_Y_Z="0.; 1350.; 0." />
+  <posXYZ  volume="NSW_F1_spoke_Bot_Plate"  X_Y_Z="0.; 795.95; 0." />
+  <posXYZ  volume="Manifolds_Support"  X_Y_Z="0.; 4515.33; 0." />
+  <posXYZ  volume="Plaque_interface2"  X_Y_Z="0.; 1745.; 111.05" />
+  <posXYZ  volume="Plaque_interface2.1"  X_Y_Z="0.; 1745.; -115.05" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="371.; 3267.85; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="-371.; 3267.85; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="610.52; 4348.24; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="322.65; 3049.77; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="-610.52; 4348.24; 154.75" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="-322.65; 3049.77; 154.75" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="537.79; 4020.21; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="338.24; 3120.06; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="-537.79; 4020.21; -118.55" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="-338.24; 3120.06; -118.55" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="315.; 3120.6; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-315.; 3120.6; -154.6" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="315.; 3120.6; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-315.; 3120.6; -261.55" />
+  <posXYZ  volume="JD_JOINT1_Pipe"  X_Y_Z="0.; 4020.2; -207." />
+  <posXYZ  volume="JD_JOINT2_Pipe"  X_Y_Z="0.; 3120.6; -207." />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="641.41; 4289.16; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="-641.41; 4289.16; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Manifolds_Support_Plate"  X_Y_Z="560.93; 4459.11; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Manifolds_Support_Plate"  X_Y_Z="-560.93; 4459.11; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="AL_BAR_KM_INCLINED_PLATE"  X_Y_Z="-243.; 4099.25; -228.5" />
+</composition>
+
+<!-- Outer Spoke Foot -->
+<gvxysx name="Plaque_interface2_SpecMain" material="Aluminium" dZ="37.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<box  name="Plaque_interface2_Spec_CutBox"      material="Aluminium"  X_Y_Z="160.; 260.; 13. " />
+
+<subtraction  name="Plaque_interface2_Spec" >
+  <posXYZ  volume="Plaque_interface2_SpecMain" />
+  <posXYZ  volume="Plaque_interface2_Spec_CutBox"  X_Y_Z="-120.94; 337.19; -12.5" rot="   0. ; 0. ; 12.5" />
+</subtraction>
+
+<gvxysx name="Plaque_interface2.1_SpecMain" material="Aluminium" dZ="45.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<subtraction  name="Plaque_interface2.1_Spec" >
+  <posXYZ  volume="Plaque_interface2.1_SpecMain" />
+  <posXYZ  volume="Plaque_interface2_Spec_CutBox"  X_Y_Z="-120.94; 337.19; 16.5" rot="   0. ; 0. ; 12.5" />
+</subtraction>
+
+<box  name="NSW_SS_spoke_PillarSpec_MainBox"      material="ShieldSteel"  X_Y_Z="135.; 2818.1; 210. " />
+<box  name="NSW_SS_spoke_PillarSpec_CutBox"      material="Aluminium"  X_Y_Z="91.; 2820.; 166. " />
+
+<subtraction  name="NSW_SS_spokeSpec_Pillar" >
+  <posXYZ  volume="NSW_SS_spoke_PillarSpec_MainBox" />
+  <posXYZ  volume="NSW_SS_spoke_PillarSpec_CutBox" />
+</subtraction>
+
+<box  name="Cale_Spec"      material="Aluminium"  X_Y_Z="135.; 280.; 38.6 " />
+<box  name="Spoke_Joint1.2"      material="Aluminium"  X_Y_Z="66.; 100.; 111.9 " />
+
+<box  name="BOTTOM_PLATE.1_Horisontal_Plate"      material="ShieldSteel"  X_Y_Z="29.8; 775.; 495. " />
+<box  name="BOTTOM_PLATE.1_Vertical_Main_Plate"      material="ShieldSteel"  X_Y_Z="460.; 640.; 35. " />
+
+<gvxy name="Connecting_Plates2.1" material="Aluminium" dZ="22.">
+  <gvxy_point X_Y="-252.; 130.65"/>
+  <gvxy_point X_Y="70.; 130.65"/>
+  <gvxy_point X_Y="252.; 25.65"/>
+  <gvxy_point X_Y="258.6; -124.1"/>
+  <gvxy_point X_Y="108.7; -130.65"/>
+  <gvxy_point X_Y="-252.; 19.35"/>
+</gvxy>
+
+<box  name="Tube_alu_feet_MainBox"      material="Aluminium"  X_Y_Z="1050.; 135.; 185. " />
+<box  name="Tube_alu_feet_CutBox"      material="Aluminium"  X_Y_Z="1055.; 111.4; 161.4 " />
+
+<subtraction  name="Tube_alu_feet" >
+  <posXYZ  volume="Tube_alu_feet_MainBox" />
+  <posXYZ  volume="Tube_alu_feet_CutBox"  X_Y_Z="-120.94; 337.19; 16.5" rot="   0. ; 0. ; 12.5" />
+</subtraction>
+
+<box  name="Fix_nut"      material="ShieldSteel"  X_Y_Z="50.; 52.; 290. " />
+
+<gvxy name="Beam_Interface" material="Aluminium" dZ="300.">
+  <gvxy_point X_Y="-80.; 73.4"/>
+  <gvxy_point X_Y="80.; 73.4"/>
+  <gvxy_point X_Y="80.; -73.4"/>
+  <gvxy_point X_Y="-80.; 28.5"/>
+</gvxy>
+
+<gvxy name="Beam_Interface2" material="Aluminium" dZ="300.">
+  <gvxy_point X_Y="-80.; 79.8"/>
+  <gvxy_point X_Y="80.; 79.8"/>
+  <gvxy_point X_Y="80.; 12.6"/>
+  <gvxy_point X_Y="-80.; -79.8"/>
+</gvxy>
+
+<box  name="LS_T_Joint"      material="ShieldSteel"  X_Y_Z="80.; 70.; 134.9 " />
+<box  name="LS_T_Joint2"      material="ShieldSteel"  X_Y_Z="77.; 67.; 147.4 " />
+
+<gvxy name="Renfort_Bas1_MainBox" material="Aluminium" dZ="135.">
+  <gvxy_point X_Y="-337.73; -67.5"/>
+  <gvxy_point X_Y="-251.72; 67.5"/>
+  <gvxy_point X_Y="251.72; 67.5"/>
+  <gvxy_point X_Y="337.27; -67.5"/>
+</gvxy>
+
+<box  name="Renfort_Bas1_CutBox"      material="Aluminium"  X_Y_Z="680.; 115.; 115. " />
+
+
+<subtraction  name="Renfort_Bas1" >
+  <posXYZ  volume="Renfort_Bas1_MainBox" />
+  <posXYZ  volume="Renfort_Bas1_CutBox" />
+</subtraction>
+
+<composition  name="Outer_Spoke_Assembly_FOOT1" >
+  <posXYZ  volume="NSW_F1_spoke"  X_Y_Z="0.; 1350.; 0." />
+  <posXYZ  volume="NSW_F1_spoke_Bot_Plate"  X_Y_Z="0.; 795.95; 0." />
+  <posXYZ  volume="Plaque_interface2_Spec"  X_Y_Z="0.; 1745.; 111.05" />
+  <posXYZ  volume="Plaque_interface2.1_Spec"  X_Y_Z="0.; 1745.; -115.05" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="371.; 3267.85; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="NSW_SS_spokeSpec_Pillar"  X_Y_Z="-385.59; 3333.67; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="315.; 3120.6; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-315.; 3120.6; -261.55" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="315.; 3120.6; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-315.; 3120.6; -154.6" />
+  <posXYZ  volume="Cale"  X_Y_Z="537.79; 4020.21; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="338.24; 3120.06; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-537.79; 4020.21; -124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-338.24; 3120.06; -124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="JD_JOINT1_Pipe"  X_Y_Z="0.; 4020.2; -207." />
+  <posXYZ  volume="JD_JOINT2_Pipe"  X_Y_Z="0.; 3120.6; -207." />
+  <posXYZ  volume="AL_BAR_KM_INCLINED_PLATE"  X_Y_Z="-243.; 4099.25; -228.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="322.65; 3049.77; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="610.52; 4348.24; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-322.65; 3049.28; 161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-610.4; 4347.75; 161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="641.41; 4289.16; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="BOTTOM_PLATE.1_Horisontal_Plate"  X_Y_Z="-675.29; 4889.64; -29." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="BOTTOM_PLATE.1_Vertical_Main_Plate"  X_Y_Z="-491.47; 4727.04; -257.5" rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; 103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; -103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Tube_alu_feet"  X_Y_Z="35.49; 4779.63; 0." rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-840.79; 4666.23; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-443.82; 5063.2; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Beam_Interface"  X_Y_Z="-716.12; 4723.86; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Beam_Interface2"  X_Y_Z="-496.92; 4934.01; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_T_Joint"  X_Y_Z="-649.; 4560.58; -172.5" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="LS_T_Joint2"  X_Y_Z="-356.49; 4881.55; -166.25" rot="   0. ; 0. ; 75." />
+  <posXYZ  volume="Renfort_Bas1"  X_Y_Z="-329.24; 4539.98; 0." rot="   0. ; 0. ; 45." />
+</composition>
+
+<composition  name="Outer_Spoke_Assembly_FOOT2" >
+  <posXYZ  volume="NSW_F1_spoke"  X_Y_Z="0.; 1350.; 0." />
+  <posXYZ  volume="NSW_F1_spoke_Bot_Plate"  X_Y_Z="0.; 795.95; 0." />
+  <posXYZ  volume="Plaque_interface2_Spec"  X_Y_Z="0.; 1745.; 111.05" />
+  <posXYZ  volume="Plaque_interface2.1_Spec"  X_Y_Z="0.; 1745.; -115.05" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="371.; 3267.85; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="NSW_SS_spokeSpec_Pillar"  X_Y_Z="-385.59; 3333.67; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="515.; 4020.2; 261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="315.; 3120.6; 261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-515.; 4020.2; 261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-315.; 3120.6; 261.55" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="515.; 4020.2; 154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="315.; 3120.6; 154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-515.; 4020.2; 154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-315.; 3120.6; 154.6" />
+  <posXYZ  volume="Cale"  X_Y_Z="537.79; 4020.21; 118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="338.24; 3120.06; 118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-537.79; 4020.21; 124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-338.24; 3120.06; 124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="JD_JOINT1_Pipe"  X_Y_Z="0.; 4020.2; 207." />
+  <posXYZ  volume="JD_JOINT2_Pipe"  X_Y_Z="0.; 3120.6; 207." />
+  <posXYZ  volume="AL_BAR_KM_INCLINED_PLATE"  X_Y_Z="-243.; 4099.25; 228.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="322.65; 3049.77; -154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="610.52; 4348.24; -154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-322.65; 3049.28; -161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-610.4; 4347.75; -161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="641.41; 4289.16; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="BOTTOM_PLATE.1_Horisontal_Plate"  X_Y_Z="-675.29; 4889.64; 29." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="BOTTOM_PLATE.1_Vertical_Main_Plate"  X_Y_Z="-491.47; 4727.04; 257.5" rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; -103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; 103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Tube_alu_feet"  X_Y_Z="35.49; 4779.63; 0." rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-840.79; 4666.23; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-443.82; 5063.2; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Beam_Interface"  X_Y_Z="-716.12; 4723.86; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Beam_Interface2"  X_Y_Z="-496.92; 4934.01; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_T_Joint"  X_Y_Z="-649.; 4560.58; 172.5" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="LS_T_Joint2"  X_Y_Z="-356.49; 4881.55; 166.25" rot="   0. ; 0. ; 75." />
+  <posXYZ  volume="Renfort_Bas1"  X_Y_Z="-329.24; 4539.98; 0." rot="   0. ; 0. ; 45." />
+</composition>
+<!-- End Outer Spoke Foot -->
+
+
+<composition  name="Outer_Spoke" >
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="Outer_Spoke_Assembly_FOOT1"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="Outer_Spoke_Assembly_FOOT2"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 180. ; 225." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 315." />
+</composition>
+<!-- ********************************************************************************* End Outer Spoke ****************************************************\
+************************************** -->
+
+<!-- *********************************************************************************** LSO LSI Connection ***********************************************\
+************************************* -->
+
+<box  name="LSO_LSI_connection_Rot"      material="ShieldSteel"  X_Y_Z="63.; 754.1; 46. " />
+
+<composition  name="LSO_LSI_connection_Pos" >
+  <posXYZ  volume="LSO_LSI_connection_Rot"  X_Y_Z="0.; 2210.09; 0." />
+</composition>
+
+<composition  name="LSO_LSI_Connection" >
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; 67.5" />
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; -22.5" />
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; -67.5" />
+</composition>
+
+<!-- *********************************************************************************** End LSO LSI Connection *******************************************\
+************************************* -->
+
+<!-- *********************************************************************************** Alignment Bars ***************************************************\
+**************************************** -->
+
+<!-- SS Bar -->
+<tubs   name="SS_Bar_Tube"      material="Aluminium"   Rio_Z="0.; 49.1; 2382." />
+
+<composition  name="SS_Bar_Assembly" >
+  <posXYZ  volume="SS_Bar_Tube"  X_Y_Z="69.2; 3364.6; 0" rot="   90. ; 0. ; -3.35" />
+</composition>
+
+<composition  name="SS_Bar" >
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 315." />
+</composition>
+<!-- End SS Bar -->
+
+<!-- LS Bar -->
+<tubs   name="LS_Bar_Tube"      material="Aluminium"   Rio_Z="0.; 48.; 2340." />
+<box  name="LS_Arm"      material="Aluminium"  X_Y_Z="1010.; 40.; 50. " />
+
+<composition  name="LS_Bar_Assembly" >
+  <posXYZ  volume="LS_Bar_Tube"  X_Y_Z="1286.4; 3086.18; 0." rot="   90. ; 0. ; -25." />
+  <posXYZ  volume="LS_Arm"  X_Y_Z="1789.34; 4164.73; 0." rot="   0. ; 0. ; -25." />
+</composition>
+
+<composition  name="LS_Bar" >
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 315." />
+</composition>
+<!-- End LS Bar -->
+
+<!-- *********************************************************************************** End Alignment Bars ***********************************************\
+******************************************** -->
+
+
+<composition  name="NSW_Aluminum_Structure_and_HUB_Assembly" >
+  <posXYZ  volume="New_Hub" />
+  <posXYZ  volume="Inner_Spoke" />
+  <posXYZ  volume="LSO_LSI_Connection" />
+  <posXYZ  volume="Outer_Spoke" />
+  <posXYZ  volume="SS_Bar" />
+  <posXYZ  volume="LS_Bar" />
+</composition>
+
+<composition  name="NSW_Aluminum_Structure_and_HUB_SideA" >
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_Assembly"  X_Y_Z="0.; 0.; 6943.8" rot="   0. ; 0. ; 0." />
+</composition>
+
+<composition  name="NSW_Aluminum_Structure_and_HUB_SideC" >
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_Assembly"  X_Y_Z="0.; 0.; -6943.8" rot="   0. ; 180. ; 0." />
+</composition>
+
+<composition  name="NSW_Aluminum_Structure_and_HUB" >
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_SideA" />
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_SideC" />
+</composition>
+
+</section>
+
+<!-- ===========================================NJD=========================================== -->
+
+<section name       = "NJD Disk"
+         version    = "0.0"
+         date       = "16-11-2016"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "NJD_Disk">
+
+<!-- NJD Disk -->
+
+<!-- main disk-->
+<tubs name="MD01"   material="ShieldSteel"  Rio_Z="430.; 4360.; 40."  nbPhi="32." />
+<tubs name="MD02"   material="ShieldSteel"  Rio_Z="430.; 2700.;  48.7"  nbPhi="32." />
+<tubs name="MDB01_Cut"   material="ShieldSteel"  Rio_Z="0.; 840.; 3."  nbPhi="32." />
+
+<gvxy   name="MD03"   material="ShieldSteel"  dZ="40." >
+  <gvxy_point X_Y="-3370.; -3950."/>
+  <gvxy_point X_Y="-3370.; -3880."/>
+  <gvxy_point X_Y="-3679.5; -2484."/>
+  <gvxy_point X_Y="-3990.; -1734.39"/>
+  <gvxy_point X_Y="-2599.16; -3470."/>
+  <gvxy_point X_Y="-2670.; -3570."/>
+  <gvxy_point X_Y="-2670.; -3950."/>
+</gvxy>
+
+<subtraction name="MDB01_Un" >
+ <posXYZ volume="MD01" />
+ <posXYZ volume="MDB01_Cut" X_Y_Z=" 0.; 0.; 19.4 " />
+</subtraction>
+
+<union name="MDB01" >
+ <posXYZ volume="MDB01_Un" />
+ <posXYZ volume="MD03"  />
+ <posXYZ volume="MD03" rot=" 0.; 180.; 0."/>
+</union>
+<!-- End main disk-->
+
+
+<!-- Ret.Flux -->
+<tubs name="FLUX_Box"   material="ShieldSteel"  Rio_Z="3800.; 4360.; 39.9"  nbPhi="32." />
+<box  name="FLUX_Cut_Box" material="ShieldSteel"  X_Y_Z="2200.; 400.;  50." />
+
+<subtraction name="FLUX" >
+ <posXYZ volume="FLUX_Box" />
+ <posXYZ volume="FLUX_Cut_Box" X_Y_Z=" -1930.; 3430.; 0." />
+</subtraction>
+<!-- End Ret.Flux -->
+
+<!-- FIXING PLATE -->
+<box  name="FIXING_PLATE" material="ShieldSteel"  X_Y_Z="350.; 975.;  40.9" />
+<box  name="FIXING_PLATE_Special" material="ShieldSteel"  X_Y_Z="350.; 787.5;  40.9" />
+
+<composition name="FIXING_PLATE_Pos" >
+ <posXYZ volume="FIXING_PLATE" X_Y_Z=" 0.; 3252.5; 0." />
+</composition>
+
+<composition name="FIXING_PLATE_Ass" >
+ <posXYZ volume="FIXING_PLATE_Special" X_Y_Z=" -1208.8; 2918.31; 0." rot=" 0.; 0.; 22.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 67.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 112.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 157.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 202.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 247.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 292.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 337.5" />
+</composition>
+<!-- End FIXING PLATE -->
+
+<!-- NJD feet-->
+<gvxy   name="JF01"   material="ShieldSteel"  dZ="37.3" >
+  <gvxy_point X_Y="-3300.; -3950."/>
+  <gvxy_point X_Y="-3300.; -3480."/>
+  <gvxy_point X_Y="-3270.; -3450."/>
+  <gvxy_point X_Y="-2730.; -3450."/>
+  <gvxy_point X_Y="-2700.; -3480."/>
+  <gvxy_point X_Y="-2700.; -3950."/>
+</gvxy>
+
+<gvxy   name="JF02"   material="ShieldSteel"  dZ="35." >
+  <gvxy_point X_Y="-342.4; -3950."/>
+  <gvxy_point X_Y="-342.4; -3930."/>
+  <gvxy_point X_Y="-77.4; -3470."/>
+  <gvxy_point X_Y="-57.4; -3470."/>
+  <gvxy_point X_Y="-57.4; -3920."/>
+  <gvxy_point X_Y="-87.4; -3950."/>
+</gvxy>
+
+<gvxy   name="JF03"   material="ShieldSteel"  dZ="48." >
+  <gvxy_point X_Y="-3370.; -362."/>
+  <gvxy_point X_Y="-3370.; 704."/>
+  <gvxy_point X_Y="-3495.; 704."/>
+  <gvxy_point X_Y="-3495.; 933."/>
+  <gvxy_point X_Y="-2660.; 933."/>
+  <gvxy_point X_Y="-2660.; 653."/>
+  <gvxy_point X_Y="-2700.; 653."/>
+  <gvxy_point X_Y="-2700.; 523."/>
+  <gvxy_point X_Y="-2590.; 523."/>
+  <gvxy_point X_Y="-2590.; -52."/>
+  <gvxy_point X_Y="-2685.; -52."/>
+  <gvxy_point X_Y="-2685.; -362."/>
+</gvxy>
+
+<gvxy   name="JF04"   material="ShieldSteel"  dZ="41.6" >
+  <gvxy_point X_Y="-453.5; -4251.1"/>
+  <gvxy_point X_Y="-453.5; -4158.1"/>
+  <gvxy_point X_Y="-603.; -4083.1"/>
+  <gvxy_point X_Y="-603.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -3998.1"/>
+  <gvxy_point X_Y="883.; -3998.1"/>
+  <gvxy_point X_Y="883.; -4251.1"/>
+</gvxy>
+
+<gvxy   name="JF05"   material="ShieldSteel"  dZ="356.1" >
+  <gvxy_point X_Y="-603.; -4048.1"/>
+  <gvxy_point X_Y="-603.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -3998.1"/>
+  <gvxy_point X_Y="-253.; -3998.1"/>
+  <gvxy_point X_Y="-253.; -4048.1"/>
+</gvxy>
+
+<box  name="JF06" material="ShieldSteel"  X_Y_Z="536.; 253.; 71.4" />
+
+<!-- Right-->
+<composition name="Right_Feet" >
+ <posXYZ volume="JF01" X_Y_Z=" 0.; 0.; 38.7" rot=" 0.; 0.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" -2802.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" -3197.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF03" X_Y_Z=" 0.; -3974.05; 0." rot=" -90.; 0.; 0." />
+ <posXYZ volume="JF04" X_Y_Z=" -2805.2; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF04" X_Y_Z=" -3203.; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF05" X_Y_Z=" -3004.1; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF06" X_Y_Z=" -3000.; -4124.6; -918.75" rot=" 0.; 0.; 0." />
+</composition>
+<!-- End Right-->
+
+<!-- Left-->
+<composition name="Left_Feet" >
+ <posXYZ volume="JF01" X_Y_Z=" 0.; 0.; 38.7" rot=" 0.; 180.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" 2802.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" 3197.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF03" X_Y_Z=" 0.; -3974.05; 0." rot=" -90.; 0.; 180." />
+ <posXYZ volume="JF04" X_Y_Z=" 2805.2; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF04" X_Y_Z=" 3203.; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF05" X_Y_Z=" 3004.1; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF06" X_Y_Z=" 3000.; -4124.6; -918.75" rot=" 0.; 0.; 0." />
+</composition>
+<!-- End Right-->
+<!-- End NJD feet-->
+
+<composition name="JDDisk_ASide" >
+ <posXYZ volume="MDB01"  X_Y_Z=" 0.; 0.; 6880." rot=" 0.; 0.; 0." />
+ <posXYZ volume="MD02" X_Y_Z=" 0.; 0.; 6835.6" rot=" 0.; 0.;0."/>
+ <posXYZ volume="FLUX" X_Y_Z=" 0.; 0.; 6840." rot=" 0.; 0.; 0." />
+ <posXYZ volume="FIXING_PLATE_Ass" X_Y_Z=" 0.; 0.; 6839.5" rot=" 0.; 0.; 0." />
+ <posXYZ volume="Right_Feet"  X_Y_Z=" 0.; 0.; 6880." rot=" 0.; 180.; 0." />
+ <posXYZ volume="Left_Feet"  X_Y_Z=" 0.; 0.; 6880." rot=" 0.; 180.; 0." />
+</composition>
+
+<composition name="JDDisk_CSide" >
+ <posXYZ volume="MDB01"  X_Y_Z=" 0.; 0.; -6880." rot=" 0.; 180.; 0." />
+ <posXYZ volume="MD02" X_Y_Z=" 0.; 0.; -6835.6" rot=" 0.; 0.;0."/>
+ <posXYZ volume="FLUX" X_Y_Z=" 0.; 0.; -6840." rot=" 0.; 0.; 0." />
+ <posXYZ volume="FIXING_PLATE_Ass" X_Y_Z=" 0.; 0.; -6839.5" rot=" 0.; 0.; 0." />
+ <posXYZ volume="Right_Feet"  X_Y_Z=" 0.; 0.; -6880." rot=" 0.; 0.; 0." />
+ <posXYZ volume="Left_Feet"  X_Y_Z=" 0.; 0.; -6880." rot=" 0.; 0.; 0." />
+</composition>
+<!-- End NJD Disk -->
+
+<composition  name="NJD_Disk" >
+ <posXYZ volume="JDDisk_ASide"  X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 0." />
+ <posXYZ volume="JDDisk_CSide"  X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 0." />
+</composition>
+
+</section>
+
+<!-- ==================================================Feet========================================= -->
+
+<section name       = "A Plate"
+         version    = "0.0"
+         date       = "29-05-2017"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "A_Plate">
+
+<gvxy name="Lateral_Plate_Main" material="ShieldSteel" dZ="21.">
+  <gvxy_point X_Y="-3300.; -4000."/>
+  <gvxy_point X_Y="-3548.3; -3235.72"/>
+  <gvxy_point X_Y="-1458.4; -560.8"/>
+  <gvxy_point X_Y="73.9; 73.9"/>
+  <gvxy_point X_Y="-628.9; -1622.8"/>
+  <gvxy_point X_Y="-818.3; -1544.4"/>
+  <gvxy_point X_Y="-1558.6; -2491.9"/>
+  <gvxy_point X_Y="-1427.8; -2980."/>
+  <gvxy_point X_Y="-0.01; -2980."/>
+  <gvxy_point X_Y="-0.01; -3280."/>
+  <gvxy_point X_Y="-1701.9; -3280."/>
+  <gvxy_point X_Y="-1995.3; -3050.8"/>
+  <gvxy_point X_Y="-2650.; -3889."/>
+  <gvxy_point X_Y="-2650.; -4000."/>
+</gvxy>
+
+<tubs name="Lateral_plate_TubeCut" material="ShieldSteel"  Rio_Z=" 0. ; 600. ; 25."  nbPhi="36." />
+
+<subtraction  name="Lateral_Plate" >
+  <posXYZ   volume="Lateral_Plate_Main"  />
+  <posXYZ   volume="Lateral_plate_TubeCut" X_Y_Z="-0.01; -0.01; 0." rot="   0. ; 0. ; 0." />
+</subtraction>
+
+<tubs     name="Anchorage"  material="ShieldSteel"  Rio_Z=" 0. ; 22.6 ; 577."  nbPhi="36." />
+
+<gvxy name="Vertical_Top_Plate" material="ShieldSteel" dZ="33.">
+  <gvxy_point X_Y="-3300.; -3998."/>
+  <gvxy_point X_Y="-3300.; -3730."/>
+  <gvxy_point X_Y="-2865.; -3730."/>
+  <gvxy_point X_Y="-2675.; -3920."/>
+  <gvxy_point X_Y="-2675.; -3998."/>
+</gvxy>
+
+<box  name="Horizontal_Plate" material="ShieldSteel"  X_Y_Z="625.; 40.6; 287. " />
+
+<composition  name="A_Plate_Assembly" >
+  <posXYZ   volume="Lateral_Plate"  />
+  <posXYZ   volume="Lateral_Plate" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ   volume="Anchorage" X_Y_Z="-3447.; -3283.25; -299.01" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Anchorage" X_Y_Z="3447.; -3283.25; -299.01" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Vertical_Top_Plate" X_Y_Z="0.; 0.; -27.01" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Vertical_Top_Plate" X_Y_Z="0.; 0.; -27.01" rot="0. ; 180. ; 0." />
+  <posXYZ   volume="Horizontal_Plate" X_Y_Z="-2987.5; -3929.7; -187.02" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Horizontal_Plate" X_Y_Z="2987.5; -3929.7; -187.02" rot="0. ; 0. ; 0." />
+</composition>
+
+<composition  name="A_Plate_SideA" >
+   <posXYZ volume="A_Plate_Assembly" X_Y_Z=" 0. ; 0.; 7857.5"  />
+</composition>
+
+<composition  name="A_Plate_SideC" >
+   <posXYZ volume="A_Plate_Assembly" X_Y_Z=" 0. ; 0.; -7857.5" rot="0. ; 180. ; 0."  />
+</composition>
+
+<composition  name="A_Plate" >
+   <posXYZ volume="A_Plate_SideA" />
+   <posXYZ volume="A_Plate_SideC" />
+</composition>
+
+</section>
+
+<!-- ========== Poisitionning all Volumes in NSW================ -->
+
+<section name="NewSmallWheels" version="4.3" top_volume="NewSmallWheel" date=" April 20, 2015 " author="Daniel Lellouch">
+
+<composition name="NewSmallWheel">
+ <posXYZ volume="NSW_sTGC" X_Y_Z="0.;0.;0."/>
+ <posXYZ volume="NSW_MM" X_Y_Z="0.;0.;0." />
+ <posXYZ volume="NSW_Spacer" />
+ <posXYZ volume="NSW_Aluminum_Structure_and_HUB" />
+ <posXYZ volume="NJD_Disk" />
+ <posXYZ volume="A_Plate" />
+</composition>
+
+</section>
+
+</AGDD>
diff --git a/MuonSpectrometer/MuonG4/NSW_Sim/data/stations.v2.08_Aside.xml b/MuonSpectrometer/MuonG4/NSW_Sim/data/stations.v2.08_Aside.xml
new file mode 100644
index 0000000000000000000000000000000000000000..49fa2d4486ea77626c551a73fb8272a0fa46bc8d
--- /dev/null
+++ b/MuonSpectrometer/MuonG4/NSW_Sim/data/stations.v2.08_Aside.xml
@@ -0,0 +1,1838 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AGDD>
+
+<section name="NSW_Parameters" version="1" top_volume="useless" date="December 16 2014" author="S.Chen" >
+<!-- Global variables-->
+<var name="NSW_NbrOfLayers" value="4"/>
+<var name="NSW_NbrOfDriftPcb" value="3"/>
+<var name="NSW_NbrOfROPcb" value="2"/>
+<!--Center between the large sectors and the small sectors-->
+<var name="ZCenter_Global" value="7409"/>
+</section>
+
+<section name="NSW_sTGC_Parameters" version="13.7" top_volume="useless" date=" June 30, 2016 " author="Daniel Lellouch">
+<!-- ================ Global Variables ================= -->
+
+<!-- Thickness of a quadruplet -->
+<var name="NSW_sTGC_Tck" value="49.34"/>
+<!-- Gas Gap inside one layer -->
+<var name="NSW_sTGC_GasTck" value="2.85"/>
+<!-- G10 thickness per layer -->
+<var name="NSW_sTGC_pcbTck" value="3"/>
+<!-- Number of layers in a quaduplet -->
+<var name="NSW_sTGC_NbrOfLayers" value="4"/>
+<!-- Wire pitch -->
+<var name="NSW_sTGC_WirePitch" value="1.8"/>
+<!-- Strip pitch -->
+<var name="NSW_sTGC_StripPitch" value="3.2"/>
+<!-- Strip width -->
+<var name="NSW_sTGC_StripWidth" value="2.7"/>
+<!-- Width of G10 frame besides gas volume -->
+<var name="NSW_sTGC_SideFrame" value="28.5"/>
+<!-- Width of G10 frame in base w/o capacitor -->
+<var name="NSW_sTGC_hFrameNoCapacitor" value="11"/>
+<!-- Width of G10 frame in base with capacitor -->
+<var name="NSW_sTGC_hFrameCapacitor" value="14"/>
+<!-- Opening (in degrees) of trapezes in small wedges -->
+<var name="NSW_sTGC_SmallOpening" value="17"/>
+<!-- Opening (in degrees) of trapezes in large wedges -->
+<var name="NSW_sTGC_LargeOpening" value="28"/>
+<!-- Z center of small Pivot -->
+<var name="NSW_sTGC_ZSmallPivot" value="ZCenter_Global-65"/>
+<!-- Z center of small Confirm -->
+<var name="NSW_sTGC_ZSmallConfirm" value="ZCenter_Global-399"/>
+<!-- Z center of Large Pivot -->
+<var name="NSW_sTGC_ZLargePivot" value="ZCenter_Global+65"/>
+<!-- Z center of Large Confirm -->
+<var name="NSW_sTGC_ZLargeConfirm" value="ZCenter_Global+399"/>
+<!-- Z of each volume, relative to center of quadruplet -->
+<array name="NSW_sTGC_LayerDeltaZ" values="-16.45;-5.48;5.49;16.46"/>
+<!-- Side of the Pad readout -->
+<array name="NSW_sTGC_PadSide" values="-1;1;-1;1"/>
+<!-- Side of the Strip readout -->
+<array name="NSW_sTGC_StripSide" values="1;-1;1;-1"/>
+</section>
+
+<!-- ================ sTGC ========================= -->
+
+
+<section name="NewSmallWheels_sTGC" version="22.1" top_volume="NSW_sTGC" date=" June 22, 2018 " author="Daniel Lellouch">
+
+<composition name="NSW_sTGC">
+
+<sTGC_Tech type="sTGC_1" geometryLevel="1" nLayers="NSW_sTGC_NbrOfLayers" gasTck="NSW_sTGC_GasTck" pcbTck="NSW_sTGC_pcbTck" Tck="NSW_sTGC_Tck" f4="NSW_sTGC_hFrameNoCapacitor" f5="NSW_sTGC_hFrameNoCapacitor" f6="NSW_sTGC_SideFrame" zLayout="Z_POSITIVE"/>
+
+<!-- ================ small Pivot ========================= -->
+
+<sTGC type="sTG1-QS1P" tech="sTGC_1" subType="QS1P" sWidth="346.93" lWidth="743.15" Length="1325.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="279.32" lPadWidth="667.18" padH="80;80;80.24;80.24" rankPadPhi="4;3;2;1" nPadPhi="4;4;3;3" anglePadPhi="5" firstPadPhiDivision_C="-5;-5;-2.5;-2.5" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-5;-5;-2.5;-2.5" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="17;17;17;17" firstPadH="65.8;65.8;28.61;28.61" firstPadRow="1;1;1;1" sStripWidth="293.48" lStripWidth="681.33" wireCutout="802.8;829.8;856.8;883.8" nWires="371;370;370;370" firstWire="-333;-331.65;-332.55;-332.1" wireGroupWidth="20" nStrips="406" firstTriggerBand="6;6;6;6" nTriggerBands="28;28;28;28" firstStripInTrigger="73;73;73;73" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="13;12;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;9" StripsInBandsLayer2="13;12;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;9" StripsInBandsLayer3="14;14;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;6" StripsInBandsLayer4="14;14;13;12;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;12;13;12;13;12;13; 12;13;12;13;12;10;6" nWireGroups="19;20;19;19" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS1P" type="ENDCAP" chamberType="sTGS" radius="1563" zPos="NSW_sTGC_ZSmallPivot" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QS2P" tech="sTGC_1" subType="QS2P" sWidth="746.14" lWidth="1102.25" Length="1191.4" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="677.64" lPadWidth="1026.28" padH="80;80;80.24;80.24" rankPadPhi="2;1;4;3" nPadPhi="2;2;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="0;0;-3.75;-3.75" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="0;0;-3.75;-3.75" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="15;15;15;15" firstPadH="93.2;93.2;60.09;60.09" firstPadRow="18;18;18;18" sStripWidth="691.8" lStripWidth="1040.43" wireCutout="0;0;0;0" nWires="569;570;570;570" firstWire="-511.2;-511.65;-512.55;-512.1" wireGroupWidth="20" nStrips="365" firstTriggerBand="34;34;34;34" nTriggerBands="29;29;29;29" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="14;14;14;13;12;12;13;12;13;12; 12;13;12;13;12;13;12;13;13;12; 13;12;13;12;13;12;13;12;11" StripsInBandsLayer2="14;14;14;13;12;12;13;12;13;12; 12;13;12;13;12;13;12;13;13;12; 13;12;13;12;13;12;13;12;11" StripsInBandsLayer3="14;14;14;13;12;12;13;12;13;12; 12;13;12;13;12;13;12;13;13;12; 13;12;13;12;13;12;13;12;10" StripsInBandsLayer4="14;14;14;13;12;12;13;12;13;12; 13;13;13;12;13;12;13;12;13;12; 13;12;13;12;13;12;13;12;10" nWireGroups="29;30;29;29" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS2P" type="ENDCAP" chamberType="sTGS" radius="2831.5" zPos="NSW_sTGC_ZSmallPivot" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QS3P" tech="sTGC_1" subType="QS3P" sWidth="1105.96" lWidth="1406.59" Length="1005.8" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1037.46" lPadWidth="1330.62" padH="80;80;80.24;80.24" rankPadPhi="2;1;4;3" nPadPhi="2;2;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="0;0;-3.75;-3.75" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="0;0;-3.75;-3.75" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="12;12;13;13" firstPadH="89.4;89.4;59.88;59.88" firstPadRow="33;33;33;33" sStripWidth="1051.61" lStripWidth="1344.78" wireCutout="0;0;0;0" nWires="739;739;739;738" firstWire="-664.2;-664.65;-663.75;-663.3" wireGroupWidth="20" nStrips="307" firstTriggerBand="64;64;64;64" nTriggerBands="25;25;25;25" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="3;13;13;10;13;13;13;13;13;13;13; 13;12;12;13;12;13;12;13;12;12; 13;13;13;14" StripsInBandsLayer2="3;13;13;10;13;13;13;13;13;13;13; 13;12;12;13;12;13;12;13;12;12; 13;13;13;14" StripsInBandsLayer3="6;13;12;11;14;12;13;12;13;13;13; 13;13;12;13;12;13;12;13;12;13; 13;12;13;11" StripsInBandsLayer4="6;13;12;11;14;12;13;12;13;13;13; 13;13;12;13;12;13;12;13;12;13; 13;12;13;11" nWireGroups="37;38;38;38" firstWireGroup="20;14;10;3" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS3P" type="ENDCAP" chamberType="sTGS" radius="3942.5" zPos="NSW_sTGC_ZSmallPivot" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+
+<!-- ================ small confirm =============== -->
+
+<sTGC type="sTG1-QS1C" tech="sTGC_1" subType="QS1C" sWidth="346.93" lWidth="743.15" Length="1325.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="293.48" lPadWidth="681.33" padH="76.35;76.35;76.59;76.59" rankPadPhi="1;4;2;3" nPadPhi="4;4;4;4" anglePadPhi="5" firstPadPhiDivision_C="-3.75;-6.25;-3.75;-6.25" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-6.25;-3.75;-6.25;-3.75" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="17;17;18;18" firstPadH="78.4;78.4;43.21;43.21" firstPadRow="2;2;2;2" sStripWidth="293.48" lStripWidth="681.33" wireCutout="883.8;856.8;829.8;802.8" nWires="370;370;370;371" firstWire="-332.1;-332.55;-331.65;-333" wireGroupWidth="20" nStrips="406" firstTriggerBand="7;7;8;8" nTriggerBands="29;29;29;29" firstStripInTrigger="73;73;73;73" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="13;12;12;12;12;12;12;12;12;12;11;12;12;12;12;12;12;12;12;12;12;12;12; 12;11;12;12;12;12;12;12;14;10;11" StripsInBandsLayer2="13;12;12;12;12;12;12;12;12;12;11;12;12;12;12;12;12;12;12;12;12;12;12; 12;11;12;12;12;12;12;12;14;10;11" StripsInBandsLayer3="8;12;12;12;12;12;12;12;12;12;12;12; 12;12;12;12;12;11;12;12;12;12; 12;12;12;12;12;12;12;12;12;13;14" StripsInBandsLayer4="8;12;12;12;12;12;12;12;12;12;12;12; 12;12;12;12;12;11;12;12;12;12; 12;12;12;12;12;12;12;12;12;13;14" nWireGroups="19;19;20;19" firstWireGroup="15;10;5;20" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS1C" type="ENDCAP" chamberType="sTGS" radius="1563" zPos="NSW_sTGC_ZSmallConfirm" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QS2C" tech="sTGC_1" subType="QS2C" sWidth="746.14" lWidth="1102.25" Length="1191.4" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="691.8" lPadWidth="1040.43" padH="76.35;76.35;76.59;76.59" rankPadPhi="3;2;4;1" nPadPhi="3;3;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-1.87;-5.62;-1.87" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-1.87;-5.62;-1.87;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="16;16;15;15" firstPadH="43.8;43.8;89.29;89.29" firstPadRow="19;19;20;20" sStripWidth="691.8" lStripWidth="1040.43" wireCutout="0;0;0;0" nWires="570;570;570;569" firstWire="-512.1;-512.55;-511.65;-511.2" wireGroupWidth="20" nStrips="365" firstTriggerBand="36;36;36;36" nTriggerBands="31;31;31;31" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="7;12;12;12;11;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;12;12; 12;12;12;12;12;12;12;12;12" StripsInBandsLayer2="7;12;12;12;11;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;12;12; 12;12;12;12;12;12;12;12;12" StripsInBandsLayer3="9;12;12;12;12;12;12;12;12;12;12;11; 12;12;11;12;12;12;12;12;12;12; 12;12;12;12;12;12;11;11;11" StripsInBandsLayer4="9;12;12;12;12;12;12;12;12;12;12;11; 12;12;12;12;12;12;12;12;12;12; 12;12;12;12;12;12;11;11;11" nWireGroups="29;29;30;29" firstWireGroup="15;10;5;20" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS2C" type="ENDCAP" chamberType="sTGS" radius="2831.5" zPos="NSW_sTGC_ZSmallConfirm" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QS3C" tech="sTGC_1" subType="QS3C" sWidth="1105.96" lWidth="1406.59" Length="1005.8" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1051.61" lPadWidth="1344.78" padH="76.35;76.35;76.59;76.59" rankPadPhi="3;2;4;1" nPadPhi="3;3;3;3" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-1.87;-5.62;-1.87" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-1.87;-5.62;-1.87;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="13;13;14;14" firstPadH="61.66;61.66;34.38;34.38" firstPadRow="35;35;35;35" sStripWidth="1051.61" lStripWidth="1344.78" wireCutout="0;0;0;0" nWires="738;739;739;739" firstWire="-663.3;-663.75;-664.65;-664.2" wireGroupWidth="20" nStrips="307" firstTriggerBand="67;67;67;67" nTriggerBands="21;21;21;21" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="3;12;12;12;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;11;12;13;13;13;13;14" StripsInBandsLayer2="3;12;12;12;12;12;12;12;12;12;12; 12;12;11;12;12;12;12;12;11;12;13;13;13;13;14" StripsInBandsLayer3="5;13;12;12;12;12;12;12;12;12;12; 11;12;12;12;12;12;12;12;12;12;12;12;12;12;14" StripsInBandsLayer4="5;13;12;12;12;12;12;12;12;12;12; 11;12;12;12;12;12;12;12;12;12;12;12;12;12;14" nWireGroups="38;38;38;37" firstWireGroup="3;10;14;20" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QS3C" type="ENDCAP" chamberType="sTGS" radius="3942.5" zPos="NSW_sTGC_ZSmallConfirm" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+
+<!-- ================ Large Pivot ==================== -->
+
+<sTGC type="sTG1-QL1P" tech="sTGC_1" subType="QL1P" sWidth="542.61" lWidth="1206.82" Length="1332" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="476.42" lPadWidth="1126.66" padH="81.42;81.42;81.66;81.66" rankPadPhi="4;3;2;1" nPadPhi="6;6;7;7" anglePadPhi="5" firstPadPhiDivision_C="-10;-10;-12.5;-12.5" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-10;-10;-12.5;-12.5" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="17;17;16;16" firstPadH="54.39;54.39;98.15;98.15" firstPadRow="1;1;2;2" sStripWidth="490.84" lStripWidth="1141.09" wireCutout="808;835;862;889" nWires="621;620;620;620" firstWire="-558;-556.65;-557.55;-557.1" wireGroupWidth="20" nStrips="408" firstTriggerBand="7;7;7;7" nTriggerBands="28;28;28;28" firstStripInTrigger="73;73;73;73" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="11;12;13;13;13;12;13;13;12;13;13;12;13;13;13;12;13;13;12;13;13;12;13; 13;13;12;13;13;12;9;13;12;8" StripsInBandsLayer2="11;12;13;13;13;12;13;13;12;13;13;12;13;13;13;12;13;13;12;13;13;12;13; 13;13;12;13;13;12;9;13;12;8" StripsInBandsLayer3="12;12;13;13;13;12;13;13;13;12;13;13;13;12;13;13;12;13;13;13;12;13;13; 13;12;13;13;13;12;9;13;12;6" StripsInBandsLayer4="12;12;13;13;13;12;13;13;13;12;13;13;13;12;13;13;12;13;13;13;12;13;13; 13;12;13;13;13;12;9;13;12;6" nWireGroups="32;32;32;32" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL1P" type="ENDCAP" chamberType="sTGL" radius="1595" zPos="NSW_sTGC_ZLargePivot" phi0="0.0" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QL2P" tech="sTGC_1" subType="QL2P" sWidth="1211.81" lWidth="1807.5" Length="1194.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1144.12" lPadWidth="1727.34" padH="81.42;81.42;81.66;81.66" rankPadPhi="2;1;4;3" nPadPhi="4;4;5;5" anglePadPhi="7.5" firstPadPhiDivision_C="-7.5;-7.5;-11.25;-11.25" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-7.5;-7.5;-11.25;-11.25" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="14;14;15;15" firstPadH="99.51;99.51;65.69;65.69" firstPadRow="18;18;18;18" sStripWidth="1158.55" lStripWidth="1741.77" wireCutout="0;0;0;0" nWires="953;954;954;954" firstWire="-856.8;-857.25;-858.15;-857.7" wireGroupWidth="20" nStrips="366" firstTriggerBand="35;35;35;35" nTriggerBands="29;29;29;29" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="11;13;13;13;12;13;13;12;13;13; 13;12;13;13;12;13;13;12;13;13;13; 12;13;13;11;13;13;13;12" StripsInBandsLayer2="11;13;13;13;12;13;13;12;13;13; 13;12;13;13;12;13;13;12;13;13;13; 12;13;13;11;13;13;13;12" StripsInBandsLayer3="14;12;13;13;13;12;13;13;13;12; 13;13;13;12;13;13;12;13;13;13;12; 13;13;13;11;13;13;13;9" StripsInBandsLayer4="14;12;13;13;13;12;13;13;13;12; 13;13;13;12;13;13;12;13;13;13;12; 13;13;13;11;13;13;13;9" nWireGroups="48;49;49;48" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL2P" type="ENDCAP" chamberType="sTGL" radius="2868.3" zPos="NSW_sTGC_ZLargePivot" phi0="0.0" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QL3P" tech="sTGC_1" subType="QL3P" sWidth="1813.68" lWidth="2111" Length="1153" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="545.3" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode="539.26">
+
+<sTGC_readout sPadWidth="1745.99" lPadWidth="2054" padH="81.42;81.42;81.66;81.66"
+ rankPadPhi="2;1;4;3" nPadPhi="4;4;5;5" anglePadPhi="7.5" firstPadPhiDivision_C="-7.5;-7.5;-11.25;-11.25" PadPhiShift_C="2;-2;2;-2" firstPadPhiDivision_A="-7.5;-7.5;-11.25;-11.25" PadPhiShift_A="-2;2;-2;2" rankPadH="1;2;3;4" nPadH="15;15;14;14" firstPadH="32.38;32.38;83.57;83.57" firstPadRow="32;32;33;33" sStripWidth="1760.42" lStripWidth="2054" wireCutout="0;0;0;0" nWires="1133;1134;1134;1134" firstWire="-1018.8;-1019.25;-1020.15;-1019.7" wireGroupWidth="20" nStrips="353" firstTriggerBand="64;64;64;64" nTriggerBands="24;24;24;24" firstStripInTrigger="1;1;1;1" firstStripWidth="1.6;3.2;1.6;3.2" StripsInBandsLayer1="11;11;13;13;12;13;13;13;12; 13;13;12;13;13;13;12;13;13;13; 12;13;12;13;12;11;11;10;10;10" StripsInBandsLayer2="11;11;13;13;12;13;13;13;12; 13;13;12;13;13;13;12;13;13;13; 12;13;12;13;12;11;11;10;10;10" StripsInBandsLayer3="13;13;12;13;13;13;13;13;12; 13;13;13;12;13;13;13;13;12;13; 13;13;12;13;13;13;13;13;7" StripsInBandsLayer4="13;13;12;13;13;13;13;13;12; 13;13;13;12;13;13;13;13;12;13; 13;13;12;13;13;13;13;13;7" nWireGroups="57;58;58;57" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL3P" type="ENDCAP" chamberType="sTGL" radius="4054.5" zPos="NSW_sTGC_ZLargePivot" phi0="0.0" zLayout="Z_POSITIVE"/>
+
+<!-- =============== Large Confirm ===================== -->
+
+<sTGC type="sTG1-QL1C" tech="sTGC_1" subType="QL1C" sWidth="542.61" lWidth="1206.82" Length="1332" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="490.84" lPadWidth="1141.09" padH="85.07;85.07;85.31;85.31" rankPadPhi="4;3;2;1" nPadPhi="6;6;6;6" anglePadPhi="5" firstPadPhiDivision_C="-8.75;-11.25;-8.75;-11.25" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-11.25;-8.75;-11.25;-8.75" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="16;16;16;16" firstPadH="77.79;77.79;38.01;38.01" firstPadRow="1;1;1;1" sStripWidth="490.84" lStripWidth="1141.09" wireCutout="889;862;835;808" nWires="620;620;620;621" firstWire="-557.1;-556.65;-557.55;-558" wireGroupWidth="20" nStrips="408" firstTriggerBand="6;6;6;6" nTriggerBands="26;26;26;26" firstStripInTrigger="73;73;73;73" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="13;11;14;13;13;13;14;13;13;14;13;13; 13;14;13;13;13;14;13;13;14;13; 13;13;14;13;13;13;14;14;11" StripsInBandsLayer2="13;11;14;13;13;13;14;13;13;14;13;13; 13;14;13;13;13;14;13;13;14;13; 13;13;14;13;13;13;14;14;11" StripsInBandsLayer3="14;11;14;13;13;14;13;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;14;13;10" StripsInBandsLayer4="14;11;14;13;13;14;13;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;14;13;10" nWireGroups="32;32;32;32" firstWireGroup="15;10;5;20" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL1C" type="ENDCAP" chamberType="sTGL" radius="1595" zPos="NSW_sTGC_ZLargeConfirm" phi0="0.0" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QL2C" tech="sTGC_1" subType="QL2C" sWidth="1211.81" lWidth="1807.5" Length="1194.6" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="0" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode ="0">
+
+<sTGC_readout sPadWidth="1158.55" lPadWidth="1741.77" padH="85.07;85.07;85.31;85.31" rankPadPhi="3;2;4;1" nPadPhi="4;4;4;4" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-9.37;-5.62;-9.37" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-9.37;-5.62;-9.37;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="14;14;14;14" firstPadH="99.84;99.84;63.9;63.9" firstPadRow="17;17;17;17" sStripWidth="1158.55" lStripWidth="1741.77" wireCutout="0;0;0;0" nWires="954;954;954;953" firstWire="-857.7;-857.25;-858.15;-856.8" wireGroupWidth="20" nStrips="366" firstTriggerBand="32;32;32;32" nTriggerBands="29;29;29;29" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="10;10;11;13;13;14;13;13;14; 13;13;14;13;14;13;13;13;13;14; 13;13;13;14;13;13;14;13;13;3" StripsInBandsLayer2="10;10;11;13;13;14;13;13;14; 13;13;14;13;14;13;13;13;13;14; 13;13;13;14;13;13;14;13;13;3" StripsInBandsLayer3="11;11;12;12;13;14;13;13;14; 13;13;14;13;13;13;14;13;13;14; 13;13;14;13;13;14;13;13;12;2" StripsInBandsLayer4="11;11;12;12;13;14;13;13;14; 13;13;14;13;13;13;14;13;13;14; 13;13;14;13;13;14;13;13;12;2" nWireGroups="48;49;49;48" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL2C" type="ENDCAP" chamberType="sTGL" radius="2868.3" zPos="NSW_sTGC_ZLargeConfirm" phi0="0.0" zLayout="Z_POSITIVE"/>
+
+<sTGC type="sTG1-QL3C" tech="sTGC_1" subType="QL3C" sWidth="1813.68" lWidth="2111" Length="1153" Tck="NSW_sTGC_Tck" xFrame="NSW_sTGC_SideFrame" ysFrame="NSW_sTGC_hFrameNoCapacitor" ylFrame="NSW_sTGC_hFrameCapacitor" yCutout="545.3" stripPitch="NSW_sTGC_StripPitch" wirePitch="NSW_sTGC_WirePitch" stripWidth="NSW_sTGC_StripWidth" yCutoutCathode="539.26">
+
+<sTGC_readout sPadWidth="1760.42" lPadWidth="2054" padH="85.07;85.07;85.31;85.31" rankPadPhi="3;2;4;1" nPadPhi="4;4;4;4" anglePadPhi="7.5" firstPadPhiDivision_C="-5.62;-9.37;-5.62;-9.37" PadPhiShift_C="-2;2;-2;2" firstPadPhiDivision_A="-9.37;-5.62;-9.37;-5.62" PadPhiShift_A="2;-2;2;-2" rankPadH="1;2;3;4" nPadH="13;13;14;14" firstPadH="83.76;83.76;51.17;51.17" firstPadRow="31;31;31;31" sStripWidth="1760.42" lStripWidth="2054" wireCutout="0;0;0;0" nWires="1134;1134;1134;1133" firstWire="-1019.7;-1019.25;-1020.15;-1018.8" wireGroupWidth="20" nStrips="353" firstTriggerBand="61;61;61;61" nTriggerBands="27;27;27;27" firstStripInTrigger="1;1;1;1" firstStripWidth="3.2;1.6;3.2;1.6" StripsInBandsLayer1="12;12;12;12;11;14;13;13;14;13; 13;14;13;13;14;13;13;13;14;13; 13;13;14;13;13;14;14" StripsInBandsLayer2="12;12;12;12;11;14;13;13;14;13; 13;14;13;13;14;13;13;13;14;13; 13;13;14;13;13;14;14" StripsInBandsLayer3="13;13;13;14;10;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;11" StripsInBandsLayer4="13;13;13;14;10;13;13;14;13;13; 14;13;13;14;13;13;14;13;13;13; 14;13;13;14;13;13;11" nWireGroups="57;58;58;57" firstWireGroup="20;5;10;15" zLayout="Z_POSITIVE"/>
+</sTGC>
+
+<chamberPosition volume="sTG1-QL3C" type="ENDCAP" chamberType="sTGL" radius="4054.5" zPos="NSW_sTGC_ZLargeConfirm" phi0="0.0" zLayout="Z_POSITIVE"/>
+
+</composition>
+</section>
+
+
+<!-- ========== MicroMegas ============================== -->
+
+<section name="NSW_MM_Parameters" version="1" top_volume="useless" date="December 16 2014" author="S.Chen" >
+
+<!-- Frames. "f1": frame width close to the trapezium large side. "f2": frame width close to the trapezium small side. "f3": frame width close to the trapezium oblique side  -->
+
+<!-- Distance from IP, labeled zmin_MM in Parameter Book -->
+<var name="NSW_MM_LM_distanceFromIP" value="7536"/>
+<var name="NSW_MM_SM_distanceFromIP" value="7072"/>
+<!-- Thickness of Multilayer and the subcomponent (mm)-->
+<var name="NSW_MM_GasTck" value="5.04"/>
+<var name="NSW_MM_ROPcbTck" value="11.69"/>
+<var name="NSW_MM_DriftPcbTck" value="11.284"/>
+<var name="NSW_MM_MultilayerTck" value="NSW_NbrOfLayers* NSW_MM_GasTck + (NSW_NbrOfDriftPcb) * NSW_MM_DriftPcbTck+ ( NSW_NbrOfROPcb) * NSW_MM_ROPcbTck" /> <!-- Thickness of one multilayer -->
+
+<!-- Large sector modules (LM1" LM2). Modules are all trapezoid. ""Height"": radial envelope" ""base/top Width"": upper/lower side of the trapezoid-->
+<var name="NSW_MM_LM1_InnerRadius" value="923" />
+<var name="NSW_MM_LM1_Length" value="2310" />
+<var name="NSW_MM_LM1_outerRadius" value="NSW_MM_LM1_InnerRadius+NSW_MM_LM1_Length" />
+<var name="NSW_MM_LM1_f1" value="30"/>
+<var name="NSW_MM_LM1_f2" value="30"/>
+<var name="NSW_MM_LM1_f3" value="100"/>
+<var name="NSW_MM_LMGap_Length" value="5" /> <!-- Radial gap between LM1 and LM2 -->
+<var name="NSW_MM_LM2_InnerRadius" value="NSW_MM_LM1_outerRadius+NSW_MM_LMGap_Length" />
+<var name="NSW_MM_LM2_Length" value="1410" />
+<var name="NSW_MM_LM2_outerRadius" value="NSW_MM_LM2_InnerRadius+NSW_MM_LM2_Length" />
+<var name="NSW_MM_LM1_baseWidth" value="640" />
+<var name="NSW_MM_LM1_topWidth" value="2008.5" />
+<var name="NSW_MM_LM2_baseWidth" value="2022.8" />
+<var name="NSW_MM_LM2_topWidth" value="2220" />
+<var name="NSW_MM_LM2_f1" value="30"/>
+<var name="NSW_MM_LM2_f2" value="30"/>
+<var name="NSW_MM_LM2_f3" value="100"/>
+<!-- These lines added by Alexandre Laurier to fix MM active Geometry / updated values by Chara Kitsaki -->
+<!-- *_activeBottom: bottom length -->
+<!-- *_activeTop: top length -->
+<!-- *_activeH: radial distance -->
+<var name="NSW_MM_LM1_activeBottom" value="426.73"/>
+<var name="NSW_MM_LM1_activeTop" value="1753.0"/>
+<var name="NSW_MM_LM1_activeH" value="2238.75"/>
+<var name="NSW_MM_LM2_activeBottom" value="1802.5"/>
+<var name="NSW_MM_LM2_activeTop" value="1990.0"/>
+<var name="NSW_MM_LM2_activeH" value="1339.2"/>
+<!-- These lines added by Chara Kitsaki to implement all the parameters needed for the strips description -->
+<!-- *_etaMissedTop: the #of eta strips that are not connected to the FE boards (top part of the module) -->
+<!-- *_etaMissedBottom: the #of eta strips that are not connected to the FE boards (bottom part of the module) -->
+<!-- *_stereoMissedBottom: the #of stereo strips that are not connected to the FE boards (bottom part of the module) -->
+<!-- *_stereoMissedTop: the #of stereo strips that are not connected to the FE boards (top part of the module) -->
+<!-- *_stereoRoutedTop: the #of stereo strips that are shorter in length due to geometry restrictions (top part of the module) -->
+<!-- *_stereoRoutedBottom: the #of stereo strips that are shorter in length due to geometry restrictions (bottom part of the module) -->
+<var name="NSW_MM_LM1_etaMissedTop" value="72"/>
+<var name="NSW_MM_LM1_etaMissedBottom" value="72"/>
+<var name="NSW_MM_LM1_stereoMissedTop" value="36"/>
+<var name="NSW_MM_LM1_stereoMissedBottom" value="86"/>
+<var name="NSW_MM_LM1_stereoRoutedTop" value="88"/>
+<var name="NSW_MM_LM1_stereoRoutedBottom" value="0"/>
+<var name="NSW_MM_LM2_etaMissedTop" value="48"/>
+<var name="NSW_MM_LM2_etaMissedBottom" value="47"/>
+<var name="NSW_MM_LM2_stereoMissedTop" value="43"/>
+<var name="NSW_MM_LM2_stereoMissedBottom" value="42"/>
+<var name="NSW_MM_LM2_stereoRoutedTop" value="64"/>
+<var name="NSW_MM_LM2_stereoRoutedBottom" value="58"/>
+<!-- Small sector modules (SM1" SM2). Modules are all trapezoids. ""Height"": radial envelope" ""base/top Width"": upper/lower side -->
+<var name="NSW_MM_SM1_InnerRadius" value="895" />
+<var name="NSW_MM_SM1_Length" value="2210" />
+<var name="NSW_MM_SM1_outerRadius" value="NSW_MM_SM1_InnerRadius+NSW_MM_SM1_Length" />
+<var name="NSW_MM_SMGap_Length" value="5" /> <!-- Radial gap between SM1 and SM2 -->
+<var name="NSW_MM_SM1_f1" value="30"/>
+<var name="NSW_MM_SM1_f2" value="30"/>
+<var name="NSW_MM_SM1_f3" value="100"/>
+<var name="NSW_MM_SM2_InnerRadius" value="NSW_MM_SM1_outerRadius+NSW_MM_SMGap_Length" />
+<var name="NSW_MM_SM2_Length" value="1350" />
+<var name="NSW_MM_SM2_outerRadius" value="NSW_MM_SM2_InnerRadius+NSW_MM_SM2_Length" />
+<var name="NSW_MM_SM1_baseWidth" value="500" />
+<var name="NSW_MM_SM1_topWidth" value="1319.2" />
+<var name="NSW_MM_SM2_baseWidth" value="1321.1" />
+<var name="NSW_MM_SM2_topWidth" value="1821.5" />
+<var name="NSW_MM_SM2_f1" value="30"/>
+<var name="NSW_MM_SM2_f2" value="30"/>
+<var name="NSW_MM_SM2_f3" value="100"/>
+<!-- These lines added by Alexandre Laurier to fix MM active Geometry / updated values by Chara Kitsaki -->
+<var name="NSW_MM_SM1_activeBottom" value="284.0"/>
+<var name="NSW_MM_SM1_activeTop" value="1078.4"/>
+<var name="NSW_MM_SM1_activeH" value="2140.3"/>
+<var name="NSW_MM_SM2_activeBottom" value="1103.05"/>
+<var name="NSW_MM_SM2_activeTop" value="1579.6"/>
+<var name="NSW_MM_SM2_activeH" value="1279.675"/>
+<!-- These lines added by Chara Kitsaki to implement all the parameters needed for the strips description -->
+<var name="NSW_MM_SM1_etaMissedTop" value="41"/>
+<var name="NSW_MM_SM1_etaMissedBottom" value="42"/>
+<var name="NSW_MM_SM1_stereoMissedTop" value="11"/>
+<var name="NSW_MM_SM1_stereoMissedBottom" value="35"/>
+<var name="NSW_MM_SM1_stereoRoutedTop" value="66"/>
+<var name="NSW_MM_SM1_stereoRoutedBottom" value="18"/>
+<var name="NSW_MM_SM2_etaMissedTop" value="31"/>
+<var name="NSW_MM_SM2_etaMissedBottom" value="29"/>
+<var name="NSW_MM_SM2_stereoMissedTop" value="1"/>
+<var name="NSW_MM_SM2_stereoMissedBottom" value="1"/>
+<var name="NSW_MM_SM2_stereoRoutedTop" value="79"/>
+<var name="NSW_MM_SM2_stereoRoutedBottom" value="64"/>
+
+<var name="NSW_MM_LargeSector_ZCENTER" value="ZCenter_Global+232."/>
+<var name="NSW_MM_SmallSector_ZCENTER" value="ZCenter_Global-232."/>
+
+
+<!-- Thickness of inter-multilayer spacers -->
+<var name="NSW_MM_SpacerThickness" value="50" />
+
+<!-- Global z-coordinate for the sector center -->
+<!--  <var name="NSW_MM_LargeSector_ZCENTER" value="NSW_MM_LM_distanceFromIP + 4.*NSW_MM_DriftPcbTck + 4.*NSW_MM_ROPcbTck + 4.*NSW_MM_GasTck + NSW_MM_SpacerThickness/2."/>
+<var name="NSW_MM_SmallSector_ZCENTER" value="NSW_MM_SM_distanceFromIP + 4.*NSW_MM_DriftPcbTck + 4.*NSW_MM_ROPcbTck + 4.*NSW_MM_GasTck + NSW_MM_SpacerThickness/2."/>  -->
+
+</section>
+
+<section name="NewSmallWheelsMM" version="1" top_volume="NSW_MM" date="December 16 2014" author="S.Chen" >
+
+<!-- Technologies  -->
+<mm_Tech type="MM_1" geometryLevel="1" nLayers="NSW_NbrOfLayers" gasTck="NSW_MM_GasTck" driftPcbTck="NSW_MM_DriftPcbTck" ROPcbTck="NSW_MM_ROPcbTck" Tck="NSW_MM_MultilayerTck" zLayout="Z_POSITIVE"/>
+<!--Chilufya<mmSpacer_Tech type="Spa_1" Tck="NSW_MM_SpacerThickness" />Chilufya-->
+
+<!-- large wheel -->
+<!-- These lines are modified by Chara Kitsaki -->
+<!-- minYPhiL minYPhiR: the (radial)distance kept (left and right part of the module) between the first active stereo and eta strips -->
+<!-- dlStereoTop, dlStereoBottom: the distance between the first stereo and eta strip that is kept starting from the corner-->
+<!-- Some strips are not connected to the FE boards these we call missed strips -->
+<!-- At the corners of the module some strips are shorter in length and they are routed to the FE boards (routed strips). These areas are of low efficiency. LM1 is the special case (there is not much space to route any strips at the module's bottom part) -->
+
+<micromegas type="sMD1-1-1" tech="MM_1" subType="M1L1" sWidth="NSW_MM_LM1_baseWidth" lWidth="NSW_MM_LM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM1_Length" ylFrame="NSW_MM_LM1_f1" ysFrame="NSW_MM_LM1_f2" xFrame="NSW_MM_LM1_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM1_InnerRadius" roLength="NSW_MM_LM1_Length" activeBottomLength="NSW_MM_LM1_activeBottom" activeTopLength="NSW_MM_LM1_activeTop" activeH="NSW_MM_LM1_activeH" minYPhiR="12" minYPhiL="0.69" maxYPhi="6.69" nMissedTopEta="NSW_MM_LM1_etaMissedTop" nMissedBottomEta="NSW_MM_LM1_etaMissedBottom" nMissedTopStereo="NSW_MM_LM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM1_stereoMissedBottom" nRoutedTop="NSW_MM_LM1_stereoRoutedTop" nRoutedBottom="NSW_MM_LM1_stereoRoutedBottom" dlStereoTop="257.61" dlStereoBottom="426.73" totalStrips="5120" zLayout="Z_POSITIVE" offset="0.225"/>
+</micromegas>
+<micromegas type="sMD1-2-1" tech="MM_1" subType="M2L1" sWidth="NSW_MM_LM2_baseWidth" lWidth="NSW_MM_LM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM2_Length" ylFrame="NSW_MM_LM2_f1" ysFrame="NSW_MM_LM2_f2" xFrame="NSW_MM_LM2_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM2_InnerRadius" roLength="NSW_MM_LM2_Length" activeBottomLength="NSW_MM_LM2_activeBottom" activeTopLength="NSW_MM_LM2_activeTop" activeH="NSW_MM_LM2_activeH" minYPhiR="21.39" minYPhiL="0" maxYPhi="23.77" nMissedTopEta="NSW_MM_LM2_etaMissedTop" nMissedBottomEta="NSW_MM_LM2_etaMissedBottom" nMissedTopStereo="NSW_MM_LM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM2_stereoMissedBottom" nRoutedTop="NSW_MM_LM2_stereoRoutedTop" nRoutedBottom="NSW_MM_LM2_stereoRoutedBottom" dlStereoTop="909.4" dlStereoBottom="815.32" totalStrips="3072" zLayout="Z_POSITIVE" offset="0."/>
+</micromegas>
+<micromegas type="sMD1-1-2" tech="MM_1" subType="M1L2" sWidth="NSW_MM_LM1_baseWidth" lWidth="NSW_MM_LM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM1_Length" ylFrame="NSW_MM_LM1_f1" ysFrame="NSW_MM_LM1_f2" xFrame="NSW_MM_LM1_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM1_InnerRadius" roLength="NSW_MM_LM1_Length" activeBottomLength="NSW_MM_LM1_activeBottom" activeTopLength="NSW_MM_LM1_activeTop" activeH="NSW_MM_LM1_activeH" minYPhiR="12" minYPhiL="0.69" maxYPhi="6.69" nMissedTopEta="NSW_MM_LM1_etaMissedTop" nMissedBottomEta="NSW_MM_LM1_etaMissedBottom" nMissedTopStereo="NSW_MM_LM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM1_stereoMissedBottom" nRoutedTop="NSW_MM_LM1_stereoRoutedTop" nRoutedBottom="NSW_MM_LM1_stereoRoutedBottom" dlStereoTop="257.61" dlStereoBottom="426.73" totalStrips="5120" zLayout="Z_POSITIVE" offset="0.225"/>
+</micromegas>
+<micromegas type="sMD1-2-2" tech="MM_1" subType="M2L2" sWidth="NSW_MM_LM2_baseWidth" lWidth="NSW_MM_LM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_LM2_Length" ylFrame="NSW_MM_LM2_f1" ysFrame="NSW_MM_LM2_f2" xFrame="NSW_MM_LM2_f3" >
+<mm_readout stripPitch="0.45" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_LM2_InnerRadius" roLength="NSW_MM_LM2_Length" activeBottomLength="NSW_MM_LM2_activeBottom" activeTopLength="NSW_MM_LM2_activeTop" activeH="NSW_MM_LM2_activeH" minYPhiR="21.39" minYPhiL="0" maxYPhi="23.77" nMissedTopEta="NSW_MM_LM2_etaMissedTop" nMissedBottomEta="NSW_MM_LM2_etaMissedBottom" nMissedTopStereo="NSW_MM_LM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_LM2_stereoMissedBottom" nRoutedTop="NSW_MM_LM2_stereoRoutedTop" nRoutedBottom="NSW_MM_LM2_stereoRoutedBottom" dlStereoTop="909.4" dlStereoBottom="815.32" totalStrips="3072" zLayout="Z_POSITIVE" offset="0."/>
+</micromegas>
+
+<!--Chilufya<mmSpacer type="spa1-1" tech="Spa_1" sWidth="NSW_MM_LM1_baseWidth" lWidth="NSW_MM_LM1_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_LM1_Length" />
+<mmSpacer type="spa1-2" tech="Spa_1" sWidth="NSW_MM_LM2_baseWidth" lWidth="NSW_MM_LM2_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_LM2_Length" />Chilufya-->
+
+
+<!-- small wheel -->
+<micromegas type="sMD3-1-1" tech="MM_1" subType="M1S1" sWidth="NSW_MM_SM1_baseWidth" lWidth="NSW_MM_SM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM1_Length" ylFrame="NSW_MM_SM1_f1" ysFrame="NSW_MM_SM1_f2" xFrame="NSW_MM_SM1_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM1_InnerRadius" roLength="NSW_MM_SM1_Length" activeBottomLength="NSW_MM_SM1_activeBottom" activeTopLength="NSW_MM_SM1_activeTop" activeH="NSW_MM_SM1_activeH" minYPhiR="0.75" minYPhiL="0" maxYPhi="1.36" nMissedTopEta="NSW_MM_SM1_etaMissedTop" nMissedBottomEta="NSW_MM_SM1_etaMissedBottom" nMissedTopStereo="NSW_MM_SM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM1_stereoMissedBottom" nRoutedTop="NSW_MM_SM1_stereoRoutedTop" nRoutedBottom="NSW_MM_SM1_stereoRoutedBottom" dlStereoTop="52.15" dlStereoBottom="28.41" totalStrips="5120" zLayout="Z_POSITIVE" offset="0.025"/>
+</micromegas>
+<micromegas type="sMD3-2-1" tech="MM_1" subType="M2S1" sWidth="NSW_MM_SM2_baseWidth" lWidth="NSW_MM_SM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM2_Length" ylFrame="NSW_MM_SM2_f1" ysFrame="NSW_MM_SM2_f2" xFrame="NSW_MM_SM2_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.; 0.; 0.02618; -0.02618" readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM2_InnerRadius" roLength="NSW_MM_SM2_Length" activeBottomLength="NSW_MM_SM2_activeBottom" activeTopLength="NSW_MM_SM2_activeTop" activeH="NSW_MM_SM2_activeH" minYPhiR="2.53" minYPhiL="0" maxYPhi="7.92" nMissedTopEta="NSW_MM_SM2_etaMissedTop" nMissedBottomEta="NSW_MM_SM2_etaMissedBottom" nMissedTopStereo="NSW_MM_SM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM2_stereoMissedBottom" nRoutedTop="NSW_MM_SM2_stereoRoutedTop" nRoutedBottom="NSW_MM_SM2_stereoRoutedBottom" dlStereoTop="303.86" dlStereoBottom="96.14" totalStrips="3072" zLayout="Z_POSITIVE" offset="0.2375"/>
+</micromegas>
+<micromegas type="sMD3-1-2" tech="MM_1" subType="M1S2" sWidth="NSW_MM_SM1_baseWidth" lWidth="NSW_MM_SM1_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM1_Length" ylFrame="NSW_MM_SM1_f1" ysFrame="NSW_MM_SM1_f2" xFrame="NSW_MM_SM1_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM1_InnerRadius" roLength="NSW_MM_SM1_Length" activeBottomLength="NSW_MM_SM1_activeBottom" activeTopLength="NSW_MM_SM1_activeTop" activeH="NSW_MM_SM1_activeH" minYPhiR="0.75" minYPhiL="0" maxYPhi="1.36" nMissedTopEta="NSW_MM_SM1_etaMissedTop" nMissedBottomEta="NSW_MM_SM1_etaMissedBottom" nMissedTopStereo="NSW_MM_SM1_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM1_stereoMissedBottom" nRoutedTop="NSW_MM_SM1_stereoRoutedTop" nRoutedBottom="NSW_MM_SM1_stereoRoutedBottom" dlStereoTop="52.15" dlStereoBottom="28.41" totalStrips="5120" zLayout="Z_POSITIVE" offset="0.025"/>
+</micromegas>
+<micromegas type="sMD3-2-2" tech="MM_1" subType="M2S2" sWidth="NSW_MM_SM2_baseWidth" lWidth="NSW_MM_SM2_topWidth" Tck="NSW_MM_MultilayerTck" Length="NSW_MM_SM2_Length" ylFrame="NSW_MM_SM2_f1" ysFrame="NSW_MM_SM2_f2" xFrame="NSW_MM_SM2_f3" >
+<mm_readout stripPitch="0.425" gasThickness="NSW_MM_GasTck" pcbThickness="NSW_MM_ROPcbTck" driftThickness="NSW_MM_DriftPcbTck" stereoAngle="0.02618; -0.02618; 0.; 0." readoutSide="-1; 1; -1; 1" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." distanceFromZAxis="NSW_MM_SM2_InnerRadius" roLength="NSW_MM_SM2_Length" activeBottomLength="NSW_MM_SM2_activeBottom" activeTopLength="NSW_MM_SM2_activeTop" activeH="NSW_MM_SM2_activeH" minYPhiR="2.53" minYPhiL="0" maxYPhi="7.92" nMissedTopEta="NSW_MM_SM2_etaMissedTop" nMissedBottomEta="NSW_MM_SM2_etaMissedBottom" nMissedTopStereo="NSW_MM_SM2_stereoMissedTop" nMissedBottomStereo="NSW_MM_SM2_stereoMissedBottom" nRoutedTop="NSW_MM_SM2_stereoRoutedTop" nRoutedBottom="NSW_MM_SM2_stereoRoutedBottom" dlStereoTop="303.86" dlStereoBottom="96.14" totalStrips="3072" zLayout="Z_POSITIVE" offset="0.2375"/>
+</micromegas>
+<!--Chilufya<mmSpacer type="spa3-1" tech="Spa_1" sWidth="NSW_MM_SM1_baseWidth" lWidth="NSW_MM_SM1_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_SM1_Length" />
+<mmSpacer type="spa3-2" tech="Spa_1" sWidth="NSW_MM_SM2_baseWidth" lWidth="NSW_MM_SM2_topWidth" Tck="NSW_MM_SpacerThickness" Length="NSW_MM_SM2_Length" />Chilufya-->
+
+<composition name="NSW_MM" >
+<!-- A-SIDE -->
+
+<!-- LARGE SECTOR -->
+
+<!-- MM multilayer 1 -->
+<chamberPosition volume="sMD1-1-1" radius="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" zLayout="Z_POSITIVE"/>
+<chamberPosition volume="sMD1-2-1" radius="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" zLayout="Z_POSITIVE"/>
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa1-1" ncopy="8" R_Z="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2;NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 270.; 90." />
+<mposPhi volume="spa1-2" ncopy="8" R_Z="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2;NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 270.; 90." />Chilufya-->
+
+<!-- MM multilayer 2 -->
+<chamberPosition volume="sMD1-1-2" radius="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" zLayout="Z_POSITIVE"/>
+<chamberPosition volume="sMD1-2-2" radius="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2" zPos="NSW_MM_LargeSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="0" zLayout="Z_POSITIVE"/>
+
+<!-- SMALL SECTOR -->
+
+<!-- MM multilayer 1 -->
+<chamberPosition volume="sMD3-1-1" radius="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" zLayout="Z_POSITIVE"/>
+<chamberPosition volume="sMD3-2-1" radius="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER-NSW_MM_MultilayerTck/2.-NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa3-1" ncopy="8" R_Z="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2;NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 270.; 90." />
+<mposPhi volume="spa3-2" ncopy="8" R_Z="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2;NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 270.; 90." />Chilufya-->
+
+<!-- MM multilayer 2 -->
+<chamberPosition volume="sMD3-1-2" radius="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" zLayout="Z_POSITIVE"/>
+<chamberPosition volume="sMD3-2-2" radius="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2" zPos="NSW_MM_SmallSector_ZCENTER+NSW_MM_MultilayerTck/2.+NSW_MM_SpacerThickness/2." type="ENDCAP" chamberType="Micromegas" phi0="22.5" zLayout="Z_POSITIVE"/>
+
+<!-- C-SIDE -->
+<!-- LARGE SECTOR -->
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa1-1" ncopy="8" R_Z="(NSW_MM_LM1_InnerRadius+NSW_MM_LM1_outerRadius)/2;-NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 90.; 90." />
+<mposPhi volume="spa1-2" ncopy="8" R_Z="(NSW_MM_LM2_InnerRadius+NSW_MM_LM2_outerRadius)/2;-NSW_MM_LargeSector_ZCENTER" Phi0="0" rot=" 90.; 90.; 90." />Chilufya-->
+
+<!-- SMALL SECTOR -->
+<!-- spacer -->
+<!--Chilufya<mposPhi volume="spa3-1" ncopy="8" R_Z="(NSW_MM_SM1_InnerRadius+NSW_MM_SM1_outerRadius)/2;-NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 90.; 90." />
+<mposPhi volume="spa3-2" ncopy="8" R_Z="(NSW_MM_SM2_InnerRadius+NSW_MM_SM2_outerRadius)/2;-NSW_MM_SmallSector_ZCENTER" Phi0="22.5" rot=" 90.; 90.; 90." />Chilufya-->
+
+</composition>
+
+</section>
+
+
+
+
+
+
+
+<!--====================================SPACER FRAME===============================================-->
+
+<section name       = "LS and SS Spacer Frames"
+         version    = "0.0"
+         date       = "25-07-2017"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "NSW_Spacer">
+
+<!-- LS Spacer Ftame -->
+<gvxy name="LS_StructuralPlate_Main" material="Aluminium" dZ="5.9">
+  <gvxy_point X_Y="226.; 958."/>
+  <gvxy_point X_Y="914.15; 3281."/>
+  <gvxy_point X_Y="1007.3; 4613."/>
+  <gvxy_point X_Y="0.01; 4613."/>
+  <gvxy_point X_Y="0.01; 958."/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut1" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="902.87; 4123."/>
+  <gvxy_point X_Y="932.24; 4543."/>
+  <gvxy_point X_Y="40.; 4543."/>
+  <gvxy_point X_Y="40.; 4123."/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut2" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="774.41; 3913.25"/>
+  <gvxy_point X_Y="770.86; 3963."/>
+  <gvxy_point X_Y="135.; 3963."/>
+  <gvxy_point X_Y="135.; 3821.33"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut3" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="778.83; 3639.29"/>
+  <gvxy_point X_Y="792.52; 3835.04"/>
+  <gvxy_point X_Y="203.42; 3750.35"/>
+  <gvxy_point X_Y="203.46; 3720.65"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut4" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="477.15; 3586.36"/>
+  <gvxy_point X_Y="477.24; 3606.18"/>
+  <gvxy_point X_Y="135.; 3654.58"/>
+  <gvxy_point X_Y="135.; 3541.07"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut5" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="762.41; 3404.48"/>
+  <gvxy_point X_Y="772.57; 3549.82"/>
+  <gvxy_point X_Y="286.06; 3485.41"/>
+  <gvxy_point X_Y="286.1; 3465.58"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut6" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="600.; 3314.58"/>
+  <gvxy_point X_Y="602.55; 3354.42"/>
+  <gvxy_point X_Y="60.; 3424.01"/>
+  <gvxy_point X_Y="60.; 3314.58"/>
+</gvxy>
+
+<box  name="LS_StructuralPlate_Cut7" material="Aluminium"  X_Y_Z="138.; 70.; 7. " />
+
+<gvxy name="LS_StructuralPlate_Cut8" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="678.71; 2838.18"/>
+  <gvxy_point X_Y="772.71; 3155.5"/>
+  <gvxy_point X_Y="63.52; 3155.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut9" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="533.6; 2715.5"/>
+  <gvxy_point X_Y="551.94; 2791.05"/>
+  <gvxy_point X_Y="40.; 3055.11"/>
+  <gvxy_point X_Y="40.; 2715.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut10" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="459.9; 2169.9"/>
+  <gvxy_point X_Y="585.97; 2595.5"/>
+  <gvxy_point X_Y="117.42; 2595.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut11" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="391.41; 2095.5"/>
+  <gvxy_point X_Y="135.; 2414.15"/>
+  <gvxy_point X_Y="135.; 2095.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut12" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="344.91; 1865.18"/>
+  <gvxy_point X_Y="389.44; 2015.5"/>
+  <gvxy_point X_Y="258.79; 2015.5"/>
+</gvxy>
+<gvxy name="LS_StructuralPlate_Cut13" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="275.45; 1825.5"/>
+  <gvxy_point X_Y="172.35; 2005.44"/>
+  <gvxy_point X_Y="135.; 1995.5"/>
+  <gvxy_point X_Y="135.; 1825.5"/>
+</gvxy>
+
+<gvxy name="LS_StructuralPlate_Cut14" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="173.8; 1028."/>
+  <gvxy_point X_Y="380.41; 1725.5"/>
+  <gvxy_point X_Y="40.; 1725.5"/>
+  <gvxy_point X_Y="40.; 1028."/>
+</gvxy>
+
+<subtraction  name="LS_StructuralPlateSub" >
+  <posXYZ   volume="LS_StructuralPlate_Main"   />
+  <posXYZ   volume="LS_StructuralPlate_Cut1" />
+  <posXYZ   volume="LS_StructuralPlate_Cut2" />
+  <posXYZ   volume="LS_StructuralPlate_Cut3" />
+  <posXYZ   volume="LS_StructuralPlate_Cut4" />
+  <posXYZ   volume="LS_StructuralPlate_Cut5" />
+  <posXYZ   volume="LS_StructuralPlate_Cut6" />
+  <posXYZ   volume="LS_StructuralPlate_Cut7" X_Y_Z="589.; 3235.5; 0." />
+  <posXYZ   volume="LS_StructuralPlate_Cut8" />
+  <posXYZ   volume="LS_StructuralPlate_Cut9" />
+  <posXYZ   volume="LS_StructuralPlate_Cut10" />
+  <posXYZ   volume="LS_StructuralPlate_Cut11" />
+  <posXYZ   volume="LS_StructuralPlate_Cut12" />
+  <posXYZ   volume="LS_StructuralPlate_Cut13" />
+  <posXYZ   volume="LS_StructuralPlate_Cut14" />
+</subtraction>
+
+<composition  name="LS_StructuralPlate" >
+  <posXYZ  volume="LS_StructuralPlateSub" />
+  <posXYZ  volume="LS_StructuralPlateSub" rot="0. ; 180. ; 0." />
+</composition>
+
+<box  name="LS_Central_reference_bar" material="Aluminium"  X_Y_Z="1704.; 100.; 27.8 " />
+
+<box  name="LS_Channel_section_L2000_Main" material="Aluminium"  X_Y_Z="50.; 2000.; 30. " />
+<box  name="LS_Channel_section_L2000_Cut" material="Aluminium"  X_Y_Z="40.; 2050.; 20. " />
+<subtraction  name="LS_Channel_section_L2000" >
+  <posXYZ   volume="LS_Channel_section_L2000_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_Channel_section_L1200_Main" material="Aluminium"  X_Y_Z="50.; 1200.; 30. " />
+<subtraction  name="LS_Channel_section_L1200" >
+  <posXYZ   volume="LS_Channel_section_L1200_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_Channel_section_L850_Main" material="Aluminium"  X_Y_Z="50.; 850.; 30. " />
+<subtraction  name="LS_Channel_section_L850" >
+  <posXYZ   volume="LS_Channel_section_L850_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_Channel_section_L1000_Main" material="Aluminium"  X_Y_Z="50.; 1000.; 30. " />
+<subtraction  name="LS_Channel_section_L1000" >
+  <posXYZ   volume="LS_Channel_section_L1000_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="LS_UProfile_L1460_Main" material="Aluminium"  X_Y_Z="20.; 1460.; 30. " />
+<box  name="LS_UProfile_L1460_Cut" material="Aluminium"  X_Y_Z="20.; 1500.; 24. " />
+<subtraction  name="LS_UProfile_L1460" >
+  <posXYZ   volume="LS_UProfile_L1460_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="LS_UProfile_L750_Main" material="Aluminium"  X_Y_Z="20.; 750.; 30. " />
+<subtraction  name="LS_UProfile_L750" >
+  <posXYZ   volume="LS_UProfile_L750_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="3.; 0.; 0." />
+</subtraction>
+
+<gvxy name="LS_Top_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="914.3; 3484.44"/>
+  <gvxy_point X_Y="1146.47; 3571.68"/>
+  <gvxy_point X_Y="1141.27; 3656.86"/>
+  <gvxy_point X_Y="1054.98; 3656.86"/>
+  <gvxy_point X_Y="1054.98; 4070."/>
+  <gvxy_point X_Y="813.64; 4070."/>
+  <gvxy_point X_Y="774.65; 3494.2"/>
+</gvxy>
+
+<gvxy name="LS_Bottom_Grabber_interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="-801.54; 2552.21"/>
+  <gvxy_point X_Y="-858.34; 2743.97"/>
+  <gvxy_point X_Y="-591.97; 2822.88"/>
+  <gvxy_point X_Y="-535.17; 2631.11"/>
+</gvxy>
+
+<gvxy name="LS_Bottom_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="-558.42; 1731.46"/>
+  <gvxy_point X_Y="-616.93; 1928.98"/>
+  <gvxy_point X_Y="-678.34; 1910.78"/>
+  <gvxy_point X_Y="-727.9; 1985.99"/>
+  <gvxy_point X_Y="-570.48; 2124.21"/>
+  <gvxy_point X_Y="-437.49; 2163.6"/>
+  <gvxy_point X_Y="-329.56; 1799.25"/>
+</gvxy>
+
+<box  name="LS_MM_Connectors" material="Aluminium"  X_Y_Z="76.; 40.; 30. " />
+<composition  name="LS_MM_Connectors_Assembly" >
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="323.24; 1278.98; 0." rot="0. ; 0. ; -16.5" />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="596.23; 2200.58; 0." rot="0. ; 0. ; -16.5" />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="800.97; 2891.78; 0." rot="0. ; 0. ; -16.5" />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="922.31; 3368.81; 0." rot="0. ; 0. ; -4." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="986.76; 4290.41; 0." rot="0. ; 0. ; -4." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="824.; 4615.; 0." rot="0. ; 0. ; 90." />
+</composition>
+
+<box  name="LS_KM_Joint" material="ShieldSteel"  X_Y_Z="150.; 118.; 48. " />
+
+<composition  name="LS_Spacer_Frame_Assembly" >
+  <posXYZ  volume="LS_StructuralPlate" X_Y_Z="0.; 0.; 18." />
+  <posXYZ  volume="LS_StructuralPlate" X_Y_Z="0.; 0.; -18." />
+  <posXYZ  volume="LS_Central_reference_bar" X_Y_Z="0.; 3235.5; 0." />
+  <posXYZ  volume="LS_Channel_section_L2000" X_Y_Z="0.; 2185.49; 0." />
+  <posXYZ  volume="LS_Channel_section_L1200" X_Y_Z="0.; 3885.51; 0." />
+  <posXYZ  volume="LS_Channel_section_L850" X_Y_Z="130.5; 3710.51; 0." />
+  <posXYZ  volume="LS_Channel_section_L850" X_Y_Z="-130.5; 3710.51; 0." />
+  <posXYZ  volume="LS_Channel_section_L1000" X_Y_Z="130.5; 2223.; 0." />
+  <posXYZ  volume="LS_Channel_section_L1000" X_Y_Z="-130.5; 2223.; 0." />
+  <posXYZ  volume="LS_UProfile_L1460" X_Y_Z="252.; 2455.49; 0." />
+  <posXYZ  volume="LS_UProfile_L1460" X_Y_Z="-252.; 2455.49; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="252.; 3760.5; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-252.; 3760.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="465.; 3760.5; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-465.; 3760.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="678.; 3760.5; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-678.; 3760.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="465.; 2551.; 0." />
+  <posXYZ  volume="LS_UProfile_L750" X_Y_Z="-465.; 2551.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_Top_Interface" X_Y_Z="0.; 0.; 0." />
+  <posXYZ  volume="LS_Top_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="0.; 956.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="LS_MM_Connectors" X_Y_Z="0.; 4615.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="LS_KM_Joint" X_Y_Z="-1130.01; 3970.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_KM_Joint" X_Y_Z="1130.01; 3970.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="LS_KM_Joint" X_Y_Z="656.6; 1798.8; 0." rot="0. ; 0. ; -16.5" />
+</composition>
+
+<composition  name="LS" >
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="LS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 315." />
+</composition>
+<!-- LS Spacer Ftame -->
+
+<!-- SS Spacer Ftame -->
+<gvxy name="SS_StructuralPlate_Main" material="Aluminium" dZ="5.9">
+  <gvxy_point X_Y="154.8; 930."/>
+  <gvxy_point X_Y="745.; 4114.46"/>
+  <gvxy_point X_Y="745.; 4425."/>
+  <gvxy_point X_Y="0.01; 4425."/>
+  <gvxy_point X_Y="0.01; 930."/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut1" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="685.; 4242.5"/>
+  <gvxy_point X_Y="685.; 4375."/>
+  <gvxy_point X_Y="25.; 4375."/>
+  <gvxy_point X_Y="25.; 4242.5"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut2" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="449.11; 4102.75"/>
+  <gvxy_point X_Y="446.87; 4122.5"/>
+  <gvxy_point X_Y="125.; 4122.5"/>
+  <gvxy_point X_Y="125.; 4028.36"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut3" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="577.21; 3867.18"/>
+  <gvxy_point X_Y="620.57; 4101.07"/>
+  <gvxy_point X_Y="131.86; 3988.9"/>
+  <gvxy_point X_Y="131.86; 3969.4"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut4" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="395.9; 3847.5"/>
+  <gvxy_point X_Y="398.14; 3867.25"/>
+  <gvxy_point X_Y="125.; 3929.94"/>
+  <gvxy_point X_Y="125.; 3847.5"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut5" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="495.98; 3705.39"/>
+  <gvxy_point X_Y="495.98; 3747.5"/>
+  <gvxy_point X_Y="25.; 3747.5"/>
+  <gvxy_point X_Y="25.; 3475.7"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut6" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="488.74; 3225.16"/>
+  <gvxy_point X_Y="576.8; 3700.3"/>
+  <gvxy_point X_Y="45.63; 3441.26"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut7" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="408.58; 3177.5"/>
+  <gvxy_point X_Y="417.35; 3215.48"/>
+  <gvxy_point X_Y="25.; 3406.82"/>
+  <gvxy_point X_Y="25.; 3177.5"/>
+</gvxy>
+
+<box  name="SS_StructuralPlate_Cut8" material="Aluminium"  X_Y_Z="92.; 70.; 7. " />
+
+<gvxy name="SS_StructuralPlate_Cut9" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="429.19; 3037.5"/>
+  <gvxy_point X_Y="25.; 3037.5"/>
+  <gvxy_point X_Y="25.; 2483.96"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut10" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="342.44; 2435.8"/>
+  <gvxy_point X_Y="445.53; 2992.05"/>
+  <gvxy_point X_Y="50.98; 2451.7"/>
+  <gvxy_point X_Y="59.05; 2435.8"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut11" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="275.17; 2072.87"/>
+  <gvxy_point X_Y="330.64; 2372.16"/>
+  <gvxy_point X_Y="310.98; 2395.8"/>
+  <gvxy_point X_Y="39.37; 2395.8"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut12" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="245.39; 2045.82"/>
+  <gvxy_point X_Y="25.; 2347.65"/>
+  <gvxy_point X_Y="25.; 2045.82"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut13" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="144.83; 1534.74"/>
+  <gvxy_point X_Y="203.73; 1852.5"/>
+  <gvxy_point X_Y="125.; 1852.5"/>
+  <gvxy_point X_Y="125.; 1536.56"/>
+</gvxy>
+
+<gvxy name="SS_StructuralPlate_Cut14" material="Aluminium" dZ="7.">
+  <gvxy_point X_Y="123.38; 980."/>
+  <gvxy_point X_Y="201.04; 1399."/>
+  <gvxy_point X_Y="25.; 1399."/>
+  <gvxy_point X_Y="25.; 980."/>
+</gvxy>
+
+<subtraction  name="SS_StructuralPlateSub" >
+  <posXYZ   volume="SS_StructuralPlate_Main"   />
+  <posXYZ   volume="SS_StructuralPlate_Cut1" />
+  <posXYZ   volume="SS_StructuralPlate_Cut2" />
+  <posXYZ   volume="SS_StructuralPlate_Cut3" />
+  <posXYZ   volume="SS_StructuralPlate_Cut4" />
+  <posXYZ   volume="SS_StructuralPlate_Cut5" />
+  <posXYZ   volume="SS_StructuralPlate_Cut6" />
+  <posXYZ   volume="SS_StructuralPlate_Cut7" />
+  <posXYZ   volume="SS_StructuralPlate_Cut8" X_Y_Z="-340.5; 3107.5; 0." />
+  <posXYZ   volume="SS_StructuralPlate_Cut9" />
+  <posXYZ   volume="SS_StructuralPlate_Cut10" />
+  <posXYZ   volume="SS_StructuralPlate_Cut11" />
+  <posXYZ   volume="SS_StructuralPlate_Cut12" />
+  <posXYZ   volume="SS_StructuralPlate_Cut13" />
+  <posXYZ   volume="SS_StructuralPlate_Cut14" />
+</subtraction>
+
+<composition  name="SS_StructuralPlate" >
+  <posXYZ  volume="SS_StructuralPlateSub" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_StructuralPlateSub" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+</composition>
+
+<box  name="SS_Central_reference_bar" material="Aluminium"  X_Y_Z="1012.; 100.; 28. " />
+
+<box  name="SS_Channel_section_L1100_Main" material="Aluminium"  X_Y_Z="50.; 1100.; 30. " />
+<subtraction  name="SS_Channel_section_L1100" >
+  <posXYZ   volume="SS_Channel_section_L1100_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+
+<box  name="SS_Channel_section_L650_Main" material="Aluminium"  X_Y_Z="50.; 650.; 30. " />
+<subtraction  name="SS_Channel_section_L650" >
+  <posXYZ   volume="SS_Channel_section_L650_Main"   />
+  <posXYZ   volume="LS_Channel_section_L2000_Cut" />
+</subtraction>
+
+<box  name="SS_UProfile_L1000_Main" material="Aluminium"  X_Y_Z="20.; 1000.; 30. " />
+<subtraction  name="SS_UProfile_L1000" >
+  <posXYZ   volume="SS_UProfile_L1000_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="SS_UProfile_L920_Main" material="Aluminium"  X_Y_Z="20.; 920.; 30. " />
+<subtraction  name="SS_UProfile_L920" >
+  <posXYZ   volume="SS_UProfile_L920_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="SS_UProfile_L1200_Main" material="Aluminium"  X_Y_Z="20.; 1200.; 30. " />
+<subtraction  name="SS_UProfile_L1200" >
+  <posXYZ   volume="SS_UProfile_L1200_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<box  name="SS_UProfile_L700_Main" material="Aluminium"  X_Y_Z="20.; 700.; 30. " />
+<subtraction  name="SS_UProfile_L700" >
+  <posXYZ   volume="SS_UProfile_L700_Main"   />
+  <posXYZ   volume="LS_UProfile_L1460_Cut" X_Y_Z="-3.; 0.; 0." />
+</subtraction>
+
+<gvxy name="SS_Top_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="849.99; 3705.17"/>
+  <gvxy_point X_Y="849.99; 4260."/>
+  <gvxy_point X_Y="627.69; 4260."/>
+  <gvxy_point X_Y="627.69; 4106.34"/>
+  <gvxy_point X_Y="564.77; 3758.03"/>
+</gvxy>
+
+<gvxy name="SS_Bottom_Grabber_interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="454.99; 1875."/>
+  <gvxy_point X_Y="454.99; 2075."/>
+  <gvxy_point X_Y="255.; 2075."/>
+  <gvxy_point X_Y="255.; 1875."/>
+</gvxy>
+
+<gvxy name="SS_Bottom_Interface" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="442.2; 1397.5"/>
+  <gvxy_point X_Y="442.2; 1560.65"/>
+  <gvxy_point X_Y="397.; 1560.65"/>
+  <gvxy_point X_Y="397.; 1792.5"/>
+  <gvxy_point X_Y="194.29; 1792.5"/>
+  <gvxy_point X_Y="149.53; 1434.71"/>
+  <gvxy_point X_Y="204.54; 1397.5"/>
+</gvxy>
+
+<box  name="SS_MM_Connectors" material="Aluminium"  X_Y_Z="76.; 40.; 30. " />
+<box  name="SS_MM_Connectors_Lar" material="Aluminium"  X_Y_Z="120.; 40.; 30. " />
+<composition  name="SS_MM_Connectors_Assembly" >
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="214.86; 1243.14; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="376.17; 2113.54; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="497.16; 2766.34; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="626.36; 3463.34; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors_Lar" X_Y_Z="766.02; 4337.75; 0." rot="0. ; 0. ; -10.5" />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="624.; 4427.; 0." rot="0. ; 0. ; 90." />
+</composition>
+
+<box  name="SS_KM_Joint" material="ShieldSteel"  X_Y_Z="154.; 101.; 48. " />
+
+<composition  name="SS_Spacer_Frame_Assembly" >
+  <posXYZ  volume="SS_StructuralPlate" X_Y_Z="0.; 0.; 18." />
+  <posXYZ  volume="SS_StructuralPlate" X_Y_Z="0.; 0.; -18." />
+  <posXYZ  volume="SS_Central_reference_bar" X_Y_Z="0.; 3107.5; 0." />
+  <posXYZ  volume="LS_Channel_section_L2000" X_Y_Z="0.; 2057.49; 0." />
+  <posXYZ  volume="SS_Channel_section_L1100" X_Y_Z="0.; 3707.51; 0." />
+  <posXYZ  volume="SS_Channel_section_L1100" X_Y_Z="-110.5; 3707.51; 0." />
+  <posXYZ  volume="SS_Channel_section_L1100" X_Y_Z="110.5; 3707.51; 0." />
+  <posXYZ  volume="SS_Channel_section_L650" X_Y_Z="-110.5; 1722.; 0." />
+  <posXYZ  volume="SS_Channel_section_L650" X_Y_Z="110.5; 1722.; 0." />
+  <posXYZ  volume="SS_UProfile_L1000" X_Y_Z="-345.; 3742.5; 0." />
+  <posXYZ  volume="SS_UProfile_L1000" X_Y_Z="345.; 3742.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_UProfile_L920" X_Y_Z="-195.; 3782.5; 0." />
+  <posXYZ  volume="SS_UProfile_L920" X_Y_Z="195.; 3782.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_UProfile_L1200" X_Y_Z="-195.; 2457.49; 0." />
+  <posXYZ  volume="SS_UProfile_L1200" X_Y_Z="195.; 2457.49; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_UProfile_L700" X_Y_Z="-360.; 2587.5; 0." />
+  <posXYZ  volume="SS_UProfile_L700" X_Y_Z="360.; 2587.5; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_Top_Interface" X_Y_Z="0.; 0.; 0." />
+  <posXYZ  volume="SS_Top_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_Bottom_Grabber_interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_Bottom_Interface" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_MM_Connectors_Assembly" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="0.; 928.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="SS_MM_Connectors" X_Y_Z="0.; 4427.; 0." rot="0. ; 0. ; 90." />
+  <posXYZ  volume="SS_KM_Joint" X_Y_Z="-927.01; 4160.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_KM_Joint" X_Y_Z="927.01; 4160.; 0." rot="0. ; 0. ; 0." />
+  <posXYZ  volume="SS_KM_Joint" X_Y_Z="-532.01; 1975.; 0." rot="0. ; 0. ; 0." />
+</composition>
+
+<composition  name="SS_AssemblyRot" >
+  <posXYZ  volume="SS_Spacer_Frame_Assembly"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 22.5" />
+</composition>
+
+<composition  name="SS" >
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="SS_AssemblyRot"  X_Y_Z="0.; 0.; 0." rot="   0. ; 0. ; 315." />
+</composition>
+<!-- End SS Spacer_Frame-->
+
+<composition  name="LS_and_SS_SideA" >
+  <posXYZ  volume="LS"  X_Y_Z="0.; 0.; 7641." rot=" 0. ; 0. ; 0." />
+  <posXYZ  volume="SS"  X_Y_Z="0.; 0.; 7177." rot=" 0. ; 0. ; 0." />
+</composition>
+
+<composition  name="LS_and_SS_SideC" >
+  <posXYZ  volume="LS"  X_Y_Z="0.; 0.; -7641." rot=" 0. ; 0. ; 0." />
+  <posXYZ  volume="SS"  X_Y_Z="0.; 0.; -7177." rot=" 0. ; 0. ; 0." />
+</composition>
+
+<composition  name="NSW_Spacer" >
+  <posXYZ  volume="LS_and_SS_SideA" />
+</composition>
+
+</section>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<!--====================================Support Structures and Hub===============================================-->
+
+<section name       = "NSW Aluminum Structure and HUB"
+         version    = "0.0"
+         date       = "25-04-2017"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "NSW_Aluminum_Structure_and_HUB">
+
+<!-- ********************************************** New Hub ************************************************** -->
+
+<!-- Horizontal Shielding -->
+<gvxysx name="Hub_Outer_Plate1" material="Lead" dZ="517.5">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+ <gvxysx name="Hub_Outer_Plate2" material="PolyBoron207HD5" dZ="517.5">
+  <gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate3" material="Lead" dZ="504.">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate4" material="PolyBoron207HD5" dZ="545.">
+  <gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate5" material="Lead" dZ="30.">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate6" material="PolyBoron207HD5" dZ="30.">
+  <gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate7" material="Lead" dZ="85.">
+  <gvxy_point X_Y="-163.1; 820.05"/>
+  <gvxy_point X_Y=" -169.25; 850.95"/>
+</gvxysx>
+
+<gvxysx name="Hub_Outer_Plate8" material="PolyBoron207HD5" dZ="126.">
+<gvxy_point X_Y="-163.1; 820."/>
+  <gvxy_point X_Y=" -153.15; 770."/>
+</gvxysx>
+
+<composition  name="Horizontal_Shielding_ForRot_Spec" >
+  <posXYZ  volume="Hub_Outer_Plate5"  X_Y_Z="0.; 0.; 908.2" />
+  <posXYZ  volume="Hub_Outer_Plate6"  X_Y_Z="0.; 0.; 908.2" />
+</composition>
+
+<composition  name="Horizontal_Shielding_ForRot_Spec2" >
+  <posXYZ  volume="Hub_Outer_Plate3"  X_Y_Z="0.; 0.; 248.7" rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="Hub_Outer_Plate4"  X_Y_Z="0.; 0.; 228.2" rot="   0. ; 0. ; 22.5" />
+</composition>
+
+<composition  name="Horizontal_Shielding_ForRot" >
+  <posXYZ  volume="Hub_Outer_Plate1"  X_Y_Z="0.; 0.; 643.45" />
+  <posXYZ  volume="Hub_Outer_Plate2"  X_Y_Z="0.; 0.; 643.45" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec2" />
+  <posXYZ  volume="Hub_Outer_Plate7"  X_Y_Z="0.; 0.; 39.2" />
+  <posXYZ  volume="Hub_Outer_Plate8"  X_Y_Z="0.; 0.; 18.7" />
+</composition>
+
+<composition  name="Horizontal_Shielding" >
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot"  rot="   0. ; 0. ; 315." />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; 67.5" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; -22.5" />
+  <posXYZ  volume="Horizontal_Shielding_ForRot_Spec"  rot="   0. ; 0. ; -67.5" />
+</composition>
+<!-- End Horizontal Shielding (New Hub) -->
+
+<!-- Other Parts of New Hub -->
+<pcon name="HUB_Extension_inner_tube" material="ShieldSteel" nbPhi="20">
+  <polyplane Rio_Z="172.; 225.; 997.75"/>
+  <polyplane Rio_Z=" 152.3; 225.; 0."/>
+</pcon>
+<tubs   name="HUB_Extension_plate_HO_side"      material="ShieldSteel"   Rio_Z="172.5; 530.; 59.2" />
+<tubs   name="Copper_disk_Extension"      material="Copper"   Rio_Z="225.5; 454.5; 998." />
+<tubs   name="HUB_Extension_outer_tube"      material="ShieldSteel"   Rio_Z="455.5; 530.; 998.7" />
+
+<pcon name="HUB_Main_part_inner_tube" material="ShieldSteel" nbPhi="20">
+  <polyplane Rio_Z="148.7; 225.; 858.5"/>
+  <polyplane Rio_Z=" 137.; 225.; 0."/>
+</pcon>
+
+<tubs   name="Copper_disk_Main_part"      material="Copper"   Rio_Z="225.5; 699.5; 760." />
+
+<gvxysxy name="Plate_IP_Main" material="ShieldSteel" dZ="91.6">
+  <gvxy_point X_Y="769.95; 153.16"/>
+  <gvxy_point X_Y="652.77; 436.16"/>
+  <gvxy_point X_Y="436.16; 652.77"/>
+  <gvxy_point X_Y="153.16; 769.95"/>
+</gvxysxy>
+
+<tubs   name="Plate_IP_Cut_Tube"      material="ShieldSteel"   Rio_Z="0.; 226.; 95." />
+
+<subtraction  name="Plate_IP" >
+  <posXYZ   volume="Plate_IP_Main"   />
+  <posXYZ   volume="Plate_IP_Cut_Tube" />
+</subtraction>
+
+<gvxysxy name="HUB_Main_part_outer_tube_Main" material="ShieldSteel" dZ="767.7">
+  <gvxy_point X_Y="769.95; 153.16"/>
+  <gvxy_point X_Y="652.77; 436.16"/>
+  <gvxy_point X_Y="436.16; 652.77"/>
+  <gvxy_point X_Y="153.16; 769.95"/>
+</gvxysxy>
+
+<tubs   name="HUB_Main_part_outer_tube_Cut_Tube"      material="ShieldSteel"   Rio_Z="0.; 700.; 770." />
+
+<subtraction  name="HUB_Main_part_outer_tube" >
+  <posXYZ   volume="HUB_Main_part_outer_tube_Main"   />
+  <posXYZ   volume="HUB_Main_part_outer_tube_Cut_Tube" />
+</subtraction>
+
+<gvxysxy name="Plate_HO_Main" material="ShieldSteel" dZ="78.">
+  <gvxy_point X_Y="769.95; 153.16"/>
+  <gvxy_point X_Y="652.77; 436.16"/>
+  <gvxy_point X_Y="436.16; 652.77"/>
+  <gvxy_point X_Y="153.16; 769.95"/>
+</gvxysxy>
+
+<tubs   name="Plate_HO_Cut_Tube"      material="ShieldSteel"   Rio_Z="0.; 150.5; 80." />
+
+<subtraction  name="Plate_HO" >
+  <posXYZ   volume="Plate_HO_Main"   />
+  <posXYZ   volume="Plate_HO_Cut_Tube" />
+</subtraction>
+
+<tubs name="Plate_HO_SupportTube" material="ShieldSteel" Rio_Z="585.; 770.; 21.4" profile="-15.; 210." nbPhi="20"/>
+
+<tubs   name="Disque_shileding_ext"      material="PolyBoron207HD5"   Rio_Z="532.5; 800.; 40." />
+<tubs   name="Plaque_polyboron_droite_v2"      material="PolyBoron207HD5"   Rio_Z="532.5; 582.5; 200." />
+
+<composition  name="Hub_Other_Parts_Assembly" >
+  <posXYZ  volume="HUB_Extension_plate_HO_side"  X_Y_Z="0.; 0.; 1920.6" />
+  <posXYZ  volume="HUB_Extension_inner_tube"  X_Y_Z="0.; 0.; 892.25" />
+  <posXYZ  volume="Copper_disk_Extension"  X_Y_Z="0.; 0.; 1391.95" />
+  <posXYZ  volume="HUB_Extension_outer_tube"  X_Y_Z="0.; 0.; 1391.6" />
+  <posXYZ  volume="HUB_Main_part_inner_tube"  X_Y_Z="0.; 0.; -45.8" />
+  <posXYZ  volume="Copper_disk_Main_part"  X_Y_Z="0.; 0.; 434.2" />
+  <posXYZ  volume="Plate_IP" />
+  <posXYZ  volume="HUB_Main_part_outer_tube"  X_Y_Z="0.; 0.; 430.3" />
+  <posXYZ  volume="Disque_shileding_ext"  X_Y_Z="0.; 0.; 944.2" />
+  <posXYZ  volume="Plaque_polyboron_droite_v2"  X_Y_Z="0.; 0.; 1064.25" />
+  <posXYZ  volume="Plate_HO"  X_Y_Z="0.; 0.; 853.2" />
+  <posXYZ  volume="Plate_HO_SupportTube"  X_Y_Z="0.; 0.; 902.95" />
+</composition>
+<!-- End Other Parts of New Hub -->
+
+<composition  name="New_Hub" >
+  <posXYZ  volume="Hub_Other_Parts_Assembly" />
+  <posXYZ  volume="Horizontal_Shielding" />
+</composition>
+<!-- ************************************************************************************** End New Hub *********************************************** -->
+
+<!-- **************************************************** Inner Spoke ******************************************************************* -->
+<gvxysx name="Base_Leg" material="Aluminium" dZ="390.">
+  <gvxy_point X_Y="40.; 531.5"/>
+  <gvxy_point X_Y=" 40.; -501.5"/>
+  <gvxy_point X_Y="150.; -501.5"/>
+  <gvxy_point X_Y=" 150.; -531.5"/>
+</gvxysx>
+
+<gvxy name="JOINING_BAR3" material="Aluminium" dZ="150.">
+  <gvxy_point X_Y="75.; 23."/>
+  <gvxy_point X_Y="75.; 7."/>
+  <gvxy_point X_Y="640.; 7."/>
+  <gvxy_point X_Y="640.; -23."/>
+  <gvxy_point X_Y="-640.; -23."/>
+  <gvxy_point X_Y="-640.; 7."/>
+  <gvxy_point X_Y="-75.; 7."/>
+  <gvxy_point X_Y="-75.; 23."/>
+</gvxy>
+
+<box  name="LATERAL_PLATE_L"      material="Aluminium"  X_Y_Z="21.; 1680.; 390. " />
+
+<gvxysx name="Front_plate2" material="Aluminium" dZ="14.">
+  <gvxy_point X_Y="98.65; 2867.18"/>
+  <gvxy_point X_Y=" 89.94; 2805.19"/>
+  <gvxy_point X_Y="89.94; 2587.18"/>
+</gvxysx>
+
+<gvxysx name="LS_OUTER3_MainBox" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="323.7; 450."/>
+  <gvxy_point X_Y=" 197.21; -450."/>
+</gvxysx>
+
+<box  name="LS_OUTER3_CutBox"      material="Aluminium"  X_Y_Z="250.; 600.; 35. " />
+
+<subtraction  name="LS_OUTER3" >
+  <posXYZ   volume="LS_OUTER3_MainBox"  />
+  <posXYZ   volume="LS_OUTER3_CutBox"  X_Y_Z=" 0.; -50.; 0. " />
+</subtraction>
+
+<gvxysx name="REAR_PLATE1" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="176.95; 309.25"/>
+  <gvxy_point X_Y=" 90.03; -309.25"/>
+</gvxysx>
+
+<gvxy name="REAR_PLATE2" material="Aluminium" dZ="30.">
+ <gvxy_point X_Y="273.95; 174.5"/>
+  <gvxy_point X_Y="224.9; -174.5"/>
+  <gvxy_point X_Y="125.; -174.5"/>
+  <gvxy_point X_Y="125.; -154.5"/>
+  <gvxy_point X_Y="-125.; -154.5"/>
+  <gvxy_point X_Y="-125.; -174.5"/>
+  <gvxy_point X_Y="-224.9; -174.5"/>
+  <gvxy_point X_Y="-273.95; 174.5"/>
+</gvxy>
+
+<box  name="SHIM1"      material="Aluminium"  X_Y_Z="700.; 150.; 21.6 " />
+<box  name="SHIM2"      material="Aluminium"  X_Y_Z="350.; 150.; 21.6 " />
+
+<gvxysx name="REAR_PLATE3" material="Aluminium" dZ="30.">
+  <gvxy_point X_Y="323.7; 80."/>
+  <gvxy_point X_Y=" 301.21; -80."/>
+</gvxysx>
+
+<box  name="KM_FRONT_PLATE1"      material="ShieldSteel"  X_Y_Z="34.; 160.; 250. " />
+<box  name="KM_LOCKING_PLATE1"      material="ShieldSteel"  X_Y_Z="20.; 120.; 200. " />
+
+<gvxy name="JOINING_BAR2" material="Aluminium" dZ="29.">
+  <gvxy_point X_Y="175.; 75."/>
+  <gvxy_point X_Y="964.81; -64.27"/>
+  <gvxy_point X_Y="938.77; -211.99"/>
+  <gvxy_point X_Y="161.88; -75."/>
+  <gvxy_point X_Y="-161.88; -75."/>
+  <gvxy_point X_Y="-938.77; -211.99"/>
+  <gvxy_point X_Y="-964.81; -64.27"/>
+  <gvxy_point X_Y="-175.; 75."/>
+</gvxy>
+
+<gvxy name="JOINING_BAR1" material="Aluminium" dZ="29.">
+  <gvxy_point X_Y="350.; 75."/>
+  <gvxy_point X_Y="1196.93; -74.34"/>
+  <gvxy_point X_Y="1170.88; -222.06"/>
+  <gvxy_point X_Y="336.88; -75."/>
+  <gvxy_point X_Y="-336.88; -75."/>
+  <gvxy_point X_Y="-1170.88; -222.06"/>
+  <gvxy_point X_Y="-1196.93; -74.34"/>
+  <gvxy_point X_Y="-350.; 75."/>
+</gvxy>
+
+<composition  name="Inner_Spoke_Assembly" >
+  <posXYZ  volume="Base_Leg"  X_Y_Z="0.; 1301.5; 0." />
+  <posXYZ  volume="JOINING_BAR1"  X_Y_Z="0.; 4385.; -231.2" />
+  <posXYZ  volume="JOINING_BAR2"  X_Y_Z="0.; 3065.; -231.2" />
+  <posXYZ  volume="JOINING_BAR3"  X_Y_Z="0.; 1715.; -218.05" rot="   90. ; 0. ; 0." />
+  <posXYZ  volume="LATERAL_PLATE_L"  X_Y_Z="-217.3; 3635.56; 0." rot="   0. ; 0. ; 8." />
+  <posXYZ  volume="LATERAL_PLATE_L"  X_Y_Z="217.3; 3635.56; 0." rot="   0. ; 0. ; -8." />
+  <posXYZ  volume="Front_plate2"  X_Y_Z="0.; 0.; 188." />
+  <posXYZ  volume="LS_OUTER3"  X_Y_Z="0.; 4018.41; 180." />
+  <posXYZ  volume="REAR_PLATE1"  X_Y_Z="0.; 3114.99; -180." />
+  <posXYZ  volume="REAR_PLATE2"  X_Y_Z="0.; 3939.93; -180." />
+  <posXYZ  volume="REAR_PLATE3"  X_Y_Z="0.; 4388.42; -180." />
+  <posXYZ  volume="SHIM1"  X_Y_Z="0.; 4385.; -205.85" />
+  <posXYZ  volume="SHIM2"  X_Y_Z="0.; 3065.; -205.85" />
+  <posXYZ  volume="KM_FRONT_PLATE1"  X_Y_Z="318.34; 4156.56; 25." rot="   0. ; 0. ; -8." />
+  <posXYZ  volume="KM_FRONT_PLATE1"  X_Y_Z="-318.34; 4156.56; 25." rot="   0. ; 0. ; 8." />
+  <posXYZ  volume="KM_LOCKING_PLATE1"  X_Y_Z="270.71; 4163.26; 0." rot="   0. ; 0. ; -8." />
+  <posXYZ  volume="KM_LOCKING_PLATE1"  X_Y_Z="-270.71; 4163.26; 0." rot="   0. ; 0. ; 8." />
+</composition>
+
+<composition  name="Inner_Spoke" >
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 67.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 112.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 157.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 202.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 247.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 292.5" />
+  <posXYZ  volume="Inner_Spoke_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 337.5" />
+</composition>
+
+<!-- *********************************************************************************** End Inner Spoke **************************************************\
+************************************* -->
+
+<!-- *********************************************************************************** Outer Spoke ******************************************************\
+************************************* -->
+
+<box  name="NSW_F1_spoke_MainBox"      material="Aluminium"  X_Y_Z="135.; 1060.; 185. " />
+<box  name="NSW_F1_spoke_CutBox"      material="Aluminium"  X_Y_Z="111.; 1070.; 161. " />
+
+<subtraction  name="NSW_F1_spoke" >
+  <posXYZ  volume="NSW_F1_spoke_MainBox" />
+  <posXYZ  volume="NSW_F1_spoke_CutBox" />
+</subtraction>
+<box  name="NSW_F1_spoke_Bot_Plate"      material="Aluminium"  X_Y_Z="300.; 48.; 300. " />
+
+<gvxysx name="Plaque_interface2" material="Aluminium" dZ="37.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<gvxysx name="Plaque_interface2.1" material="Aluminium" dZ="45.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<box  name="NSW_SS_spoke_Pillar_MainBox"      material="Aluminium"  X_Y_Z="135.; 2683.25; 185. " />
+<box  name="NSW_SS_spoke_Pillar_CutBox"      material="Aluminium"  X_Y_Z="113.; 2685.; 163. " />
+
+<subtraction  name="NSW_SS_spoke_Pillar" >
+  <posXYZ  volume="NSW_SS_spoke_Pillar_MainBox" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar_CutBox" />
+</subtraction>
+
+<box  name="Spoke_Joint"      material="ShieldSteel"  X_Y_Z="75.; 85.; 124.4 " />
+
+<gvxysx name="Manifolds_Support_Main" material="Aluminium" dZ="150.">
+  <gvxy_point X_Y="585.; 75."/>
+  <gvxy_point X_Y=" 551.74; -75."/>
+</gvxysx>
+
+<box  name="Manifolds_Support_CutBox1"      material="Aluminium"  X_Y_Z="1180.; 140.; 140. " />
+<box  name="Manifolds_Support_CutBox2"      material="Aluminium"  X_Y_Z="160.; 90.; 160. " />
+
+<subtraction  name="Manifolds_Support" >
+  <posXYZ  volume="Manifolds_Support_Main" />
+  <posXYZ  volume="Manifolds_Support_CutBox1" />
+  <posXYZ  volume="Manifolds_Support_CutBox2"  X_Y_Z="135.; -45.; 0." />
+</subtraction>
+
+<box  name="Cale"      material="Aluminium"  X_Y_Z="135.; 280.; 52. " />
+<box  name="JD_JOINT2.1_Plate1"      material="Aluminium"  X_Y_Z="250.; 270.; 20. " />
+<box  name="Shim_JD"      material="Aluminium"  X_Y_Z="250.; 270.; 29. " />
+<box  name="JD_JOINT1_Pipe_MainBox" material="Aluminium"  X_Y_Z="1300.; 120.; 80." />
+<box  name="JD_JOINT1_Pipe_CutBox"      material="Aluminium"  X_Y_Z="1305.; 100.; 60. " />
+
+<subtraction  name="JD_JOINT1_Pipe" >
+  <posXYZ  volume="JD_JOINT1_Pipe_MainBox"  />
+  <posXYZ  volume="JD_JOINT1_Pipe_CutBox"  />
+</subtraction>
+
+<box  name="JD_JOINT2_Pipe_MainBox" material="Aluminium"  X_Y_Z="900.; 120.; 80." />
+
+<subtraction  name="JD_JOINT2_Pipe" >
+  <posXYZ  volume="JD_JOINT2_Pipe_MainBox" />
+  <posXYZ  volume="JD_JOINT1_Pipe_CutBox"  />
+</subtraction>
+
+<box  name="KM_FRONT_PLATE.1.1"      material="ShieldSteel"  X_Y_Z="27.; 272.; 120. " />
+<box  name="Manifolds_Support_Plate"      material="Aluminium"  X_Y_Z="9.8; 275.; 175. " />
+<box  name="AL_BAR_KM_INCLINED_PLATE"      material="Aluminium"  X_Y_Z="290.; 38.; 67. " />
+
+<composition  name="Outer_Spoke_Assembly" >
+  <posXYZ  volume="NSW_F1_spoke"  X_Y_Z="0.; 1350.; 0." />
+  <posXYZ  volume="NSW_F1_spoke_Bot_Plate"  X_Y_Z="0.; 795.95; 0." />
+  <posXYZ  volume="Manifolds_Support"  X_Y_Z="0.; 4515.33; 0." />
+  <posXYZ  volume="Plaque_interface2"  X_Y_Z="0.; 1745.; 111.05" />
+  <posXYZ  volume="Plaque_interface2.1"  X_Y_Z="0.; 1745.; -115.05" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="371.; 3267.85; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="-371.; 3267.85; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="610.52; 4348.24; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="322.65; 3049.77; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="-610.52; 4348.24; 154.75" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="-322.65; 3049.77; 154.75" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="537.79; 4020.21; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="338.24; 3120.06; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="-537.79; 4020.21; -118.55" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="-338.24; 3120.06; -118.55" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="315.; 3120.6; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-315.; 3120.6; -154.6" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="315.; 3120.6; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-315.; 3120.6; -261.55" />
+  <posXYZ  volume="JD_JOINT1_Pipe"  X_Y_Z="0.; 4020.2; -207." />
+  <posXYZ  volume="JD_JOINT2_Pipe"  X_Y_Z="0.; 3120.6; -207." />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="641.41; 4289.16; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="-641.41; 4289.16; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Manifolds_Support_Plate"  X_Y_Z="560.93; 4459.11; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Manifolds_Support_Plate"  X_Y_Z="-560.93; 4459.11; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="AL_BAR_KM_INCLINED_PLATE"  X_Y_Z="-243.; 4099.25; -228.5" />
+</composition>
+
+<!-- Outer Spoke Foot -->
+<gvxysx name="Plaque_interface2_SpecMain" material="Aluminium" dZ="37.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<box  name="Plaque_interface2_Spec_CutBox"      material="Aluminium"  X_Y_Z="160.; 260.; 13. " />
+
+<subtraction  name="Plaque_interface2_Spec" >
+  <posXYZ  volume="Plaque_interface2_SpecMain" />
+  <posXYZ  volume="Plaque_interface2_Spec_CutBox"  X_Y_Z="-120.94; 337.19; -12.5" rot="   0. ; 0. ; 12.5" />
+</subtraction>
+
+<gvxysx name="Plaque_interface2.1_SpecMain" material="Aluminium" dZ="45.">
+  <gvxy_point X_Y="182.5; 375."/>
+  <gvxy_point X_Y="146.5; 213.2"/>
+  <gvxy_point X_Y="90.; -375."/>
+</gvxysx>
+
+<subtraction  name="Plaque_interface2.1_Spec" >
+  <posXYZ  volume="Plaque_interface2.1_SpecMain" />
+  <posXYZ  volume="Plaque_interface2_Spec_CutBox"  X_Y_Z="-120.94; 337.19; 16.5" rot="   0. ; 0. ; 12.5" />
+</subtraction>
+
+<box  name="NSW_SS_spoke_PillarSpec_MainBox"      material="ShieldSteel"  X_Y_Z="135.; 2818.1; 210. " />
+<box  name="NSW_SS_spoke_PillarSpec_CutBox"      material="Aluminium"  X_Y_Z="91.; 2820.; 166. " />
+
+<subtraction  name="NSW_SS_spokeSpec_Pillar" >
+  <posXYZ  volume="NSW_SS_spoke_PillarSpec_MainBox" />
+  <posXYZ  volume="NSW_SS_spoke_PillarSpec_CutBox" />
+</subtraction>
+
+<box  name="Cale_Spec"      material="Aluminium"  X_Y_Z="135.; 280.; 38.6 " />
+<box  name="Spoke_Joint1.2"      material="Aluminium"  X_Y_Z="66.; 100.; 111.9 " />
+
+<box  name="BOTTOM_PLATE.1_Horisontal_Plate"      material="ShieldSteel"  X_Y_Z="29.8; 775.; 495. " />
+<box  name="BOTTOM_PLATE.1_Vertical_Main_Plate"      material="ShieldSteel"  X_Y_Z="460.; 640.; 35. " />
+
+<gvxy name="Connecting_Plates2.1" material="Aluminium" dZ="22.">
+  <gvxy_point X_Y="-252.; 130.65"/>
+  <gvxy_point X_Y="70.; 130.65"/>
+  <gvxy_point X_Y="252.; 25.65"/>
+  <gvxy_point X_Y="258.6; -124.1"/>
+  <gvxy_point X_Y="108.7; -130.65"/>
+  <gvxy_point X_Y="-252.; 19.35"/>
+</gvxy>
+
+<box  name="Tube_alu_feet_MainBox"      material="Aluminium"  X_Y_Z="1050.; 135.; 185. " />
+<box  name="Tube_alu_feet_CutBox"      material="Aluminium"  X_Y_Z="1055.; 111.4; 161.4 " />
+
+<subtraction  name="Tube_alu_feet" >
+  <posXYZ  volume="Tube_alu_feet_MainBox" />
+  <posXYZ  volume="Tube_alu_feet_CutBox"  X_Y_Z="-120.94; 337.19; 16.5" rot="   0. ; 0. ; 12.5" />
+</subtraction>
+
+<box  name="Fix_nut"      material="ShieldSteel"  X_Y_Z="50.; 52.; 290. " />
+
+<gvxy name="Beam_Interface" material="Aluminium" dZ="300.">
+  <gvxy_point X_Y="-80.; 73.4"/>
+  <gvxy_point X_Y="80.; 73.4"/>
+  <gvxy_point X_Y="80.; -73.4"/>
+  <gvxy_point X_Y="-80.; 28.5"/>
+</gvxy>
+
+<gvxy name="Beam_Interface2" material="Aluminium" dZ="300.">
+  <gvxy_point X_Y="-80.; 79.8"/>
+  <gvxy_point X_Y="80.; 79.8"/>
+  <gvxy_point X_Y="80.; 12.6"/>
+  <gvxy_point X_Y="-80.; -79.8"/>
+</gvxy>
+
+<box  name="LS_T_Joint"      material="ShieldSteel"  X_Y_Z="80.; 70.; 134.9 " />
+<box  name="LS_T_Joint2"      material="ShieldSteel"  X_Y_Z="77.; 67.; 147.4 " />
+
+<gvxy name="Renfort_Bas1_MainBox" material="Aluminium" dZ="135.">
+  <gvxy_point X_Y="-337.73; -67.5"/>
+  <gvxy_point X_Y="-251.72; 67.5"/>
+  <gvxy_point X_Y="251.72; 67.5"/>
+  <gvxy_point X_Y="337.27; -67.5"/>
+</gvxy>
+
+<box  name="Renfort_Bas1_CutBox"      material="Aluminium"  X_Y_Z="680.; 115.; 115. " />
+
+
+<subtraction  name="Renfort_Bas1" >
+  <posXYZ  volume="Renfort_Bas1_MainBox" />
+  <posXYZ  volume="Renfort_Bas1_CutBox" />
+</subtraction>
+
+<composition  name="Outer_Spoke_Assembly_FOOT1" >
+  <posXYZ  volume="NSW_F1_spoke"  X_Y_Z="0.; 1350.; 0." />
+  <posXYZ  volume="NSW_F1_spoke_Bot_Plate"  X_Y_Z="0.; 795.95; 0." />
+  <posXYZ  volume="Plaque_interface2_Spec"  X_Y_Z="0.; 1745.; 111.05" />
+  <posXYZ  volume="Plaque_interface2.1_Spec"  X_Y_Z="0.; 1745.; -115.05" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="371.; 3267.85; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="NSW_SS_spokeSpec_Pillar"  X_Y_Z="-385.59; 3333.67; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="315.; 3120.6; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-515.; 4020.2; -261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-315.; 3120.6; -261.55" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="315.; 3120.6; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-515.; 4020.2; -154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-315.; 3120.6; -154.6" />
+  <posXYZ  volume="Cale"  X_Y_Z="537.79; 4020.21; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="338.24; 3120.06; -118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-537.79; 4020.21; -124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-338.24; 3120.06; -124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="JD_JOINT1_Pipe"  X_Y_Z="0.; 4020.2; -207." />
+  <posXYZ  volume="JD_JOINT2_Pipe"  X_Y_Z="0.; 3120.6; -207." />
+  <posXYZ  volume="AL_BAR_KM_INCLINED_PLATE"  X_Y_Z="-243.; 4099.25; -228.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="322.65; 3049.77; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="610.52; 4348.24; 154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-322.65; 3049.28; 161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-610.4; 4347.75; 161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="641.41; 4289.16; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="BOTTOM_PLATE.1_Horisontal_Plate"  X_Y_Z="-675.29; 4889.64; -29." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="BOTTOM_PLATE.1_Vertical_Main_Plate"  X_Y_Z="-491.47; 4727.04; -257.5" rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; 103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; -103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Tube_alu_feet"  X_Y_Z="35.49; 4779.63; 0." rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-840.79; 4666.23; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-443.82; 5063.2; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Beam_Interface"  X_Y_Z="-716.12; 4723.86; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Beam_Interface2"  X_Y_Z="-496.92; 4934.01; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_T_Joint"  X_Y_Z="-649.; 4560.58; -172.5" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="LS_T_Joint2"  X_Y_Z="-356.49; 4881.55; -166.25" rot="   0. ; 0. ; 75." />
+  <posXYZ  volume="Renfort_Bas1"  X_Y_Z="-329.24; 4539.98; 0." rot="   0. ; 0. ; 45." />
+</composition>
+
+<composition  name="Outer_Spoke_Assembly_FOOT2" >
+  <posXYZ  volume="NSW_F1_spoke"  X_Y_Z="0.; 1350.; 0." />
+  <posXYZ  volume="NSW_F1_spoke_Bot_Plate"  X_Y_Z="0.; 795.95; 0." />
+  <posXYZ  volume="Plaque_interface2_Spec"  X_Y_Z="0.; 1745.; 111.05" />
+  <posXYZ  volume="Plaque_interface2.1_Spec"  X_Y_Z="0.; 1745.; -115.05" />
+  <posXYZ  volume="NSW_SS_spoke_Pillar"  X_Y_Z="371.; 3267.85; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="NSW_SS_spokeSpec_Pillar"  X_Y_Z="-385.59; 3333.67; 0." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="515.; 4020.2; 261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="315.; 3120.6; 261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-515.; 4020.2; 261.55" />
+  <posXYZ  volume="Shim_JD"  X_Y_Z="-315.; 3120.6; 261.55" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="515.; 4020.2; 154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="315.; 3120.6; 154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-515.; 4020.2; 154.6" />
+  <posXYZ  volume="JD_JOINT2.1_Plate1"  X_Y_Z="-315.; 3120.6; 154.6" />
+  <posXYZ  volume="Cale"  X_Y_Z="537.79; 4020.21; 118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale"  X_Y_Z="338.24; 3120.06; 118.55" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-537.79; 4020.21; 124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Cale_Spec"  X_Y_Z="-338.24; 3120.06; 124.35" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="JD_JOINT1_Pipe"  X_Y_Z="0.; 4020.2; 207." />
+  <posXYZ  volume="JD_JOINT2_Pipe"  X_Y_Z="0.; 3120.6; 207." />
+  <posXYZ  volume="AL_BAR_KM_INCLINED_PLATE"  X_Y_Z="-243.; 4099.25; 228.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="322.65; 3049.77; -154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint"  X_Y_Z="610.52; 4348.24; -154.75" rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-322.65; 3049.28; -161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="Spoke_Joint1.2"  X_Y_Z="-610.4; 4347.75; -161." rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="KM_FRONT_PLATE.1.1"  X_Y_Z="641.41; 4289.16; 0." rot="   0. ; 0. ; -12.5" />
+  <posXYZ  volume="BOTTOM_PLATE.1_Horisontal_Plate"  X_Y_Z="-675.29; 4889.64; 29." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="BOTTOM_PLATE.1_Vertical_Main_Plate"  X_Y_Z="-491.47; 4727.04; 257.5" rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; -103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Connecting_Plates2.1"  X_Y_Z="475.73; 4596.28; 103.55" rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Tube_alu_feet"  X_Y_Z="35.49; 4779.63; 0." rot="   0. ; 0. ; -15." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-840.79; 4666.23; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Fix_nut"  X_Y_Z="-443.82; 5063.2; -5." rot="   0. ; 0. ; -45." />
+  <posXYZ  volume="Beam_Interface"  X_Y_Z="-716.12; 4723.86; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Beam_Interface2"  X_Y_Z="-496.92; 4934.01; 0." rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_T_Joint"  X_Y_Z="-649.; 4560.58; 172.5" rot="   0. ; 0. ; 12.5" />
+  <posXYZ  volume="LS_T_Joint2"  X_Y_Z="-356.49; 4881.55; 166.25" rot="   0. ; 0. ; 75." />
+  <posXYZ  volume="Renfort_Bas1"  X_Y_Z="-329.24; 4539.98; 0." rot="   0. ; 0. ; 45." />
+</composition>
+<!-- End Outer Spoke Foot -->
+
+
+<composition  name="Outer_Spoke" >
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="Outer_Spoke_Assembly_FOOT1"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="Outer_Spoke_Assembly_FOOT2"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 180. ; 225." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="Outer_Spoke_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 315." />
+</composition>
+<!-- ********************************************************************************* End Outer Spoke ****************************************************\
+************************************** -->
+
+<!-- *********************************************************************************** LSO LSI Connection ***********************************************\
+************************************* -->
+
+<box  name="LSO_LSI_connection_Rot"      material="ShieldSteel"  X_Y_Z="63.; 754.1; 46. " />
+
+<composition  name="LSO_LSI_connection_Pos" >
+  <posXYZ  volume="LSO_LSI_connection_Rot"  X_Y_Z="0.; 2210.09; 0." />
+</composition>
+
+<composition  name="LSO_LSI_Connection" >
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; 22.5" />
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; 67.5" />
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; -22.5" />
+  <posXYZ  volume="LSO_LSI_connection_Pos"  X_Y_Z="0.; 0.; 870.2" rot="   0. ; 0. ; -67.5" />
+</composition>
+
+<!-- *********************************************************************************** End LSO LSI Connection *******************************************\
+************************************* -->
+
+<!-- *********************************************************************************** Alignment Bars ***************************************************\
+**************************************** -->
+
+<!-- SS Bar -->
+<tubs   name="SS_Bar_Tube"      material="Aluminium"   Rio_Z="0.; 49.1; 2382." />
+
+<composition  name="SS_Bar_Assembly" >
+  <posXYZ  volume="SS_Bar_Tube"  X_Y_Z="69.2; 3364.6; 0" rot="   90. ; 0. ; -3.35" />
+</composition>
+
+<composition  name="SS_Bar" >
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="SS_Bar_Assembly"  X_Y_Z="0.; 0.; 233.2" rot="   0. ; 0. ; 315." />
+</composition>
+<!-- End SS Bar -->
+
+<!-- LS Bar -->
+<tubs   name="LS_Bar_Tube"      material="Aluminium"   Rio_Z="0.; 48.; 2340." />
+<box  name="LS_Arm"      material="Aluminium"  X_Y_Z="1010.; 40.; 50. " />
+
+<composition  name="LS_Bar_Assembly" >
+  <posXYZ  volume="LS_Bar_Tube"  X_Y_Z="1286.4; 3086.18; 0." rot="   90. ; 0. ; -25." />
+  <posXYZ  volume="LS_Arm"  X_Y_Z="1789.34; 4164.73; 0." rot="   0. ; 0. ; -25." />
+</composition>
+
+<composition  name="LS_Bar" >
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 0." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 45." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 90." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 135." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 180." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 225." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 270." />
+  <posXYZ  volume="LS_Bar_Assembly"  X_Y_Z="0.; 0.; 697.2" rot="   0. ; 0. ; 315." />
+</composition>
+<!-- End LS Bar -->
+
+<!-- *********************************************************************************** End Alignment Bars ***********************************************\
+******************************************** -->
+
+
+<composition  name="NSW_Aluminum_Structure_and_HUB_Assembly" >
+  <posXYZ  volume="New_Hub" />
+  <posXYZ  volume="Inner_Spoke" />
+  <posXYZ  volume="LSO_LSI_Connection" />
+  <posXYZ  volume="Outer_Spoke" />
+  <posXYZ  volume="SS_Bar" />
+  <posXYZ  volume="LS_Bar" />
+</composition>
+
+<composition  name="NSW_Aluminum_Structure_and_HUB_SideA" >
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_Assembly"  X_Y_Z="0.; 0.; 6943.8" rot="   0. ; 0. ; 0." />
+</composition>
+
+<composition  name="NSW_Aluminum_Structure_and_HUB_SideC" >
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_Assembly"  X_Y_Z="0.; 0.; -6943.8" rot="   0. ; 180. ; 0." />
+</composition>
+
+<composition  name="NSW_Aluminum_Structure_and_HUB" >
+  <posXYZ  volume="NSW_Aluminum_Structure_and_HUB_SideA" />
+</composition>
+
+</section>
+
+<!-- ===========================================NJD=========================================== -->
+
+<section name       = "NJD Disk"
+         version    = "0.0"
+         date       = "16-11-2016"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "NJD_Disk">
+
+<!-- NJD Disk -->
+
+<!-- main disk-->
+<tubs name="MD01"   material="ShieldSteel"  Rio_Z="430.; 4360.; 40."  nbPhi="32." />
+<tubs name="MD02"   material="ShieldSteel"  Rio_Z="430.; 2700.;  48.7"  nbPhi="32." />
+<tubs name="MDB01_Cut"   material="ShieldSteel"  Rio_Z="0.; 840.; 3."  nbPhi="32." />
+
+<gvxy   name="MD03"   material="ShieldSteel"  dZ="40." >
+  <gvxy_point X_Y="-3370.; -3950."/>
+  <gvxy_point X_Y="-3370.; -3880."/>
+  <gvxy_point X_Y="-3679.5; -2484."/>
+  <gvxy_point X_Y="-3990.; -1734.39"/>
+  <gvxy_point X_Y="-2599.16; -3470."/>
+  <gvxy_point X_Y="-2670.; -3570."/>
+  <gvxy_point X_Y="-2670.; -3950."/>
+</gvxy>
+
+<subtraction name="MDB01_Un" >
+ <posXYZ volume="MD01" />
+ <posXYZ volume="MDB01_Cut" X_Y_Z=" 0.; 0.; 19.4 " />
+</subtraction>
+
+<union name="MDB01" >
+ <posXYZ volume="MDB01_Un" />
+ <posXYZ volume="MD03"  />
+ <posXYZ volume="MD03" rot=" 0.; 180.; 0."/>
+</union>
+<!-- End main disk-->
+
+
+<!-- Ret.Flux -->
+<tubs name="FLUX_Box"   material="ShieldSteel"  Rio_Z="3800.; 4360.; 39.9"  nbPhi="32." />
+<box  name="FLUX_Cut_Box" material="ShieldSteel"  X_Y_Z="2200.; 400.;  50." />
+
+<subtraction name="FLUX" >
+ <posXYZ volume="FLUX_Box" />
+ <posXYZ volume="FLUX_Cut_Box" X_Y_Z=" -1930.; 3430.; 0." />
+</subtraction>
+<!-- End Ret.Flux -->
+
+<!-- FIXING PLATE -->
+<box  name="FIXING_PLATE" material="ShieldSteel"  X_Y_Z="350.; 975.;  40.9" />
+<box  name="FIXING_PLATE_Special" material="ShieldSteel"  X_Y_Z="350.; 787.5;  40.9" />
+
+<composition name="FIXING_PLATE_Pos" >
+ <posXYZ volume="FIXING_PLATE" X_Y_Z=" 0.; 3252.5; 0." />
+</composition>
+
+<composition name="FIXING_PLATE_Ass" >
+ <posXYZ volume="FIXING_PLATE_Special" X_Y_Z=" -1208.8; 2918.31; 0." rot=" 0.; 0.; 22.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 67.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 112.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 157.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 202.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 247.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 292.5" />
+ <posXYZ volume="FIXING_PLATE_Pos" X_Y_Z=" 0.; 0.; 0."  rot=" 0.; 0.; 337.5" />
+</composition>
+<!-- End FIXING PLATE -->
+
+<!-- NJD feet-->
+<gvxy   name="JF01"   material="ShieldSteel"  dZ="37.3" >
+  <gvxy_point X_Y="-3300.; -3950."/>
+  <gvxy_point X_Y="-3300.; -3480."/>
+  <gvxy_point X_Y="-3270.; -3450."/>
+  <gvxy_point X_Y="-2730.; -3450."/>
+  <gvxy_point X_Y="-2700.; -3480."/>
+  <gvxy_point X_Y="-2700.; -3950."/>
+</gvxy>
+
+<gvxy   name="JF02"   material="ShieldSteel"  dZ="35." >
+  <gvxy_point X_Y="-342.4; -3950."/>
+  <gvxy_point X_Y="-342.4; -3930."/>
+  <gvxy_point X_Y="-77.4; -3470."/>
+  <gvxy_point X_Y="-57.4; -3470."/>
+  <gvxy_point X_Y="-57.4; -3920."/>
+  <gvxy_point X_Y="-87.4; -3950."/>
+</gvxy>
+
+<gvxy   name="JF03"   material="ShieldSteel"  dZ="48." >
+  <gvxy_point X_Y="-3370.; -362."/>
+  <gvxy_point X_Y="-3370.; 704."/>
+  <gvxy_point X_Y="-3495.; 704."/>
+  <gvxy_point X_Y="-3495.; 933."/>
+  <gvxy_point X_Y="-2660.; 933."/>
+  <gvxy_point X_Y="-2660.; 653."/>
+  <gvxy_point X_Y="-2700.; 653."/>
+  <gvxy_point X_Y="-2700.; 523."/>
+  <gvxy_point X_Y="-2590.; 523."/>
+  <gvxy_point X_Y="-2590.; -52."/>
+  <gvxy_point X_Y="-2685.; -52."/>
+  <gvxy_point X_Y="-2685.; -362."/>
+</gvxy>
+
+<gvxy   name="JF04"   material="ShieldSteel"  dZ="41.6" >
+  <gvxy_point X_Y="-453.5; -4251.1"/>
+  <gvxy_point X_Y="-453.5; -4158.1"/>
+  <gvxy_point X_Y="-603.; -4083.1"/>
+  <gvxy_point X_Y="-603.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -3998.1"/>
+  <gvxy_point X_Y="883.; -3998.1"/>
+  <gvxy_point X_Y="883.; -4251.1"/>
+</gvxy>
+
+<gvxy   name="JF05"   material="ShieldSteel"  dZ="356.1" >
+  <gvxy_point X_Y="-603.; -4048.1"/>
+  <gvxy_point X_Y="-603.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -4038.1"/>
+  <gvxy_point X_Y="-362.; -3998.1"/>
+  <gvxy_point X_Y="-253.; -3998.1"/>
+  <gvxy_point X_Y="-253.; -4048.1"/>
+</gvxy>
+
+<box  name="JF06" material="ShieldSteel"  X_Y_Z="536.; 253.; 71.4" />
+
+<!-- Right-->
+<composition name="Right_Feet" >
+ <posXYZ volume="JF01" X_Y_Z=" 0.; 0.; 38.7" rot=" 0.; 0.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" -2802.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" -3197.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF03" X_Y_Z=" 0.; -3974.05; 0." rot=" -90.; 0.; 0." />
+ <posXYZ volume="JF04" X_Y_Z=" -2805.2; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF04" X_Y_Z=" -3203.; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF05" X_Y_Z=" -3004.1; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF06" X_Y_Z=" -3000.; -4124.6; -918.75" rot=" 0.; 0.; 0." />
+</composition>
+<!-- End Right-->
+
+<!-- Left-->
+<composition name="Left_Feet" >
+ <posXYZ volume="JF01" X_Y_Z=" 0.; 0.; 38.7" rot=" 0.; 180.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" 2802.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF02" X_Y_Z=" 3197.5; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF03" X_Y_Z=" 0.; -3974.05; 0." rot=" -90.; 0.; 180." />
+ <posXYZ volume="JF04" X_Y_Z=" 2805.2; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF04" X_Y_Z=" 3203.; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF05" X_Y_Z=" 3004.1; 0.; 0." rot=" 0.; 90.; 0." />
+ <posXYZ volume="JF06" X_Y_Z=" 3000.; -4124.6; -918.75" rot=" 0.; 0.; 0." />
+</composition>
+<!-- End Right-->
+<!-- End NJD feet-->
+
+<composition name="JDDisk_ASide" >
+ <posXYZ volume="MDB01"  X_Y_Z=" 0.; 0.; 6880." rot=" 0.; 0.; 0." />
+ <posXYZ volume="MD02" X_Y_Z=" 0.; 0.; 6835.6" rot=" 0.; 0.;0."/>
+ <posXYZ volume="FLUX" X_Y_Z=" 0.; 0.; 6840." rot=" 0.; 0.; 0." />
+ <posXYZ volume="FIXING_PLATE_Ass" X_Y_Z=" 0.; 0.; 6839.5" rot=" 0.; 0.; 0." />
+ <posXYZ volume="Right_Feet"  X_Y_Z=" 0.; 0.; 6880." rot=" 0.; 180.; 0." />
+ <posXYZ volume="Left_Feet"  X_Y_Z=" 0.; 0.; 6880." rot=" 0.; 180.; 0." />
+</composition>
+
+<composition name="JDDisk_CSide" >
+ <posXYZ volume="MDB01"  X_Y_Z=" 0.; 0.; -6880." rot=" 0.; 180.; 0." />
+ <posXYZ volume="MD02" X_Y_Z=" 0.; 0.; -6835.6" rot=" 0.; 0.;0."/>
+ <posXYZ volume="FLUX" X_Y_Z=" 0.; 0.; -6840." rot=" 0.; 0.; 0." />
+ <posXYZ volume="FIXING_PLATE_Ass" X_Y_Z=" 0.; 0.; -6839.5" rot=" 0.; 0.; 0." />
+ <posXYZ volume="Right_Feet"  X_Y_Z=" 0.; 0.; -6880." rot=" 0.; 0.; 0." />
+ <posXYZ volume="Left_Feet"  X_Y_Z=" 0.; 0.; -6880." rot=" 0.; 0.; 0." />
+</composition>
+<!-- End NJD Disk -->
+
+<composition  name="NJD_Disk" >
+ <posXYZ volume="JDDisk_ASide"  X_Y_Z=" 0.; 0.; 0." rot=" 0.; 0.; 0." />
+</composition>
+
+</section>
+
+<!-- ==================================================Feet========================================= -->
+
+<section name       = "A Plate"
+         version    = "0.0"
+         date       = "29-05-2017"
+         author     = "Georgian Engineering Team - Niko Tsutskiridze"
+         top_volume = "A_Plate">
+
+<gvxy name="Lateral_Plate_Main" material="ShieldSteel" dZ="21.">
+  <gvxy_point X_Y="-3300.; -4000."/>
+  <gvxy_point X_Y="-3548.3; -3235.72"/>
+  <gvxy_point X_Y="-1458.4; -560.8"/>
+  <gvxy_point X_Y="73.9; 73.9"/>
+  <gvxy_point X_Y="-628.9; -1622.8"/>
+  <gvxy_point X_Y="-818.3; -1544.4"/>
+  <gvxy_point X_Y="-1558.6; -2491.9"/>
+  <gvxy_point X_Y="-1427.8; -2980."/>
+  <gvxy_point X_Y="-0.01; -2980."/>
+  <gvxy_point X_Y="-0.01; -3280."/>
+  <gvxy_point X_Y="-1701.9; -3280."/>
+  <gvxy_point X_Y="-1995.3; -3050.8"/>
+  <gvxy_point X_Y="-2650.; -3889."/>
+  <gvxy_point X_Y="-2650.; -4000."/>
+</gvxy>
+
+<tubs name="Lateral_plate_TubeCut" material="ShieldSteel"  Rio_Z=" 0. ; 600. ; 25."  nbPhi="36." />
+
+<subtraction  name="Lateral_Plate" >
+  <posXYZ   volume="Lateral_Plate_Main"  />
+  <posXYZ   volume="Lateral_plate_TubeCut" X_Y_Z="-0.01; -0.01; 0." rot="   0. ; 0. ; 0." />
+</subtraction>
+
+<tubs     name="Anchorage"  material="ShieldSteel"  Rio_Z=" 0. ; 22.6 ; 577."  nbPhi="36." />
+
+<gvxy name="Vertical_Top_Plate" material="ShieldSteel" dZ="33.">
+  <gvxy_point X_Y="-3300.; -3998."/>
+  <gvxy_point X_Y="-3300.; -3730."/>
+  <gvxy_point X_Y="-2865.; -3730."/>
+  <gvxy_point X_Y="-2675.; -3920."/>
+  <gvxy_point X_Y="-2675.; -3998."/>
+</gvxy>
+
+<box  name="Horizontal_Plate" material="ShieldSteel"  X_Y_Z="625.; 40.6; 287. " />
+
+<composition  name="A_Plate_Assembly" >
+  <posXYZ   volume="Lateral_Plate"  />
+  <posXYZ   volume="Lateral_Plate" X_Y_Z="0.; 0.; 0." rot="0. ; 180. ; 0." />
+  <posXYZ   volume="Anchorage" X_Y_Z="-3447.; -3283.25; -299.01" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Anchorage" X_Y_Z="3447.; -3283.25; -299.01" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Vertical_Top_Plate" X_Y_Z="0.; 0.; -27.01" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Vertical_Top_Plate" X_Y_Z="0.; 0.; -27.01" rot="0. ; 180. ; 0." />
+  <posXYZ   volume="Horizontal_Plate" X_Y_Z="-2987.5; -3929.7; -187.02" rot="0. ; 0. ; 0." />
+  <posXYZ   volume="Horizontal_Plate" X_Y_Z="2987.5; -3929.7; -187.02" rot="0. ; 0. ; 0." />
+</composition>
+
+<composition  name="A_Plate_SideA" >
+   <posXYZ volume="A_Plate_Assembly" X_Y_Z=" 0. ; 0.; 7857.5"  />
+</composition>
+
+<composition  name="A_Plate_SideC" >
+   <posXYZ volume="A_Plate_Assembly" X_Y_Z=" 0. ; 0.; -7857.5" rot="0. ; 180. ; 0."  />
+</composition>
+
+<composition  name="A_Plate" >
+   <posXYZ volume="A_Plate_SideA" />
+</composition>
+
+</section>
+
+<!-- ========== Poisitionning all Volumes in NSW================ -->
+
+<section name="NewSmallWheels" version="4.3" top_volume="NewSmallWheel" date=" April 20, 2015 " author="Daniel Lellouch">
+
+<composition name="NewSmallWheel">
+ <posXYZ volume="NSW_sTGC" X_Y_Z="0.;0.;0." zLayout="Z_POSITIVE"/>
+ <posXYZ volume="NSW_MM" X_Y_Z="0.;0.;0." zLayout="Z_POSITIVE"/>
+ <posXYZ volume="NSW_Spacer" />
+ <posXYZ volume="NSW_Aluminum_Structure_and_HUB" />
+ <posXYZ volume="NJD_Disk" />
+ <posXYZ volume="A_Plate" />
+</composition>
+
+</section>
+
+</AGDD>
diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrec_Run2.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrec_Run2.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ca6016a78f237401a0e97a4e6bab3a46776391fe
--- /dev/null
+++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrec_Run2.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# art-description: Test the Run2 layout in reconstruction
+# 
+# art-type: grid
+# art-include: master/Athena
+# art-include: 21.3/Athena
+# art-include: 21.0/Athena
+# art-output: trkPerformance_MuonSpectrometerTracks.txt
+# art-output: trkPerformance_ExtrapolatedMuonTracks.txt
+# art-output: trkPerformance_MSOnlyExtrapolatedMuonTracks.txt
+# art-output: trkPerformance_CombinedMuonTracks.txt
+# art-output: muonPerformance_segments.txt
+# art-output: muonPerformance_xAOD.txt
+# art-output: warningCount.txt
+
+#####################################################################
+# run reconstruction on 2000 di-muon events (|eta|<2.7) using the Run2 production layout (ATLAS-R2-2016-01-00-01)
+# the input RDO was produced (simulation/digitisation was run) in Athena,21.0.115
+LOG_RECO="log_Run2_reco.log"
+Reco_tf.py --inputRDOFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/Run2/RDO/RDO_DiMuon_fullEta_v1.root \
+           --preExec "from MuonRecExample.MuonRecFlags import muonRecFlags;muonRecFlags.setDefaults();muonRecFlags.doFastDigitization=False;muonRecFlags.useLooseErrorTuning.set_Value_and_Lock(True);muonRecFlags.doTrackPerformance=True;muonRecFlags.TrackPerfSummaryLevel=2;muonRecFlags.TrackPerfDebugLevel=5;from RecExConfig.RecFlags import rec;rec.doTrigger=False;rec.doEgamma=True;rec.doLucid=True;rec.doZdc=True;rec.doJetMissingETTag=True;from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags;muonStandaloneFlags.printSummary=True;" \
+           --autoConfiguration everything \
+           --imf False \
+           --outputESDFile OUT_ESD.root &> ${LOG_RECO}
+exit_code=$?
+echo  "art-result: ${exit_code} Reco_tf.py"
+if [ ${exit_code} -ne 0 ]
+then
+    exit ${exit_code}
+fi
+# check the log file for WARNING/ERROR/FATAL
+NWARNING="$(cat ${LOG_RECO} | grep WARNING | wc -l)"
+NERROR="$(cat ${LOG_RECO} | grep ERROR | wc -l)"
+NFATAL="$(cat ${LOG_RECO} | grep FATAL | wc -l)"
+echo "Found ${NWARNING} WARNING, ${NERROR} ERROR and ${NFATAL} FATAL messages in ${LOG_RECO}" > warningCount.txt
+
+echo "art-result: $?"
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM7.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM7.py
index 33e0ebe5a1ebf227164ac7bfe86a51884d7c3d1f..d722af437cf1d19c81939fd11e0fe5bb12048102 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM7.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM7.py
@@ -176,7 +176,7 @@ STDM7SlimmingHelper.SmartCollections = ["Electrons",
                                         "AntiKt4EMTopoJets",
                                         "BTagging_AntiKt4EMTopo",
                                         "InDetTrackParticles",
-                                        "PrimaryVertices" ]
+                                        "PrimaryVertices"]
 
 STDM7SlimmingHelper.IncludeEGammaTriggerContent = True
 STDM7SlimmingHelper.IncludeMuonTriggerContent = True
diff --git a/Projects/AthSimulation/package_filters.txt b/Projects/AthSimulation/package_filters.txt
index c07fc3af1aea26da491cc56ff484841ac1c0fe38..d7c7e2a39aab372ce76251c45d9a77b81ee06468 100644
--- a/Projects/AthSimulation/package_filters.txt
+++ b/Projects/AthSimulation/package_filters.txt
@@ -218,7 +218,6 @@
 + LArCalorimeter/LArG4/LArG4RunControl
 + LArCalorimeter/LArG4/LArG4SD
 + LArCalorimeter/LArG4/LArG4ShowerLib
-+ LArCalorimeter/LArG4/LArG4ShowerLibData
 + LArCalorimeter/LArG4/LArG4ShowerLibSvc
 + LArCalorimeter/LArGeoModel/LArGeoAlgsNV
 + LArCalorimeter/LArGeoModel/LArGeoBarrel
diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt
index 49314c181042c137435c2a2fa738c7ced233e895..0640368a1137c2040c462139c9b0d0a74ec2a472 100644
--- a/Projects/Athena/package_filters.txt
+++ b/Projects/Athena/package_filters.txt
@@ -20,6 +20,8 @@
 # Some analysis packages that are not part of Athena
 - PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection
 - PhysicsAnalysis/ElectronPhotonID/PhotonVertexSelection
+- Trigger/TrigTools/TrigJPsiTools
+- Trigger/TrigMonitoring/TrigIDJpsiMonitoring
 
 # Data quality packages not needed in Athena
 - DataQuality/DataQualityConfigurations
diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
index 967db2379c0d2c922eb73987fa057c2a645f804b..db872ec8a370cc67af41d343c6ff8eac6ce6d9d3 100644
--- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
+++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
@@ -283,6 +283,13 @@ namespace Trk
        ATH_MSG_VERBOSE (" p at MuonEntry " << muonEntry->momentum().mag() << " cov 00 " << (*(muonEntry->covariance()))(0,0) << " cov 11 " << (*(muonEntry->covariance()))(1,1));
        }
     }
+
+    // add the following lines to avoid double deletion of the "startPars" object
+    // more details in jira DATREP-183
+    if (muonEntry == &startPars) {
+	muonEntry = startPars.clone();
+    }
+
     // clean-up memory
     delete caloParameters;
     CaloExtension* theExtension = new CaloExtension(caloEntry,muonEntry,std::move(caloLayers));
diff --git a/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx
index d32ad1a47764e0ccda0aef8bad19e7aeabf6f4c3..b9de6cc501a99804469a9a080d8fad7622ebfc03 100644
--- a/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx
+++ b/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx
@@ -15,7 +15,7 @@ StatusCode ClusterHistograms::initializePlots() {
   histo2DMap["number_cells_vs_et_in_layer_0_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_0_2D"), "Number of cells;E_{T}", 60,0,300,50,   0,100.));
   histo2DMap["number_cells_vs_et_in_layer_1_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_1_2D"), "Number of cells;E_{T}", 60,0,300,50,   0,100.));
   histo2DMap["number_cells_vs_et_in_layer_2_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_2_2D"), "Number of cells;E_{T}", 60,0,300,50,   0,100.));
-  histo2DMap["number_cells_vs_et_in_layer_3_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_3_2D"), "Number of cells;E_{T}", 600,0,300,50,   0,100.));
+  histo2DMap["number_cells_vs_et_in_layer_3_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_3_2D"), "Number of cells;E_{T}", 60,0,300,50,   0,100.));
   
   histo2DMap["number_cell_in_layer"] = (new TH2D(Form("%s_%s",m_name.c_str(),"number_cell_in_layer"), ";Number of cells;Layer",100,0,200, 4,0,4));  
   histo2DMap["mu_energy_resolution_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"mu_energy_resolution_2D"), ";<#mu>; Energy Resolution", 5,0,80,20,-1,1));
diff --git a/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx
index b0fe70f4a860aa4970fd5dae978d1039307c21c9..56d942f253001868ed64904cfb4917be6a4392e9 100644
--- a/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx
+++ b/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx
@@ -17,9 +17,9 @@ StatusCode ShowerShapesHistograms::initializePlots() {
   histoMap["rphi"]    = (new TH1D(Form("%s_%s",m_name.c_str(),"rphi"   ), ";R_{#phi}; R_{#phi} Events"                  , 355,  0.  ,  1.1005));
   histoMap["weta2"]   = (new TH1D(Form("%s_%s",m_name.c_str(),"weta2"  ), ";W_{#etas2}; W_{#etas2} Events"              , 100,  0.  ,  0.03  ));
   histoMap["eratio"]  = (new TH1D(Form("%s_%s",m_name.c_str(),"eratio" ), ";E_{ratio}; E_{ratio} Events"                , 100,  0.  ,  1.    ));
-  histoMap["deltae"]  = (new TH1D(Form("%s_%s",m_name.c_str(),"deltae" ), ";#DeltaE [GeV]; #DeltaE Events"              , 250,  0.  ,  0.5   ));
+  histoMap["deltae"]  = (new TH1D(Form("%s_%s",m_name.c_str(),"deltae" ), ";#DeltaE [GeV]; #DeltaE Events"              , 100,  0.  ,  0.1   ));
   histoMap["f1"]      = (new TH1D(Form("%s_%s",m_name.c_str(),"f1"     ), ";f_{1}; f_{1} Events"                        , 100,  0.  ,  1.0   ));
-  histoMap["fside"]   = (new TH1D(Form("%s_%s",m_name.c_str(),"fside"  ), ";f_{side}; f_{side} Events"                  , 350,  0.  ,  3.5   ));
+  histoMap["fside"]   = (new TH1D(Form("%s_%s",m_name.c_str(),"fside"  ), ";f_{side}; f_{side} Events"                  , 100,  0.  ,  2.0   ));
   histoMap["wtots1"]  = (new TH1D(Form("%s_%s",m_name.c_str(),"wtots1" ), ";w_{s, tot}; w_{s, tot} Events"              , 100,  0.  , 10.    ));
   histoMap["ws3"]     = (new TH1D(Form("%s_%s",m_name.c_str(),"ws3"    ), ";w_{s, 3}; w_{s, 3} Events"                  , 100,  0.  ,  1.    ));
   histoMap["lateral"] = (new TH1D(Form("%s_%s",m_name.c_str(),"lateral"), ";Lateral of seed; Events", 50, 0, 1));
diff --git a/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx
index 56049818a2e6d55df8ff7c0ca51043a288f76f6c..1b83e8ab333a120dd253e632996ac65eaef34dda 100644
--- a/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx
+++ b/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx
@@ -12,12 +12,12 @@ using namespace egammaMonitoring;
 
 StatusCode TruthElectronHistograms::initializePlots() {
 
-  histoMap["deltaPhi2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaPhi2"), ";deltaPhi2; Events", 20, -0.06, 0.06);
-  histoMap["deltaEta2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaEta2"), ";deltaEta2; Events", 20, -0.04, 0.04);
-  histoMap["deltaPhiRescaled2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaPhiRescaled2"), ";deltaPhi2; Events", 20, -0.04, 0.04);
+  histoMap["deltaPhi2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaPhi2"), ";deltaPhi2; Events", 40, -0.06, 0.06);
+  histoMap["deltaEta2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaEta2"), ";deltaEta2; Events", 40, -0.04, 0.04);
+  histoMap["deltaPhiRescaled2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaPhiRescaled2"), ";deltaPhi2; Events", 40, -0.04, 0.04);
 
-  histoMap["d0Oversigmad0"] = new TH1D(Form("%s_%s",m_name.c_str(),"d0Oversigmad0"), "; d0Oversigmad0; Events", 20, -10, 10);
-  histoMap["qOverp_resolution"] = new TH1D(Form("%s_%s",m_name.c_str(),"qOverp_resolution"), ";(q/P reco - q/P truth)/ q/p truth; Events", 20, -2, 2);
+  histoMap["d0Oversigmad0"] = new TH1D(Form("%s_%s",m_name.c_str(),"d0Oversigmad0"), "; d0Oversigmad0; Events", 40, -10, 10);
+  histoMap["qOverp_resolution"] = new TH1D(Form("%s_%s",m_name.c_str(),"qOverp_resolution"), ";(q/P reco - q/P truth)/ q/p truth; Events", 60, -1, 1.5);
 
 
   ATH_CHECK(m_rootHistSvc->regHist(m_folder+"deltaPhi2", histoMap["deltaPhi2"]));
diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_MCOverlayMC16_ttbar.sh b/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_MCOverlayMC16_ttbar.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ce10e0a0ac3857c11a08fdde7f523f76aab66ad2
--- /dev/null
+++ b/Simulation/FastSimulation/FastChainPileup/test/test_FastChain_MCOverlayMC16_ttbar.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# art-description: Run FastChain with MC+MC Overlay for MC16, ttbar, no trigger
+# art-type: grid
+# art-include: 21.3/Athena
+
+# art-output: *.root                                                           
+# art-output: log.*                                                            
+# art-output: mem.summary.*                                                    
+# art-output: mem.full.*                                                       
+# art-output: runargs.*  
+
+export inputHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000425.pool.root.1
+export inputRdoBkgFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/PileupPremixing/21.0/v1/RDO.merged-pileup.100events.pool.root
+export outputRdoFile=MC_plus_MC.RDO.pool.root
+export outputAodFile=MC_plus_MC.AOD.pool.root
+export outputEsdFile=MC_plus_MC.ESD.pool.root
+
+FastChain_tf.py \
+    --inputHITSFile $inputHitsFile \
+    --inputRDO_BKGFile $inputRdoBkgFile \
+    --outputRDOFile $outputRdoFile \
+    --maxEvents 20 \
+    --skipEvents 10  \
+    --digiSeedOffset1 511 \
+    --digiSeedOffset2 727 \
+    --conditionsTag OFLCOND-MC16-SDR-20 \
+    --geometryVersion ATLAS-R2-2016-01-00-01 \
+    --triggerConfig 'OverlayPool=NONE' \
+    --postExec 'ServiceMgr.TGCcablingServerSvc.forcedUse=True' \
+    --preExec 'from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False);' \
+    --postInclude 'EventOverlayJobTransforms/blockFoldersMC_OverlayPool.py' \
+    --imf False
+
+
+FastChain_tf.py \
+   --inputRDOFile $outputRdoFile \
+   --outputESDFile $outputEsdFile \
+   --outputAODFile $outputAodFile \
+   --maxEvents -1 \
+   --skipEvents 0 \
+   --autoConfiguration everything \
+   --preExec 'rec.doTrigger=False;from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False);' 'RAWtoESD:from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArCellEmMisCalib=False' \
+  --postInclude 'r2e:EventOverlayJobTransforms/blockFoldersMC_RAWtoESD.py' 'e2a:EventOverlayJobTransforms/blockFoldersMC_ESDtoAOD.py' \
+  --imf False
diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ5W_wPU.sh b/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ5W_wPU.sh
deleted file mode 100755
index bb44ba6e05c558bbf32ac20eb1890b529cd58a29..0000000000000000000000000000000000000000
--- a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ5W_wPU.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run the full reconstruction on HITS with pile-up for JZ5W samples (leading jet pt: 800-1300 GeV) for validation of tracking overlay
-# art-include: 21.0/Athena
-# art-include: master/Athena
-# art-type: grid
-
-export inputHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrackingOverlay/JZ5W_HITS
-export inputHighPtMinbiasHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/mc16_13TeV.361239.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_high.simul.HITS.e4981_s3087_s3161
-export inputLowPtMinbiasHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/mc16_13TeV.361238.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_low.simul.HITS.e4981_s3087_s3161
-export outputRDOFile=RDO.JZ5W_wPU.root
-export outputESDFile=ESD.JZ5W_wPU.root
-export outputAODFile=AOD.JZ5W_wPU.root
-export outputNTUP_PHYSVALFile=NTUP_PHYSVAL.JZ5W_wPU.root
-
-# Copied from r11627 (asetup Athena,21.0.97)
-# Running also with asetup 21.0,Athena,2020-02-28T2145
-Reco_tf.py --inputHITSFile $inputHitsFile/*root.? \
-           --inputHighPtMinbiasHitsFile $inputHighPtMinbiasHitsFile/*root.? \
-           --inputLowPtMinbiasHitsFile $inputLowPtMinbiasHitsFile/*.root.? \
-           --triggerConfig "RDOtoRDOTrigger=MCRECO:DBF:TRIGGERDBMC:2232,86,278" \
-           --steering "doRDO_TRIG" \
-           --autoConfiguration everything \
-           --conditionsTag "default:OFLCOND-MC16-SDR-25" \
-           --geometryVersion "default:ATLAS-R2-2016-01-00-01" \
-           --postExec "all:CfgMgr.MessageSvc().setError+=['HepMcParticleLink']" 'svcMgr.AthenaPoolCnvSvc.MaxFileSizes=["15000000000"]' \
-           --postInclude "default:PyJobTransforms/UseFrontier.py" \
-           --preExec "all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(20.0);from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False)" 'HITtoRDO:userRunLumiOverride={"run":310000,"lb":61,"starttstamp":1550003600,"mu":60.500};' "from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True);" \
-           --preInclude "HITtoRDO:Digitization/ForceUseOfPileUpTools.py,SimulationJobOptions/preInlcude.PileUpBunchTrainsMC16c_2017_Config1.py,RunDependentSimData/configLumi_user.py" \
-           --valid=True \
-           --validationFlags doEgamma,doInDet,doZee,doJet \
-           --outputRDOFile $outputRDOFile \
-           --outputESDFile $outputESDFile \
-           --outputAODFile $outputAODFile \
-           --outputNTUP_PHYSVALFile $outputNTUP_PHYSVALFile \
-           --jobNumber=2 \
-           --maxEvents=2000 \
-           --numberOfCavernBkg 0 \
-           --numberOfHighPtMinBias 0.2595392 \
-           --numberOfLowPtMinBias 99.2404608 \
-           --pileupFinalBunch 6
diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ5W_woPU.sh b/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ5W_woPU.sh
deleted file mode 100755
index 844acca7c7545f9b1739989c6e4fc1d078e1d513..0000000000000000000000000000000000000000
--- a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ5W_woPU.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run the full reconstruction on HITS without pile-up JZ5W samples (leading jet pt: 800-1300 GeV) for validation of tracking overlay
-# art-include: 21.0/Athena
-# art-include: master/Athena
-# art-type: grid
-
-export inputHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrackingOverlay/JZ5W_HITS
-export outputRDOFile=RDO.JZ5W_woPU.root
-export outputESDFile=ESD.JZ5W_woPU.root
-export outputAODFile=AOD.JZ5W_woPU.root
-export outputNTUP_PHYSVALFile=NTUP_PHYSVAL.JZ5W_woPU.root
-
-# Copied from r11627 (asetup Athena,21.0.97)
-# Running also with asetup 21.0,Athena,2020-02-28T2145
-Reco_tf.py --inputHITSFile $inputHitsFile/*root.? \
-           --triggerConfig "RDOtoRDOTrigger=MCRECO:DBF:TRIGGERDBMC:2232,86,278" \
-           --steering "doRDO_TRIG" \
-           --autoConfiguration everything \
-           --conditionsTag "default:OFLCOND-MC16-SDR-25" \
-           --geometryVersion "default:ATLAS-R2-2016-01-00-01" \
-           --postExec "all:CfgMgr.MessageSvc().setError+=['HepMcParticleLink']" \
-           --postInclude "default:PyJobTransforms/UseFrontier.py" \
-           --preExec "all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(20.0);from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False)" 'HITtoRDO:userRunLumiOverride={"run":310000,"lb":61,"starttstamp":1550003600,"mu":60.500};' "from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True);" \
-           --valid=True \
-           --validationFlags doEgamma,doInDet,doZee,doJet \
-           --outputRDOFile $outputRDOFile \
-           --outputESDFile $outputESDFile \
-           --outputAODFile $outputAODFile \
-           --outputNTUP_PHYSVALFile $outputNTUP_PHYSVALFile \
-           --jobNumber=2 \
-           --maxEvents=2000
diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ6W_wPU.sh b/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ6W_wPU.sh
deleted file mode 100755
index 4637d1f8a053ef8bfabe21ff302344645d6dd59d..0000000000000000000000000000000000000000
--- a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ6W_wPU.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run the full reconstruction on HITS with pile-up for JZ6W samples (leading jet pt: 1300-1800 GeV) for validation of tracking overlay
-# art-include: 21.0/Athena
-# art-include: master/Athena
-# art-type: grid
-
-export inputHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrackingOverlay/JZ6W_HITS
-export inputHighPtMinbiasHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/mc16_13TeV.361239.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_high.simul.HITS.e4981_s3087_s3161
-export inputLowPtMinbiasHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastChainPileup/mc16_13TeV.361238.Pythia8EvtGen_A3NNPDF23LO_minbias_inelastic_low.simul.HITS.e4981_s3087_s3161
-export outputRDOFile=RDO.JZ6W_wPU.root
-export outputESDFile=ESD.JZ6W_wPU.root
-export outputAODFile=AOD.JZ6W_wPU.root
-export outputNTUP_PHYSVALFile=NTUP_PHYSVAL.JZ6W_wPU.root
-
-# Copied from r11627 (asetup Athena,21.0.97)
-# Running also with asetup 21.0,Athena,2020-02-28T2145
-Reco_tf.py --inputHITSFile $inputHitsFile/*root.? \
-           --inputHighPtMinbiasHitsFile $inputHighPtMinbiasHitsFile/*root.? \
-           --inputLowPtMinbiasHitsFile $inputLowPtMinbiasHitsFile/*.root.? \
-           --triggerConfig "RDOtoRDOTrigger=MCRECO:DBF:TRIGGERDBMC:2232,86,278" \
-           --steering "doRDO_TRIG" \
-           --autoConfiguration everything \
-           --conditionsTag "default:OFLCOND-MC16-SDR-25" \
-           --geometryVersion "default:ATLAS-R2-2016-01-00-01" \
-           --postExec "all:CfgMgr.MessageSvc().setError+=['HepMcParticleLink']" 'svcMgr.AthenaPoolCnvSvc.MaxFileSizes=["15000000000"]' \
-           --postInclude "default:PyJobTransforms/UseFrontier.py" \
-           --preExec "all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(20.0);from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False)" 'HITtoRDO:userRunLumiOverride={"run":310000,"lb":61,"starttstamp":1550003600,"mu":60.500};' "from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True);" \
-           --preInclude "HITtoRDO:Digitization/ForceUseOfPileUpTools.py,SimulationJobOptions/preInlcude.PileUpBunchTrainsMC16c_2017_Config1.py,RunDependentSimData/configLumi_user.py" \
-           --valid=True \
-           --validationFlags doEgamma,doInDet,doZee,doJet \
-           --outputRDOFile $outputRDOFile \
-           --outputESDFile $outputESDFile \
-           --outputAODFile $outputAODFile \
-           --outputNTUP_PHYSVALFile $outputNTUP_PHYSVALFile \
-           --jobNumber=2 \
-           --maxEvents=2000 \
-           --numberOfCavernBkg 0 \
-           --numberOfHighPtMinBias 0.2595392 \
-           --numberOfLowPtMinBias 99.2404608 \
-           --pileupFinalBunch 6
diff --git a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ6W_woPU.sh b/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ6W_woPU.sh
deleted file mode 100755
index d75346280fcb15b877c62c31e5c2f98e023ee1e0..0000000000000000000000000000000000000000
--- a/Simulation/FastSimulation/FastChainPileup/test/test_TrackingOverlay_JZ6W_woPU.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-#
-# art-description: Run the full reconstruction on HITS without pile-up JZ6W samples (leading jet pt: 1300-1800 GeV) for validation of tracking overlay
-# art-include: 21.0/Athena
-# art-include: master/Athena
-# art-type: grid
-
-export inputHitsFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrackingOverlay/JZ6W_HITS
-export outputRDOFile=RDO.JZ6W_woPU.root
-export outputESDFile=ESD.JZ6W_woPU.root
-export outputAODFile=AOD.JZ6W_woPU.root
-export outputNTUP_PHYSVALFile=NTUP_PHYSVAL.JZ6W_woPU.root
-
-# Copied from r11627 (asetup Athena,21.0.97)
-# Running also with asetup 21.0,Athena,2020-02-28T2145
-Reco_tf.py --inputHITSFile $inputHitsFile/*root.? \
-           --triggerConfig "RDOtoRDOTrigger=MCRECO:DBF:TRIGGERDBMC:2232,86,278" \
-           --steering "doRDO_TRIG" \
-           --autoConfiguration everything \
-           --conditionsTag "default:OFLCOND-MC16-SDR-25" \
-           --geometryVersion "default:ATLAS-R2-2016-01-00-01" \
-           --postExec "all:CfgMgr.MessageSvc().setError+=['HepMcParticleLink']" \
-           --postInclude "default:PyJobTransforms/UseFrontier.py" \
-           --preExec "all:rec.Commissioning.set_Value_and_Lock(True);from AthenaCommon.BeamFlags import jobproperties;jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(20.0);from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False)" 'HITtoRDO:userRunLumiOverride={"run":310000,"lb":61,"starttstamp":1550003600,"mu":60.500};' "from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True);" \
-           --valid=True \
-           --validationFlags doEgamma,doInDet,doZee,doJet \
-           --outputRDOFile $outputRDOFile \
-           --outputESDFile $outputESDFile \
-           --outputAODFile $outputAODFile \
-           --outputNTUP_PHYSVALFile $outputNTUP_PHYSVALFile \
-           --jobNumber=2 \
-           --maxEvents=2000
diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py
index 0faf55833cd5389aad705554192e5102f24199a3..ce3b1e7f948432a83e32b8386c1719a79763d8b6 100644
--- a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py
+++ b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py
@@ -120,17 +120,24 @@ def getIDETEnvelope(name="IDET", **kwargs):
     return CfgMgr.CylindricalEnvelope(name, **kwargs)
 
 def getCALOEnvelope(name="CALO", **kwargs):
+    from LArGeoAlgsNV.LArGeoAlgsNVConf import LArDetectorToolNV
+    calolim = 6735.
+    try:
+        if LArDetectorToolNV.ActivateFeedThrougs:
+            calolim = 6747.
+    except AttributeError:
+        pass
     kwargs.setdefault("DetectorName", "CALO")
     nSurfaces = 18
     innerRadii = [   41.,   41.,   41.,  41.,    41.,   41.,  120., 120.,  1148.,1148., 120., 120.,  41.,  41.,  41.,  41.,  41.,  41.] #FIXME Units?
     outerRadii = [  415.,  415., 3795., 3795., 4251., 4251., 4251., 4251., 4251.,4251.,4251.,4251.,4251.,4251.,3795.,3795., 415., 415.] #FIXME Units?
-    zSurfaces  = [-6781.,-6735.,-6735.,-6530.,-6530.,-4587.,-4587.,-3475.,-3475.,3475.,3475.,4587.,4587.,6530.,6530.,6735.,6735.,6781.] #FIXME Units?
+    zSurfaces  = [-6781.,-calolim,-calolim,-6530.,-6530.,-4587.,-4587.,-3475.,-3475.,3475.,3475.,4587.,4587.,6530.,6530.,calolim,calolim,6781.] #FIXME Units?
     from AthenaCommon.DetFlags import DetFlags
     # if HGTD is on, the calo envelope should *not* include it (changed from 20.20 to 21.9)
     if hasattr(DetFlags.simulate, 'HGTD_on') and DetFlags.simulate.HGTD_on():
         innerRadii = [   41.,   41.,   41.,   41.,   41.,   41.,  120.,  120., 1148.,1148., 120., 120.,  41.,  41.,  41.,  41.,  41.,  41.] #FIXME Units?
         outerRadii = [  415.,  415., 3795., 3795., 4251., 4251., 4251., 4251., 4251.,4251.,4251.,4251.,4251.,4251.,3795.,3795., 415., 415.] #FIXME Units?
-        zSurfaces  = [-6781.,-6735.,-6735.,-6530.,-6530.,-4587.,-4587.,-3545.,-3545.,3545.,3545.,4587.,4587.,6530.,6530.,6735.,6735.,6781.] #FIXME Units?
+        zSurfaces  = [-6781.,-calolim,-calolim,-6530.,-6530.,-4587.,-4587.,-3545.,-3545.,3545.,3545.,4587.,4587.,6530.,6530.,calolim,calolim,6781.] #FIXME Units?
     kwargs.setdefault("NSurfaces", nSurfaces)
     kwargs.setdefault("InnerRadii", innerRadii)
     kwargs.setdefault("OuterRadii", outerRadii)
@@ -163,11 +170,18 @@ def getForwardRegionEnvelope(name='ForwardRegion', **kwargs):
     return CfgMgr.GeoDetectorTool(name, **kwargs) ##FIXME Should this really be a GeoDetectorTool???
 
 def getMUONEnvelope(name="MUONQ02", **kwargs): #FIXME rename to MUON when safe
+    from LArGeoAlgsNV.LArGeoAlgsNVConf import LArDetectorToolNV
+    calolim = 6736.
+    try:
+        if LArDetectorToolNV.ActivateFeedThrougs:
+            calolim = 6748.
+    except AttributeError:
+        pass
     kwargs.setdefault("DetectorName", "MUONQ02") #FIXME rename to MUON when safe
     kwargs.setdefault("NSurfaces", 34)
     kwargs.setdefault("InnerRadii", [1050.,1050.,1050.,1050.,436.7,436.7,279.,279.,70.,70.,420.,420.,3800.,3800.,4255.,4255.,4255.,4255.,4255.,4255.,3800.,3800.,420.,420.,70.,70.,279.,279.,436.7,436.7,1050.,1050.,1050.,1050.]) #FIXME Units?
     kwargs.setdefault("OuterRadii", [1500.,1500.,2750.,2750.,12650.,12650.,13400.,13400.,14200.,14200.,14200.,14200.,14200.,14200.,14200.,14200.,13000.,13000.,14200.,14200.,14200.,14200.,14200.,14200.,14200.,14200.,13400.,13400.,12650.,12650.,2750.,2750.,1500.,1500.]) #FIXME Units?
-    kwargs.setdefault("ZSurfaces", [-26046.,-23001.,-23001.,-22030.,-22030.,-18650.,-18650.,-12900.,-12900.,-6783.,-6783.,-6736.,-6736.,-6550.,-6550.,-4000.,-4000.,4000.,4000.,6550.,6550.,6736.,6736.,6783.,6783.,12900.,12900.,18650.,18650.,22030.,22030.,23001.,23001.,26046.]) #FIXME Units?
+    kwargs.setdefault("ZSurfaces", [-26046.,-23001.,-23001.,-22030.,-22030.,-18650.,-18650.,-12900.,-12900.,-6783.,-6783.,-calolim,-calolim,-6550.,-6550.,-4000.,-4000.,4000.,4000.,6550.,6550.,calolim,calolim,6783.,6783.,12900.,12900.,18650.,18650.,22030.,22030.,23001.,23001.,26046.]) #FIXME Units?
     SubDetectorList=[]
     from AthenaCommon.DetFlags import DetFlags
     if DetFlags.geometry.Muon_on():
diff --git a/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt b/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
index a5156c4045c49f28161a01c0eb858e0e4a7d6dd4..b97e6c42c8d8de9edbeadcc9552a0ca8a1f45230 100644
--- a/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
@@ -29,7 +29,7 @@ find_package( XercesC )
 # Component(s) in the package:
 atlas_add_library( G4DebuggingHelperLib
                    src/G4DebuggingHelper.cxx
-                   PUBLIC_HEADERS G4DebubggingTools
+                   PUBLIC_HEADERS G4DebuggingTools
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} )
 
diff --git a/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMaker.h b/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMaker.h
index 7518fa86914e7a83744158abe6ec75fed272a26b..9649023f68f2422ad954e0baa82695f80a926052 100644
--- a/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMaker.h
+++ b/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMaker.h
@@ -54,6 +54,14 @@ namespace G4UA
 	double phiMinZoom = -180.; // degrees
 	double phiMaxZoom =  180.; // degrees
 
+	// theta x dphi bins are used in the theta-spectra
+	
+	int nBinsdphi =  18; // 0 degrees <= dphi < 360 degrees
+	int nBinstheta =  9;
+
+	double thetaMin =  0.; // degrees
+	double thetaMax = 90.; // degrees
+
 	// neutron spectra
 	int nBinslogEn  =  90;   
 	double logEMinn = -11.; // min log10(E_kin/MeV) 
@@ -146,13 +154,17 @@ namespace G4UA
 	std::vector<double> m_rz_neut_spec;
         /// vector of neutron spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_neut_spec;
+        /// vector of neutron spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_neut_spec;
 
 	// gamma
 	
         /// vector of gamma spectra in log10(E/MeV) bins and the zoom 2d grid
 	std::vector<double> m_rz_gamm_spec;
-        /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid
+        /// vector of gamma spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_gamm_spec;
+        /// vector of gamma spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_gamm_spec;
 
 	// e^+/-
 	
@@ -160,6 +172,8 @@ namespace G4UA
 	std::vector<double> m_rz_elec_spec;
         /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_elec_spec;
+        /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_elec_spec;
 
 	// mu^+/-
 	
@@ -167,6 +181,8 @@ namespace G4UA
 	std::vector<double> m_rz_muon_spec;
         /// vector of mu^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_muon_spec;
+        /// vector of mu^+/- spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_muon_spec;
 
 	// pi^+/-
 	
@@ -174,6 +190,8 @@ namespace G4UA
 	std::vector<double> m_rz_pion_spec;
         /// vector of pi^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_pion_spec;
+        /// vector of pi^+/- spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_pion_spec;
 
 	// proton
 	
@@ -181,6 +199,8 @@ namespace G4UA
 	std::vector<double> m_rz_prot_spec;
         /// vector of proton spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_prot_spec;
+        /// vector of proton spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_prot_spec;
 
 	// rest
 	
@@ -188,6 +208,10 @@ namespace G4UA
 	std::vector<double> m_rz_rest_spec;
         /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_rest_spec;
+        /// vector of rest charged spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_rchgd_spec;
+        /// vector of rest neutral spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_rneut_spec;
 
 	// time dependent maps
 
diff --git a/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMakerTool.h b/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMakerTool.h
index 5e87a4811764e4c07ef46bd99e06de28da347357..f9a7847f670e1efabb6c0fd88fce4d6c951982c1 100644
--- a/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMakerTool.h
+++ b/Simulation/G4Utilities/G4UserActions/G4UserActions/RadiationMapsMakerTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef G4USERACTIONS_G4UA__RADIATIONMAPSMAKERTOOL_H 
diff --git a/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py b/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py
index dd8e3e194f28270eb8f28f5dde84ff5f6d03da22..4b63c4e819070743276769af5045057e7f8462e5 100644
--- a/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py
+++ b/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py
@@ -15,6 +15,8 @@ from G4UserActions.G4UserActionsConf import G4UA__RadiationMapsMakerTool
 # radmaptool.NBinsLogEn      =    90
 # radmaptool.NBinsLogEo      =    45
 # radmaptool.NBinsLogTimeCut =    20
+# radmaptool.NBinsDPhi       =    18
+# radmaptool.NBinsTheta      =     9
 # radmaptool.NBinsR3D        =    30
 # radmaptool.NBinsZ3D        =    60
 # radmaptool.NBinsPhi3D      =    32
@@ -34,6 +36,8 @@ from G4UserActions.G4UserActionsConf import G4UA__RadiationMapsMakerTool
 # radmaptool.LogEMaxo        =    7.0  # in log10(E/MeV)
 # radmaptool.LogTMin         =   -9.0  # in log10(t_cut/s)
 # radmaptool.LogTMax         =   11.0  # in log10(t_cut/s)
+# radmaptool.ThetaMin        =    0.0  # in degrees
+# radmaptool.ThetaMax        =   90.0  # in degrees
 # radmaptool.ElemZMin        =    1    # Atomic number
 # radmaptool.ElemZMax        =   92    # Atomic number
 #
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
index 19f1188a4e70e54813d6cdea8dca96187c2d8ce9..1ddb423ec4b6b32f128bef1c990c79b44718b294 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
@@ -131,6 +131,10 @@ namespace G4UA{
       m_rz_neut_spec     [i] += maps.m_rz_neut_spec     [i];
       m_full_rz_neut_spec[i] += maps.m_full_rz_neut_spec[i];
     }
+    // x theta bins
+    for(unsigned int i=0;i<maps.m_theta_full_rz_neut_spec.size();i++) {
+      m_theta_full_rz_neut_spec[i] += maps.m_theta_full_rz_neut_spec[i];
+    }
     // all other particle's spectra have same size
     for(unsigned int i=0;i<maps.m_rz_gamm_spec.size();i++) {
       m_rz_gamm_spec     [i] += maps.m_rz_gamm_spec     [i];
@@ -146,6 +150,16 @@ namespace G4UA{
       m_rz_rest_spec     [i] += maps.m_rz_rest_spec     [i];
       m_full_rz_rest_spec[i] += maps.m_full_rz_rest_spec[i];
     }
+    // x theta bins
+    for(unsigned int i=0;i<maps.m_theta_full_rz_gamm_spec.size();i++) {
+      m_theta_full_rz_gamm_spec[i]  += maps.m_theta_full_rz_gamm_spec[i];
+      m_theta_full_rz_elec_spec[i]  += maps.m_theta_full_rz_elec_spec[i];
+      m_theta_full_rz_muon_spec[i]  += maps.m_theta_full_rz_muon_spec[i];
+      m_theta_full_rz_pion_spec[i]  += maps.m_theta_full_rz_pion_spec[i];
+      m_theta_full_rz_prot_spec[i]  += maps.m_theta_full_rz_prot_spec[i];
+      m_theta_full_rz_rchgd_spec[i] += maps.m_theta_full_rz_rchgd_spec[i];
+      m_theta_full_rz_rneut_spec[i] += maps.m_theta_full_rz_rneut_spec[i];
+    }
   }
 
   void RadiationMapsMaker::BeginOfRunAction(const G4Run*){
@@ -193,6 +207,15 @@ namespace G4UA{
     m_maps.m_full_rz_prot_spec.resize(0);
     m_maps.m_rz_rest_spec     .resize(0);
     m_maps.m_full_rz_rest_spec.resize(0);
+
+    m_maps.m_theta_full_rz_neut_spec .resize(0);
+    m_maps.m_theta_full_rz_gamm_spec .resize(0);
+    m_maps.m_theta_full_rz_elec_spec .resize(0);
+    m_maps.m_theta_full_rz_muon_spec .resize(0);
+    m_maps.m_theta_full_rz_pion_spec .resize(0);
+    m_maps.m_theta_full_rz_prot_spec .resize(0);
+    m_maps.m_theta_full_rz_rchgd_spec.resize(0);
+    m_maps.m_theta_full_rz_rneut_spec.resize(0);
     
     if (!m_config.material.empty()) {
       // need volume fraction only if particular material is selected
@@ -248,6 +271,15 @@ namespace G4UA{
     m_maps.m_rz_rest_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
     m_maps.m_full_rz_rest_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
 
+    m_maps.m_theta_full_rz_neut_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEn,0.0);
+    m_maps.m_theta_full_rz_gamm_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_elec_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_muon_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_pion_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_prot_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_rchgd_spec.resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_rneut_spec.resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+
     if (!m_config.material.empty()) {
       // need volume fraction only if particular material is selected
       // 2d zoom
@@ -407,7 +439,7 @@ namespace G4UA{
       double y1 = aStep->GetPostStepPoint()->GetPosition().y()*0.1;
       double z0 = aStep->GetPreStepPoint()->GetPosition().z()*0.1;
       double z1 = aStep->GetPostStepPoint()->GetPosition().z()*0.1;
-      
+
       double l = sqrt(pow(x1-x0,2)+pow(y1-y0,2)+pow(z1-z0,2));
       // make 1 mm steps but at least 1 step
       double dl0 = 0.1;
@@ -419,6 +451,14 @@ namespace G4UA{
       
       double weight = 0; // weight for NIEL
       double eKin = aStep->GetTrack()->GetKineticEnergy();
+      double theta = aStep->GetTrack()->GetMomentumDirection().theta()*180./M_PI;
+      // if theta range in configuration is 0 - 90 assume that 180-theta should
+      // be used for theta > 90; otherwise leave theta unchanged
+      theta = (theta > 90&&m_config.thetaMin==0&&m_config.thetaMax==90?180-theta:theta);
+      double dphi = (aStep->GetTrack()->GetMomentumDirection().phi()-p.phi())*180./M_PI;
+      while ( dphi > 360 ) dphi -= 360.;
+      while ( dphi <   0 ) dphi += 360.;
+      
       double logEKin = (eKin > 0?log10(eKin):(m_config.logEMinn<m_config.logEMino?m_config.logEMinn:m_config.logEMino)-1);
 
       if ( pdgid == 1 || pdgid == 9 ) {
@@ -472,6 +512,8 @@ namespace G4UA{
 	int vBinFullSpeco = -1;
 	int vBinZoomTime  = -1;
 	int vBinFullTime  = -1;
+	int vBinThetaFullSpecn = -1;
+	int vBinThetaFullSpeco = -1;
 	
 	// zoom 2d
 	if ( m_config.zMinZoom < abszorz && 
@@ -517,12 +559,26 @@ namespace G4UA{
 		 (pdgid == 6 || pdgid == 7)) {
 	      int ile = (logEKin-m_config.logEMinn)/(m_config.logEMaxn-m_config.logEMinn)*m_config.nBinslogEn;
 	      vBinFullSpecn = m_config.nBinsr*m_config.nBinslogEn*iz+ir*m_config.nBinslogEn+ile;
+	      if ( m_config.thetaMin < theta && 
+		   m_config.thetaMax > theta ) {
+		int ith = (theta-m_config.thetaMin)/(m_config.thetaMax-m_config.thetaMin)*m_config.nBinstheta;
+		int idph = dphi/360.*m_config.nBinsdphi;
+		ith = ith*m_config.nBinsdphi+idph;
+		vBinThetaFullSpecn = m_config.nBinsr*m_config.nBinslogEn*m_config.nBinsdphi*m_config.nBinstheta*iz+ir*m_config.nBinslogEn*m_config.nBinsdphi*m_config.nBinstheta+ile*m_config.nBinsdphi*m_config.nBinstheta+ith;
+	      }
 	    }
 	    if ( m_config.logEMino < logEKin && 
 		 m_config.logEMaxo > logEKin &&
 		 pdgid != 6 && pdgid != 7) {
 	      int ile = (logEKin-m_config.logEMino)/(m_config.logEMaxo-m_config.logEMino)*m_config.nBinslogEo;
 	      vBinFullSpeco = m_config.nBinsr*m_config.nBinslogEo*iz+ir*m_config.nBinslogEo+ile;
+	      if ( m_config.thetaMin < theta && 
+		   m_config.thetaMax > theta ) {
+		int ith = (theta-m_config.thetaMin)/(m_config.thetaMax-m_config.thetaMin)*m_config.nBinstheta;
+		int idph = dphi/360.*m_config.nBinsdphi;
+		ith = ith*m_config.nBinsdphi+idph;
+		vBinThetaFullSpeco = m_config.nBinsr*m_config.nBinslogEo*m_config.nBinsdphi*m_config.nBinstheta*iz+ir*m_config.nBinslogEo*m_config.nBinsdphi*m_config.nBinstheta+ile*m_config.nBinsdphi*m_config.nBinstheta+ith;
+	      }
 	    }
 	  }
 	}
@@ -685,6 +741,9 @@ namespace G4UA{
 	    if ( vBinFullSpecn >=0 ) {
 	      m_maps.m_full_rz_neut_spec [vBinFullSpecn] += dl;
 	    }
+	    if ( vBinThetaFullSpecn >=0 ) {
+	      m_maps.m_theta_full_rz_neut_spec [vBinThetaFullSpecn] += dl;
+	    }
 	  }
 	}
 	
@@ -730,6 +789,31 @@ namespace G4UA{
 	      m_maps.m_full_rz_rest_spec [vBinFullSpeco] += dl;
 	    }
 	  }
+	  if ( vBinThetaFullSpeco >=0 ) {
+	    if ( pdgid == 0 ) {
+	      m_maps.m_theta_full_rz_gamm_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 1 ) {
+	      m_maps.m_theta_full_rz_prot_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 2 ) {
+	      m_maps.m_theta_full_rz_pion_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 3 ) {
+	      m_maps.m_theta_full_rz_muon_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 4 || pdgid == 5 ) {
+	      m_maps.m_theta_full_rz_elec_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else {
+	      if ( absq > 0 ) {
+		m_maps.m_theta_full_rz_rchgd_spec [vBinThetaFullSpeco] += dl;
+	      }
+	      else {
+		m_maps.m_theta_full_rz_rneut_spec [vBinThetaFullSpeco] += dl;
+	      }
+	    }
+	  }
 	}
 	
 	if (!m_config.material.empty()) {
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx
index 7596051fe821f2c5b5baa1c85ff46139a1ea6aeb..bc63d6aa3463fee7c0a0948e7e95093fa40e54fc 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx
@@ -21,7 +21,7 @@ namespace G4UA{
     declareProperty("RadMapsFileName", m_radMapsFileName);
     /// Name of the material to make radiation maps for (take all if empty) 
     declareProperty("Material"       , m_config.material);
-    /// If true consider hits with y>0 only -- useful for shafts 
+    /// If true consider hits with y>0 only -- useful for shafts
     declareProperty("PositiveYOnly"  , m_config.posYOnly);
     /// map granularities 
     /// number of bins in r and z for all 2D maps
@@ -31,6 +31,10 @@ namespace G4UA{
     declareProperty("NBinsLogEn"     , m_config.nBinslogEn);
     /// number of bins in logE for energy spectra of other particles in 2D grids
     declareProperty("NBinsLogEo"     , m_config.nBinslogEo);
+    /// number of bins in dphi for dphi x theta dependent energy spectra
+    declareProperty("NBinsDPhi"      , m_config.nBinsdphi);
+    /// number of bins in theta for dphi x theta dependent energy spectra
+    declareProperty("NBinsTheta"     , m_config.nBinstheta);
     /// number of bins in r, z and phi for all 3D maps
     declareProperty("NBinsR3D"       , m_config.nBinsr3d);
     declareProperty("NBinsZ3D"       , m_config.nBinsz3d);
@@ -57,6 +61,9 @@ namespace G4UA{
     /// for logE of other particles in 2D spectra
     declareProperty("LogEMino"       , m_config.logEMino);
     declareProperty("LogEMaxo"       , m_config.logEMaxo);
+    /// for Theta in 2D spectra
+    declareProperty("ThetaMin"       , m_config.thetaMin);
+    declareProperty("ThetaMax"       , m_config.thetaMax);
     /// for logT in time-dependent TID 2D maps
     declareProperty("LogTMin"        , m_config.logTMin);
     declareProperty("LogTMax"        , m_config.logTMax);
@@ -84,6 +91,9 @@ namespace G4UA{
                                          m_config.logEMinn   << " < log10(E/MeV) < "                              << m_config.logEMaxn   << "\n" << 
                   "Other Spectra:   " << m_config.nBinslogEo << " log10E-bins"                                    << ", "                <<
                                          m_config.logEMino   << " < log10(E/MeV) < "                              << m_config.logEMaxo   << "\n" << 
+                  "DPhi-Bins:       " << m_config.nBinsdphi << " dphi-bins, 0 < dphi < 360 \n" << 
+		  "Theta-Bins:      " << m_config.nBinstheta << " theta-bins"                                     << ", "                  <<
+                                         m_config.thetaMin   << " < theta < "                                     << m_config.thetaMax   << "\n" << 
                   "3D Maps:         " << m_config.nBinsz3d   << (m_config.zMinFull<0?" z-bins, ":" |z|-bins, ")   << 
                                          m_config.nBinsr3d   << " r-bins, "                                       << 
                                          m_config.nBinsphi3d << " phi-bins"                                       << "\n"                << 
@@ -105,44 +115,70 @@ namespace G4UA{
   {
     ATH_MSG_DEBUG( "Finalizing " << name() );
 
-    // first make sure the vectors are empty
-
-    m_report.m_rz_tid .resize(0);
-    m_report.m_rz_eion.resize(0);
-    m_report.m_rz_niel.resize(0);
-    m_report.m_rz_h20 .resize(0);
-    m_report.m_rz_neut.resize(0);
-    m_report.m_rz_chad.resize(0);
-
-    m_report.m_full_rz_tid .resize(0);
-    m_report.m_full_rz_eion.resize(0);
-    m_report.m_full_rz_niel.resize(0);
-    m_report.m_full_rz_h20 .resize(0);
-    m_report.m_full_rz_neut.resize(0);
-    m_report.m_full_rz_chad.resize(0);
-
-    m_report.m_3d_tid .resize(0);
-    m_report.m_3d_eion.resize(0);
-    m_report.m_3d_niel.resize(0);
-    m_report.m_3d_h20 .resize(0);
-    m_report.m_3d_neut.resize(0);
-    m_report.m_3d_chad.resize(0);
-
-    m_report.m_rz_neut_spec     .resize(0);
-    m_report.m_full_rz_neut_spec.resize(0);
-    m_report.m_rz_gamm_spec     .resize(0);
-    m_report.m_full_rz_gamm_spec.resize(0);
-    m_report.m_rz_elec_spec     .resize(0);
-    m_report.m_full_rz_elec_spec.resize(0);
-    m_report.m_rz_muon_spec     .resize(0);
-    m_report.m_full_rz_muon_spec.resize(0);
-    m_report.m_rz_pion_spec     .resize(0);
-    m_report.m_full_rz_pion_spec.resize(0);
-    m_report.m_rz_prot_spec     .resize(0);
-    m_report.m_full_rz_prot_spec.resize(0);
-    m_report.m_rz_rest_spec     .resize(0);
-    m_report.m_full_rz_rest_spec.resize(0);
+    // vector of pointers to vectors of double to save space
+    std::vector<std::vector<double> *> pVal = {
+      &(m_report.m_rz_tid),&(m_report.m_rz_eion),&(m_report.m_rz_niel),&(m_report.m_rz_h20),&(m_report.m_rz_neut),&(m_report.m_rz_chad),
+      &(m_report.m_full_rz_tid),&(m_report.m_full_rz_eion),&(m_report.m_full_rz_niel),&(m_report.m_full_rz_h20),&(m_report.m_full_rz_neut),&(m_report.m_full_rz_chad)
+    };
 
+    std::vector<std::vector<double> *> pVal3d = {
+      &(m_report.m_3d_tid),&(m_report.m_3d_eion),&(m_report.m_3d_niel),&(m_report.m_3d_h20),&(m_report.m_3d_neut),&(m_report.m_3d_chad)
+    };
+
+    std::vector<std::vector<double> *> pValSpec = {
+      &(m_report.m_rz_neut_spec),&(m_report.m_rz_gamm_spec),&(m_report.m_rz_elec_spec),&(m_report.m_rz_muon_spec),&(m_report.m_rz_pion_spec),&(m_report.m_rz_prot_spec),&(m_report.m_rz_rest_spec),     
+      &(m_report.m_full_rz_neut_spec),&(m_report.m_full_rz_gamm_spec),&(m_report.m_full_rz_elec_spec),&(m_report.m_full_rz_muon_spec),&(m_report.m_full_rz_pion_spec),&(m_report.m_full_rz_prot_spec),&(m_report.m_full_rz_rest_spec)
+    };
+
+    std::vector<int> nBinslogE = {
+      m_config.nBinslogEn,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,
+      m_config.nBinslogEn,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo      
+    };
+
+    std::vector<std::vector<double> *> pValThetaSpec = {
+      &(m_report.m_theta_full_rz_neut_spec),&(m_report.m_theta_full_rz_gamm_spec),&(m_report.m_theta_full_rz_elec_spec),&(m_report.m_theta_full_rz_muon_spec),&(m_report.m_theta_full_rz_pion_spec),&(m_report.m_theta_full_rz_prot_spec),&(m_report.m_theta_full_rz_rchgd_spec),&(m_report.m_theta_full_rz_rneut_spec)
+    };
+
+    std::vector<int> nBinsThetalogE = {
+      m_config.nBinslogEn,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo
+    };
+
+    for(unsigned int hi=0;hi<pVal.size();hi++) {
+
+      // first make sure the vectors are empty
+
+      (pVal[hi])->resize(0);
+
+      // then resize to proper size and initialize with 0's 
+      // all maps are needed for the merge - so have to do resize
+      // for all before merging any ...
+
+      (pVal[hi])->resize(m_config.nBinsz*m_config.nBinsr,0.0);
+    }
+
+    // same for 3d 
+
+    for(unsigned int hi=0;hi<pVal3d.size();hi++) {
+      (pVal3d[hi])->resize(0);
+      (pVal3d[hi])->resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
+    }
+
+    // same for spectra
+
+    for(unsigned int hi=0;hi<pValSpec.size();hi++) {
+      (pValSpec[hi])->resize(0);
+      (pValSpec[hi])->resize(m_config.nBinsz*m_config.nBinsr*nBinslogE[hi],0.0);
+    }
+
+    // same for theta x dphi spectra
+
+    for(unsigned int hi=0;hi<pValThetaSpec.size();hi++) {
+      (pValThetaSpec[hi])->resize(0);
+      (pValThetaSpec[hi])->resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*nBinsThetalogE[hi],0.0);
+    }
+
+    // same for misc individual maps
+    
     m_report.m_rz_tid_time      .resize(0);
     m_report.m_full_rz_tid_time .resize(0);
 
@@ -163,42 +199,8 @@ namespace G4UA{
     }
 
     // then resize to proper size and initialize with 0's 
-
-    m_report.m_rz_tid .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_rz_eion.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_rz_niel.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_rz_h20 .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_rz_neut.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_rz_chad.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-
-    m_report.m_full_rz_tid .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_full_rz_eion.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_full_rz_niel.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_full_rz_h20 .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_full_rz_neut.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    m_report.m_full_rz_chad.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    
-    m_report.m_3d_tid .resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    m_report.m_3d_eion.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    m_report.m_3d_niel.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    m_report.m_3d_h20 .resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    m_report.m_3d_neut.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    m_report.m_3d_chad.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-
-    m_report.m_rz_neut_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEn,0.0);
-    m_report.m_full_rz_neut_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEn,0.0);
-    m_report.m_rz_gamm_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_full_rz_gamm_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_rz_elec_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_full_rz_elec_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_rz_muon_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_full_rz_muon_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_rz_pion_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_full_rz_pion_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_rz_prot_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_full_rz_prot_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_rz_rest_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    m_report.m_full_rz_rest_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    // all maps are needed for the merge - so have to do resize
+    // for all first ...
 
     m_report.m_rz_tid_time      .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogT,0.0);
     m_report.m_full_rz_tid_time .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogT,0.0);
@@ -224,321 +226,378 @@ namespace G4UA{
 
     TFile * f = new TFile(m_radMapsFileName.c_str(),"RECREATE");
 
-    TH2D * h_rz_tid  = new TH2D("rz_tid" ,"rz_tid" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_eion = new TH2D("rz_eion","rz_eion",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_niel = new TH2D("rz_niel","rz_niel",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_h20  = new TH2D("rz_h20" ,"rz_h20" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_neut = new TH2D("rz_neut","rz_neut",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_chad = new TH2D("rz_chad","rz_chad",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
+    // histograms can be booked, filled, written and deleted in a loop
+    // in order to save memory. Need vectors to loop over them ...
+
+    std::vector<const char *> h2dNames = {
+      "rz_tid","rz_eion","rz_niel","rz_h20","rz_neut","rz_chad",
+      "full_rz_tid","full_rz_eion","full_rz_niel","full_rz_h20","full_rz_neut","full_rz_chad"
+    };
+
+    std::vector<const char *> h2dZTitles = {
+      "TID [Gy]","E_{ion}/V [MeV/cm^{3}]","NIEL [n_{eq}/cm^{2}]","SEE [h_{>20 MeV}/cm^{2}]","FLUX [n_{>100 keV}/cm^{2}]","FLUX [h_{charged}/cm^{2}]",
+      "TID [Gy]","E_{ion}/V [MeV/cm^{3}]","NIEL [n_{eq}/cm^{2}]","SEE [h_{>20 MeV}/cm^{2}]","FLUX [n_{>100 keV}/cm^{2}]","FLUX [h_{charged}/cm^{2}]"
+    };
+
+    std::vector<double> zMin = {
+      m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,
+      m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull
+    };
+ 
+    std::vector<double> zMax = {
+      m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,
+      m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull
+    };
+ 
+    std::vector<double> rMin = {
+      m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,
+      m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull
+    };
+ 
+    std::vector<double> rMax = {
+      m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,
+      m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull
+    };
 
     const char * xtitle =  (m_config.zMinFull<0?"z [cm]":"|z| [cm]");
 
-    h_rz_tid  ->SetXTitle(xtitle);
-    h_rz_eion ->SetXTitle(xtitle);
-    h_rz_niel ->SetXTitle(xtitle);
-    h_rz_h20  ->SetXTitle(xtitle);
-    h_rz_neut ->SetXTitle(xtitle);
-    h_rz_chad ->SetXTitle(xtitle);
-
-    h_rz_tid  ->SetYTitle("r [cm]");
-    h_rz_eion ->SetYTitle("r [cm]");
-    h_rz_niel ->SetYTitle("r [cm]");
-    h_rz_h20  ->SetYTitle("r [cm]");
-    h_rz_neut ->SetYTitle("r [cm]");
-    h_rz_chad ->SetYTitle("r [cm]");
-
-    h_rz_tid  ->SetZTitle("TID [Gy]");
-    h_rz_eion ->SetZTitle("E_{ion}/V [MeV/cm^{3}]");
-    h_rz_niel ->SetZTitle("NIEL [n_{eq}/cm^{2}]");
-    h_rz_h20  ->SetZTitle("SEE [h_{>20 MeV}/cm^{2}]");
-    h_rz_neut ->SetZTitle("FLUX [n_{>100 keV}/cm^{2}]");
-    h_rz_chad ->SetZTitle("FLUX [h_{charged}/cm^{2}]");
-
-    TH2D *h_full_rz_tid  = new TH2D("full_rz_tid" ,"full_rz_tid" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_eion = new TH2D("full_rz_eion","full_rz_eion",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_niel = new TH2D("full_rz_niel","full_rz_niel",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_h20  = new TH2D("full_rz_h20" ,"full_rz_h20" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_neut = new TH2D("full_rz_neut","full_rz_neut",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_chad = new TH2D("full_rz_chad","full_rz_chad",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-
-    h_full_rz_tid  ->SetXTitle(xtitle);
-    h_full_rz_eion ->SetXTitle(xtitle);
-    h_full_rz_niel ->SetXTitle(xtitle);
-    h_full_rz_h20  ->SetXTitle(xtitle);
-    h_full_rz_neut ->SetXTitle(xtitle);
-    h_full_rz_chad ->SetXTitle(xtitle);
-
-    h_full_rz_tid  ->SetYTitle("r [cm]");
-    h_full_rz_eion ->SetYTitle("r [cm]");
-    h_full_rz_niel ->SetYTitle("r [cm]");
-    h_full_rz_h20  ->SetYTitle("r [cm]");
-    h_full_rz_neut ->SetYTitle("r [cm]");
-    h_full_rz_chad ->SetYTitle("r [cm]");
-
-    h_full_rz_tid  ->SetZTitle("TID [Gy]");
-    h_full_rz_eion ->SetZTitle("E_{ion}/V [MeV/cm^{3}]");
-    h_full_rz_niel ->SetZTitle("NIEL [n_{eq}/cm^{2}]");
-    h_full_rz_h20  ->SetZTitle("SEE [h_{>20 MeV}/cm^{2}]");
-    h_full_rz_neut ->SetZTitle("FLUX [n_{>100 keV}/cm^{2}]");
-    h_full_rz_chad ->SetZTitle("FLUX [h_{charged}/cm^{2}]");
-
-    TH3D * h_3d_tid  = new TH3D("h3d_tid" ,"h3d_tid" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_eion = new TH3D("h3d_eion","h3d_eion",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_niel = new TH3D("h3d_niel","h3d_niel",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_h20  = new TH3D("h3d_h20" ,"h3d_h20" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_neut = new TH3D("h3d_neut","h3d_neut",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_chad = new TH3D("h3d_chad","h3d_chad",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-
-    h_3d_tid  ->SetXTitle(xtitle);
-    h_3d_eion ->SetXTitle(xtitle);
-    h_3d_niel ->SetXTitle(xtitle);
-    h_3d_h20  ->SetXTitle(xtitle);
-    h_3d_neut ->SetXTitle(xtitle);
-    h_3d_chad ->SetXTitle(xtitle);
-
-    h_3d_tid  ->SetYTitle("r [cm]");
-    h_3d_eion ->SetYTitle("r [cm]");
-    h_3d_niel ->SetYTitle("r [cm]");
-    h_3d_h20  ->SetYTitle("r [cm]");
-    h_3d_neut ->SetYTitle("r [cm]");
-    h_3d_chad ->SetYTitle("r [cm]");
-
-    h_3d_tid  ->SetZTitle("#phi [#circ]");
-    h_3d_eion ->SetZTitle("#phi [#circ]");
-    h_3d_niel ->SetZTitle("#phi [#circ]");
-    h_3d_h20  ->SetZTitle("#phi [#circ]");
-    h_3d_neut ->SetZTitle("#phi [#circ]");
-    h_3d_chad ->SetZTitle("#phi [#circ]");
-
-    h_3d_tid  ->SetTitle("TID [Gy]");
-    h_3d_eion ->SetTitle("E_{ion}/V [MeV/cm^{3}]");
-    h_3d_niel ->SetTitle("NIEL [n_{eq}/cm^{2}]");
-    h_3d_h20  ->SetTitle("SEE [h_{>20 MeV}/cm^{2}]");
-    h_3d_neut ->SetTitle("FLUX [n_{>100 keV}/cm^{2}]");
-    h_3d_chad ->SetTitle("FLUX [h_{charged}/cm^{2}]");
-
-    // neutron spectra
-    TH3D *h_full_rz_neut_spec = new TH3D("full_rz_neut_spec","full_rz_neut_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEn,m_config.logEMinn,m_config.logEMaxn);
-    TH3D *h_rz_neut_spec      = new TH3D("rz_neut_spec","rz_neut_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEn,m_config.logEMinn,m_config.logEMaxn);
-
-    h_rz_neut_spec      ->SetXTitle(xtitle);
-    h_rz_neut_spec      ->SetYTitle("r [cm]");
-    h_rz_neut_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_neut_spec      ->SetTitle("FLUX [n(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_neut_spec ->SetXTitle(xtitle);
-    h_full_rz_neut_spec ->SetYTitle("r [cm]");
-    h_full_rz_neut_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_neut_spec ->SetTitle("FLUX [n(log_{10}(E/MeV))/cm^{2}]");
-
-    // gamma spectra
-    TH3D *h_full_rz_gamm_spec = new TH3D("full_rz_gamm_spec","full_rz_gamm_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_gamm_spec      = new TH3D("rz_gamm_spec","rz_gamm_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_gamm_spec      ->SetXTitle(xtitle);
-    h_rz_gamm_spec      ->SetYTitle("r [cm]");
-    h_rz_gamm_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_gamm_spec      ->SetTitle("FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_gamm_spec ->SetXTitle(xtitle);
-    h_full_rz_gamm_spec ->SetYTitle("r [cm]");
-    h_full_rz_gamm_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_gamm_spec ->SetTitle("FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]");
-
-    // e^+/- spectra
-    TH3D *h_full_rz_elec_spec = new TH3D("full_rz_elec_spec","full_rz_elec_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_elec_spec      = new TH3D("rz_elec_spec","rz_elec_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_elec_spec      ->SetXTitle(xtitle);
-    h_rz_elec_spec      ->SetYTitle("r [cm]");
-    h_rz_elec_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_elec_spec      ->SetTitle("FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_elec_spec ->SetXTitle(xtitle);
-    h_full_rz_elec_spec ->SetYTitle("r [cm]");
-    h_full_rz_elec_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_elec_spec ->SetTitle("FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    // mu^+/- spectra
-    TH3D *h_full_rz_muon_spec = new TH3D("full_rz_muon_spec","full_rz_muon_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_muon_spec      = new TH3D("rz_muon_spec","rz_muon_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_muon_spec      ->SetXTitle(xtitle);
-    h_rz_muon_spec      ->SetYTitle("r [cm]");
-    h_rz_muon_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_muon_spec      ->SetTitle("FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_muon_spec ->SetXTitle(xtitle);
-    h_full_rz_muon_spec ->SetYTitle("r [cm]");
-    h_full_rz_muon_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_muon_spec ->SetTitle("FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    // pi^+/- spectra
-    TH3D *h_full_rz_pion_spec = new TH3D("full_rz_pion_spec","full_rz_pion_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_pion_spec      = new TH3D("rz_pion_spec","rz_pion_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_pion_spec      ->SetXTitle(xtitle);
-    h_rz_pion_spec      ->SetYTitle("r [cm]");
-    h_rz_pion_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_pion_spec      ->SetTitle("FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_pion_spec ->SetXTitle(xtitle);
-    h_full_rz_pion_spec ->SetYTitle("r [cm]");
-    h_full_rz_pion_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_pion_spec ->SetTitle("FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    // proton spectra
-    TH3D *h_full_rz_prot_spec = new TH3D("full_rz_prot_spec","full_rz_prot_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_prot_spec      = new TH3D("rz_prot_spec","rz_prot_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_prot_spec      ->SetXTitle(xtitle);
-    h_rz_prot_spec      ->SetYTitle("r [cm]");
-    h_rz_prot_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_prot_spec      ->SetTitle("FLUX [p(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_prot_spec ->SetXTitle(xtitle);
-    h_full_rz_prot_spec ->SetYTitle("r [cm]");
-    h_full_rz_prot_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_prot_spec ->SetTitle("FLUX [p(log_{10}(E/MeV))/cm^{2}]");
-
-    // rest spectra
-    TH3D *h_full_rz_rest_spec = new TH3D("full_rz_rest_spec","full_rz_rest_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_rest_spec      = new TH3D("rz_rest_spec","rz_rest_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_rest_spec      ->SetXTitle(xtitle);
-    h_rz_rest_spec      ->SetYTitle("r [cm]");
-    h_rz_rest_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_rest_spec      ->SetTitle("FLUX [rest(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_rest_spec ->SetXTitle(xtitle);
-    h_full_rz_rest_spec ->SetYTitle("r [cm]");
-    h_full_rz_rest_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_rest_spec ->SetTitle("FLUX [rest(log_{10}(E/MeV))/cm^{2}]");
-
-    // time dependent TID maps
+    TH2D * h_rz_vol  = 0;
+    TH2D * h_rz_norm = 0;
+    TH2D * h_full_rz_vol  = 0;
+    TH2D * h_full_rz_norm = 0;
+
+    for(unsigned int hi=0;hi<h2dNames.size();hi++) {
+      TH2D *h2d = new TH2D(h2dNames[hi],h2dNames[hi],m_config.nBinsz,zMin[hi],zMax[hi],m_config.nBinsr,rMin[hi],rMax[hi]);
+      h2d->SetXTitle(xtitle);
+      h2d->SetYTitle("r [cm]");
+      h2d->SetZTitle(h2dZTitles[hi]);
+      if (hi==0 && !m_config.material.empty()) {
+	// need volume fraction only if particular material is selected
+	//
+	// the maps for TID, NIEL and SEE need to be divided by the ratio of (vol/norm) in order to get
+	// the proper estimate per volume bin for the selected material. 
+	// This is *not* done in the tool directly and left to the user after having summed the histograms
+	// from many individual jobs.
+	// 
+	h_rz_vol  = new TH2D("rz_vol" ,"rz_vol" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
+	h_rz_norm = new TH2D("rz_norm","rz_norm",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
+	h_full_rz_vol  = new TH2D("full_rz_vol" ,"full_rz_vol" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
+	h_full_rz_norm = new TH2D("full_rz_norm","full_rz_norm",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
+	
+	h_rz_vol  ->SetXTitle(xtitle);
+	h_rz_norm ->SetXTitle(xtitle);
+	h_rz_vol  ->SetYTitle("r [cm]");
+	h_rz_norm ->SetYTitle("r [cm]");
+	std::string hname("Volume fraction of ");
+	hname += m_config.material;
+	h_rz_vol  ->SetZTitle(hname.data());
+	h_rz_norm ->SetZTitle("Volume norm");
+
+	h_full_rz_vol  ->SetXTitle(xtitle);
+	h_full_rz_norm ->SetXTitle(xtitle);
+	h_full_rz_vol  ->SetYTitle("r [cm]");
+	h_full_rz_norm ->SetYTitle("r [cm]");
+	h_full_rz_vol  ->SetZTitle(hname.data());
+	h_full_rz_norm ->SetZTitle("Volume norm");
+      }
+      
+      // normalize to volume element per bin
+      for(int i=0;i<h2d->GetNbinsX();i++) { 
+	for(int j=0;j<h2d->GetNbinsY();j++) { 
+	  int iBin = h2d->GetBin(i+1,j+1); 
+	  int vBin = m_config.nBinsr*i+j;
+	  double r0=h2d->GetYaxis()->GetBinLowEdge(j+1);
+	  double r1=h2d->GetYaxis()->GetBinUpEdge(j+1);
+	  double z0=h2d->GetXaxis()->GetBinLowEdge(i+1);
+	  double z1=h2d->GetXaxis()->GetBinUpEdge(i+1); 
+	  double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
+	  // if |z| instead of z double the volume
+	  if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	  // if positive y hemisphere is used only -- half the volume
+	  if ( m_config.posYOnly ) vol *= 0.5; 
+	  double val = (*(pVal[hi]))[vBin];
+	  h2d->SetBinContent(iBin,val/vol);
+	  if (hi ==0 && !m_config.material.empty()) {
+	    // need volume fraction only if particular material is selected
+	    // VOL
+	    val =m_report.m_rz_vol[vBin];
+	    h_rz_vol->SetBinContent(iBin,val/vol);
+	    // NORM
+	    val =m_report.m_rz_norm[vBin];
+	    h_rz_norm->SetBinContent(iBin,val/vol);
+	  }
+	  if (hi ==h2dNames.size()/2 && !m_config.material.empty()) {
+	    // need volume fraction only if particular material is selected
+	    // VOL
+	    val =m_report.m_full_rz_vol[vBin];
+	    h_full_rz_vol->SetBinContent(iBin,val/vol);
+	    // NORM
+	    val =m_report.m_full_rz_norm[vBin];
+	    h_full_rz_norm->SetBinContent(iBin,val/vol);
+	  }
+	}
+      }
+      h2d->Write();
+      h2d->Delete();
+      if (hi ==h2dNames.size()/2 && !m_config.material.empty()) {
+	h_rz_vol->Write();
+	h_rz_vol->Delete();
+	h_rz_norm->Write();
+	h_rz_norm->Delete();
+	h_full_rz_vol->Write();
+	h_full_rz_vol->Delete();
+	h_full_rz_norm->Write();
+	h_full_rz_norm->Delete();
+      }
+    }
+
+    std::vector<const char *> h3dNames = {
+      "h3d_tid","h3d_eion","h3d_niel","h3d_h20","h3d_neut","h3d_chad"
+    };
+
+    std::vector<const char *> h3dTitles = {
+      "TID [Gy]","E_{ion}/V [MeV/cm^{3}]","NIEL [n_{eq}/cm^{2}]","SEE [h_{>20 MeV}/cm^{2}]","FLUX [n_{>100 keV}/cm^{2}]","FLUX [h_{charged}/cm^{2}]"
+    };
+
+    TH3D * h_3d_vol  = 0;
+    TH3D * h_3d_norm = 0;
+
+    for(unsigned int hi=0;hi<h3dNames.size();hi++) {
+      TH3D *h3d = new TH3D(h3dNames[hi],h3dNames[hi],m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
+      h3d->SetXTitle(xtitle);
+      h3d->SetYTitle("r [cm]");
+      h3d->SetZTitle("#phi [#circ]");
+      h3d->SetTitle(h3dTitles[hi]);
+      if (hi == 0 && !m_config.material.empty()) {
+	h_3d_vol  = new TH3D("h3d_vol" ,"h3d_vol" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
+	h_3d_norm = new TH3D("h3d_norm","h3d_norm",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
+	h_3d_vol  ->SetXTitle(xtitle);
+	h_3d_norm ->SetXTitle(xtitle);
+	h_3d_vol  ->SetYTitle("r [cm]");
+	h_3d_norm ->SetYTitle("r [cm]");
+	h_3d_vol  ->SetZTitle("#phi [#circ]");
+	h_3d_norm ->SetZTitle("#phi [#circ]");
+	std::string hname("Volume fraction of ");
+	hname += m_config.material;
+	h_3d_vol  ->SetTitle(hname.data());
+	h_3d_norm ->SetTitle("Volume norm");
+      }
+      // normalize to volume element per bin
+      for(int i=0;i<h3d->GetNbinsX();i++) { 
+	for(int j=0;j<h3d->GetNbinsY();j++) { 
+	  for(int k=0;k<h3d->GetNbinsZ();k++) { 
+	    int vBin = m_config.nBinsr3d*m_config.nBinsphi3d*i+m_config.nBinsphi3d*j+k;
+	    int iBin = h3d->GetBin(i+1,j+1,k+1); 
+	    double phi0=h3d->GetZaxis()->GetBinLowEdge(k+1);
+	    double phi1=h3d->GetZaxis()->GetBinUpEdge(k+1);
+	    double r0=h3d->GetYaxis()->GetBinLowEdge(j+1);
+	    double r1=h3d->GetYaxis()->GetBinUpEdge(j+1);
+	    double z0=h3d->GetXaxis()->GetBinLowEdge(i+1);
+	    double z1=h3d->GetXaxis()->GetBinUpEdge(i+1); 
+	    double vol=(z1-z0)*M_PI*(r1*r1-r0*r0)*(phi1-phi0)/360.; 
+	    // if |z| instead of z double the volume
+	    if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	    // assume that phi-range corresponds to full 360 degrees in case 
+	    // lower phi boundary is 0 - i.e. all phi-segments mapped to first
+	    if ( m_config.phiMinZoom == 0 ) {
+	      vol *= 360./m_config.phiMaxZoom;
+	      // if positive y hemisphere is used only -- half the volume
+	      if ( m_config.posYOnly ) 
+		vol *= 0.5; 
+	    }
+	    double val = (*(pVal3d[hi]))[vBin];
+	    h3d->SetBinContent(iBin,val/vol);
+	    if (hi == 0 && !m_config.material.empty()) {
+	      // VOL
+	      val =m_report.m_3d_vol[vBin];
+	      h_3d_vol->SetBinContent(iBin,val/vol);
+	      // NORM
+	      val =m_report.m_3d_norm[vBin];
+	      h_3d_norm->SetBinContent(iBin,val/vol);
+	    }
+	  }
+	}
+      }
+      h3d->Write();
+      h3d->Delete();
+      if (hi == 0 && !m_config.material.empty()) {
+	h_3d_vol->Write();
+	h_3d_vol->Delete();
+	h_3d_norm->Write();
+	h_3d_norm->Delete();
+      }
+    }
+
+    // spectra
+    
+    std::vector<const char *> hSpecNames = {
+      "rz_neut_spec","rz_gamm_spec","rz_elec_spec","rz_muon_spec","rz_pion_spec","rz_prot_spec","rz_rest_spec",
+      "full_rz_neut_spec","full_rz_gamm_spec","full_rz_elec_spec","full_rz_muon_spec","full_rz_pion_spec","full_rz_prot_spec","full_rz_rest_spec"
+    };
+
+    std::vector<const char *> hSpecTitles = {
+      "FLUX [n(log_{10}(E/MeV))/cm^{2}]","FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]","FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [p(log_{10}(E/MeV))/cm^{2}]","FLUX [rest(log_{10}(E/MeV))/cm^{2}]",
+      "FLUX [n(log_{10}(E/MeV))/cm^{2}]","FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]","FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [p(log_{10}(E/MeV))/cm^{2}]","FLUX [rest(log_{10}(E/MeV))/cm^{2}]"
+    };
+
+    std::vector<double> zMinSpec = {
+      m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,
+      m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull
+    };
+ 
+    std::vector<double> zMaxSpec = {
+      m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,
+      m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull
+    };
+ 
+    std::vector<double> rMinSpec = {
+      m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,
+      m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull
+    };
+ 
+    std::vector<double> rMaxSpec = {
+      m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,
+      m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull
+    };
+
+    std::vector<double> logEMin = {
+      m_config.logEMinn,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,
+      m_config.logEMinn,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino
+    };
+ 
+    std::vector<double> logEMax = {
+      m_config.logEMaxn,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,
+      m_config.logEMaxn,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo
+    };
+ 
+    for(unsigned int hi=0;hi<hSpecNames.size();hi++) {
+      TH3D *hSpec = new TH3D(hSpecNames[hi],hSpecNames[hi],m_config.nBinsz,zMinSpec[hi],zMaxSpec[hi],m_config.nBinsr,rMinSpec[hi],rMaxSpec[hi],nBinslogE[hi],logEMin[hi],logEMax[hi]);
+      hSpec->SetXTitle(xtitle);
+      hSpec->SetYTitle("r [cm]");
+      hSpec->SetZTitle("log_{10}(E/MeV)");
+      hSpec->SetTitle(hSpecTitles[hi]);
+      // normalize to volume element per bin
+      for(int i=0;i<hSpec->GetNbinsX();i++) { 
+	for(int j=0;j<hSpec->GetNbinsY();j++) {
+	  double r0=hSpec->GetYaxis()->GetBinLowEdge(j+1);
+	  double r1=hSpec->GetYaxis()->GetBinUpEdge(j+1);
+	  double z0=hSpec->GetXaxis()->GetBinLowEdge(i+1);
+	  double z1=hSpec->GetXaxis()->GetBinUpEdge(i+1); 
+	  double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
+	  // if |z| instead of z double the volume
+	  if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	  // if positive y hemisphere is used only -- half the volume
+	  if ( m_config.posYOnly ) vol *= 0.5; 
+	  double val;
+	  // Energy Spectra
+	  for(int k=0;k<hSpec->GetNbinsZ();k++) { 
+	    int kBin = hSpec->GetBin(i+1,j+1,k+1); 
+	    int vBinE = m_config.nBinsr*nBinslogE[hi]*i+j*nBinslogE[hi]+k;
+	    val = (*(pValSpec[hi]))[vBinE];
+	    hSpec->SetBinContent(kBin,val/vol);
+	  }
+	}
+      }
+      hSpec->Write();
+      hSpec->Delete();
+    }
+    
+    std::vector<const char *> hThetaSpecNames = {
+      "theta_dphi_full_rz_neut_spec","theta_dphi_full_rz_gamm_spec","theta_dphi_full_rz_elec_spec","theta_dphi_full_rz_muon_spec","theta_dphi_full_rz_pion_spec","theta_dphi_full_rz_prot_spec","theta_dphi_full_rz_rchgd_spec","theta_dphi_full_rz_rneut_spec"
+    };
+
+    std::vector<const char *> hThetaSpecTitles = {
+      "FLUX [n(log_{10}(E/MeV))/cm^{2}]","FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]","FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [p(log_{10}(E/MeV))/cm^{2}]","FLUX [rest^{chgd}(log_{10}(E/MeV))/cm^{2}]","FLUX [rest^{neut}(log_{10}(E/MeV))/cm^{2}]"
+    };
+
+    std::vector<double> thetalogEMin = {
+      m_config.logEMinn,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino
+    };
+ 
+    std::vector<double> thetalogEMax = {
+      m_config.logEMaxn,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo
+    };
+ 
+    for(unsigned int hi=0;hi<hThetaSpecNames.size();hi++) {
+      for(int i=0;i<m_config.nBinstheta;i++) {
+	for(int j=0;j<m_config.nBinsdphi;j++) {
+	  TString hname(hThetaSpecNames[hi]);
+	  hname += "_";
+	  hname += (int)(m_config.thetaMin +   i  *(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += "_";
+	  hname += (int)(m_config.thetaMin + (i+1)*(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += "_";
+	  hname += (int)(j*360./m_config.nBinsdphi);
+	  hname += "_";
+	  hname += (int)((j+1)*360./m_config.nBinsdphi);
+	  TH3D * hThetaSpec = new TH3D(hname.Data(),hname.Data(),m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,nBinsThetalogE[hi],thetalogEMin[hi],thetalogEMax[hi]);
+	  
+	  hThetaSpec->SetXTitle(xtitle);
+	  hThetaSpec->SetYTitle("r [cm]");
+	  hThetaSpec->SetZTitle("log_{10}(E/MeV)");
+	  hname = TString(hThetaSpecTitles[hi]);
+	  hname += " Theta: ";
+	  hname += (int)(m_config.thetaMin +   i  *(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += " - ";
+	  hname += (int)(m_config.thetaMin + (i+1)*(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += " DPhi: ";
+	  hname += (int)(j*360./m_config.nBinsdphi);
+	  hname += " - ";
+	  hname += (int)((j+1)*360./m_config.nBinsdphi);
+	  hThetaSpec->SetTitle(hname.Data());
+	  // normalize to volume element per bin
+	  for(int k=0;k<hThetaSpec->GetNbinsX();k++) { 
+	    for(int l=0;l<hThetaSpec->GetNbinsY();l++) {
+	      double r0=hThetaSpec->GetYaxis()->GetBinLowEdge(l+1);
+	      double r1=hThetaSpec->GetYaxis()->GetBinUpEdge(l+1);
+	      double z0=hThetaSpec->GetXaxis()->GetBinLowEdge(k+1);
+	      double z1=hThetaSpec->GetXaxis()->GetBinUpEdge(k+1); 
+	      double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
+	      // if |z| instead of z double the volume
+	      if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	      // if positive y hemisphere is used only -- half the volume
+	      if ( m_config.posYOnly ) vol *= 0.5; 
+	      double val;
+	      // Energy Spectra
+	      for(int m=0;m<hThetaSpec->GetNbinsZ();m++) { 
+		int mBin = hThetaSpec->GetBin(k+1,l+1,m+1); 
+		int vBinETh = m_config.nBinsr*nBinsThetalogE[hi]*m_config.nBinsdphi*m_config.nBinstheta*k+l*nBinsThetalogE[hi]*m_config.nBinsdphi*m_config.nBinstheta+m*m_config.nBinsdphi*m_config.nBinstheta+i*m_config.nBinsdphi+j;
+		val = (*(pValThetaSpec[hi]))[vBinETh];
+		hThetaSpec->SetBinContent(mBin,val/vol);
+	      }
+	    }
+	  }
+	  hThetaSpec->Write();
+	  hThetaSpec->Delete();
+	}
+      }
+    }
+    
+    // time dependent TID maps zoom
     TH3D * h_rz_tid_time       = new TH3D("rz_tid_time" ,"rz_tid_time"           ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogT,m_config.logTMin,m_config.logTMax);
-    TH3D * h_full_rz_tid_time  = new TH3D("full_rz_tid_time" ,"full_rz_tid_time" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogT,m_config.logTMin,m_config.logTMax);
     h_rz_tid_time     ->SetXTitle(xtitle);
-    h_full_rz_tid_time->SetXTitle(xtitle);
     h_rz_tid_time     ->SetYTitle("r [cm]");
-    h_full_rz_tid_time->SetYTitle("r [cm]");
     h_rz_tid_time     ->SetZTitle("log_{10}(t_{cut}/s)");
-    h_full_rz_tid_time->SetZTitle("log_{10}(t_{cut}/s)");
 
-    // element mass fraction maps
+    // element mass fraction maps zoom
     TH3D * h_rz_element       = new TH3D("rz_element" ,"rz_element"           ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.elemZMax-m_config.elemZMin+1,m_config.elemZMin-0.5,m_config.elemZMax+0.5);
-    TH3D * h_full_rz_element  = new TH3D("full_rz_element" ,"full_rz_element" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.elemZMax-m_config.elemZMin+1,m_config.elemZMin-0.5,m_config.elemZMax+0.5);
     h_rz_element     ->SetXTitle(xtitle);
-    h_full_rz_element->SetXTitle(xtitle);
     h_rz_element     ->SetYTitle("r [cm]");
-    h_full_rz_element->SetYTitle("r [cm]");
     h_rz_element     ->SetZTitle("Z");
-    h_full_rz_element->SetZTitle("Z");
-
-    TH2D * h_rz_vol  = 0;
-    TH2D * h_rz_norm = 0;
-    TH2D * h_full_rz_vol  = 0;
-    TH2D * h_full_rz_norm = 0;
-    TH3D * h_3d_vol  = 0;
-    TH3D * h_3d_norm = 0;
-    if (!m_config.material.empty()) {
-      // need volume fraction only if particular material is selected
-      //
-      // the maps for TID, NIEL and SEE need to be divided by the ratio of (vol/norm) in order to get
-      // the proper estimate per volume bin for the selected material. 
-      // This is *not* done in the tool directly and left to the user after having summed the histograms
-      // from many individual jobs.
-      // 
-      h_rz_vol  = new TH2D("rz_vol" ,"rz_vol" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-      h_rz_norm = new TH2D("rz_norm","rz_norm",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-      h_full_rz_vol  = new TH2D("full_rz_vol" ,"full_rz_vol" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-      h_full_rz_norm = new TH2D("full_rz_norm","full_rz_norm",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-      h_3d_vol  = new TH3D("h3d_vol" ,"h3d_vol" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-      h_3d_norm = new TH3D("h3d_norm","h3d_norm",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-
-      h_rz_vol  ->SetXTitle(xtitle);
-      h_rz_norm ->SetXTitle(xtitle);
-      h_rz_vol  ->SetYTitle("r [cm]");
-      h_rz_norm ->SetYTitle("r [cm]");
-      std::string hname("Volume fraction of ");
-      hname += m_config.material;
-      h_rz_vol  ->SetZTitle(hname.data());
-      h_rz_norm ->SetZTitle("Volume norm");
-
-      h_full_rz_vol  ->SetXTitle(xtitle);
-      h_full_rz_norm ->SetXTitle(xtitle);
-      h_full_rz_vol  ->SetYTitle("r [cm]");
-      h_full_rz_norm ->SetYTitle("r [cm]");
-      h_full_rz_vol  ->SetZTitle(hname.data());
-      h_full_rz_norm ->SetZTitle("Volume norm");
-
-      h_3d_vol  ->SetXTitle(xtitle);
-      h_3d_norm ->SetXTitle(xtitle);
-      h_3d_vol  ->SetYTitle("r [cm]");
-      h_3d_norm ->SetYTitle("r [cm]");
-      h_3d_vol  ->SetZTitle("#phi [#circ]");
-      h_3d_norm ->SetZTitle("#phi [#circ]");
-      h_3d_vol  ->SetTitle(hname.data());
-      h_3d_norm ->SetTitle("Volume norm");
-    }
 
     // normalize to volume element per bin
-    for(int i=0;i<h_rz_tid->GetNbinsX();i++) { 
-      for(int j=0;j<h_rz_tid->GetNbinsY();j++) { 
-	int iBin = h_rz_tid->GetBin(i+1,j+1); 
-	int vBin = m_config.nBinsr*i+j;
-	double r0=h_rz_tid->GetYaxis()->GetBinLowEdge(j+1);
-	double r1=h_rz_tid->GetYaxis()->GetBinUpEdge(j+1);
-	double z0=h_rz_tid->GetXaxis()->GetBinLowEdge(i+1);
-	double z1=h_rz_tid->GetXaxis()->GetBinUpEdge(i+1); 
+    for(int i=0;i<h_rz_tid_time->GetNbinsX();i++) { 
+      for(int j=0;j<h_rz_tid_time->GetNbinsY();j++) { 
+	double r0=h_rz_tid_time->GetYaxis()->GetBinLowEdge(j+1);
+	double r1=h_rz_tid_time->GetYaxis()->GetBinUpEdge(j+1);
+	double z0=h_rz_tid_time->GetXaxis()->GetBinLowEdge(i+1);
+	double z1=h_rz_tid_time->GetXaxis()->GetBinUpEdge(i+1); 
 	double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
 	// if |z| instead of z double the volume
 	if ( m_config.zMinFull >= 0 ) vol *= 2; 
 	// if positive y hemisphere is used only -- half the volume
 	if ( m_config.posYOnly ) vol *= 0.5; 
 	double val;
-	// TID
-	val =m_report.m_rz_tid[vBin];
-	h_rz_tid->SetBinContent(iBin,val/vol);
-	// EION
-	val =m_report.m_rz_eion[vBin];
-	h_rz_eion->SetBinContent(iBin,val/vol);
-	// NIEL
-	val =m_report.m_rz_niel[vBin];
-	h_rz_niel->SetBinContent(iBin,val/vol);
-	// SEE
-	val =m_report.m_rz_h20[vBin];
-	h_rz_h20->SetBinContent(iBin,val/vol);
-	// NEUT
-	val =m_report.m_rz_neut[vBin];
-	h_rz_neut->SetBinContent(iBin,val/vol);
-	// CHAD
-	val =m_report.m_rz_chad[vBin];
-	h_rz_chad->SetBinContent(iBin,val/vol);
-	// Neutron Energy Spectra
-	for(int k=0;k<h_rz_neut_spec->GetNbinsZ();k++) { 
-	  int kBin = h_rz_neut_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEn*i+j*m_config.nBinslogEn+k;
-	  val =m_report.m_rz_neut_spec[vBinE];
-	  h_rz_neut_spec->SetBinContent(kBin,val/vol);
-	}
-	// All other particle's Energy Spectra
-	for(int k=0;k<h_rz_gamm_spec->GetNbinsZ();k++) { 
-	  int kBin = h_rz_gamm_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEo*i+j*m_config.nBinslogEo+k;
-	  val =m_report.m_rz_gamm_spec[vBinE];
-	  h_rz_gamm_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_rz_elec_spec[vBinE];
-	  h_rz_elec_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_rz_muon_spec[vBinE];
-	  h_rz_muon_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_rz_pion_spec[vBinE];
-	  h_rz_pion_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_rz_prot_spec[vBinE];
-	  h_rz_prot_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_rz_rest_spec[vBinE];
-	  h_rz_rest_spec->SetBinContent(kBin,val/vol);
-	}
 	// Time dependent TID maps
 	for(int k=0;k<h_rz_tid_time->GetNbinsZ();k++) { 
 	  int kBin = h_rz_tid_time->GetBin(i+1,j+1,k+1); 
@@ -553,90 +612,39 @@ namespace G4UA{
 	  val =m_report.m_rz_element[vBinElem];
 	  h_rz_element->SetBinContent(kBin,val/vol);
 	}
-	if (!m_config.material.empty()) {
-	  // need volume fraction only if particular material is selected
-	  // VOL
-	  val =m_report.m_rz_vol[vBin];
-	  h_rz_vol->SetBinContent(iBin,val/vol);
-	  // NORM
-	  val =m_report.m_rz_norm[vBin];
-	  h_rz_norm->SetBinContent(iBin,val/vol);
-	}
       }
     }
-    h_rz_tid->Write();
-    h_rz_eion->Write();
-    h_rz_niel->Write();
-    h_rz_h20->Write();
-    h_rz_neut->Write();
-    h_rz_chad->Write();
-    h_rz_neut_spec->Write();
-    h_rz_gamm_spec->Write();
-    h_rz_elec_spec->Write();
-    h_rz_muon_spec->Write();
-    h_rz_pion_spec->Write();
-    h_rz_prot_spec->Write();
-    h_rz_rest_spec->Write();
+
     h_rz_tid_time->Write();
+    h_rz_tid_time->Delete();
     h_rz_element->Write();
+    h_rz_element->Delete();
     
+    // time dependent TID maps full
+    TH3D * h_full_rz_tid_time  = new TH3D("full_rz_tid_time" ,"full_rz_tid_time" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogT,m_config.logTMin,m_config.logTMax);
+    h_full_rz_tid_time->SetXTitle(xtitle);
+    h_full_rz_tid_time->SetYTitle("r [cm]");
+    h_full_rz_tid_time->SetZTitle("log_{10}(t_{cut}/s)");
+
+    // element mass fraction maps full
+    TH3D * h_full_rz_element  = new TH3D("full_rz_element" ,"full_rz_element" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.elemZMax-m_config.elemZMin+1,m_config.elemZMin-0.5,m_config.elemZMax+0.5);
+    h_full_rz_element->SetXTitle(xtitle);
+    h_full_rz_element->SetYTitle("r [cm]");
+    h_full_rz_element->SetZTitle("Z");
+
     // normalize to volume element per bin
-    for(int i=0;i<h_full_rz_tid->GetNbinsX();i++) { 
-      for(int j=0;j<h_full_rz_tid->GetNbinsY();j++) { 
-	int iBin = h_full_rz_tid->GetBin(i+1,j+1); 
-	int vBin = m_config.nBinsr*i+j;
-	double r0=h_full_rz_tid->GetYaxis()->GetBinLowEdge(j+1);
-	double r1=h_full_rz_tid->GetYaxis()->GetBinUpEdge(j+1);
-	double z0=h_full_rz_tid->GetXaxis()->GetBinLowEdge(i+1);
-	double z1=h_full_rz_tid->GetXaxis()->GetBinUpEdge(i+1); 
+    for(int i=0;i<h_full_rz_tid_time->GetNbinsX();i++) { 
+      for(int j=0;j<h_full_rz_tid_time->GetNbinsY();j++) { 
+	double r0=h_full_rz_tid_time->GetYaxis()->GetBinLowEdge(j+1);
+	double r1=h_full_rz_tid_time->GetYaxis()->GetBinUpEdge(j+1);
+	double z0=h_full_rz_tid_time->GetXaxis()->GetBinLowEdge(i+1);
+	double z1=h_full_rz_tid_time->GetXaxis()->GetBinUpEdge(i+1); 
 	double vol=(z1-z0)*M_PI*(r1*r1-r0*r0); 
 	// if |z| instead of z double the volume
 	if ( m_config.zMinFull >= 0 ) vol *= 2; 
 	// if positive y hemisphere is used only -- half the volume
 	if ( m_config.posYOnly ) vol *= 0.5; 
 	double val;
-	// TID
-	val =m_report.m_full_rz_tid[vBin];
-	h_full_rz_tid->SetBinContent(iBin,val/vol);
-	// EION
-	val =m_report.m_full_rz_eion[vBin];
-	h_full_rz_eion->SetBinContent(iBin,val/vol);
-	// NIEL
-	val =m_report.m_full_rz_niel[vBin];
-	h_full_rz_niel->SetBinContent(iBin,val/vol);
-	// SEE
-	val =m_report.m_full_rz_h20[vBin];
-	h_full_rz_h20->SetBinContent(iBin,val/vol);
-	// NEUT
-	val =m_report.m_full_rz_neut[vBin];
-	h_full_rz_neut->SetBinContent(iBin,val/vol);
-	// CHAD
-	val =m_report.m_full_rz_chad[vBin];
-	h_full_rz_chad->SetBinContent(iBin,val/vol);
-	// Neutron Energy Spectra
-	for(int k=0;k<h_full_rz_neut_spec->GetNbinsZ();k++) { 
-	  int kBin = h_full_rz_neut_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEn*i+j*m_config.nBinslogEn+k;
-	  val =m_report.m_full_rz_neut_spec[vBinE];
-	  h_full_rz_neut_spec->SetBinContent(kBin,val/vol);
-	}
-	// All other particle's Energy Spectra
-	for(int k=0;k<h_full_rz_gamm_spec->GetNbinsZ();k++) { 
-	  int kBin = h_full_rz_gamm_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEo*i+j*m_config.nBinslogEo+k;
-	  val =m_report.m_full_rz_gamm_spec[vBinE];
-	  h_full_rz_gamm_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_full_rz_elec_spec[vBinE];
-	  h_full_rz_elec_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_full_rz_muon_spec[vBinE];
-	  h_full_rz_muon_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_full_rz_pion_spec[vBinE];
-	  h_full_rz_pion_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_full_rz_prot_spec[vBinE];
-	  h_full_rz_prot_spec->SetBinContent(kBin,val/vol);
-	  val =m_report.m_full_rz_rest_spec[vBinE];
-	  h_full_rz_rest_spec->SetBinContent(kBin,val/vol);
-	}
 	// Time dependent TID maps
 	for(int k=0;k<h_full_rz_tid_time->GetNbinsZ();k++) { 
 	  int kBin = h_full_rz_tid_time->GetBin(i+1,j+1,k+1); 
@@ -651,103 +659,12 @@ namespace G4UA{
 	  val =m_report.m_full_rz_element[vBinElem];
 	  h_full_rz_element->SetBinContent(kBin,val/vol);
 	}
-	if (!m_config.material.empty()) {
-	  // need volume fraction only if particular material is selected
-	  // VOL
-	  val =m_report.m_full_rz_vol[vBin];
-	  h_full_rz_vol->SetBinContent(iBin,val/vol);
-	  // NORM
-	  val =m_report.m_full_rz_norm[vBin];
-	  h_full_rz_norm->SetBinContent(iBin,val/vol);
-	}
       }
     }
-    h_full_rz_tid->Write();
-    h_full_rz_eion->Write();
-    h_full_rz_niel->Write();
-    h_full_rz_h20->Write();
-    h_full_rz_neut->Write();
-    h_full_rz_chad->Write();
-    h_full_rz_neut_spec->Write();
-    h_full_rz_gamm_spec->Write();
-    h_full_rz_elec_spec->Write();
-    h_full_rz_muon_spec->Write();
-    h_full_rz_pion_spec->Write();
-    h_full_rz_prot_spec->Write();
-    h_full_rz_rest_spec->Write();
     h_full_rz_tid_time->Write();
+    h_full_rz_tid_time->Delete();
     h_full_rz_element->Write();
-
-    // normalize to volume element per bin
-    for(int i=0;i<h_3d_tid->GetNbinsX();i++) { /* |z| */
-      for(int j=0;j<h_3d_tid->GetNbinsY();j++) { /* r */
-	for(int k=0;k<h_3d_tid->GetNbinsZ();k++) { /* phi */
-	  int vBin = m_config.nBinsr3d*m_config.nBinsphi3d*i+m_config.nBinsphi3d*j+k;
-	  int iBin = h_3d_tid->GetBin(i+1,j+1,k+1); 
-	  double phi0=h_3d_tid->GetZaxis()->GetBinLowEdge(k+1);
-	  double phi1=h_3d_tid->GetZaxis()->GetBinUpEdge(k+1);
-	  double r0=h_3d_tid->GetYaxis()->GetBinLowEdge(j+1);
-	  double r1=h_3d_tid->GetYaxis()->GetBinUpEdge(j+1);
-	  double z0=h_3d_tid->GetXaxis()->GetBinLowEdge(i+1);
-	  double z1=h_3d_tid->GetXaxis()->GetBinUpEdge(i+1); 
-	  double vol=(z1-z0)*M_PI*(r1*r1-r0*r0)*(phi1-phi0)/360.; 
-	  // if |z| instead of z double the volume
-	  if ( m_config.zMinFull >= 0 ) vol *= 2; 
-	  // assume that phi-range corresponds to full 360 degrees in case 
-	  // lower phi boundary is 0 - i.e. all phi-segments mapped to first
-	  if ( m_config.phiMinZoom == 0 ) {
-	    vol *= 360./m_config.phiMaxZoom;
-	    // if positive y hemisphere is used only -- half the volume
-	    if ( m_config.posYOnly ) 
-	      vol *= 0.5; 
-	  }
-	  double val;
-	  // TID
-	  val =m_report.m_3d_tid[vBin];
-	  h_3d_tid->SetBinContent(iBin,val/vol);
-	  // EION
-	  val =m_report.m_3d_eion[vBin];
-	  h_3d_eion->SetBinContent(iBin,val/vol);
-	  // NIEL
-	  val =m_report.m_3d_niel[vBin];
-	  h_3d_niel->SetBinContent(iBin,val/vol);
-	  // SEE
-	  val =m_report.m_3d_h20[vBin];
-	  h_3d_h20->SetBinContent(iBin,val/vol);
-	  // NEUT
-	  val =m_report.m_3d_neut[vBin];
-	  h_3d_neut->SetBinContent(iBin,val/vol);
-	  // CHAD
-	  val =m_report.m_3d_chad[vBin];
-	  h_3d_chad->SetBinContent(iBin,val/vol);
-	  if (!m_config.material.empty()) {
-	    // need volume fraction only if particular material is selected
-	    // VOL
-	    val =m_report.m_3d_vol[vBin];
-	    h_3d_vol->SetBinContent(iBin,val/vol);
-	    // NORM
-	    val =m_report.m_3d_norm[vBin];
-	    h_3d_norm->SetBinContent(iBin,val/vol);
-	  }
-	}
-      }
-    }
-    h_3d_tid->Write();
-    h_3d_eion->Write();
-    h_3d_niel->Write();
-    h_3d_h20->Write();
-    h_3d_neut->Write();
-    h_3d_chad->Write();
-
-    if (!m_config.material.empty()) {
-      // need volume fraction only if particular material is selected
-      h_rz_vol->Write();
-      h_rz_norm->Write();
-      h_full_rz_vol->Write();
-      h_full_rz_norm->Write();
-      h_3d_vol->Write();
-      h_3d_norm->Write();
-    }
+    h_full_rz_element->Delete();
 
     f->Close();
 
diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py
index 5027d6d8f5adc68efd31271ccb13579804b98033..96ad70aa64332240db57896075029edac35268e0 100644
--- a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py
+++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 """
 Tools configurations for ISF
@@ -306,6 +306,11 @@ def getKernel_G4FastCalo(name="ISF_Kernel_G4FastCalo", **kwargs):
     kwargs.setdefault("IDSimulationSelectors"      , [ 'ISF_DefaultAFIIGeant4Selector' ]            )
     kwargs.setdefault("CaloSimulationSelectors"    , [ 'ISF_MuonAFIIGeant4Selector',
                                                        'ISF_EtaGreater5ParticleKillerSimSelector',
+                                                       'ISF_PionG4FastCaloGeant4Selector',
+                                                       'ISF_ProtonG4FastCaloGeant4Selector',
+                                                       'ISF_NeutronG4FastCaloGeant4Selector',
+                                                       'ISF_ChargedKaonG4FastCaloGeant4Selector',
+                                                       'ISF_KLongG4FastCaloGeant4Selector',
                                                        'ISF_DefaultFastCaloSimV2Selector' ] )
     kwargs.setdefault("MSSimulationSelectors"      , [ 'ISF_DefaultAFIIGeant4Selector' ]            )
     kwargs.setdefault("CavernSimulationSelectors"  , [ 'ISF_DefaultParticleKillerSelector' ]        )
@@ -392,9 +397,9 @@ def getKernel_ATLFASTIIF(name="ISF_Kernel_ATLFASTIIF", **kwargs):
 def getKernel_ATLFASTIIF_G4MS(name="ISF_Kernel_ATLFASTIIF_G4MS", **kwargs):
     kwargs.setdefault("BeamPipeSimulationSelectors" , [ 'ISF_DefaultParticleKillerSelector' ]       )
     kwargs.setdefault("IDSimulationSelectors"       , [ 'ISF_DefaultFatrasSelector' ]               )
-    kwargs.setdefault("CaloSimulationSelectors"     , [ 'ISF_MuonAFIIGeant4Selector',
+    kwargs.setdefault("CaloSimulationSelectors",      [ 'ISF_MuonFatrasSelector',
                                                         'ISF_EtaGreater5ParticleKillerSimSelector',
-                                                        'ISF_DefaultLegacyAFIIFastCaloSimSelector' ])
+                                                        'ISF_DefaultFastCaloSimSelector'])
     kwargs.setdefault("MSSimulationSelectors"       , [ 'ISF_DefaultAFIIGeant4Selector' ]           )
     kwargs.setdefault("CavernSimulationSelectors"   , [ 'ISF_DefaultParticleKillerSelector' ]       )
     # set the simFlags accordingly (TODO: is this even needed?)
diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h
index c1655f550908fbdbaa7f93bfe442b7cfbbd6c123..f020097eb5dff69f0e7af1e8162bfe2d1660e65d 100644
--- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h
+++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -39,6 +39,7 @@ namespace ISF {
       float    m_cut_maxMomEta; //!< maximum pseudorapidity of particle momentum
       double   m_cut_minMom2;   //!< minimum squarde particle momentum magnitude
       double   m_cut_maxMom2;   //!< maximum squared particle momentum magnitude 
+      double   m_cut_maxEkin;   //!< maximum particle kinetic energy 
       float    m_cut_charge;    //!< particle charge
       int      m_cut_pdg;       //!< particle PDG code
   };
diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc
index 708d0f933775cc99477e222ca354f20254152093..f85f32e1b4f1e9ecc170e5ab6442fa06bfd8e49c 100644
--- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc
+++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -17,6 +17,7 @@ ISF::KinematicParticleCuts::KinematicParticleCuts() :
   m_cut_maxMomEta( 99.f),
   m_cut_minMom2(-1.),
   m_cut_maxMom2(-1.),
+  m_cut_maxEkin(-1.),
   m_cut_charge(ISF_UNDEF_CHARGE),
   m_cut_pdg(0)
 {
@@ -33,10 +34,12 @@ bool  ISF::KinematicParticleCuts::pass(const ISFParticle& particle) const {
   double mom2    = hepMom.mag2();
   double momEta  = hepMom.eta();
 
+
   // tolerance on the charge
   const float chargeTolerance = 1e-4f;
 
   bool pass = true;
+ 
   pass &= m_cut_pdg ? (abs(particle.pdgCode()) == m_cut_pdg) : true;
   pass &= (m_cut_charge < (ISF_UNDEF_CHARGE+1.)) || fabs(particle.charge()-m_cut_charge)<chargeTolerance;
   pass &= (m_cut_minMom2 < 0.) || (mom2 >= m_cut_minMom2);
diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx
index 4c8ce918e397a2d830f73c294e338df05be225e3..1bcc15e0225b3f4a37023bc06bde7592db6e2cc8 100644
--- a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx
+++ b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx
@@ -45,6 +45,7 @@
 // CLHEP includes
 #include "CLHEP/Geometry/Point3D.h"
 #include "CLHEP/Geometry/Vector3D.h"
+#include "CLHEP/Units/SystemOfUnits.h"
 // HepPDT
 #include "HepPDT/ParticleID.hh"
 #include "HepPDT/DecayData.hh"
@@ -241,6 +242,18 @@ ISF::InputConverter::convertParticle(HepMC::GenParticle* genPartPtr, EBC_EVCOLL
   const auto& pMomentum(genPart.momentum());
   const Amg::Vector3D mom(pMomentum.px(), pMomentum.py(), pMomentum.pz());
   const double pMass = this->getParticleMass(genPart);
+
+  double e=pMomentum.e();
+  if(e>1) { //only test for >1 MeV in momentum
+    double px=pMomentum.px();
+    double py=pMomentum.py();
+    double pz=pMomentum.pz();
+    double teste=sqrt(px*px + py*py + pz*pz + pMass*pMass);
+    if(std::abs(e-teste)/e>0.01) {
+      ATH_MSG_WARNING("Difference in energy for: " << genPart<<" Morg="<<pMomentum.m()<<" Mmod="<<pMass<<" Eorg="<<e<<" Emod="<<teste);
+    }
+  }  
+
   const int pPdgId = genPart.pdg_id();
   const double charge = HepPDT::ParticleID(pPdgId).charge();
   const double pTime = pVertex->position().t() / Gaudi::Units::c_light;
@@ -551,13 +564,54 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(const ISF::ISFParti
         }
         g4particle->SetDaughter( daughterG4Particle );
       }
-     } // particle had an end vertex
-    //Code copied from TruthHepMCEventConverter::TransformHepMCParticle
+    } // particle had an end vertex
+    
+    double px,py,pz;
+    const double pmass = g4particle->GetMass();
     CLHEP::Hep3Vector gpv = g4particle->GetMomentum();
-    double pmass = g4particle->GetMass();
-    const double pe = sqrt(gpv.mag2() + pmass*pmass);  // this does only change for boosts, etc.
-    genpart->set_momentum(CLHEP::HepLorentzVector(gpv.x(),gpv.y(),gpv.z(),pe));
-    //End of code copied from TruthHepMCEventConverter::TransformHepMCParticle
+    double g4px=g4particle->GetMomentum().x();
+    double g4py=g4particle->GetMomentum().y();
+    double g4pz=g4particle->GetMomentum().z();
+    if(useHepMC) {
+      //Code adapted from TruthHepMCEventConverter::TransformHepMCParticle
+      px=g4px;
+      py=g4py;
+      pz=g4pz;
+    } else {
+      //Take mass from g4particle, put keep momentum as in genpart
+      px=genpart->momentum().px();
+      py=genpart->momentum().py();
+      pz=genpart->momentum().pz();
+      //Now a dirty hack to keep backward compatibility in the truth:
+      //When running AtlasG4 or FullG4 between 21.0.41 and 21.0.111, the genpart 3-momentum and mass was reset to the values from the g4particle 
+      //together with the mass of the g4particle after the 1st initialization of the g4particle from the genevent. This is done for a consistent mass
+      //value in the truth record compared to the used g4 mass. Since g4particles don't store the 3-momentum directly, but rather a
+      //unit direction vector, the mass and the kinetic energy, this reduces the numeric accuracy.
+      //For backward compatibility, if all 3-momentum components agree to the g4particle momentum within 1 keV, we keep
+      //this old method. This comparison is needed, since in ISF this code could be rerun after the ID or CALO simulation, where
+      //real energy was lost in previous detectors and hence genpart should NOT be changed to some g4particle values!
+      //TODO: find a way to implement this in a backward compatible way in ISF::InputConverter::convertParticle(HepMC::GenParticle* genPartPtr, int bcid)
+      if(std::abs(px-g4px)<CLHEP::keV && std::abs(py-g4py)<CLHEP::keV && std::abs(pz-g4pz)<CLHEP::keV) {
+        px=g4px;
+        py=g4py;
+        pz=g4pz;
+      }
+    }
+    const double mag2=px*px + py*py + pz*pz;
+    const double pe = std::sqrt(mag2 + pmass*pmass);  // this does only change for boosts, etc.
+    
+    double originalEnergy=genpart->momentum().e();
+    if(originalEnergy>0.01) { //only test for >1 MeV in momentum
+      if((originalEnergy-pe)/originalEnergy>0.01) {
+        double genpx=genpart->momentum().px();
+        double genpy=genpart->momentum().py();
+        double genpz=genpart->momentum().pz();
+        double genp=sqrt(genpx*genpx + genpy*genpy + genpz*genpz);
+        ATH_MSG_WARNING("Truth change in energy for: " << genpart<<" Morg="<<genpart->momentum().m()<<" Mmod="<<pmass<<" Eorg="<<originalEnergy<<" Emod="<<pe<<" porg="<<genp<<" pmod="<<gpv.mag());
+      }
+    }  
+
+    genpart->set_momentum(CLHEP::HepLorentzVector(px,py,pz,pe));
   } // Truth was detected
 
   ATH_MSG_VERBOSE("PrimaryParticleInformation:");
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx
index a4a241619301a932489ada786996a82d6f88a80e..d73451fc8184828c77a1b96e7de5f471608bcf7e 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx
@@ -64,7 +64,7 @@ unsigned int TFCSEnergyAndHitGAN::get_nr_of_init(unsigned int bin) const
 
 void TFCSEnergyAndHitGAN::set_nr_of_init(unsigned int bin,unsigned int ninit)
 {
-  if(bin<=m_bin_ninit.size()) {
+  if(bin>=m_bin_ninit.size()) {
     m_bin_ninit.resize(bin+1,0);
     m_bin_ninit.shrink_to_fit();
   }
@@ -164,8 +164,13 @@ void TFCSEnergyAndHitGAN::GetBinning(int pid,int etaMid,std::string FastCaloGANI
                      
                      std::string name = "hist_pid_" + std::to_string(nodePid) + "_etaSliceNumber_" + std::to_string(EtaMaxList.size()) + "_layer_" + std::to_string(layer);
                      int xBins = edges.size()-1;
-                     if (xBins == 0) xBins = 1; //remove warning
+                     if (xBins == 0) {
+                       xBins = 1; //remove warning
+                       edges.push_back(0);
+                       edges.push_back(1);
+                     }  
                      binsInLayer[layer] = TH2D(name.c_str(), name.c_str(), xBins, &edges[0], binsInAlpha, -TMath::Pi(), TMath::Pi());
+                     binsInLayer[layer].SetDirectory(0);
                   }
                }
                
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx
index e9b0da415f84c220122fd9de681caa73929fde0f..84d2c5af687203657dce7dcf49cddb6ffd1ebedb 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyRenormalization.cxx
@@ -21,7 +21,7 @@ TFCSEnergyRenormalization::~TFCSEnergyRenormalization()
 
 FCSReturnCode TFCSEnergyRenormalization::simulate(TFCSSimulationState& simulstate,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) const
 {
-  std::vector< float > energies(CaloCell_ID_FCS::MaxSample,0);
+  std::vector< double > energies(CaloCell_ID_FCS::MaxSample,0);
 
   //Loop over all cells and sum up energies
   for(const auto& iter : simulstate.cells()) {
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
index 7da03c6ebf00c084a41a5d9c89190c04b1223fc6..17398d1204ebac51913aa0ed138d898d969ebb33 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 import argparse
 import logging
@@ -26,3 +26,6 @@ def addFCS_NtupArgs(parser):
     parser.add_argument('--saveAllBranches',
                         type=argFactory(argBool),
                         help='Flag to turn on extra branches for Hits and G4hits', group='FCS_Ntup_tf')
+    parser.add_argument('--NTruthParticles',
+                        type=argFactory(argInt),
+                        help='Option to select number of truth particles copied to ntuples', group='FCS_Ntup_tf')
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py
index 15f51e0ca815ef0887674b22a8ab900d23bff7a5..09c68c74ec2f61a9978c53f96d73597f7f4dbb87 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/scripts/FCS_Ntup_tf.py
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 """
 Run HITS file and produce histograms.
@@ -40,7 +40,7 @@ def getTransform():
     executorSet.add(athenaExecutor(name = 'FCS_Ntup',
                                    skeletonFile = 'ISF_FastCaloSimParametrization/skeleton.ESDtoNTUP_FCS.py',
                                    inData = ['ESD'], outData = ['NTUP_FCS'],))
-    trf = transform(executor = executorSet, description = 'FastCaloSim V2 Parametrization ntuple transform. Inputs must be ESD. Outputs must bentuple files.')
+    trf = transform(executor = executorSet, description = 'FastCaloSim V2 Parametrization ntuple transform. Inputs must be ESD. Outputs must be ntuple files.')
     addAthenaArguments(trf.parser)
     addFCS_NtupArgs(trf.parser)
     return trf
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
index 4d8a10fa16eddbe3db8c3a9fb0d8c2e925458d7b..e8b51bf31baf60cd5b5319c29b79ba3722f6231f 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
@@ -78,7 +78,7 @@ ServiceMgr += sctSiPropertiesSvc
 ISF_HitAnalysis.CaloBoundaryR = 1148.0
 ISF_HitAnalysis.CaloBoundaryZ = 3550.0 #before: 3475.0
 ISF_HitAnalysis.CaloMargin=100 #=10cm
-ISF_HitAnalysis.NTruthParticles = 1 # Copy only one truth particle to the ntuples for now
+ISF_HitAnalysis.NTruthParticles = NTruthParticles 
 ISF_HitAnalysis.SaveAllBranches = saveAllBranches
 ISF_HitAnalysis.DoAllCells = False
 ISF_HitAnalysis.DoLayers = True
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
index 0edf23c1d8c572a90a68cca6c521d9fee367e1cd..ba648ab2c18aa8111b0d8caa2ef4367a3c21f497 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
@@ -59,6 +59,12 @@ if hasattr(runArgs, "saveAllBranches"):
 else:
     saveAllBranches = False
 
+## Sets the number of truth particles copied to ntuples
+if hasattr(runArgs, "NTruthParticles"):
+    NTruthParticles = runArgs.NTruthParticles;
+else:
+    NTruthParticles = 1
+
 #==============================================================
 # Job Configuration parameters:
 #==============================================================
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
index e4c330305ba2b354053ee98885dcf9c6e3f4fdf4..81921b682fbc94ec2600fd89baaa7f481f5b0aa8 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "ISF_FastCaloSimParametrization/ISF_HitAnalysis.h"
@@ -1131,7 +1131,7 @@ StatusCode ISF_HitAnalysis::execute()
 
  //Retrieve and save MuonEntryLayer information 
  const TrackRecordCollection *MuonEntry = nullptr;
- ATH_CHECK(evtStore()->retrieve(MuonEntry, "MuonEntryLayer"));
+ sc = evtStore()->retrieve(MuonEntry, "MuonEntryLayer");
  if (sc.isFailure())
  {
  ATH_MSG_WARNING( "Couldn't read MuonEntry from StoreGate");
diff --git a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt
index 60aeb15e1223497a001b6b06b62c1482bb4dc89d..65e510ab0587fa148773daa02aaddcedf454d21a 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt
+++ b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt
@@ -16,14 +16,15 @@ atlas_depends_on_subdirs( PUBLIC
 
 # External dependencies:
 find_package( HepMC )
+find_package( HepPDT )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
 # Component(s) in the package:
 atlas_add_component( ISF_SimulationSelectors
                      src/*.cxx
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel BarcodeServicesLib ISF_Event ISF_Interfaces )
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} ${HEPPDT_LIBRARIES} GaudiKernel BarcodeServicesLib ISF_Event ISF_Interfaces )
 
 # Install files from the package:
 atlas_install_headers( ISF_SimulationSelectors )
diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py
index ebcdc778e23d88ffbb393f34a05afdc143460fa0..89c11f060316e778bd3c862ed38c0ee4b3f3ccfa 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py
+++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 ISF_SimulationSelectors configurations for ISF
 Elmar Ritsch, 04/02/2013
@@ -133,7 +133,7 @@ def getNeutralGeant4Selector(name="ISF_NeutralGeant4Selector", **kwargs):
 
 def getProtonAFIIGeant4Selector(name="ISF_ProtonAFIIGeant4Selector", **kwargs):
     kwargs.setdefault('MaxMom'          , 750)
-    kwargs.setdefault('ParticlePDG'     , 2112)
+    kwargs.setdefault('ParticlePDG'     , 2212)
     kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
     return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
 
@@ -147,6 +147,36 @@ def getPionAFIIGeant4Selector(name="ISF_PionAFIIGeant4Selector", **kwargs):
     kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
     return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
 
+def getPionG4FastCaloGeant4Selector(name="ISF_PionG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 200)
+    kwargs.setdefault('ParticlePDG'     , 211)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getProtonG4FastCaloGeant4Selector(name="ISF_ProtonG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 2212)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getNeutronG4FastCaloGeant4Selector(name="ISF_NeutronG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 2112)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getChargedKaonG4FastCaloGeant4Selector(name="ISF_ChargedKaonG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 321)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getKLongG4FastCaloGeant4Selector(name="ISF_KLongG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 130)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
 def getPionAFII_QS_Geant4Selector(name="ISF_PionAFII_QS_Geant4Selector", **kwargs):
     kwargs.setdefault('Simulator'       , 'ISF_AFII_QS_Geant4SimSvc')
     return getPionAFIIGeant4Selector(name, **kwargs)
diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py
index 441640d7e994ab7d5c837ac75cda608389542337..27508de3ac1ed9b6e093fd3967d2364052c8b768 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py
+++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 Configuration database for ISF_SimulationSelectors
 Elmar Ritsch, 10/11/2014
@@ -12,6 +12,11 @@ addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getMuonGeant4Sele
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFIIGeant4Selector"             , "ISF_ProtonAFIIGeant4Selector"            )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFII_QS_Geant4Selector"         , "ISF_ProtonAFII_QS_Geant4Selector"        )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFIIGeant4Selector"               , "ISF_PionAFIIGeant4Selector"              )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionG4FastCaloGeant4Selector"         , "ISF_PionG4FastCaloGeant4Selector"        )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonG4FastCaloGeant4Selector"       , "ISF_ProtonG4FastCaloGeant4Selector"      )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getNeutronG4FastCaloGeant4Selector"      , "ISF_NeutronG4FastCaloGeant4Selector"     )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonG4FastCaloGeant4Selector"  , "ISF_ChargedKaonG4FastCaloGeant4Selector" ) 
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getKLongG4FastCaloGeant4Selector"        , "ISF_KLongG4FastCaloGeant4Selector"       )      
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFII_QS_Geant4Selector"           , "ISF_PionAFII_QS_Geant4Selector"          )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFIIGeant4Selector"        , "ISF_ChargedKaonAFIIGeant4Selector"       )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFII_QS_Geant4Selector"    , "ISF_ChargedKaonAFII_QS_Geant4Selector"   )
diff --git a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx
index 74be16e56c25f68b3504453b6e940b2b8241e11a..8baec8e2c29669233c5f832fc01e768ea49db45b 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx
+++ b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -9,17 +9,23 @@
 // class include
 #include "KinematicSimSelector.h"
 
+ 
+#include "HepPDT/ParticleDataTable.hh"
+#include "HepPDT/ParticleData.hh"
+
 /** Constructor **/
 ISF::KinematicSimSelector::KinematicSimSelector(const std::string& t, const std::string& n, const IInterface* p)
   : BaseSimulationSelector(t,n,p)
   , KinematicParticleCuts()
-{
+  , m_partPropSvc("PartPropSvc", name())
+{  
   declareProperty("MinPosEta",            m_cut_minPosEta  , "Minimum Position Pseudorapidity" );
   declareProperty("MaxPosEta",            m_cut_maxPosEta  , "Maximum Position Pseudorapidity" );
   declareProperty("MinMomEta",            m_cut_minMomEta  , "Minimum Momentum Pseudorapidity" );
   declareProperty("MaxMomEta",            m_cut_maxMomEta  , "Maximum Momentum Pseudorapidity" );
   declareProperty("MinMom",               m_cut_minMom2    , "Minimum Particle Momentum"       );
-  declareProperty("MaxMom",               m_cut_maxMom2    , "Maximum Particle Moemntum"       );
+  declareProperty("MaxMom",               m_cut_maxMom2    , "Maximum Particle Momentum"       );
+  declareProperty("MaxEkin",              m_cut_maxEkin    , "Maximum Particle Kinetic Energy"  );
   declareProperty("Charge",               m_cut_charge     , "Particle Charge"                 );
   declareProperty("ParticlePDG",          m_cut_pdg        , "Particle PDG Code"               );
 }
@@ -32,12 +38,33 @@ ISF::KinematicSimSelector::~KinematicSimSelector()
 // Athena algtool's Hooks
 StatusCode  ISF::KinematicSimSelector::initialize()
 {
-  ATH_MSG_VERBOSE("Initializing ...");
+   ATH_MSG_VERBOSE("Initializing ...");
+
+   ATH_CHECK(m_partPropSvc.retrieve()); 
+
+   HepPDT::ParticleDataTable* m_particleDataTable; 
+   m_particleDataTable = (HepPDT::ParticleDataTable*) m_partPropSvc->PDT();
+
+   if(m_particleDataTable == 0) 
+   {
+    ATH_MSG_ERROR("PDG table not found");
+    return StatusCode::FAILURE;
+    }
+
+  const HepPDT::ParticleData* data = m_particleDataTable->particle(HepPDT::ParticleID(abs(m_cut_pdg))); 
+
+  double mass = 0; 
+  if(data) mass = data->mass().value(); 
 
   // compute and store the square of the momentum cuts (faster comparisons)
   if ( !(m_cut_minMom2<0.)) m_cut_minMom2 *= m_cut_minMom2;
   if ( !(m_cut_maxMom2<0.)) m_cut_maxMom2 *= m_cut_maxMom2;
 
+  // if use kinetic energy 
+  if(!(m_cut_maxEkin < 0.)) m_cut_maxMom2 = m_cut_maxEkin * (m_cut_maxEkin + 2 * mass); 
+
+
+
   return StatusCode::SUCCESS;
 }
 
diff --git a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h
index 503a13b80af04f9d3bcd6cbe7aec279505e2c30c..58f80d6871c6fdaddfe0a085e9c6fd570f91178b 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h
+++ b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -9,10 +9,13 @@
 #ifndef ISF_TOOLS_KINEMATICSIMSELECTOR_H
 #define ISF_TOOLS_KINEMATICSIMSELECTOR_H 1
 
+#include "GaudiKernel/IPartPropSvc.h"
+
 // ISF includes
 #include "ISF_Event/KinematicParticleCuts.h"
 #include "BaseSimulationSelector.h"
 
+
 namespace ISF
 {
 
@@ -25,6 +28,8 @@ namespace ISF
   class KinematicSimSelector final : public BaseSimulationSelector, public KinematicParticleCuts
   {
 
+  ServiceHandle<IPartPropSvc> m_partPropSvc; 
+
   public:
     /** Constructor with parameters */
     KinematicSimSelector( const std::string& t, const std::string& n, const IInterface* p );
diff --git a/Simulation/ISF/ISF_Validation/test/test_AtlasG4_FullG4_comparison.sh b/Simulation/ISF/ISF_Validation/test/test_AtlasG4_FullG4_comparison.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8aa32cb96fbc3a8cbd8317a908443796abf8f4fe
--- /dev/null
+++ b/Simulation/ISF/ISF_Validation/test/test_AtlasG4_FullG4_comparison.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# art-description: MC16-style simulation comparison of FullG4 and AtlasG4
+# art-type: build
+# art-include: 21.0/Athena
+# art-include: 21.0/AthSimulation
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-include: master/AthSimulation
+
+# MC16 setup
+# ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14
+
+export TRF_ECHO=1
+Sim_tf.py \
+--conditionsTag 'default:OFLCOND-MC16-SDR-14' \
+--physicsList 'FTFP_BERT_ATL' \
+--truthStrategy 'MC15aPlus' \
+--simulator 'FullG4' \
+--postInclude 'default:PyJobTransforms/UseFrontier.py' \
+--preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py' \
+--preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' \
+--DataRunNumber '284500' \
+--geometryVersion 'default:ATLAS-R2-2016-01-00-01' \
+--inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1" \
+--outputHITSFile "HITS.FullG4.pool.root" \
+--maxEvents 2 \
+--imf False
+
+rc1=$?
+echo  "art-result: $rc1 simulation FullG4"
+
+AtlasG4_tf.py \
+--conditionsTag 'default:OFLCOND-MC16-SDR-14' \
+--physicsList 'FTFP_BERT_ATL' \
+--truthStrategy 'MC15aPlus' \
+--postInclude 'default:PyJobTransforms/UseFrontier.py' \
+--preInclude 'sim:SimulationJobOptions/preInclude.BeamPipeKill.py' \
+--preExec 'sim:simFlags.TightMuonStepping=True' \
+--postExec 'sim:topSeq.BeamEffectsAlg.ISFRun=True' \
+--DataRunNumber '284500' \
+--geometryVersion 'default:ATLAS-R2-2016-01-00-01' \
+--inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1" \
+--outputHITSFile "HITS.AtlasG4.pool.root" \
+--maxEvents 2 \
+--imf False
+
+rc2=$?
+echo  "art-result: $rc2 simulation AtlasG4"
+
+rc3=-999
+if [ $rc1 -eq 0 ]
+then
+  if [ $rc2 -eq 0 ]
+  then
+    # Compare the merged outputs
+    acmd.py diff-root HITS.FullG4.pool.root HITS.AtlasG4.pool.root --error-mode resilient --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings TrackRecordCollection_p2_CaloEntryLayer TrackRecordCollection_p2_MuonEntryLayer TrackRecordCollection_p2_MuonExitLayer RecoTimingObj_p1_RAWtoESD_mems RecoTimingObj_p1_RAWtoESD_timings RAWtoESD_mems RAWtoESD_timings ESDtoAOD_mems ESDtoAOD_timings HITStoRDO_timings RAWtoALL_mems RAWtoALL_timings RecoTimingObj_p1_RAWtoALL_mems RecoTimingObj_p1_RAWtoALL_timings RecoTimingObj_p1_EVNTtoHITS_timings EVNTtoHITS_timings RecoTimingObj_p1_Bkg_HITStoRDO_timings index_ref
+    rc3=$?
+  fi
+fi
+echo "art-result: $rc3 comparison"
+
diff --git a/Simulation/ISF/ISF_Validation/test/test_Sim_G4FastCalo_ttbar.sh b/Simulation/ISF/ISF_Validation/test/test_Sim_G4FastCalo_ttbar.sh
index 12c633f2d42fe24ff6ee10d803c570b4d44277d1..f6fd2cb5ad8c1d914858b18c8ddb97ef04748236 100755
--- a/Simulation/ISF/ISF_Validation/test/test_Sim_G4FastCalo_ttbar.sh
+++ b/Simulation/ISF/ISF_Validation/test/test_Sim_G4FastCalo_ttbar.sh
@@ -21,7 +21,8 @@ Sim_tf.py \
 --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ISF_Validation/mc12_valid.110401.PowhegPythia_P2012_ttbar_nonallhad.evgen.EVNT.e3099.01517252._000001.pool.root.1" \
 --outputHITSFile "test.HITS.pool.root" \
 --maxEvents 250 \
---imf False
+--imf False \
+--preExec 'from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags;ISF_FastCaloSimFlags.ParamsInputFilename="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/FastCaloSim/MC16/TFCSparam_dev_weightedhits_v12.root"'
 
 echo  "art-result: $? simulation"
 
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2010_ttbar_no_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2010_ttbar_no_pileup.sh
index d2a14ab2982f421099a476f8df0978cde2700e66..24fffe230fb4da8fab77a20e808e34fbc75150b3 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2010_ttbar_no_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2010_ttbar_no_pileup.sh
@@ -25,7 +25,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -36,5 +36,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2011_ttbar_no_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2011_ttbar_no_pileup.sh
index d67deaebe60e7b93a8acab0ae120c0a00e40a307..7bba7c90bd7a8ab8face04dd84cb82442fc0c0bb 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2011_ttbar_no_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2011_ttbar_no_pileup.sh
@@ -25,7 +25,7 @@ art-diff.py ./$DigiOutFileName   /cvmfs/atlas-nightlies.cern.ch/repo/data/data-a
 echo  "art-result: $? diff-pool"
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -34,5 +34,5 @@ echo "art-result: $? checkFile"
 
 ArtPackage=$1
 ArtJobName=$2
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2012_ttbar_no_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2012_ttbar_no_pileup.sh
index ad91d2ef018dd9e352976d3656da729266848157..59807ef8518b39d8fbe4b7a40a404b8ff9fe224a 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2012_ttbar_no_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2012_ttbar_no_pileup.sh
@@ -26,7 +26,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -37,5 +37,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_cosmics.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_cosmics.sh
index 9ccc6b86bdca44edd608954ba307f8c5738fd2ab..05a37c0d41b512b13a384949d07d2f8fd7b99557 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_cosmics.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_cosmics.sh
@@ -24,7 +24,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -35,5 +35,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_nu_25ns_premixing.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_nu_25ns_premixing.sh
index 18353201519301276601b369aa4ff62f861fd608..4064873adb8af57d44b7f10d56d2e1029ab545e5 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_nu_25ns_premixing.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_nu_25ns_premixing.sh
@@ -32,7 +32,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -43,5 +43,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_algs_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_algs_pileup.sh
index 729bfa1cdef3d239f2acaa2ce91908692be4220f..b38597c4df917e5ea80cec39ea20fb8d45a62c14 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_algs_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_algs_pileup.sh
@@ -31,7 +31,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -42,5 +42,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup.sh
index 746acf44032156d100dc1a70372d76656337ceb2..776c21ab0081ff7e3253005f4f7ae967a2717ca7 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup.sh
@@ -29,7 +29,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -40,5 +40,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup_noNoise.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup_noNoise.sh
index 8998389b16c34ca4bf26082ac325d4976c13ca0e..df7c77e8c875dcecc29ca1ade640cae737fb87e7 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup_noNoise.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_25ns_pileup_noNoise.sh
@@ -29,7 +29,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -40,5 +40,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_50ns_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_50ns_pileup.sh
index c72c35b14d03145323c189c1dd50fe984c4a72b5..887f47503aa90cd0cc4d208c5c3e6c135a9bb62f 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_50ns_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_50ns_pileup.sh
@@ -30,7 +30,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -41,5 +41,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_no_pileup.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_no_pileup.sh
index aee784c49217c1d2afa760cb804999d3bacb9002..f30406480c79db887726f714b49238011e1a6a3e 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_no_pileup.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc15_2015_ttbar_no_pileup.sh
@@ -28,7 +28,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -38,5 +38,5 @@ echo "art-result: $? checkFile"
 ArtPackage=$1
 ArtJobName=$2
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_qballs.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_qballs.sh
index f48525f2f43266038e517023e69b72a9ec2235e9..c04d294fca57523f39ef4f7d901e8cb94de99ef0 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_qballs.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_qballs.sh
@@ -41,5 +41,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_ttbar.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_ttbar.sh
index 68252a6f86451c3265b2e7c2d7cbcc1c88c3f202..fd85678c60d07d77d83a52255779c54e1f1fb3e5 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_ttbar.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16a_ttbar.sh
@@ -27,7 +27,7 @@ echo  "art-result: $? diff-pool"
 
 
 
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 
 checkFile ./$DigiOutFileName
@@ -38,5 +38,5 @@ ArtPackage=$1
 ArtJobName=$2
 
 
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16d_ttbar.sh b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16d_ttbar.sh
index e06e529934e90d591426918659d75f08fbee8d60..a10553edb885be3c310cd51a2e9aaf5288d0d435 100755
--- a/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16d_ttbar.sh
+++ b/Simulation/Tests/DigitizationTests/test/test_Digi_tf_mc16d_ttbar.sh
@@ -36,7 +36,7 @@ echo  "art-result: $? diff-pool"
 #
 #
 #
-art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=summary
+art-diff.py ./$DigiOutFileName /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/DigitizationTests/ReferenceFiles/$DigitizationTestsVersion/$CMTCONFIG/$DigiOutFileName --diff-type=diff-root --mode=semi-detailed
 echo  "art-result: $? diff-root"
 #
 checkFile ./$DigiOutFileName
@@ -47,5 +47,5 @@ ArtPackage=$1
 ArtJobName=$2
 #
 #
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 echo  "art-result: $? art-compare"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh
index 8ec1a25c51ba2ae40ef90bd8b29f04682b575e34..7d2ae08af2f70bb78d29f03b2d7c1e4c36b54f1f 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh
index 7a8c1ae1e3725e122b315d7e2a8b0bf545fbda95..da1327b4113d566a7a24442513e56fba16495e48 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh
index 23bba416dea6808329711388257128b375a9363b..f08e729a4b755019495ef30c589c6617ba14189b 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_AFPSimTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_AFPSimTest.sh
index ad3a5e075ce4c8461d65ce35c88746c2b472472b..8900d92c884a0009db217bbc0e778860b411b6aa 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_AFPSimTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_AFPSimTest.sh
@@ -27,6 +27,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ALFASimTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ALFASimTest.sh
index c1c5ece1a9a80539ce2a75ac0e9a80a166b8a235..b0f9750541503703e65577e77cdbf2c0c1830e44 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ALFASimTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ALFASimTest.sh
@@ -27,6 +27,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and add DCube tests
-art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh
index 55cd5afc5d89a2aa9f5d50210ddf3dc1a93dfbb2..15959c086048c0798fd2623b889501c0e1a21cb3 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh
@@ -32,6 +32,6 @@ rm discard.HITS.pool.root
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 2 ${ArtPackage} ${ArtJobName} --mode=summary --diff-root --file=*EVNT.pool.root
+art.py compare grid --entries 2 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --diff-root --file=*EVNT.pool.root
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh
index 95b5a5f773f1924f795e41454d02a714d060a851..c996753225be8eaf9b327cef28a5daa12e32a671 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh
index 044004e5d9817dcb6904dfbaf241b1be6ba0a723..bb2bbea83f11b779b1b72718c6affe228b7a2372 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh
@@ -30,6 +30,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid ${ArtPackage} ${ArtJobName}
+art.py compare grid ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh
index 333d6e082459dc5ebab2e112061588cb6ab973d3..ce949e21a5bb62ef4298c7930b3733f8120d94c6 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh
@@ -27,6 +27,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid ${ArtPackage} ${ArtJobName}
+art.py compare grid ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh
index 6e215ff79e94055072b0421a5f30157fc3d85fdd..63681a34911c9d411ca0e36ee9b80bbcf71f69ca 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh
@@ -29,6 +29,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest.sh
index ecc42f3ef48fb056baa26283f6ab0eda774dfd29..22453978ed0b8ca8c81fb90a56302496d6ba64d5 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh
index d654539be59b59cc3184add4c3553616eca256ed..d60470d43dd0d9f015ff820d39ba659057e436fb 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 1 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 1 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_LucidSimTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_LucidSimTest.sh
index 95fb32f6c5e7d76baa4ad67336f82788039290d1..6f562735295f3834b5998a10027f35b9e0f57031 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_LucidSimTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_LucidSimTest.sh
@@ -29,6 +29,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and add DCube tests
-art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NSWSimTest_OldGeoConf.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NSWSimTest_OldGeoConf.sh
index 5f8a6e09dc8abca88c501d51d8919efe56ac96ba..e6eefd58ef1ecc4c5388bb7553dc02d3d8171e00 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NSWSimTest_OldGeoConf.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NSWSimTest_OldGeoConf.sh
@@ -26,6 +26,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and add DCube tests
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh
index 847ba910784d56244c71073fa00c2727b31d8b1b..530df4cabb2114dcf23fdac6e4d3223d5a42d19a 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh
@@ -29,6 +29,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh
index 1e3b83788584661e1be5df26cd54c8ad935c83a7..5df8a0626f52bffe4483f864290cbc1dec2c1751 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_SkipEventsTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_SkipEventsTest.sh
index dcf49546967f3290ce8b5436de801e4163e256e3..1905511958afdce46db9bac530d7f0d4cc2738fc 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_SkipEventsTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_SkipEventsTest.sh
@@ -29,6 +29,6 @@ ArtPackage=$1
 ArtJobName=$2
 # TODO Here we also want to be able to grep the log file for:
 #<fileGrepperPattern>skipping event 1.*skipping event 2.*skipping event 3.*skipping event 4.*skipping event 5</fileGrepperPattern>
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TTbarSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TTbarSim.sh
index 0409e52e4a5ad5d0a244084b64b6f617eb7766c5..f1d5bd72863547093f5d2d5b6e27c91ce9e1ac62 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TTbarSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TTbarSim.sh
@@ -28,6 +28,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 4 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 4 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TimingTest_TTbarSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TimingTest_TTbarSim.sh
index bd0c00f9a45f38c61b3ca2e9a3fe822856830755..03c28b20302d890e35f6766166b358df21ad2194 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TimingTest_TTbarSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_TimingTest_TTbarSim.sh
@@ -30,6 +30,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO Need to run DCube on timing histograms
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh
index 47cb0fd82f0ed88f9d7cd1263463985a358eaf81..5c0b25bbc1045fb1ebf5cdb299d7abbfe4711aa4 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh
@@ -29,6 +29,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 #TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ZDCSimTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ZDCSimTest.sh
index 3abda2c68850c73b3f02c10b2f4dd384da8e3e42..959e3a710b81ae68bf5abb8f0c1a030ff699d068 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ZDCSimTest.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ZDCSimTest.sh
@@ -27,6 +27,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 3 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_electrons.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_electrons.sh
index 411826b73b753f4ae242200cc3e303a3dc48baf9..853c8e8c325b3d789dc73bb1f6d0cef8c94597bc 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_electrons.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_electrons.sh
@@ -27,7 +27,7 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
 
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_minbias.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_minbias.sh
index 64959fca7cddf9cdbe4da4423d6625623b820a28..47e5a57a22de793d7e97797e0a76c933ddf58e40 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_minbias.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_minbias.sh
@@ -31,6 +31,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_muons.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_muons.sh
index ebec2f324dc761eac73044a2d14b73eeff75e996..91637d232003df244555b4088e72386666cec379 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_muons.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_muons.sh
@@ -27,7 +27,7 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
 
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_pions.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_pions.sh
index 71a8b05e49545f04de96bad81df13fa74b35505e..2d3d4be57a6e2691a07572ba46fb5a623a5871bc 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_pions.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_pions.sh
@@ -27,6 +27,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references and run DCube
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_MC16_AtlasG4_ttbar.sh b/Simulation/Tests/SimCoreTests/test/test_MC16_AtlasG4_ttbar.sh
index ca42dac977a210ced5b473d2b87f2422fd78f749..5f0cb33d37f47d14d7b52a1498884c7d4dab0d9a 100755
--- a/Simulation/Tests/SimCoreTests/test/test_MC16_AtlasG4_ttbar.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_MC16_AtlasG4_ttbar.sh
@@ -30,6 +30,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid  --entries 4 ${ArtPackage} ${ArtJobName}
+art.py compare grid  --entries 4 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_TestBeamSim.sh b/Simulation/Tests/SimCoreTests/test/test_TestBeamSim.sh
index 47b0ebf2df68e23ce242812afca4f84edc0e9e57..ef5458dd3bd3cb33491e481d0ee19777f18f948e 100755
--- a/Simulation/Tests/SimCoreTests/test/test_TestBeamSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_TestBeamSim.sh
@@ -21,6 +21,6 @@ echo  "art-result: $? simulation"
 ArtPackage=$1
 ArtJobName=$2
 # TODO This is a regression test I think. We would also need to compare these files to fixed references
-art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimCoreTests/test/test_athena_G4AtlasCosmic.sh b/Simulation/Tests/SimCoreTests/test/test_athena_G4AtlasCosmic.sh
index b4ce4d79dbb443e596032417d5f63cf34aeb35c5..f4d91b2487f3444caf0a32d1f0f7966693e8ee99 100755
--- a/Simulation/Tests/SimCoreTests/test/test_athena_G4AtlasCosmic.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_athena_G4AtlasCosmic.sh
@@ -15,6 +15,6 @@ echo  "art-result: $? simulation"
 # TODO This is a regression test I think. 
 ArtPackage=$1
 ArtJobName=$2
-art.py compare grid --entries -1 ${ArtPackage} ${ArtJobName}
+art.py compare grid --entries -1 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
 
 echo  "art-result: $? regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh
index a8e7c5ba15ec7ebf4e46784b846e3252794c3d92..e565afc1cfa6c6ffe86b59d006b227a3295fdf1c 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh
index e9a64b838b588f21509608137e078c2052a0327d..b25a0f7c60363506063891ef3a5731a0e62f3660 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 4 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 4 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh
index b4c25825aa061c30058899975efa2e2d4faa64f2..b04bd95213ba7e2effd09760d2545c830ee6bb32 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh
index 8b60764fc8b52534ef7677965ea2994bd883702c..077572bbb907333d8be03349b31513fd404b35f8 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh
index 18d2d005ba5154c8cce5a8d3f6d1aa5b0a09b3bb..7b99a767758193decf08407e2c56130c5976576d 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh
index b9e3e953f75235fc0ddb69ce3fc4fc346c1c0175..c4aedaefea424cd356cd6c1cc7b6b2f57f6cbfaa 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh
index 225b0e886af0db5c51ba2645463aea14ba0d9991..2abc2a9fe236d07d8ed2cf6a3aed5605ff605fad 100755
--- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh
+++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh
@@ -32,7 +32,7 @@ if [ $rc -eq 0 ]
 then
     ArtPackage=$1
     ArtJobName=$2
-    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=summary
+    art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed
     rc2=$?
 fi
 echo  "art-result: $rc2 regression"
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt
index 75c3a65b080eb422ebc8ccdcc82aa93d76f21a42..b697747a09d99be99c521ee9071d6ee2a440b7d3 100644
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt
@@ -10,20 +10,25 @@ atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel
                           PRIVATE
                           Calorimeter/CaloDetDescr
+                          Calorimeter/CaloEvent
                           Calorimeter/CaloIdentifier
                           Calorimeter/CaloSimEvent
-                          Calorimeter/CaloEvent
                           Control/AthenaBaseComps
                           DetectorDescription/GeoModel/GeoAdaptors
+                          DetectorDescription/Identifier
                           Event/EventInfo
-                          LArCalorimeter/LArSimEvent
+                          External/AtlasHepMC/AtlasHepMC
                           LArCalorimeter/LArElecCalib
+                          LArCalorimeter/LArG4/LArG4RunControl
+                          LArCalorimeter/LArGeoModel/LArReadoutGeometry
+                          LArCalorimeter/LArSimEvent
                           TileCalorimeter/TileDetDescr
                           TileCalorimeter/TileSimEvent )
 
 # External dependencies:
 find_package( CLHEP )
 find_package( HepMC )
+find_package( Eigen )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 )
 
 # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake
@@ -35,10 +40,10 @@ atlas_add_component( CaloSamplingFractionAnalysis
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent CaloEvent AthenaBaseComps GeoAdaptors EventInfo LArSimEvent TileDetDescr TileSimEvent )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel CaloDetDescrLib CaloIdentifier CaloSimEvent CaloEvent AthenaBaseComps GeoAdaptors EventInfo LArSimEvent LArG4RunControl LArReadoutGeometry TileDetDescr TileSimEvent )
 
 # Install files from the package:
 # atlas_install_headers( CaloSamplingFractionAnalysis )
-# atlas_install_joboptions( share/*.py )
+atlas_install_joboptions( share/*.py )
 atlas_install_runtime( share/*.C )
 
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/README.md b/Simulation/Tools/CaloSamplingFractionAnalysis/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..4554a4a30c3cc34e3d70a0a62de48247f0cd8b41
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/README.md
@@ -0,0 +1,72 @@
+# LAr EM sampling fractions
+
+## Input evgen
+
+The sampling fractions input electrons are generated in release 21.6 as single electrons with a momentum of 50 GeV, injected at a radius of r=1.5m for the barrel and distance of z=3.7405m for the endcap
+```
+setupATLAS
+asetup 21.6.31,AthGeneration
+Gen_tf.py  --ecmEnergy=13000 --firstEvent=1 --maxEvents=10 --randomSeed=1234 --jobConfig=athena/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Radius1500000_eta_0_140 --outputEVNTFile=mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.HITS.root
+Gen_tf.py  --ecmEnergy=13000 --firstEvent=1 --maxEvents=10 --randomSeed=1234 --jobConfig=athena/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Z3740500_bec_eta_135_350 --outputEVNTFile=mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.HITS.pool.root
+```
+Input files with 100k events can be found in:
+```
+/eos/atlas/atlascerngroupdisk/proj-simul/G4Run3/SamplingFractions/LArEM/mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.100k.EVNT.root
+/eos/atlas/atlascerngroupdisk/proj-simul/G4Run3/SamplingFractions/LArEM/mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.100k.EVNT.root
+```
+
+## G4 Simulation
+Simulation is run with calibration hits
+```
+Sim_tf.py --simulator 'FullG4' \
+--conditionsTag 'default:OFLCOND-MC16-SDR-14' \
+--physicsList 'FTFP_BERT_ATL' \
+--truthStrategy 'MC15aPlus' \
+--postExec 'EVNTtoHITS:topSequence.BeamEffectsAlg.GenEventManipulators = [getPublicTool("GenEventValidityChecker")]' \
+--postInclude 'default:PyJobTransforms/UseFrontier.py' \
+--preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py,SimulationJobOptions/preInclude.CalHits.py,SimulationJobOptions/preInclude.ParticleID.py' \
+--preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' \
+--DataRunNumber '284500' \
+--geometryVersion 'default:ATLAS-R2-2016-01-00-01' \
+--inputEVNTFile "/eos/atlas/atlascerngroupdisk/proj-simul/G4Run3/SamplingFractions/LArEM/mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.100k.EVNT.root" \
+--outputHITSFile 'mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.0_10k.HITS.root' \
+--maxEvents 10000 \
+--skipEvent 0 \
+--imf False
+Sim_tf.py --simulator 'FullG4' \
+--conditionsTag 'default:OFLCOND-MC16-SDR-14' \
+--physicsList 'FTFP_BERT_ATL' \
+--truthStrategy 'MC15aPlus' \
+--postExec 'EVNTtoHITS:topSequence.BeamEffectsAlg.GenEventManipulators = [getPublicTool("GenEventValidityChecker")]' \
+--postInclude 'default:PyJobTransforms/UseFrontier.py' \
+--preInclude 'EVNTtoHITS:SimulationJobOptions/preInclude.BeamPipeKill.py,SimulationJobOptions/preInclude.CalHits.py,SimulationJobOptions/preInclude.ParticleID.py' \
+--preExec 'EVNTtoHITS:simFlags.TightMuonStepping=True' \
+--DataRunNumber '284500' \
+--geometryVersion 'default:ATLAS-R2-2016-01-00-01' \
+--inputEVNTFile "/afs/cern.ch/user/m/mduehrss/public/mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.100k.EVNT.root" \
+--outputHITSFile 'mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.0_5k.HITS.pool.root' \
+--maxEvents 5000 \
+--skipEvent 0 \
+--imf False
+```
+
+## NTuple creation and analysis
+For a sufficient precision, ~40k electrons in the barrel and ~40k electrons in the endcap are needed
+
+```
+get_files LarEMSamplingFraction_topOptions.py
+athena.py -c 'inFileName=["mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.0_10k.HITS.root","mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.10k_20k.HITS.root","mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.20k_30k.HITS.root","mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.30k_40k.HITS.root"]' LarEMSamplingFraction_topOptions.py
+mv LArEM_SF.root LArEM_SF_barrel.root
+
+athena.py -c 'inFileName=["mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.0_5k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.5k_10k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.10k_15k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.15k_20k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.20k_25k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.25k_30k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.30k_35k.HITS.pool.root","mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.35k_40k.HITS.pool.root"]' LarEMSamplingFraction_topOptions.py
+mv LArEM_SF.root LArEM_SF_endcap.root
+
+get_files LarEMSamplingFraction_analysis.C
+root -b -q LarEMSamplingFraction_analysis.C 
+```
+
+# HEC sampling fractions
+
+# FCal sampling fractions
+
+# Tile sampline fractions
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C
index 76d1fb099a34f99cd8efe5b14e0ffe601934cb75..f7d22be0e9b3b5165a799c845c6d79ebdb63853d 100644
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarEMSamplingFraction_analysis.C
@@ -14,20 +14,34 @@ void LarEMSamplingFraction_barrel()
 
   TCanvas* c;
   c=new TCanvas("SF_LAr_barrel_calibhit","SF_LAr_barrel_calibhit");
-  mytree->Draw("(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel_calibhit(56,0,1.4,140,0.18,0.25)","","colz");
+  mytree->Draw("(energy_active_em[1]+energy_active_em[2]+energy_active_em[3]+energy_active_nonem[1]+energy_active_nonem[2]+energy_active_nonem[3] + energy_inactive_em[1]+energy_inactive_em[2]+energy_inactive_em[3]+energy_inactive_nonem[1]+energy_inactive_nonem[2]+energy_inactive_nonem[3])/mc_e:mc_eta>>SF_LAr_barrel_calibhit(56,0,1.4,300,0.7,1.0)","","colz");
   TH2* SF_LAr_barrel_calibhit=(TH2*)gDirectory->Get("SF_LAr_barrel_calibhit");
   //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
   TProfile* SF_prof_calibhit=SF_LAr_barrel_calibhit->ProfileX();
+  
+  SF_LAr_barrel_calibhit->GetYaxis()->SetRangeUser(0.96,1.0);
+  
   SF_prof_calibhit->SetLineColor(2);
   SF_prof_calibhit->Draw("same");
-  //TFitResultPtr* fitres=
-  //SF_prof_calibhit->Fit("pol0","","",0.1,0.75);
-  //SF_prof_calibhit->Fit("pol0","+","",0.85,1.35);
+
+  c->SetGridx();
+  c->SetGridy();
+  
+  c=new TCanvas("SF_LAr_barrel_hit","SF_LAr_barrel_hit");
+  mytree->Draw("(energy_hit[1]+energy_hit[2]+energy_hit[3])/mc_e:mc_eta>>SF_LAr_barrel_hit(56,0,1.4,300,0.13,0.28)","","colz");
+  TH2* SF_LAr_barrel_hit=(TH2*)gDirectory->Get("SF_LAr_barrel_hit");
+  TProfile* SF_prof_hit=SF_LAr_barrel_hit->ProfileX();
+  
+  SF_LAr_barrel_hit->GetYaxis()->SetRangeUser(0.96,1.0);
+  
+  SF_prof_hit->SetLineColor(2);
+  SF_prof_hit->Draw("same");
+
   c->SetGridx();
   c->SetGridy();
   
   c=new TCanvas("SF_LAr_barrel","SF_LAr_barrel");
-  mytree->Draw("(energy_hit[0]+energy_hit[1]+energy_hit[2]+energy_hit[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel(56,0,1.4,140,0.16,0.23)","","colz");
+  mytree->Draw("(energy_hit[1]+energy_hit[2]+energy_hit[3])/(energy_active_em[1]+energy_active_em[2]+energy_active_em[3]+energy_active_nonem[1]+energy_active_nonem[2]+energy_active_nonem[3] + energy_inactive_em[1]+energy_inactive_em[2]+energy_inactive_em[3]+energy_inactive_nonem[1]+energy_inactive_nonem[2]+energy_inactive_nonem[3]):mc_eta>>SF_LAr_barrel(56,0,1.4,300,0.13,0.28)","","colz");
   TH2* SF_LAr_barrel=(TH2*)gDirectory->Get("SF_LAr_barrel");
   SF_LAr_barrel->SetStats(0);
   SF_LAr_barrel->SetTitle("Sampling fraction LAr EM barrel");
@@ -41,6 +55,11 @@ void LarEMSamplingFraction_barrel()
   SF_prof->Fit("pol0","Q+","",0.85,1.35);
   TList* res=SF_prof->GetListOfFunctions();
 
+  TProfile* SF_prof_noncorr=(TProfile*)(SF_prof_hit->Clone("SF_prof_noncorr"));
+  SF_prof_noncorr->Divide(SF_prof_calibhit);
+  SF_prof_noncorr->SetLineColor(1);
+  SF_prof_noncorr->Draw("samehist");
+
   TPaveText *pt = new TPaveText(.05,.2,.75,.23,"");
   pt->SetFillStyle(1001);
   pt->SetFillColor(10);
@@ -57,52 +76,73 @@ void LarEMSamplingFraction_barrel()
   
   pt->Draw();
    
-  
   c->SetGridx();
   c->SetGridy();
+  c->SaveAs(".pdf");
 }
 
 void LarEMSamplingFraction_endcap()
 {
   TFile* file = TFile::Open("LArEM_SF_endcap.root");
   TTree* mytree=(TTree*)file->Get("mytree");
-  new TCanvas("Etot_endcap","Etot_endcap");
-  mytree->Draw("Sum$(energy_active_total+energy_inactive_total)");
 
   new TCanvas("ELAr_hit_endcap","ELAr_hit_endcap");
-  mytree->Draw("(energy_hit[4]+energy_hit[5]+energy_hit[6]+energy_hit[7])");
+  mytree->Draw("(energy_hit[5]+energy_hit[6]+energy_hit[7])/mc_e:mc_eta>>ELAr_hit_endcap(86,1.35,3.5,150,0,0.15)","","colz");
 
   TCanvas* c;
   c=new TCanvas("SF_LAr_endcap_calibhit","SF_LAr_endcap_calibhit");
-  mytree->Draw("(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7])/(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7]+energy_inactive_total[4]+energy_inactive_total[5]+energy_inactive_total[6]+energy_inactive_total[7]):mc_eta>>SF_LAr_endcap_calibhit(86,1.35,3.5,400,0.00,0.40)","","colz");
+  mytree->Draw("(energy_active_em[5]+energy_active_em[6]+energy_active_em[7]+energy_active_nonem[5]+energy_active_nonem[6]+energy_active_nonem[7] + energy_inactive_em[5]+energy_inactive_em[6]+energy_inactive_em[7]+energy_inactive_nonem[5]+energy_inactive_nonem[6]+energy_inactive_nonem[7])/mc_e:mc_eta>>SF_LAr_endcap_calibhit(86,1.35,3.5,100,0.00,1.00)","","colz");
   TH2* SF_LAr_endcap_calibhit=(TH2*)gDirectory->Get("SF_LAr_endcap_calibhit");
-  //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
   TProfile* SF_prof_calibhit=SF_LAr_endcap_calibhit->ProfileX();
   SF_prof_calibhit->SetLineColor(2);
   SF_prof_calibhit->Draw("same");
-  //TFitResultPtr* fitres=
-  //SF_prof_calibhit->Fit("pol0","","",0.1,0.75);
-  //SF_prof_calibhit->Fit("pol0","+","",0.85,1.35);
+
   c->SetGridx();
   c->SetGridy();
   
   c=new TCanvas("SF_LAr_endcap","SF_LAr_endcap");
-  mytree->Draw("(energy_hit[4]+energy_hit[5]+energy_hit[6]+energy_hit[7])/(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7]+energy_inactive_total[4]+energy_inactive_total[5]+energy_inactive_total[6]+energy_inactive_total[7]):mc_eta>>SF_LAr_endcap(86,1.35,3.5,800,0.00,0.40)","","colz");
+  mytree->Draw("(energy_hit[5]+energy_hit[6]+energy_hit[7])/(energy_active_em[5]+energy_active_em[6]+energy_active_em[7]+energy_active_nonem[5]+energy_active_nonem[6]+energy_active_nonem[7] + energy_inactive_em[5]+energy_inactive_em[6]+energy_inactive_em[7]+energy_inactive_nonem[5]+energy_inactive_nonem[6]+energy_inactive_nonem[7]):mc_eta>>SF_LAr_endcap(86,1.35,3.5,800,0.00,0.40)","","colz");
   TH2* SF_LAr_endcap=(TH2*)gDirectory->Get("SF_LAr_endcap");
   SF_LAr_endcap->SetStats(0);
   SF_LAr_endcap->SetTitle("Sampling fraction LAr EM endcap");
   SF_LAr_endcap->GetXaxis()->SetTitle("|#eta|");
   SF_LAr_endcap->GetYaxis()->SetTitle("E_{G4hit}/E_{total}");
-  SF_LAr_endcap->GetYaxis()->SetRangeUser(0,0.15);
-  //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
+  SF_LAr_endcap->GetYaxis()->SetRangeUser(0,0.13);
   TProfile* SF_prof=SF_LAr_endcap->ProfileX();
   SF_prof->SetLineColor(2);
   SF_prof->Draw("same");
-  //TFitResultPtr* fitres=
-  //SF_prof->Fit("pol0","","",0.1,0.75);
-  //SF_prof->Fit("pol0","+","",0.85,1.35);
+  
+  SF_prof->Fit(new TF1("r1","[0]+(x-1.47)*[1]",1,4),"","",1.45,1.49);
+  SF_prof->Fit(new TF1("r2","[0]+(x-1.55)*[1]",1,4),"+","",1.53,1.57);
+  SF_prof->Fit(new TF1("r3","[0]+(x-1.70)*[1]",1,4),"+","",1.64,1.76);
+  SF_prof->Fit(new TF1("r4","[0]+(x-1.90)*[1]",1,4),"+","",1.84,1.96);
+  SF_prof->Fit(new TF1("r5","[0]+(x-2.055)*[1]",1,4),"+","",2.03,2.08);
+  SF_prof->Fit(new TF1("r6","[0]+(x-2.20)*[1]",1,4),"+","",2.14,2.26);
+  SF_prof->Fit(new TF1("r7","[0]+(x-2.395)*[1]",1,4),"+","",2.34,2.45);
+  SF_prof->Fit(new TF1("r8","[0]+(x-2.66)*[1]",1,4),"+","",2.56,2.76);
+  SF_prof->Fit(new TF1("r9","[0]+(x-2.995)*[1]",1,4),"+","",2.85,3.14);
+  TList* res=SF_prof->GetListOfFunctions();
+
+  TPaveText *pt = new TPaveText(1.45,0.005,3.1,0.075,"");
+  pt->SetFillStyle(1001);
+  pt->SetFillColor(10);
+  pt->SetBorderSize(1);
+  pt->AddText("Sampling fractions LAr EM endcap");
+
+  for(int i=0;i<res->GetSize();++i) if(res->At(i)->InheritsFrom(TF1::Class())) {
+    TF1* func=(TF1*)res->At(i);
+    TString text=Form("%4.2f < #eta < %4.2f = %+7.5f +- %7.5f + (|#eta|-%5.3f)*( %7.5f +- %7.5f )",func->GetXmin(),func->GetXmax(),func->GetParameter(0),func->GetParError(0),0.5*(func->GetXmin()+func->GetXmax()),func->GetParameter(1),func->GetParError(1));
+    std::cout<<"Sampling fraction : "<<text<<std::endl;
+    pt->AddText(text);
+    if(func->GetFormula()) {
+    }
+  }
+  
+  pt->Draw();
+
   c->SetGridx();
   c->SetGridy();
+  c->SaveAs(".pdf");
 }
 
 void LarEMSamplingFraction_analysis()
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_G4Atlas_jobOptions.py b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_G4Atlas_jobOptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..89866a0979e458e31b7bcf7959480ebc6394a09d
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_G4Atlas_jobOptions.py
@@ -0,0 +1,173 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+"""
+Job options file for Geant4 ATLAS detector simulations to measure the FCal
+sampling fractions.
+
+Set the 'module' variable to one of 'fcal1', 'fcal2' or 'fcal3' to simulate
+particle interactions in the FCal1, FCal2 or FCal3 modules, respectively.
+
+Additionaly parameters, such as the number of events to simulate and the
+particle gun energy and coordinates, may be set in the 'params' variable.
+"""
+
+import random
+
+## Common parameters
+module = "fcal1"   # Choose from "fcal1", "fcal2" or "fcal3"
+
+## Distance from IP to face of each FCal module [mm]
+
+## Values based on Table 3 in JINST 3 P02010 (2008), "The ATLAS Forward Calorimeter"
+## These numbers do not necessarily reflect the geometry and location of the FCal in the Geant4 model!
+# fcal1_z = 4708.90  # Distance from IP to FCal1 face [mm]; = 4683.5 + 26.4 - 1.0
+# fcal2_z = 5166.10  # Distance from IP to FCal2 face [mm]; = 4683.5 + 483.6 - 1.0
+# fcal3_z = 5648.20  # Distance from IP to FCal3 face [mm]; = 4683.5 + 965.7 - 1.0
+
+## Values for the Geant4 module
+fcal1_z = 4713.5
+fcal2_z = 5173.3
+fcal3_z = 5647.8
+
+params = {
+    'n_event': 200,          # Number of events to simulate
+    'pg_E': 40000,           # Particle gun energy [MeV]
+    'pg_x': [212.5, 277.5],  # Particle gun x-coordinate; constant or range
+    'pg_y': [7.5, 72.5],     # Particle gun y-coordinate; constant or range
+    'pg_z': None,            # Particle gun z-coordinate (distance to IP); should be constant
+    'pg_eta': None,          # Particle gun eta; constant or range
+}
+
+if module.lower() == "fcal1":
+    params['pg_z'] = fcal1_z
+    params['pg_eta'] = [3.5, 3.8]
+elif module.lower() == "fcal2":
+    params['pg_z'] = fcal2_z
+    params['pg_eta'] = [3.5, 3.8]
+elif module.lower() == "fcal3":
+    params['pg_z'] = fcal3_z
+    params['pg_eta'] = [3.5, 3.8]
+
+
+## Algorithm sequence
+from AthenaCommon.AlgSequence import AlgSequence
+topSeq = AlgSequence()
+
+## Output threshold (DEBUG, INFO, WARNING, ERROR, FATAL)
+ServiceMgr.MessageSvc.OutputLevel = INFO
+
+## Detector flags
+from AthenaCommon.DetFlags import DetFlags
+DetFlags.ID_setOff()
+DetFlags.Calo_setOn()
+DetFlags.Muon_setOff()
+DetFlags.HEC_setOff()
+DetFlags.em_setOff()
+DetFlags.Tile_setOff()
+# DetFlags.Lucid_setOn()
+DetFlags.Truth_setOn()
+DetFlags.simulate.Truth_setOn()
+
+## Global conditions tag
+from AthenaCommon.GlobalFlags import jobproperties
+jobproperties.Global.ConditionsTag = "OFLCOND-MC16-SDR-16"
+
+## AthenaCommon flags
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.PoolHitsOutput = "atlasG4.hits.pool.root"
+athenaCommonFlags.EvtMax = params['n_event']
+
+## Simulation flags
+from G4AtlasApps.SimFlags import simFlags
+simFlags.load_atlas_flags()
+simFlags.RandomSvc = "AtDSFMTGenSvc"
+
+## Layout tags: see simFlags.SimLayout for allowed values
+## Use the default layout:
+simFlags.SimLayout.set_On()
+## Set a specific layout tag:
+simFlags.SimLayout = "ATLAS-R2-2016-01-00-01"
+## Set a specific non-officially-supported layout tag using the _VALIDATION suffix, e.g.:
+# simFlags.SimLayout = "ATLAS-R2-2016-01-00-01_VALIDATION"
+
+## Set the EtaPhi, VertexSpread and VertexRange checks on
+simFlags.EventFilter.set_Off()
+
+## Set CalibrationRun
+simFlags.CalibrationRun = "LAr"
+
+## Set random seeds
+## Seeds need to explicitly set, otherwise default constants are used
+simFlags.RandomSeedList.addSeed('AtlasG4',random.randint(10000, 99999999), random.randint(10000, 99999999))
+simFlags.RandomSeedList.addSeed('VERTEX', random.randint(10000, 99999999), random.randint(10000, 99999999))
+simFlags.RandomSeedList.addSeed('SINGLE', random.randint(10000, 99999999), random.randint(10000, 99999999))
+
+## No magnetic field
+# simFlags.MagneticField.set_Off()
+
+## Register callback functions at various init stages
+# def test_preInit():
+#     print "CALLBACK AT PREINIT"
+# def test_postInit():
+#     print "CALLBACK AT POSTINIT"
+# simFlags.InitFunctions.add_function("preInit", test_preInit)
+# simFlags.InitFunctions.add_function("postInit", test_postInit)
+
+## Change the field stepper or use verbose G4 tracking
+# from G4AtlasApps import callbacks
+# simFlags.InitFunctions.add_function("postInit", callbacks.use_simplerunge_stepper)
+# simFlags.InitFunctions.add_function("postInit", callbacks.use_verbose_tracking)
+
+## Use single particle generator
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+athenaCommonFlags.PoolEvgenInput.set_Off()
+athenaCommonFlags.SkipEvents.set_Off()
+
+## Set particle gun parameters
+import AthenaCommon.AtlasUnixGeneratorJob
+import ParticleGun as PG
+pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
+pg.sampler.pid = 11
+pg.sampler.mom = PG.EEtaMPhiSampler(energy=params['pg_E'], eta=params['pg_eta'])
+pg.sampler.pos = PG.PosSampler(x=params['pg_x'], y=params['pg_y'], z=params['pg_z'], t=params['pg_z'])
+topSeq += pg
+
+## Dump truth information
+# from TruthExamples.TruthExamplesConf import DumpMC
+# topSeq += DumpMC()
+
+StoreGateSvc = Service( "StoreGateSvc" )
+StoreGateSvc.Dump = True
+
+include("G4AtlasApps/G4Atlas.flat.configuration.py")
+
+## Use GeoCheckAction
+## If using GeoCheckAction, make sure the particle type id is set to 999 (geantinos)
+# def add_GeoCheckAction():
+#     from G4AtlasApps import PyG4Atlas, AtlasG4Eng
+#     GeoCheckAction = PyG4Atlas.UserAction( 'G4UserActions', 'GeoCheckAction', ['BeginOfEvent','EndOfEvent','Step','EndOfRun'] )
+#     AtlasG4Eng.G4Eng.menu_UserActions.add_UserAction(GeoCheckAction)
+
+# simFlags.InitFunctions.add_function("postInit", add_GeoCheckAction)
+
+
+from AthenaCommon.CfgGetter import getAlgorithm
+topSeq += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True)
+topSeq.G4AtlasAlg.InputTruthCollection = "GEN_EVENT"
+
+## Tool to merge dead material containers into a single container
+from LArG4SD import LArG4SDConfig
+topSeq += LArG4SDConfig.getDeadMaterialCalibrationHitMerger()
+
+myAlg = CfgMgr.LArFCalSamplingFraction()
+myAlg.Calibration = True
+topSeq += myAlg
+
+
+from GaudiSvc.GaudiSvcConf import THistSvc
+ServiceMgr += THistSvc()
+ServiceMgr.THistSvc.Output = [
+    "AANT DATAFILE='LArFCalSamplingFraction.{}.{:g}GeV.aan.root' OPT='RECREATE'".format(module, params['pg_E']/1000)
+]
+
+print topSeq
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_analysis.py b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_analysis.py
new file mode 100755
index 0000000000000000000000000000000000000000..9987534a5d71ceb0196236f47650f3b1233b2abb
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/LarFCalSamplingFraction_analysis.py
@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+"""
+Calculate FCal Sampling Fractions
+=================================
+
+Calculate the FCal sampling fractions from Geant4 simulation.
+"""
+
+from __future__ import absolute_import, division, print_function
+
+
+import argparse
+import glob
+import math
+import sys
+
+import ROOT as root
+
+# To stop ROOT from hijacking '--help'
+root.PyConfig.IgnoreCommandLineOptions = True
+
+
+def _docstring(docstring):
+    """Return summary of docstring
+    """
+    return docstring.split('\n')[4] if docstring else ""
+
+
+def parse_args():
+    """Parse command-line arguments
+    """
+    parser = argparse.ArgumentParser(description=_docstring(__doc__))
+    parser.add_argument("--version", action="version", version="%(prog)s 0.1")
+    parser.add_argument("-v", "--verbose", action="count", default=0,
+                        help="print verbose messages; multiple -v result in more verbose messages")
+    parser.add_argument("infile", default="LArFCalSamplingFraction.aan.root",
+                        help="Path to input file; wildcards are supported (default: %(default)s)")
+    parser.add_argument("-m", "--module", choices=["FCal1", "FCal2", "FCal3"],
+                        help="Calculate the sampling fraction for this FCal module only; "
+                             "if unspecified, it will try to parse the module from the file name")
+    parser.add_argument("-o", "--outfile", default="out.txt",
+                        help="Path to output file where sampling fraction results are written "
+                             "(default: %(default)s)")
+
+    args = parser.parse_args()
+
+    return args
+
+
+def calculate_samp_frac(args):
+    """Read ntuple from the Geant4 simulation and calculate FCal sampling
+    fractions.
+
+    Returns (E_init, samp_frac, samp_frac_err)
+    """
+    tree_name = "tree_AS"
+    print("Reading tree '{}' from file '{}'...".format(tree_name, args.infile))
+
+    aan_chain = root.TChain(tree_name)
+    aan_chain.Add(args.infile)
+
+    n_event = aan_chain.GetEntries()
+
+    # Get initial electron energy [GeV]
+    for event in aan_chain:
+        E_init = round(event.E, 2) / 1000
+        break
+
+    samp_frac = 0
+    samp_frac_sq = 0
+
+    if args.verbose:
+        print("Event  Active E [MeV]  Total E [MeV]")
+
+    # Loop over events and sum energy values
+    for event in aan_chain:
+        if args.module.lower() == "fcal1":
+            totalE = event.Calib_FCal1Active + event.Calib_FCal1Inactive
+            activeE = event.FCal1_E
+        elif args.module.lower() == "fcal2":
+            totalE = event.Calib_FCal2Active + event.Calib_FCal2Inactive
+            activeE = event.FCal2_E
+        elif args.module.lower() == "fcal3":
+            totalE = event.Calib_FCal3Active + event.Calib_FCal3Inactive
+            activeE = event.FCal3_E
+
+        samp_frac += activeE / totalE
+        samp_frac_sq += (activeE / totalE)**2
+
+        if args.verbose:
+            print("{:<6} {:<15g} {:<15g}".format(event.Event, activeE, totalE))
+
+    if args.verbose:
+        print("")
+
+    # Mean sampling fractions
+    samp_frac /= n_event
+    samp_frac_sq /= n_event
+
+    # Sampling fraction error = sqrt(<x^2> - <x>^2) / sqrt(N)
+    samp_frac_err = math.sqrt(samp_frac_sq - samp_frac**2) / math.sqrt(n_event)
+
+    print("{} sampling fraction (E = {:g} GeV): {:g} +/- {:g}".format(args.module, E_init, samp_frac, samp_frac_err))
+
+    return E_init, samp_frac, samp_frac_err
+
+
+def write_results(results, args):
+    with open(args.outfile, "w") as outfile:
+        outfile.write("[{}]\n".format(args.module))
+
+        for key in sorted(results.keys()):
+            outfile.write("{:g} GeV: {} +/- {}\n".format(key, results[key][0], results[key][1]))
+
+def main():
+    try:
+        args = parse_args()
+
+        if args.module is None:
+            if "fcal1" in args.infile.lower():
+                args.module = "fcal1"
+            elif "fcal2" in args.infile.lower():
+                args.module = "fcal2"
+            elif "fcal3" in args.infile.lower():
+                args.module = "fcal3"
+            else:
+                raise Exception("unknown FCal module")
+
+        infiles = glob.glob(args.infile)
+        infiles.sort()
+
+        results = {}
+
+        for infile in infiles:
+            args.infile = infile
+            E_init, samp_frac, samp_frac_err = calculate_samp_frac(args)
+
+            results[E_init] = (samp_frac, samp_frac_err)
+
+        print("Writing results to '{}'".format(args.outfile))
+        write_results(results, args)
+
+    except KeyboardInterrupt:
+        return 1
+
+    except Exception as err:
+        print("error: {}".format(err))
+        return 1
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Radius1500000_eta_0_140/mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.py b/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Radius1500000_eta_0_140/mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.py
new file mode 100644
index 0000000000000000000000000000000000000000..1803a9aec9815c1cd7cc792cda59562f70664be2
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Radius1500000_eta_0_140/mc.PG_pid11_Mom50000_Radius1500000_eta_0_140.py
@@ -0,0 +1 @@
+include('ParticleGun/ParticleGun_SamplingFraction.py')
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Z3740500_bec_eta_135_350/mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.py b/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Z3740500_bec_eta_135_350/mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.py
new file mode 100644
index 0000000000000000000000000000000000000000..1803a9aec9815c1cd7cc792cda59562f70664be2
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/share/PG_pid11_Mom50000_Z3740500_bec_eta_135_350/mc.PG_pid11_Mom50000_Z3740500_bec_eta_135_350.py
@@ -0,0 +1 @@
+include('ParticleGun/ParticleGun_SamplingFraction.py')
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..82a803b2711a760329afcb915f88b994732981e5
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx
@@ -0,0 +1,1057 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "LArFCalSamplingFraction.h"
+
+// C++ stdlib
+#include <algorithm>
+#include <functional>
+#include <iostream>
+#include <cmath>
+
+// Root
+#include "TTree.h"
+
+// ATLAS Software
+#include "GaudiKernel/AlgFactory.h"
+#include "GaudiKernel/IToolSvc.h"
+
+// Event Info
+#include "EventInfo/EventID.h"
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventType.h"
+#include "EventInfo/TriggerInfo.h"
+#include "GaudiKernel/ITHistSvc.h"
+
+// ID classes
+#include "CaloDetDescr/CaloDetDescrElement.h"
+#include "CaloIdentifier/CaloCell_ID.h"
+#include "CaloIdentifier/CaloDM_ID.h"
+#include "CaloIdentifier/CaloIdManager.h"
+#include "Identifier/Identifier.h"
+
+// Hits and hit collections
+#include "LArSimEvent/LArHit.h"
+#include "LArSimEvent/LArHitContainer.h"
+#include "LArReadoutGeometry/FCALModule.h"
+#include "LArReadoutGeometry/FCALTile.h"
+#include "CaloSimEvent/CaloCalibrationHit.h"
+#include "CaloSimEvent/CaloCalibrationHitContainer.h"
+#include "GeoAdaptors/GeoLArHit.h"
+#include "GeoAdaptors/GeoCaloCalibHit.h"
+
+// For Cryostat Positions
+#include "LArG4RunControl/LArG4TBPosOptions.h"
+
+// Other useful tools for particle/event/beam info
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+#include "GeneratorObjects/McEventCollection.h"
+#include "HepMC/GenEvent.h"
+#include "HepMC/GenVertex.h"
+#include "HepMC/GenParticle.h"
+#include "HepMC/SimpleVector.h"
+#include "CLHEP/Vector/LorentzVector.h"
+#include "CLHEP/Vector/ThreeVector.h"
+#include "CLHEP/Geometry/Point3D.h"
+
+
+static const double mZ = 91.19 * CLHEP::GeV;
+static const int MAX_PARTICLES = 20;
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Constructor
+
+LArFCalSamplingFraction::LArFCalSamplingFraction(const std::string &name, ISvcLocator *pSvcLocator)
+    : AthAlgorithm(name, pSvcLocator),
+      m_calibrationRun(false),
+      m_cx1(0.0), m_cx2(0.0), m_cx3(0.0),
+      m_cy1(0.0), m_cy2(0.0), m_cy3(0.0)
+{
+    declareProperty("Calibration", m_calibrationRun);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Destructor
+
+LArFCalSamplingFraction::~LArFCalSamplingFraction() {}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Initialize
+///  - Get a handle on the analysis tools
+///  - Set up output TTree
+
+StatusCode LArFCalSamplingFraction::initialize()
+{
+    ATH_MSG_INFO("Initializing LArFCalSamplingFraction");
+
+    // Get a handle on the NTuple and histogramming service
+    ServiceHandle<ITHistSvc> histSvc("THistSvc", name());
+    CHECK(histSvc.retrieve());
+    ATH_MSG_DEBUG(" retrieved THistSvc");
+
+    const CaloIdManager *caloIdManager;
+    ATH_CHECK(detStore()->retrieve(caloIdManager));
+
+    // Use just for now for Calibration... change later to GeoCalibHit
+    m_larFCalID = caloIdManager->getFCAL_ID();
+
+    if (m_larFCalID == 0)
+        throw GaudiException("Invalid LAr FCAL ID helper", "LArHitAnalysis", StatusCode::FAILURE);
+
+    // Use for now... soon change to GeoCalibHit
+    m_caloCellID = caloIdManager->getCaloCell_ID();
+
+    if (m_caloCellID == 0)
+        throw GaudiException("Invalid Calo Cell ID helper", "LArHitAnalysis", StatusCode::FAILURE);
+
+    m_pdg_id = new std::vector<int>; // particle id
+
+    m_hit_x1 = new std::vector<double>; // hit positions of cells
+    m_hit_y1 = new std::vector<double>;
+
+    m_hit_x2 = new std::vector<double>;
+    m_hit_y2 = new std::vector<double>;
+
+    m_hit_x3 = new std::vector<double>;
+    m_hit_y3 = new std::vector<double>;
+
+    m_hit_ieta1 = new std::vector<double>; // hit indices of cells
+    m_hit_iphi1 = new std::vector<double>;
+    m_hit_ieta2 = new std::vector<double>;
+    m_hit_iphi2 = new std::vector<double>;
+    m_hit_ieta3 = new std::vector<double>;
+    m_hit_iphi3 = new std::vector<double>;
+
+    m_cell1_E = new std::vector<double>; // Energy in cells
+    m_cell2_E = new std::vector<double>;
+    m_cell3_E = new std::vector<double>;
+
+    // Now add branches and leaves to the AAN tree
+    m_tree_AS = new TTree("tree_AS", "TTree of AnalysisSkleton");
+
+    // Event info
+    m_tree_AS->Branch("Run", &m_runNumber, "Run/I");             // run number
+    m_tree_AS->Branch("Event", &m_eventNumber, "Event/I");       // event number
+    m_tree_AS->Branch("Time", &m_eventTime, "Time/I");           // time stamp
+    m_tree_AS->Branch("LumiBlock", &m_lumiBlock, "LumiBlock/I"); // lumi block num
+    m_tree_AS->Branch("BCID", &m_bCID, "BCID/I");                // bunch crossing ID
+    m_tree_AS->Branch("Weight", &m_eventWeight, "Weight/D");     // weight
+
+    // FCal-specific and other variables
+    m_tree_AS->Branch("EFCal", &m_totalFCalEnergy, "EFCal/D");
+    m_tree_AS->Branch("NHitsFCal", &m_numHitsFCal, "NhitsFCal/I");
+
+    m_tree_AS->Branch("Vertex_Eta", &m_vertex_eta, "Vertex_Eta/D");
+    m_tree_AS->Branch("Vertex_Phi", &m_vertex_phi, "Vertex_Phi/D");
+
+    m_tree_AS->Branch("Pt", &m_pt, "Pt/D");
+    m_tree_AS->Branch("px", &m_px, "px/D");
+    m_tree_AS->Branch("py", &m_py, "py/D");
+    m_tree_AS->Branch("pz", &m_pz, "pz/D");
+    m_tree_AS->Branch("E", &m_E, "E/D");
+
+    m_tree_AS->Branch("VertexX", &m_vertx, "VertexX/D");
+    m_tree_AS->Branch("VertexY", &m_verty, "VertexY/D");
+    m_tree_AS->Branch("VertexZ", &m_vertz, "VertexZ/D");
+
+    m_tree_AS->Branch("MC_CCX1", &m_x_mc_cc1, "MC_CCX1/D");
+    m_tree_AS->Branch("MC_CCY1", &m_y_mc_cc1, "MC_CCY1/D");
+
+    m_tree_AS->Branch("MC_CCX2", &m_x_mc_cc2, "MC_CCX2/D");
+    m_tree_AS->Branch("MC_CCY2", &m_y_mc_cc2, "MC_CCY2/D");
+
+    m_tree_AS->Branch("MC_CCX3", &m_x_mc_cc3, "MC_CCX3/D");
+    m_tree_AS->Branch("MC_CCY3", &m_y_mc_cc3, "MC_CCY3/D");
+
+    m_tree_AS->Branch("CCX1", &m_x_cc1, "CCX1/D");
+    m_tree_AS->Branch("CCY1", &m_y_cc1, "CCY1/D");
+
+    m_tree_AS->Branch("CCX2", &m_x_cc2, "CCX2/D");
+    m_tree_AS->Branch("CCY2", &m_y_cc2, "CCY2/D");
+
+    m_tree_AS->Branch("CCX3", &m_x_cc3, "CCX3/D");
+    m_tree_AS->Branch("CCY3", &m_y_cc3, "CCY3/D");
+
+    m_tree_AS->Branch("NCell_1", &m_NCell1, "NCell1_1/I");
+    m_tree_AS->Branch("NCell_2", &m_NCell2, "NCell1_2/I");
+    m_tree_AS->Branch("NCell_3", &m_NCell3, "NCell1_3/I");
+
+    m_tree_AS->Branch("ParticleID", &m_pdg_id);
+
+    m_tree_AS->Branch("Hit_X1", &m_hit_x1);
+    m_tree_AS->Branch("Hit_Y1", &m_hit_y1);
+
+    m_tree_AS->Branch("Hit_X2", &m_hit_x2);
+    m_tree_AS->Branch("Hit_Y2", &m_hit_y2);
+
+    m_tree_AS->Branch("Hit_X3", &m_hit_x3);
+    m_tree_AS->Branch("Hit_Y3", &m_hit_y3);
+
+    m_tree_AS->Branch("Hit_eta1", &m_hit_ieta1);
+    m_tree_AS->Branch("Hit_phi1", &m_hit_iphi1);
+    m_tree_AS->Branch("Hit_eta2", &m_hit_ieta2);
+    m_tree_AS->Branch("Hit_phi2", &m_hit_iphi2);
+    m_tree_AS->Branch("Hit_eta3", &m_hit_ieta3);
+    m_tree_AS->Branch("Hit_phi3", &m_hit_iphi3);
+
+    m_tree_AS->Branch("Cell1_E", &m_cell1_E);
+    m_tree_AS->Branch("Cell2_E", &m_cell2_E);
+    m_tree_AS->Branch("Cell3_E", &m_cell3_E);
+
+    m_tree_AS->Branch("FCal1_E", &m_FCal1_SumE, "FCal1_E/D");
+    m_tree_AS->Branch("FCal2_E", &m_FCal2_SumE, "FCal2_E/D");
+    m_tree_AS->Branch("FCal3_E", &m_FCal3_SumE, "FCal3_E/D");
+
+    if (m_calibrationRun) {
+        m_caloDmID = caloIdManager->getDM_ID();
+
+        if (m_caloDmID == 0)
+            throw GaudiException("Invalid Calo DM ID helper", "LArFCalTB_MC_CBNT_AA", StatusCode::FAILURE);
+
+        // Define the hit containers that we'll analyze in this program.
+        // For now, initialize the pointers to the containers to NULL (zero).
+        m_calibHitMap["LArCalibrationHitActive"] = 0;
+        m_calibHitMap["LArCalibrationHitInactive"] = 0;
+        m_calibHitMap["LArCalibrationHitDeadMaterial"] = 0;
+
+        m_tree_AS->Branch("Calib_TotalEnergy", &m_totalCalibrationEnergy, "Calib_TotalEnergy/D");
+        m_tree_AS->Branch("Calib_TotalEm", &m_totalEmEnergy, "Calib_TotalEm/D");
+        m_tree_AS->Branch("Calib_TotalNonEm", &m_totalNonEmEnergy, "Calib_TotalNonEm/D");
+        m_tree_AS->Branch("Calib_TotalInvisible", &m_totalInvisibleEnergy, "Calib_TotalInvisible/D");
+        m_tree_AS->Branch("Calib_TotalEscaped", &m_totalEscapedEnergy, "Calib_TotalEscaped/D");
+        m_tree_AS->Branch("Calib_FCalEnergy", &m_totalFCalCalibrationEnergy, "Calib_FCalEnergy/D");
+        m_tree_AS->Branch("Calib_TotalActive", &m_totalActiveEnergy, "Calib_TotalActive/D");
+        m_tree_AS->Branch("Calib_TotalInactive", &m_totalInactiveEnergy, "Calib_TotalInactive/D");
+        m_tree_AS->Branch("Calib_DeadEnergy", &m_totalDeadMaterialEnergy, "Calib_DeadEnergy/D");
+        m_tree_AS->Branch("Calib_NHitsInactive", &m_numHitsInactive, "Calib_NHitsInactive/I");
+        m_tree_AS->Branch("Calib_NHitsDead", &m_numHitsDead, "Calib_NHitsDead/I");
+        m_tree_AS->Branch("Calib_FCal1Energy", &m_totalFCal1CalibrationEnergy, "Calib_FCal1Energy/D");
+        m_tree_AS->Branch("Calib_FCal2Energy", &m_totalFCal2CalibrationEnergy, "Calib_FCal2Energy/D");
+        m_tree_AS->Branch("Calib_FCal3Energy", &m_totalFCal3CalibrationEnergy, "Calib_FCal3Energy/D");
+
+        m_tree_AS->Branch("Calib_FCalActive", &m_FCalActive, "Calib_FCalActive/D");
+        m_tree_AS->Branch("Calib_FCalInactive", &m_FCalInactive, "Calib_FCalInactive/D");
+        m_tree_AS->Branch("Calib_FCalDead", &m_FCalDead, "Calib_FCalDead/D");
+        m_tree_AS->Branch("Calib_FCalEm", &m_FCalEm, "Calib_FCalEm/D");
+        m_tree_AS->Branch("Calib_FCal1Em", &m_FCal1Em, "Calib_FCal1Em/D");
+        m_tree_AS->Branch("Calib_FCal2Em", &m_FCal2Em, "Calib_FCal2Em/D");
+        m_tree_AS->Branch("Calib_FCal3Em", &m_FCal3Em, "Calib_FCal3Em/D");
+        m_tree_AS->Branch("Calib_FCalNonEm", &m_FCalNonEm, "Calib_FCalNonEm/D");
+        m_tree_AS->Branch("Calib_FCal1NonEm", &m_FCal1NonEm, "Calib_FCal1NonEm/D");
+        m_tree_AS->Branch("Calib_FCal2NonEm", &m_FCal2NonEm, "Calib_FCal2NonEm/D");
+        m_tree_AS->Branch("Calib_FCal3NonEm", &m_FCal3NonEm, "Calib_FCal3NonEm/D");
+        m_tree_AS->Branch("Calib_FCalInvisible", &m_FCalInvisible, "Calib_FCalInvisible/D");
+        m_tree_AS->Branch("Calib_FCal1Invisible", &m_FCal1Invisible, "Calib_FCal1Invisible/D");
+        m_tree_AS->Branch("Calib_FCal2Invisible", &m_FCal2Invisible, "Calib_FCal2Invisible/D");
+        m_tree_AS->Branch("Calib_FCal3Invisible", &m_FCal3Invisible, "Calib_FCal3Invisible/D");
+        m_tree_AS->Branch("Calib_FCalEscaped", &m_FCalEscaped, "Calib_FCalEscaped/D");
+        m_tree_AS->Branch("Calib_FCal1Escaped", &m_FCal1Escaped, "Calib_FCal1Escaped/D");
+        m_tree_AS->Branch("Calib_FCal2Escaped", &m_FCal2Escaped, "Calib_FCal2Escaped/D");
+        m_tree_AS->Branch("Calib_FCal3Escaped", &m_FCal3Escaped, "Calib_FCal3Escaped/D");
+        m_tree_AS->Branch("Calib_FCal1Active", &m_FCal1Active, "Calib_FCal1Active/D");
+        m_tree_AS->Branch("Calib_FCal2Active", &m_FCal2Active, "Calib_FCal2Active/D");
+        m_tree_AS->Branch("Calib_FCal3Active", &m_FCal3Active, "Calib_FCal3Active/D");
+        m_tree_AS->Branch("Calib_FCal1Inactive", &m_FCal1Inactive, "Calib_FCal1Inactive/D");
+        m_tree_AS->Branch("Calib_FCal2Inactive", &m_FCal2Inactive, "Calib_FCal2Inactive/D");
+        m_tree_AS->Branch("Calib_FCal3Inactive", &m_FCal3Inactive, "Calib_FCal3Inactive/D");
+        m_tree_AS->Branch("Calib_FCalActiveEm", &m_FCalActiveEm, "Calib_FCalActiveEm/D");
+        m_tree_AS->Branch("Calib_FCalActiveNonEm", &m_FCalActiveNonEm, "Calib_FCalActiveNonEm/D");
+        m_tree_AS->Branch("Calib_FCalActiveInvisible", &m_FCalActiveInvisible, "Calib_FCalActiveInvisible/D");
+        m_tree_AS->Branch("Calib_FCalActiveEscaped", &m_FCalActiveEscaped, "Calib_FCalActiveEscaped/D");
+    }
+
+    CHECK(histSvc->regTree("/AANT/tree_AS", m_tree_AS));
+
+    m_eventNumber = 0;
+
+    return StatusCode::SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Finalize
+///  - delete any memory allocation from the heap
+
+StatusCode LArFCalSamplingFraction::finalize()
+{
+    return StatusCode::SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Init event
+///  - clear CBNT members
+
+StatusCode LArFCalSamplingFraction::initEvent()
+{
+    /// For Athena-Aware NTuple
+
+    ATH_MSG_INFO("Initializing event, clearing variables");
+
+    m_vertx = 0; // x-position for vertex generated particle (beam)
+    m_verty = 0;
+    m_vertz = 0;
+
+    m_vertex_eta = 0; // eta value of generated particle
+    m_vertex_phi = 0;
+
+    m_pt = 0; // Momentum of generated particle
+    m_px = 0;
+    m_py = 0;
+    m_pz = 0;
+
+    m_E = 0; // Energy of generated particle
+
+    m_NCell1 = 0; // Number of cells hit
+    m_NCell2 = 0;
+    m_NCell3 = 0;
+
+    m_x_mc_cc1 = 0; // Center of cluster in x (FCal1, extrapolated)
+    m_y_mc_cc1 = 0;
+
+    m_x_mc_cc2 = 0; // Center of cluster in x (FCal2, extrapolated)
+    m_y_mc_cc2 = 0;
+
+    m_x_mc_cc3 = 0; // Center of cluster in x (FCal3, extrapolated)
+    m_y_mc_cc3 = 0;
+
+    m_x_cc1 = 0; // Center of cluster in x (FCal1, c of g)
+    m_y_cc1 = 0;
+
+    m_x_cc2 = 0; // Center of cluster in x (FCal2, c of g)
+    m_y_cc2 = 0;
+
+    m_x_cc3 = 0; // Center of cluster in x (FCal3, c of g)
+    m_y_cc3 = 0;
+
+    m_pdg_id->clear(); // particle id
+
+    m_hit_x1->clear(); // hit positions of cells
+    m_hit_y1->clear();
+
+    m_hit_x2->clear();
+    m_hit_y2->clear();
+
+    m_hit_x3->clear();
+    m_hit_y3->clear();
+
+    m_hit_ieta1->clear(); // hit indices of cells
+    m_hit_iphi1->clear();
+    m_hit_ieta2->clear();
+    m_hit_iphi2->clear();
+    m_hit_ieta3->clear();
+    m_hit_iphi3->clear();
+
+    m_cell1_E->clear(); // Energy in cells
+    m_cell2_E->clear();
+    m_cell3_E->clear();
+
+    m_FCal1_SumE = 0; // Energy in individual FCal modules
+    m_FCal2_SumE = 0;
+    m_FCal3_SumE = 0;
+    m_TCScint_E = 0;
+    m_TCIron_E = 0;
+
+    m_totalFCalEnergy = 0;
+    m_numHitsFCal = 0;
+
+    m_totalCalibrationEnergy = 0; // Total energy
+
+    // Physic Processes
+    m_totalEmEnergy = 0;
+    m_totalNonEmEnergy = 0;
+    m_totalInvisibleEnergy = 0;
+    m_totalEscapedEnergy = 0;
+
+    // Energy deposited in different material categories
+    m_totalActiveEnergy = 0;
+    m_totalInactiveEnergy = 0;
+    m_totalDeadMaterialEnergy = 0;
+
+    // Number of hits in different material categories
+    m_numHitsActive = 0;
+    m_numHitsInactive = 0;
+    m_numHitsDead = 0;
+
+    // Total energy deposited in the different FCal Modules
+    m_totalFCalCalibrationEnergy = 0; // Energy in all FCal
+    m_totalFCal1CalibrationEnergy = 0;
+    m_totalFCal2CalibrationEnergy = 0;
+    m_totalFCal3CalibrationEnergy = 0;
+
+    m_FCalActive = 0;
+    m_FCalInactive = 0;
+    m_FCalDead = 0;
+    m_FCalActiveEm = 0;
+    m_FCalActiveNonEm = 0;
+    m_FCalActiveInvisible = 0;
+    m_FCalActiveEscaped = 0;
+    m_FCalEm = 0;
+    m_FCal1Em = 0;
+    m_FCal2Em = 0;
+    m_FCal3Em = 0;
+    m_FCalNonEm = 0;
+    m_FCal1NonEm = 0;
+    m_FCal2NonEm = 0;
+    m_FCal3NonEm = 0;
+    m_FCalInvisible = 0;
+    m_FCal1Invisible = 0;
+    m_FCal2Invisible = 0;
+    m_FCal3Invisible = 0;
+    m_FCalEscaped = 0;
+    m_FCal1Escaped = 0;
+    m_FCal2Escaped = 0;
+    m_FCal3Escaped = 0;
+    m_PhysTotE = 0;
+    m_FCal1Active = 0;
+    m_FCal2Active = 0;
+    m_FCal3Active = 0;
+    m_FCal1Inactive = 0;
+    m_FCal2Inactive = 0;
+    m_FCal3Inactive = 0;
+
+    return StatusCode::SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Calculate FCal hit center
+
+void LArFCalSamplingFraction::FCalHitCenter(const LArHitContainer *container)
+{
+    double max1 = 0.0;
+    double max2 = 0.0;
+    double max3 = 0.0;
+
+    // Loop over hits in container
+    for (LArHit* const& hit : *container) {
+
+        GeoLArHit fcalhit(*hit);
+
+        if ((!fcalhit) || (!fcalhit.getDetDescrElement()->is_lar_fcal())) {
+            ATH_MSG_WARNING("Hit in LarHitContainer is not a GeoFCalHit");
+            continue;
+        }
+
+        double energy = fcalhit.Energy();
+
+        int module_index = fcalhit.getDetDescrElement()->getLayer();
+
+        double x = fcalhit.getDetDescrElement()->x();
+        double y = fcalhit.getDetDescrElement()->y();
+
+        // Determine the center of the cluster for each FCal module
+        if (module_index == 1) {
+            // FCal1
+            if (max1 < energy) {
+                max1 = energy;
+                m_cx1 = x;
+                m_cy1 = y;
+            }
+        }
+        else if (module_index == 2) {
+            // FCal2
+            if (max2 < energy) {
+                max2 = energy;
+                m_cx2 = x;
+                m_cy2 = y;
+            }
+        }
+        else if (module_index == 3) {
+            // FCal3
+            if (max3 < energy) {
+                max3 = energy;
+                m_cx3 = x;
+                m_cy3 = y;
+            }
+        }
+
+    } // End loop over hits in container
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Calculate FCal cluster center
+
+void LArFCalSamplingFraction::FCalClusterCenter(const LArHitContainer *container)
+{
+    float xNumer1 = 0.0, xNumer2 = 0.0, xNumer3 = 0.0;
+    float yNumer1 = 0.0, yNumer2 = 0.0, yNumer3 = 0.0;
+    float Denom1 = 0.0, Denom2 = 0.0, Denom3 = 0.0;
+
+    double subClusterSize = 30.0;  // [mm]
+    double thisCG_R = 0.0;
+
+    // Loop over hits in container
+    for (LArHit* const& hit : *container) {
+
+        GeoLArHit fcalhit(*hit);
+
+        if ((!fcalhit) || (!fcalhit.getDetDescrElement()->is_lar_fcal())) {
+            ATH_MSG_WARNING("Hit in LarHitContainer is not a GeoFCalHit");
+            continue;
+        }
+
+        double energy = fcalhit.Energy();
+        int module_index = fcalhit.getDetDescrElement()->getLayer();
+
+        double x = fcalhit.getDetDescrElement()->x();
+        double y = fcalhit.getDetDescrElement()->y();
+
+        // Determine center of cluster
+        if (module_index == 1) {
+            // FCal1
+            double x_subcheck1 = m_cx1 - x;
+            double y_subcheck1 = m_cy1 - y;
+            thisCG_R = sqrt(x_subcheck1 * x_subcheck1 + y_subcheck1 * y_subcheck1);
+
+            if (thisCG_R <= subClusterSize) {
+                xNumer1 += x * energy;
+                yNumer1 += y * energy;
+                Denom1 += energy;
+            }
+        }
+        else if (module_index == 2) {
+            // FCal2
+            double x_subcheck2 = m_cx2 - x;
+            double y_subcheck2 = m_cy2 - y;
+            thisCG_R = sqrt(x_subcheck2 * x_subcheck2 + y_subcheck2 * y_subcheck2);
+
+            if (thisCG_R <= subClusterSize) {
+                xNumer2 += x * energy;
+                yNumer2 += y * energy;
+                Denom2 += energy;
+            }
+        }
+        else if (module_index == 3) {
+            // FCal3
+            double x_subcheck3 = m_cx3 - x;
+            double y_subcheck3 = m_cy3 - y;
+            thisCG_R = sqrt(x_subcheck3 * x_subcheck3 + y_subcheck3 * y_subcheck3);
+
+            if (thisCG_R <= subClusterSize) {
+                xNumer3 += x * energy;
+                yNumer3 += y * energy;
+                Denom3 += energy;
+            }
+        }
+
+    } // End loop over hits in container
+
+    if (fabs(Denom1) > 0.0) {
+        m_x_cc1 = xNumer1 / Denom1;
+        m_y_cc1 = yNumer1 / Denom1;
+    }
+
+    if (fabs(Denom2) > 0.0) {
+        m_x_cc2 = xNumer2 / Denom2;
+        m_y_cc2 = yNumer2 / Denom2;
+    }
+
+    if (fabs(Denom3) > 0.0) {
+        m_x_cc3 = xNumer3 / Denom3;
+        m_y_cc3 = yNumer3 / Denom3;
+    }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Calibration hit analysis
+
+StatusCode LArFCalSamplingFraction::doCalib()
+{
+    StatusCode sc;
+
+    ATH_MSG_DEBUG("Starting FCal Calibration Analysis");
+
+    // Get the calibration hit containers (if any)
+    for (m_calibHitMap_ptr_t i = m_calibHitMap.begin();
+         i != m_calibHitMap.end();
+         i++)
+    {
+        std::string name = (*i).first;
+        const CaloCalibrationHitContainer *container = 0;
+        sc = evtStore()->retrieve(container, name);
+
+        if (sc.isFailure() || container == 0) {
+            ATH_MSG_ERROR("CaloCalibrationHit container was not found");
+            m_numHitsActive = 0;
+            m_numHitsInactive = 0;
+            m_numHitsDead = 0;
+            (*i).second = 0;
+
+            return StatusCode::FAILURE;
+        }
+
+        ATH_MSG_DEBUG("CaloCalibrationHit container successfully retrieved");
+
+        (*i).second = container;
+    }
+
+    // Get the number of hits in each container
+    // (The braces let us re-use the name 'container')
+    {
+        const CaloCalibrationHitContainer *container = m_calibHitMap["LArCalibrationHitActive"];
+
+        if (container != 0)
+            m_numHitsActive = container->Size();
+        else
+            m_numHitsActive = 0;
+    }
+    {
+        const CaloCalibrationHitContainer *container = m_calibHitMap["LArCalibrationHitInactive"];
+
+        if (container != 0)
+            m_numHitsInactive = container->Size();
+        else
+            m_numHitsInactive = 0;
+    }
+    {
+        const CaloCalibrationHitContainer *container = m_calibHitMap["LArCalibrationHitDeadMaterial"];
+
+        if (container != 0)
+            m_numHitsDead = container->Size();
+        else
+            m_numHitsDead = 0;
+    }
+
+    // Loop over all the hit containers, inspecting each hit within the collection
+    for (m_calibHitMap_ptr_t i = m_calibHitMap.begin();
+         i != m_calibHitMap.end();
+         i++)
+    {
+        std::string name = (*i).first;
+        const CaloCalibrationHitContainer *container = (*i).second;
+
+        // Skip rest of loop if it's a null container.
+        if (container == 0)
+            continue;
+
+        // Loop over calibration hits in container
+        for (CaloCalibrationHit* const& calibhit : *container) {
+
+            Identifier identifier = calibhit->cellID();
+            double energy = calibhit->energyTotal();
+
+            // Accumulate energy sums. Use the ID helpers to determine in which
+            // detector the hit took place.
+
+            m_totalCalibrationEnergy += energy;
+            m_totalEmEnergy += calibhit->energyEM();
+            m_totalNonEmEnergy += calibhit->energyNonEM();
+            m_totalInvisibleEnergy += calibhit->energyInvisible();
+            m_totalEscapedEnergy += calibhit->energyEscaped();
+
+            if (name == "LArCalibrationHitActive")
+                m_totalActiveEnergy += energy;
+
+            if (name == "LArCalibrationHitInactive")
+                m_totalInactiveEnergy += energy;
+
+            if (name == "LArCalibrationHitDeadMaterial") {
+                m_totalDeadMaterialEnergy += energy;
+
+                if (m_caloDmID->is_lar(identifier) && (m_caloDmID->sampling(identifier) == 3) && (m_caloDmID->dmat(identifier) == 1))
+                    m_FCalDead += energy;
+            }
+
+            if (m_caloCellID->is_lar_fcal(identifier))
+                FCalCalibAnalysis(name, calibhit);
+
+        } // End loop over calibration hits in container
+    } // End loop over containers
+
+    // Execution completed
+
+    ATH_MSG_DEBUG("doCalib() completed successfully");
+    return sc;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// FCal Analysis with Calibration Hits on
+/// Added by JPA, June 2005
+
+void LArFCalSamplingFraction::FCalCalibAnalysis(const std::string name, const CaloCalibrationHit *CalibHit)
+{
+    Identifier id = CalibHit->cellID();
+    double energy = CalibHit->energyTotal();
+
+    m_totalFCalCalibrationEnergy += energy;
+    //// Added by JPA Feb. 2005
+    m_FCalEm += CalibHit->energyEM();
+    m_FCalNonEm += CalibHit->energyNonEM();
+    m_FCalInvisible += CalibHit->energyInvisible();
+    m_FCalEscaped += CalibHit->energyEscaped();
+
+    if (m_larFCalID->module(id) == 1) {
+        // FCal1
+        m_totalFCal1CalibrationEnergy += energy;
+        m_FCal1Em += CalibHit->energyEM();
+        m_FCal1NonEm += CalibHit->energyNonEM();
+        m_FCal1Invisible += CalibHit->energyInvisible();
+        m_FCal1Escaped += CalibHit->energyEscaped();
+    }
+    else if (m_larFCalID->module(id) == 2) {
+        // FCal2
+        m_totalFCal2CalibrationEnergy += energy;
+        m_FCal2Em += CalibHit->energyEM();
+        m_FCal2NonEm += CalibHit->energyNonEM();
+        m_FCal2Invisible += CalibHit->energyInvisible();
+        m_FCal2Escaped += CalibHit->energyEscaped();
+    }
+    else if (m_larFCalID->module(id) == 3) {
+        // FCal3
+        m_totalFCal3CalibrationEnergy += energy;
+        m_FCal3Em += CalibHit->energyEM();
+        m_FCal3NonEm += CalibHit->energyNonEM();
+        m_FCal3Invisible += CalibHit->energyInvisible();
+        m_FCal3Escaped += CalibHit->energyEscaped();
+    }
+
+    if (name == "LArCalibrationHitActive") {
+        m_FCalActive += energy;
+        m_FCalActiveEm += CalibHit->energyEM();
+        m_FCalActiveNonEm += CalibHit->energyNonEM();
+        m_FCalActiveInvisible += CalibHit->energyInvisible();
+        m_FCalActiveEscaped += CalibHit->energyEscaped();
+
+        if (m_larFCalID->module(id) == 1)
+            m_FCal1Active += energy;
+
+        if (m_larFCalID->module(id) == 2)
+            m_FCal2Active += energy;
+
+        if (m_larFCalID->module(id) == 3)
+            m_FCal3Active += energy;
+    }
+
+    if (name == "LArCalibrationHitInactive") {
+        m_FCalInactive += energy;
+
+        if (m_larFCalID->module(id) == 1)
+            m_FCal1Inactive += energy;
+
+        if (m_larFCalID->module(id) == 2)
+            m_FCal2Inactive += energy;
+
+        if (m_larFCalID->module(id) == 3)
+            m_FCal3Inactive += energy;
+    }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Calculate truth impact position
+
+void LArFCalSamplingFraction::TruthImpactPosition(McEventCollection::const_iterator e)
+{
+    for (HepMC::GenEvent::particle_const_iterator p = (**e).particles_begin();
+         p != (**e).particles_end(); p++)
+    {
+        const HepMC::GenParticle *theParticle = *p;
+
+        // Note: old GenParticles used HepLorentzVectors, now they use HepMC::FourVectors
+
+        // Get the kinematic variables
+        HepMC::FourVector HMCmom = theParticle->momentum();
+        CLHEP::HepLorentzVector momentum(CLHEP::Hep3Vector(HMCmom.px(), HMCmom.py(), HMCmom.pz()), HMCmom.e());
+
+        HepMC::ThreeVector HMC3vec = theParticle->production_vertex()->point3d();
+        HepGeom::Point3D<double> origin = HepGeom::Point3D<double>(HMC3vec.x(), HMC3vec.y(), HMC3vec.z());
+
+        // Put VEta and VPhi into the Ntuple
+        m_vertex_phi = momentum.vect().phi();
+        m_vertex_eta = -log(tan(momentum.vect().theta() / 2));
+
+        if (!finite(m_vertex_eta))
+            m_vertex_eta = 0;
+
+        m_pt = momentum.vect().perp();
+
+        m_px = momentum.px();
+        m_py = momentum.py();
+        m_pz = momentum.pz();
+
+        m_E = momentum.e();
+
+        m_vertx = theParticle->production_vertex()->point3d().x();
+        m_verty = theParticle->production_vertex()->point3d().y();
+        m_vertz = theParticle->production_vertex()->point3d().z();
+
+        // Must get x-offset depending on TB position. The 90.0 mm is from the
+        // initial x-offset of FCal in cryostat. The -15.0 mm is from the
+        // initial y-offset of FCal in cryostat. The second number changes
+        // between different positions (these numbers will be in database soon)
+
+        std::string nickname;
+        double xoffset = 0;
+        double sinangle = 0;
+        double yoffset = 0;
+        const double z1 = -32668.5 * CLHEP::mm; // This is 4668.5 (z=0 to FCal1 Face) + 28000 (B9 to z=0)
+        const double z2 = -33128.3 * CLHEP::mm; // This is 5128.3 (z=0 to FCal1 Face) + 28000 (B9 to z=0)
+        const double z3 = -33602.8 * CLHEP::mm; // This is 5602.8 (z=0 to FCal1 Face) + 28000 (B9 to z=0)
+
+        double shift2 = sinangle * (5128.3 - 4668.5) * CLHEP::mm;
+        double shift3 = sinangle * (5602.8 - 4668.5) * CLHEP::mm;
+
+        // Accounts for rotation of Fcal + cryostat.
+        m_x_mc_cc1 = origin.x() + m_px * z1 / m_pz + xoffset;
+        m_y_mc_cc1 = origin.y() + m_py * z1 / m_pz + yoffset;
+
+        m_x_mc_cc2 = origin.x() + m_px * z2 / m_pz + shift2 + xoffset;
+        m_y_mc_cc2 = origin.y() + m_py * z2 / m_pz + yoffset;
+
+        m_x_mc_cc3 = origin.x() + m_px * z3 / m_pz + shift3 + xoffset;
+        m_y_mc_cc3 = origin.y() + m_py * z3 / m_pz + yoffset;
+
+    } // particles
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// The main FCal analysis method
+
+StatusCode LArFCalSamplingFraction::doFCal()
+{
+    ATH_MSG_INFO("Starting main FCal analysis");
+
+    ATH_MSG_DEBUG("LArFCalSamplingFraction parameters are:");
+    ATH_MSG_DEBUG("Calibration: " << m_calibrationRun);
+
+    StatusCode sc;
+
+    // ACCESSING EVENT INFORMATION
+    // Get the basic event information (run number, event number).
+
+    const EventInfo *eventInfo = 0;
+    sc = evtStore()->retrieve(eventInfo);
+
+    if (sc.isFailure()) {
+        ATH_MSG_ERROR("Could not fetch event information");
+        return sc;
+    }
+
+    const EventID *eventID = eventInfo->event_ID();
+    m_runNumber = eventID->run_number();
+    m_eventNumber = eventID->event_number();
+
+    ATH_MSG_INFO("Run " << m_runNumber << ", event " << m_eventNumber);
+
+    // How to access MC Truth information:
+    const McEventCollection *mcEventCollection;
+    sc = evtStore()->retrieve(mcEventCollection, "TruthEvent");
+
+    if (sc.isSuccess()) {
+        // There can potentially be more than one MC event in the collection.
+        McEventCollection::const_iterator mcEvent;
+        int numMcEvent = 0;
+
+        for (mcEvent = mcEventCollection->begin();
+             mcEvent != mcEventCollection->end();
+             mcEvent++, numMcEvent++)
+            TruthImpactPosition(mcEvent);
+    } // retrieved MC event collection
+    else {
+        ATH_MSG_DEBUG("Run " << m_runNumber << ", event " << m_eventNumber
+                      << ": could not fetch MC event collection");
+    }
+
+    // Accessing Hits
+    // Regular hits
+    std::string FCalContainerName = "LArHitFCAL";
+    const LArHitContainer *container = 0;
+    sc = evtStore()->retrieve(container, FCalContainerName);
+
+    if (sc.isFailure() || container == 0) {
+        ATH_MSG_ERROR("LArHitFCAL container was not found");
+        m_numHitsFCal = 0;
+        return StatusCode::FAILURE;
+    }
+
+    ATH_MSG_DEBUG("LArHitFCAL container successfully retrieved");
+
+    // Get the number of hits in the LArHitFCAL container
+    m_numHitsFCal = container->size();
+    ATH_MSG_INFO("NumHitsFCal = " << m_numHitsFCal);
+
+    if (m_numHitsFCal > 0) {
+        // Calculate the center of gravity
+        FCalHitCenter(container);
+        FCalClusterCenter(container);
+    }
+
+    // Loop over hits in container
+    for (LArHit* const& hit : *container) {
+
+        GeoLArHit fcalhit(*hit);
+
+        // Added by JPA to get particle id for each hit
+        const McEventCollection *mcEventCollection;
+        sc = evtStore()->retrieve(mcEventCollection, "TruthEvent");
+
+        if (sc.isSuccess()) {
+            // There can potentially be more than one MC event in the collection
+            McEventCollection::const_iterator mcEvent;
+            int numParticles = 0;
+
+            for (mcEvent = mcEventCollection->begin();
+                 mcEvent != mcEventCollection->end();
+                 mcEvent++)
+            {
+                // There may be many particles per event
+                for (HepMC::GenEvent::particle_const_iterator p = (**mcEvent).particles_begin();
+                     p != (**mcEvent).particles_end();
+                     p++)
+                {
+                    const HepMC::GenParticle *theParticle = *p;
+                    m_pdg_id->push_back(theParticle->pdg_id());
+                    numParticles++;
+                }
+            }
+        } // retrieved MC event collection
+
+        // End JPA particle id
+
+        if ((!fcalhit) || (!fcalhit.getDetDescrElement()->is_lar_fcal())) {
+            ATH_MSG_ERROR("GeoFCalHit is not defined");
+        }
+
+        double energy = fcalhit.Energy();
+        int module_index = fcalhit.getDetDescrElement()->getLayer();
+        m_totalFCalEnergy += energy;
+
+        if (module_index == 1) {
+            m_FCal1_SumE += energy;
+            FillCellInfo(fcalhit, m_cell1_E, m_hit_x1, m_hit_y1, m_hit_ieta1, m_hit_iphi1, m_NCell1);
+        }
+        else if (module_index == 2) {
+            m_FCal2_SumE += energy;
+            FillCellInfo(fcalhit, m_cell2_E, m_hit_x2, m_hit_y2, m_hit_ieta2, m_hit_iphi2, m_NCell2);
+        }
+        else if (module_index == 3) {
+            m_FCal3_SumE += energy;
+            FillCellInfo(fcalhit, m_cell3_E, m_hit_x3, m_hit_y3, m_hit_ieta3, m_hit_iphi3, m_NCell3);
+        }
+    } // End loop over hits in container
+
+    // Calibration hit analysis.
+    if (m_calibrationRun)
+        CHECK(doCalib());
+
+    ATH_MSG_DEBUG("doFCal() completed successfully");
+
+    return StatusCode::SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Fill FCal cell information
+
+void LArFCalSamplingFraction::FillCellInfo(const GeoLArHit &fcalhit, std::vector<double> *cell_E,
+                                           std::vector<double> *hit_x, std::vector<double> *hit_y,
+                                           std::vector<double> *hit_ieta, std::vector<double> *hit_iphi,
+                                           int &NCell)
+{
+    const double energy = fcalhit.Energy();
+
+    //const FCALTile *tile = fcalhit.getTile();
+    const double hitx = fcalhit.getDetDescrElement()->x(); //tile->getX();
+    const double hity = fcalhit.getDetDescrElement()->y(); //tile->getY();
+    const double hiteta = 7;                               //tile->getIndexI();
+    const double hitphi = 7;                               //tile->getIndexJ();
+
+    bool cellHit = true;
+
+    if (NCell != 0) {
+        for (int icell = 0; icell < NCell; icell++) {
+            if ((hitx == hit_x->at(icell)) && (hity == hit_y->at(icell))) {
+                cellHit = false;
+                cell_E->at(icell) += energy;
+                break;
+            }
+        }
+    }
+
+    if (cellHit) {
+        cell_E->push_back(energy);
+        hit_x->push_back(hitx);
+        hit_y->push_back(hity);
+        hit_ieta->push_back(hiteta);
+        hit_iphi->push_back(hitphi);
+        NCell += 1;
+    }
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+/// Execute (event by event)
+
+StatusCode LArFCalSamplingFraction::execute()
+{
+    ATH_MSG_DEBUG(" in execute()");
+
+    m_eventNumber++;
+
+    // Initialize first before processing each event
+    StatusCode sc = initEvent();
+
+    if (sc.isFailure())
+        ATH_MSG_WARNING("initEvent failed. Continue");
+
+    sc = doFCal();
+
+    sc = addEventInfo();
+
+    if (sc.isFailure()) {
+        ATH_MSG_WARNING("Failure in getEventInfo() ");
+        return StatusCode::SUCCESS;
+    }
+
+    m_tree_AS->Fill();
+
+    return StatusCode::SUCCESS;
+}
+
+
+StatusCode LArFCalSamplingFraction::addEventInfo()
+{
+    ATH_MSG_DEBUG("in addEventInfo()");
+
+    // This code has been taken from AnalysisExamples/VFitZmmOnAOD
+    // I have the actual EventNumber, but skipped the sequential count of event #
+
+    // Get EventInfo for run and event number
+    const EventInfo *eventInfo;
+    StatusCode sc = evtStore()->retrieve(eventInfo);
+
+    if (sc.isFailure()) {
+        ATH_MSG_WARNING("Could not retrieve event info");
+        return sc;
+    }
+
+    const EventID *myEventID = eventInfo->event_ID();
+
+    m_runNumber = myEventID->run_number();
+    m_eventNumber = myEventID->event_number();
+    ATH_MSG_DEBUG("event " << m_eventNumber);
+
+    m_eventTime = myEventID->time_stamp();
+    m_lumiBlock = myEventID->lumi_block();
+    m_bCID = myEventID->bunch_crossing_id();
+
+    const EventType *myEventType = eventInfo->event_type();
+
+    if (myEventType != 0)
+        m_eventWeight = myEventType->mc_event_weight();
+
+    else
+        m_eventWeight = -999;
+
+    return StatusCode::SUCCESS;
+}
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.h b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.h
new file mode 100644
index 0000000000000000000000000000000000000000..6d53b40e7bdb3752c45368594391dae376735fa8
--- /dev/null
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.h
@@ -0,0 +1,225 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef LAR_FCAL_SAMPLING_FRACTION_H
+#define LAR_FCAL_SAMPLING_FRACTION_H
+
+// C++ stdlib
+#include <string>
+
+// ATLAS Software
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "CLHEP/Units/SystemOfUnits.h"
+#include "GaudiKernel/ITHistSvc.h"
+#include "GaudiKernel/ObjectVector.h"
+#include "GaudiKernel/ToolHandle.h"
+#include "GeneratorObjects/McEventCollection.h"
+#include "GeoAdaptors/GeoLArHit.h"
+#include "LArSimEvent/LArHit.h"
+#include "LArSimEvent/LArHitContainer.h"
+#include "StoreGate/StoreGateSvc.h"
+
+class JetCollection;
+class ISvcLocator;
+class StoreGateSvc;
+class LArFCAL_ID;
+class CaloDM_ID;
+class CaloCell_ID;
+class LArHitContainer;
+class CaloCalibrationHit;
+class CaloCalibrationHitContainer;
+class CaloDetDescrManager;
+class TCECollection;
+class TCEnergies;
+
+
+class LArFCalSamplingFraction : public AthAlgorithm
+{
+public:
+    LArFCalSamplingFraction(const std::string &name, ISvcLocator *pSvcLocator);
+    ~LArFCalSamplingFraction();
+
+    virtual StatusCode initialize();
+    virtual StatusCode finalize();
+    virtual StatusCode execute();
+    virtual StatusCode initEvent();
+    StatusCode doFCal();
+    void TruthImpactPosition(McEventCollection::const_iterator);
+
+    void FCalCalibAnalysis(const std::string name, const CaloCalibrationHit *CalibHit);
+    void FCalClusterCenter(const LArHitContainer *container);
+    void FCalHitCenter(const LArHitContainer *container);
+    void FillCellInfo(const GeoLArHit &fcalhit, std::vector<double> *cell_E,
+                      std::vector<double> *hit_x, std::vector<double> *hit_y,
+                      std::vector<double> *hit_ieta, std::vector<double> *hit_iphi,
+                      int &NCell);
+    StatusCode doCalib();
+
+private:
+    /** methods called by execute() */
+
+    // To add event info to new ntuple (used to go by default in CollectionTree)
+    StatusCode addEventInfo();
+
+private:
+    /** A handle on the Hist/TTree registration service */
+    ITHistSvc *m_thistSvc;
+
+    /** A handle on Store Gate for access to the Event Store */
+    StoreGateSvc *m_storeGate;
+
+    /** Athena-Aware Ntuple (AAN) variables - branches of the AAN TTree */
+    TTree *m_tree_AS;
+
+    unsigned int m_runNumber;
+    unsigned int m_eventNumber;
+    unsigned int m_eventTime;
+    unsigned int m_lumiBlock;
+    unsigned int m_bCID;
+    double m_eventWeight;
+    unsigned int m_statusElement;
+
+    /* ----- FCal-related variables ----- */
+    double m_vertx; // x-position for vertex generated particle (beam)
+    double m_verty;
+    double m_vertz;
+
+    double m_vertex_eta; // eta value of generated particle
+    double m_vertex_phi;
+
+    double m_pt; // Momentum of generated particle
+    double m_px;
+    double m_py;
+    double m_pz;
+
+    double m_E; // Energy of generated particle
+
+    int m_NCell1; // Number of cells hit
+    int m_NCell2;
+    int m_NCell3;
+
+    double m_x_mc_cc1; // Center of cluster in x (FCal1, extrapolated)
+    double m_y_mc_cc1;
+
+    double m_x_mc_cc2; // Center of cluster in x (FCal2, extrapolated)
+    double m_y_mc_cc2;
+
+    double m_x_mc_cc3; // Center of cluster in x (FCal3, extrapolated)
+    double m_y_mc_cc3;
+
+    double m_x_cc1; // Center of cluster in x (FCal1, c of g)
+    double m_y_cc1;
+
+    double m_x_cc2; // Center of cluster in x (FCal2, c of g)
+    double m_y_cc2;
+
+    double m_x_cc3; // Center of cluster in x (FCal3, c of g)
+    double m_y_cc3;
+
+    std::vector<int> *m_pdg_id;  // particle id
+
+    std::vector<double> *m_hit_x1; // hit positions of cells
+    std::vector<double> *m_hit_y1;
+
+    std::vector<double> *m_hit_x2;
+    std::vector<double> *m_hit_y2;
+
+    std::vector<double> *m_hit_x3;
+    std::vector<double> *m_hit_y3;
+
+    std::vector<double> *m_hit_ieta1; // hit indices of cells
+    std::vector<double> *m_hit_iphi1;
+    std::vector<double> *m_hit_ieta2;
+    std::vector<double> *m_hit_iphi2;
+    std::vector<double> *m_hit_ieta3;
+    std::vector<double> *m_hit_iphi3;
+
+    std::vector<double> *m_cell1_E; // Energy in cells
+    std::vector<double> *m_cell2_E;
+    std::vector<double> *m_cell3_E;
+
+    double m_FCal1_SumE; // Energy in individual FCal modules
+    double m_FCal2_SumE;
+    double m_FCal3_SumE;
+    double m_TCScint_E;
+    double m_TCIron_E;
+
+    double m_totalFCalEnergy;
+    int m_numHitsFCal;
+
+    /* ----- Calibration Hits Variables ----- */
+    double m_totalCalibrationEnergy; // Total energy
+
+    // Physic processes
+    double m_totalEmEnergy;
+    double m_totalNonEmEnergy;
+    double m_totalInvisibleEnergy;
+    double m_totalEscapedEnergy;
+
+    // Energy deposited in different material categories
+    double m_totalActiveEnergy;
+    double m_totalInactiveEnergy;
+    double m_totalDeadMaterialEnergy;
+
+    // Number of hits in different material categories
+    int m_numHitsActive;
+    int m_numHitsInactive;
+    int m_numHitsDead;
+
+    // Total energy deposited in the different FCal Modules
+    double m_totalFCalCalibrationEnergy; // Energy in all FCal
+    double m_totalFCal1CalibrationEnergy;
+    double m_totalFCal2CalibrationEnergy;
+    double m_totalFCal3CalibrationEnergy;
+
+    double m_FCalActive;
+    double m_FCalInactive;
+    double m_FCalDead;
+    double m_FCalActiveEm;
+    double m_FCalActiveNonEm;
+    double m_FCalActiveInvisible;
+    double m_FCalActiveEscaped;
+    double m_FCalEm;
+    double m_FCal1Em;
+    double m_FCal2Em;
+    double m_FCal3Em;
+    double m_FCalNonEm;
+    double m_FCal1NonEm;
+    double m_FCal2NonEm;
+    double m_FCal3NonEm;
+    double m_FCalInvisible;
+    double m_FCal1Invisible;
+    double m_FCal2Invisible;
+    double m_FCal3Invisible;
+    double m_FCalEscaped;
+    double m_FCal1Escaped;
+    double m_FCal2Escaped;
+    double m_FCal3Escaped;
+    double m_PhysTotE;
+    double m_FCal1Active;
+    double m_FCal2Active;
+    double m_FCal3Active;
+    double m_FCal1Inactive;
+    double m_FCal2Inactive;
+    double m_FCal3Inactive;
+
+    const CaloDM_ID *m_caloDmID;
+    const CaloCell_ID *m_caloCellID;
+    const LArFCAL_ID *m_larFCalID;
+
+    // For LAr analysis: Do we have any calibration hits at all?
+    bool m_calibrationRun;
+
+    // In order to write some clever loops, store all the hit containers
+    // of a given type in a map.
+    typedef std::map<std::string, const CaloCalibrationHitContainer *> m_calibHitMap_t;
+    typedef m_calibHitMap_t::iterator m_calibHitMap_ptr_t;
+    m_calibHitMap_t m_calibHitMap;
+
+    // Variables needed for cluster centers
+    double m_cx1, m_cx2, m_cx3;
+    double m_cy1, m_cy2, m_cy3;
+};
+
+#endif // LAR_FCAL_SAMPLING_FRACTION_H
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx
index 0e53abcbf6445ab2180841457ab44adc22660110..7c029e5df85006a43d0a11e9781233dd34a39655 100755
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/components/CaloSamplingFractionAnalysis_entries.cxx
@@ -1,10 +1,13 @@
 #include "GaudiKernel/DeclareFactoryEntries.h"
 
 #include "../LarEMSamplingFraction.h"
+#include "../LArFCalSamplingFraction.h"
 
 DECLARE_ALGORITHM_FACTORY( LarEMSamplingFraction )
+DECLARE_ALGORITHM_FACTORY( LArFCalSamplingFraction )
 
 DECLARE_FACTORY_ENTRIES( CaloSamplingFractionAnalysis ) {
   DECLARE_ALGORITHM( LarEMSamplingFraction )
+  DECLARE_ALGORITHM( LArFCalSamplingFraction )
 }
 
diff --git a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintSDOptions.h b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintSDOptions.h
index bc1d50af4dfbca52fd12ae831a61bb40e067d11b..990c67d475d013915e111981eaf959ddaf8beddd 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintSDOptions.h
+++ b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintSDOptions.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef MINBIASSCINTILLATOR_MINBIASSCINTSDOPTIONS_h
@@ -11,6 +11,9 @@
  But now that there are real tools, that setup is not necessary
  */
 
+//CLHEP headers
+#include "CLHEP/Units/SystemOfUnits.h"
+
 #include <string>
 #include <vector>
 
@@ -20,6 +23,8 @@ struct MinBiasScintSDOptions {
         : timeCut(350.5),
           tileTB(false),
           doBirk(true),
+          birk1(0.0130 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2)),
+          birk2(9.6e-6 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2) * CLHEP::g / (CLHEP::MeV * CLHEP::cm2)),
           doTOFCorrection(true),
           verboseLevel(0),
           rDBAccessSvcName("RDBAccessSvc"),
@@ -42,6 +47,9 @@ struct MinBiasScintSDOptions {
     bool tileTB;
     /** Flag to enable Birk's law */
     bool doBirk;
+    /** Birks Law parameters - exp. values from NIM 80 (1970) 239-244 */
+    double birk1;
+    double birk2;
     /** Flag to apply TOF correction (subtract Time Of Flight from ATLAS center) */
     bool doTOFCorrection;
     /** Helper to keep the same verbosity everywhere */
diff --git a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSD.cc b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSD.cc
index 98aa133fa3d52abb99935be05593d404321bbcbf..0914c7b754cfcecb75cdad0cb11a3c09dc769808 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSD.cc
+++ b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSD.cc
@@ -312,8 +312,6 @@ G4double MinBiasScintillatorSD::BirkLaw(const G4Step* aStep) const {
   // RKB = 0.013  g/(MeV*cm**2)  and  C = 9.6e-6  g**2/((MeV**2)(cm**4))
   //
   const G4String myMaterial("Scintillator");
-  const G4double birk1(0.0130 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
-  const G4double birk2(9.6e-6 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2) * CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
 
   const G4double destep(aStep->GetTotalEnergyDeposit() * aStep->GetTrack()->GetWeight());
   //  doesn't work with shower parameterization
@@ -326,14 +324,14 @@ G4double MinBiasScintillatorSD::BirkLaw(const G4Step* aStep) const {
   // ---  and materials other than scintillator  ---
   if ( (charge != 0.) && (material->GetName() == myMaterial)) { //FIXME checking for non-equality for a floating point number
 
-    G4double rkb = birk1;
+    G4double rkb = m_options.birk1;
     // --- correction for particles with more than 1 charge unit ---
     // --- based on alpha particle data (only apply for MODEL=1) ---
     if (fabs(charge) > 1.0) {
       rkb *= 7.2 / 12.6;
     }
     const G4double dedx = destep / (aStep->GetStepLength()) / (material->GetDensity());
-    const G4double response = destep / (1. + rkb * dedx + birk2 * dedx * dedx);
+    const G4double response = destep / (1. + rkb * dedx + m_options.birk2 * dedx * dedx);
     if (-2 == verboseLevel) {
       G4cout << " Destep: " << destep / CLHEP::keV << " keV" << " response after Birk: " << response / CLHEP::keV
              << " keV" << G4endl;
diff --git a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSDTool.cc b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSDTool.cc
index 2f788e539d932e7e73836fc406e835b364a24b2e..28d14e15c95255f97210b36c967e1cd311b4d678 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSDTool.cc
+++ b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/src/MinBiasScintillatorSDTool.cc
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //************************************************************
@@ -19,6 +19,8 @@ MinBiasScintillatorSDTool::MinBiasScintillatorSDTool(const std::string& type, co
   declareProperty( "TimeCut" , m_options.timeCut );
   declareProperty( "TileTB" , m_options.tileTB );
   declareProperty( "DoBirk" , m_options.doBirk );
+  declareProperty( "Birk1", m_options.birk1 );
+  declareProperty( "Birk2", m_options.birk2 );
   declareProperty( "DoTOFCorrection" , m_options.doTOFCorrection );
 
 }
diff --git a/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.cc b/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.cc
index e35425bc9aad6551dfbd7759acb2bdb6eaa6eaba..e66ba16dd846efa60817379cfd9a9bfc45041fff 100644
--- a/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.cc
+++ b/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.cc
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //************************************************************
@@ -65,6 +65,8 @@ TileGeoG4SDCalc::TileGeoG4SDCalc(const std::string& name, ISvcLocator *pSvcLocat
   declareProperty( "TileTB" , m_options.tileTB );
   declareProperty( "Ushape" , m_options.Ushape );
   declareProperty( "DoBirk" , m_options.doBirk );
+  declareProperty( "birk1", m_birk1);
+  declareProperty( "birk2", m_birk2);
   declareProperty( "DoTileRow" , m_options.doTileRow );
   declareProperty( "DoTOFCorrection" , m_options.doTOFCorrection );
 }
@@ -858,10 +860,6 @@ G4double TileGeoG4SDCalc::BirkLaw(const G4Step* aStep) const
   // RKB = 0.013  g/(MeV*cm**2)  and  C = 9.6e-6  g**2/((MeV**2)(cm**4))
 
   const G4String myMaterial = "Scintillator";
-  const G4double birk1 = 0.0130 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2);
-  const G4double birk2 = 9.6e-6 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2) * CLHEP::g / (CLHEP::MeV * CLHEP::cm2);
-  G4double response = 0.;
-
   const G4double destep = aStep->GetTotalEnergyDeposit() * aStep->GetTrack()->GetWeight();
   //  doesn't work with shower parameterisation
   //  G4Material* material = aStep->GetTrack()->GetMaterial();
@@ -872,15 +870,16 @@ G4double TileGeoG4SDCalc::BirkLaw(const G4Step* aStep) const
   // --- no saturation law for neutral particles ---
   // ---  and materials other than scintillator  ---
   if ( (charge != 0.) && (material->GetName() == myMaterial)) {
-    G4double rkb = birk1;
-    // --- correction for particles with more than 1 charge unit ---
-    // --- based on alpha particle data (only apply for MODEL=1) ---
-    if (fabs(charge) > 1.0)
-      rkb *= 7.2 / 12.6;
-
+    G4double response = 0.;
     if (aStep->GetStepLength() != 0) {
-      G4double dedx = destep / (aStep->GetStepLength()) / (material->GetDensity());
-      response = destep / (1. + rkb * dedx + birk2 * dedx * dedx);
+      G4double rkb = m_birk1;
+      // --- correction for particles with more than 1 charge unit ---
+      // --- based on alpha particle data (only apply for MODEL=1) ---
+      if (fabs(charge) > 1.0) {
+        rkb *= 7.2 / 12.6;
+      }
+      const G4double dedx = destep / (aStep->GetStepLength()) / (material->GetDensity());
+      response = destep / (1. + rkb * dedx + m_birk2 * dedx * dedx);
     }
     else {
       ATH_MSG_DEBUG("BirkLaw() - Current Step in scintillator has zero length." << "Ignore Birk Law for this Step");
diff --git a/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.hh b/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.hh
index 1cfb4014ebe8d7799900d9b225698a2cf495b520..f9f0a9108af9cf3de2ab5bb1292c9ff38425bf50 100644
--- a/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.hh
+++ b/TileCalorimeter/TileG4/TileGeoG4SD/src/TileGeoG4SDCalc.hh
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //************************************************************
@@ -33,6 +33,9 @@
 // Geant4 headers
 #include "G4Types.hh"
 
+//CLHEP headers
+#include "CLHEP/Units/SystemOfUnits.h"
+
 // STL headers
 #include <vector>
 #include <memory>
@@ -107,6 +110,8 @@ private:
 
   TileSDOptions m_options;
 
+  double m_birk1{0.0130 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2)}; //exp. values from NIM 80 (1970) 239-244;
+  double m_birk2{9.6e-6 * CLHEP::g / (CLHEP::MeV * CLHEP::cm2) * CLHEP::g / (CLHEP::MeV * CLHEP::cm2)}; //exp. values from NIM 80 (1970) 239-244;
 
   /** @brief granularity in time for hits */
   mutable double m_deltaT; // FIXME set during initialize, then reset during MakePmtEdepTime
diff --git a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h
index 30fb9144a11169d3ea092b346036de9a8cbcbc00..8b2ff36b1c7b486f0046c6039840e2f96d4f5e1a 100644
--- a/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h
+++ b/TileCalorimeter/TileRecAlgs/TileRecAlgs/TileCellSelector.h
@@ -47,6 +47,8 @@ class TileCellSelector: public AthAlgorithm {
     unsigned int m_const;
     unsigned int m_overLG;
     unsigned int m_overHG;
+    unsigned int m_underLG;
+    unsigned int m_underHG;
     unsigned int m_dqerr;
     unsigned int m_dmuerr;
     unsigned int m_warnerr;
@@ -127,6 +129,12 @@ class TileCellSelector: public AthAlgorithm {
     bool m_checkDMUs;
     bool m_checkOverLG;
     bool m_checkOverHG;
+    bool m_checkUnderLG;
+    bool m_checkUnderHG;
+    float m_overflowLG;
+    float m_overflowHG;
+    float m_underflowLG;
+    float m_underflowHG;
     bool m_checkWarning;
     bool m_checkError;
     bool m_printOnly;
diff --git a/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py b/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py
index b931dbb007ab12863e9a66d00ddb04f0de8ef307..eea0837b8d121dce6855d92120bfa3806b305ebb 100644
--- a/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py
+++ b/TileCalorimeter/TileRecAlgs/share/jobOptions_TileEventSelector.py
@@ -297,9 +297,15 @@ seq.TileSelector.CheckDCS=TileUseDCS
 seq.TileSelector.SkipMBTS=True
 seq.TileSelector.CheckDMUs=True
 seq.TileSelector.CheckJumps=True
+seq.TileSelector.OverflowLG=1022.9
 seq.TileSelector.CheckOverLG=True
+seq.TileSelector.UnderflowLG=0.1
+seq.TileSelector.CheckUnderHG=False
+seq.TileSelector.OverflowHG=1021.9
 seq.TileSelector.CheckOverHG=False
-seq.TileSelector.MaxVerboseCnt=10000
+seq.TileSelector.UnderflowHG=2.1
+seq.TileSelector.CheckUnderLG=False
+seq.TileSelector.MaxVerboseCnt=20
 seq.TileSelector.OutputLevel=1
 
 # get a handle on the job main sequence                                         
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx
index beb24117984a403b5a3d451815843147c093e90d..a3185cbc38ca1b89de90a90e8c0a798691877bba 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellSelector.cxx
@@ -48,6 +48,8 @@ TileCellSelector::TileCellSelector(const std::string& name, ISvcLocator* pSvcLoc
   , m_const(0)
   , m_overLG(0)
   , m_overHG(0)
+  , m_underLG(0)
+  , m_underHG(0)
   , m_dqerr(0)
   , m_dmuerr(0)
   , m_warnerr(0)
@@ -129,6 +131,12 @@ TileCellSelector::TileCellSelector(const std::string& name, ISvcLocator* pSvcLoc
   declareProperty( "CheckDMUs",    m_checkDMUs  = true);   // global flag which allows to swithc on/off DMU checks
   declareProperty( "CheckOverLG"  ,m_checkOverLG = true);  // select events with overflow in low gain
   declareProperty( "CheckOverHG",  m_checkOverHG = false); // select events with overflow in high gain
+  declareProperty( "CheckUnderLG", m_checkUnderLG = false); // select events with underflow in low gain
+  declareProperty( "CheckUnderHG", m_checkUnderHG = false); // select events with underflow in high gain
+  declareProperty( "OverflowLG",   m_overflowLG  = 1021.9); // threshold for overflow in low gain
+  declareProperty( "OverflowHG",   m_overflowHG  = 1021.9); // threshold for overflow in high gain
+  declareProperty( "UnderflowLG",  m_underflowLG = 2.1);    // threshold for underflow in low gain
+  declareProperty( "UnderflowHG",  m_underflowHG = 2.1);    // threshold for underflow in high gain
 
   declareProperty( "CheckWarning", m_checkWarning = false); // select events with warning status in TileCal status word
   declareProperty( "CheckError",   m_checkError = false);   // select events with error status in TileCal status word
@@ -171,6 +179,12 @@ StatusCode TileCellSelector::initialize() {
   ATH_MSG_INFO( "CheckDMUs " << ((m_checkDMUs) ? "true" : "false"));
   ATH_MSG_INFO( "CheckOverLG " << ((m_checkOverLG) ? "true" : "false"));
   ATH_MSG_INFO( "CheckOverHG " << ((m_checkOverHG) ? "true" : "false"));
+  ATH_MSG_INFO( "CheckUnderLG " << ((m_checkUnderLG) ? "true" : "false"));
+  ATH_MSG_INFO( "CheckUnderHG " << ((m_checkUnderHG) ? "true" : "false"));
+  ATH_MSG_INFO( "OverflowLG " << m_overflowLG);
+  ATH_MSG_INFO( "OverflowHG " << m_overflowHG);
+  ATH_MSG_INFO( "UnderflowLG " << m_underflowLG);
+  ATH_MSG_INFO( "UnderflowHG " << m_underflowHG);
 
   ATH_MSG_INFO( "SkipEmpty " << ((m_skipEmpty) ? "true" : "false"));
   ATH_MSG_INFO( "SkipMasked " << ((m_skipMasked) ? "true" : "false"));
@@ -1378,6 +1392,8 @@ StatusCode TileCellSelector::execute() {
       int nDmuErr = 0;
       int nOverLG = 0;
       int nOverHG = 0;
+      int nUnderLG = 0;
+      int nUnderHG = 0;
 
       TileDigitsContainer::const_iterator collItr=digits_container->begin();
       TileDigitsContainer::const_iterator lastColl=digits_container->end();
@@ -1536,20 +1552,39 @@ StatusCode TileCellSelector::execute() {
               }
             }
 
-            if (dmax > 1022.99 && (!err)  // overflow without bad patterns
+            if ((!err)  // channel without bad patterns
                 && (useCh)                // normal connected channel
                 && (badname[0] == 0 || badname[1] == 'w' // no digital error
                 || (badname[4] == 'Q' && !m_skipMasked))) { // error from TileCell but it is ignored
 
-              m_chanSel[hash] = true; // always print overflows
+              if (adc) { // HG
 
-              if (adc) {
-                if (m_checkOverHG){
-                  ++nOverHG;
+                if (dmax > m_overflowHG) {
+                  m_chanSel[hash] = true; // always print overflows
+                  if (m_checkOverHG){
+                    ++nOverHG;
+                  }
                 }
-              } else {
-                if (m_checkOverLG) {
-                  ++nOverLG;
+                if (dmin < m_underflowHG) {
+                  m_chanSel[hash] = true; // always print underflows
+                  if (m_checkUnderHG){
+                    ++nUnderHG;
+                  }
+                }
+
+              } else { // LG
+
+                if (dmax > m_overflowLG) {
+                  m_chanSel[hash] = true; // always print overflows
+                  if (m_checkOverLG){
+                    ++nOverLG;
+                  }
+                }
+                if (dmin < m_underflowLG) {
+                  m_chanSel[hash] = true; // always print underflows
+                  if (m_checkUnderLG){
+                    ++nUnderLG;
+                  }
                 }
               }
             }
@@ -1738,7 +1773,8 @@ StatusCode TileCellSelector::execute() {
             } else if (m_chanSel[hash]) {
               bool accEmin = (m_chanEne[hash] < m_minEneChan[ch_type]);
               bool accEmax = (m_chanEne[hash] > m_maxEneChan[ch_type]);
-              bool jumpOve = (dmax>1022.9);
+              bool jumpOve = (dmax > 1022.9);
+              bool jumpZer = (dmin < 0.1);
               ATH_MSG_VERBOSE(evtnum.str()
                               << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId)
                               << enename << m_chanEne[hash] << "  samp = " << fdigits[0]
@@ -1749,6 +1785,7 @@ StatusCode TileCellSelector::execute() {
                               << cellname << badname
                               << ((accEmin) ? " neg_e" : "")
                               << ((accEmax) ? " pos_e" : "")
+                              <<((jumpZer) ? " underflow" : "")
                               <<((jumpOve) ? " overflow" : "") );
             }
 
@@ -1872,6 +1909,7 @@ StatusCode TileCellSelector::execute() {
                 bool accEmin = (m_chanEne[hash]<m_minEneChan[ch_type]);
                 bool accEmax = (m_chanEne[hash]>m_maxEneChan[ch_type]);
                 bool jumpOve = (dmax > 1022.9);
+                bool jumpZer = (dmin < 0.1);
 
                 ATH_MSG_VERBOSE(evtnum.str()
                                 << " chan " << std::left << std::setw(14) << m_tileHWID->to_string(adcId)
@@ -1883,6 +1921,7 @@ StatusCode TileCellSelector::execute() {
                                 << cellname << badname
                                 << ((accEmin) ? " neg_e" : "")
                                 << ((accEmax) ? " pos_e" : "")
+                                << ((jumpZer) ? " underflow" : "")
                                 << ((jumpOve) ? " overflow" : "") );
 
               }
@@ -1930,6 +1969,20 @@ StatusCode TileCellSelector::execute() {
                       << " n_overflow_HG = " << nOverHG
                       << " accepted");
       }
+      if (nUnderLG) {
+        ++m_underLG;
+        statusOk = true;
+        ATH_MSG_DEBUG( nevtnum.str()
+                      << " n_underflow_LG = " << nUnderLG
+                      << " accepted");
+      }
+      if (nUnderHG) {
+        ++m_underHG;
+        statusOk = true;
+        ATH_MSG_DEBUG(nevtnum.str()
+                      << " n_underflow_HG = " << nUnderHG
+                      << " accepted");
+      }
       if (nDmuErr) {
         ++m_dmuerr;
         statusOk = true;
@@ -2041,6 +2094,7 @@ StatusCode TileCellSelector::finalize() {
                 << "," << m_maxCell << "/" << m_maxChan
                 << "," << m_jump << "/" << m_const
                 << "," << m_overLG << "/" << m_overHG
+                << "," << m_underLG << "/" << m_underHG
                 << "," << m_dqerr << "/" << m_dmuerr
                 << "," << m_warnerr << ") events.");
 
diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx
index 0a6801f40aa507d7b209c6b9a0da379502c37558..13dc12acbfb598c7de834695ea8b492c6413e4ad 100644
--- a/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx
+++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx
@@ -321,7 +321,7 @@ void TileROD_Decoder::unpack_frag0(uint32_t version, const uint32_t* p, pDigiVec
   // Digitizer mode doesn't change between events
   static int digiMode = -1;
   
-  if (digiMode < 0) { // try to find digi mode until good mode is found
+  if (digiMode < 0 && size > 0) { // try to find digi mode until good mode is found
     digiMode = m_d2Bytes.getDigiMode(data, chipCount, blockSize);
   }
   
diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py
index f88fc7e961b91916c5a4bdc010b3ee95ae12c38f..5f474c3325693b39ccae5dbfec258ed5a481e0c4 100644
--- a/Tools/PROCTools/python/RunTier0TestsTools.py
+++ b/Tools/PROCTools/python/RunTier0TestsTools.py
@@ -15,7 +15,7 @@ ciRefFileMap = {
                 # qTestsTier0_required-test
                 'q221-21.0'            : 'v2',
                 'q431-21.0'            : 'v1',
-                'q221-21.3'            : 'v15',
+                'q221-21.3'            : 'v16',
                 'q431-21.3'            : 'v13',
                 # SimulationTier0Test_required-test
                 's3126-21.0'           : 'v2',
diff --git a/Tools/PyJobTransforms/python/trfValidation.py b/Tools/PyJobTransforms/python/trfValidation.py
index 630f5578f3cfa1b8856040724db4be2e29b26fff..d1a2f3bc8282bd3af30707c2be95a48843b1c658 100644
--- a/Tools/PyJobTransforms/python/trfValidation.py
+++ b/Tools/PyJobTransforms/python/trfValidation.py
@@ -263,6 +263,27 @@ class athenaLogFileReport(logFileReport):
         self._dbbytes = 0
         self._dbtime  = 0.0
 
+    ## Generally, a knowledge file consists of non-standard logging error/abnormal lines
+    #  which are left out during log scan and could help diagnose job failures.
+    def knowledgeFileHandler(self, knowledgefile):
+        # load abnormal/error line(s) from the knowledge file(s)
+        linesList = []
+        fullName = trfUtils.findFile(os.environ['DATAPATH'], knowledgefile)
+        if not fullName:
+            msg.warning('Knowledge file {0} could not be found in DATAPATH'.format(knowledgefile))
+        try:
+            with open(fullName) as knowledgeFileHandle:
+                msg.debug('Opened knowledge file {0} from here: {1}'.format(knowledgefile, fullName))
+
+                for line in knowledgeFileHandle:
+                    if line.startswith('#') or line == '' or line =='\n':
+                        continue
+                    line = line.rstrip('\n')
+                    linesList.append(line)
+        except OSError as e:
+            msg.warning('Failed to open knowledge file {0}: {1}'.format(fullName, e))
+        return linesList
+
     def scanLogFile(self, resetReport=False):
         if resetReport:
             self.resetReport()
@@ -290,9 +311,9 @@ class athenaLogFileReport(logFileReport):
                     # But we can check for certain other interesting things, like core dumps
                     if 'Core dump from CoreDumpSvc' in line > -1:
                         msg.warning('Detected CoreDumpSvc report - activating core dump svc grabber')
-                        self.coreDumpSvcParser(myGen, line, lineCounter)
+                        self.coreDumpSvcParser(log, myGen, line, lineCounter)
                         continue
-                    # Add the G4 exceptipon parsers
+                    # Add the G4 exception parsers
                     if 'G4Exception-START' in line > -1:
                         msg.warning('Detected G4 exception report - activating G4 exception grabber')
                         self.g4ExceptionParser(myGen, line, lineCounter, 40)
@@ -420,12 +441,21 @@ class athenaLogFileReport(logFileReport):
         return {'level': firstName, 'nLevel': firstLevel, 'firstError': firstError}
 
     ## @brief Attempt to suck a core dump report from the current logfile
-    # @note: Current implementation just eats lines until a 'normal' line is seen.
+    # This function scans logs in two different directions:
+    # 1) downwards, to exctract information after CoreDrmpSvc; and 2) upwards, to find abnormal lines
+    # @note: Current downwards scan just eats lines until a 'normal' line is seen.
     # There is a slight problem here in that the end of core dump trigger line will not get parsed
     # TODO: fix this (OTOH core dump is usually the very last thing and fatal!)
-    def coreDumpSvcParser(self, lineGenerator, firstline, firstLineCount):
+    def coreDumpSvcParser(self, log, lineGenerator, firstline, firstLineCount):
+        abnormalLinesList = self.knowledgeFileHandler('coreDumpKnowledgeFile.db')
         _eventCounter = _run = _event = _currentAlgorithm = _functionLine = _currentFunction = None
         coreDumpReport = 'Core dump from CoreDumpSvc'
+        linesToBeScaned = 50
+        seenAbnormalLines = []
+        abnormalLinesReport = {}
+        lastNormalLineReport = {}
+        coreDumpDetailsReport = {}
+
         for line, linecounter in lineGenerator:
             m = self._regExp.match(line)
             if m == None:
@@ -454,7 +484,10 @@ class athenaLogFileReport(logFileReport):
                 if '<signal handler called>' in line:
                     _functionLine = linecounter+1
                 if _functionLine and linecounter is _functionLine:
-                    _currentFunction = line
+                    if ' in ' in line:
+                        _currentFunction = 'Current Function: ' + line.split(' in ')[1].split()[0]
+                    else:
+                        _currentFunction = 'Current Function: ' + line.split()[1]
             else:
                 # Can this be done - we want to push the line back into the generator to be
                 # reparsed in the normal way (might need to make the generator a class with the
@@ -466,13 +499,54 @@ class athenaLogFileReport(logFileReport):
         _run = 'Run: unknown' if not _run else _run
         _event = 'Evt: unknown' if not _event else _event
         _currentAlgorithm = 'Current algorithm: unknown' if not _currentAlgorithm else _currentAlgorithm
-        _currentFunction = 'Current Function: unknown' if not _currentFunction else 'Current Function: '+_currentFunction.split(' in ')[1].split()[0]
+        _currentFunction = 'Current Function: unknown' if not _currentFunction else _currentFunction
         coreDumpReport = '{0}: {1}; {2}; {3}; {4}; {5}'.format(coreDumpReport, _eventCounter, _run, _event, _currentAlgorithm, _currentFunction)
 
+        ## look up for lines before core dump for "abnormal" and "last normal" line(s)
+
+        #  make a list of last e.g. 50 lines before core dump
+        #  A new "line generator" is required to give access to the upper lines
+        linesList = []
+        lineGen = trfUtils.lineByLine(log)
+        for line, linecounter in lineGen:
+            if linecounter in range(firstLineCount - linesToBeScaned, firstLineCount-1):
+                linesList.append([linecounter, line])
+            elif linecounter == firstLineCount:
+                break
+
+        for linecounter, line in reversed(linesList):
+            if re.findall(r'|'.join(abnormalLinesList), line):
+                seenLine = False
+                for dic in seenAbnormalLines:
+                    # count repetitions or similar (e.g. first 15 char) abnormal lines
+                    if dic['message'] == line or dic['message'][0:15] == line[0:15]:
+                        dic['count'] += 1
+                        seenLine = True
+                        break
+                if seenLine is False:
+                    seenAbnormalLines.append({'message': line, 'firstLine': linecounter, 'count': 1})
+            else:
+                if line != '':
+                    lastNormalLineReport = {'message': line, 'firstLine': linecounter, 'count': 1}
+                    break
+                else:
+                    continue
+
+        # write the list of abnormal lines into a dictionary to report
+        # The keys of each abnormal line are labeled by a number starting with 0
+        # e.g. first abnormal line's keys are :{'meesage0', 'firstLine0', 'count0'}
+        for a in range(len(seenAbnormalLines)):
+            abnormalLinesReport.update({'message{0}'.format(a): seenAbnormalLines[a]['message'], 'firstLine{0}'.format(a): seenAbnormalLines[a]['firstLine'], 'count{0}'.format(a): seenAbnormalLines[a]['count']})
+        coreDumpDetailsReport = {'abnormalLine(s) before CoreDump': abnormalLinesReport, 'lastNormalLine before CoreDump': lastNormalLineReport}
+
+        # concatenate an extract of first seen abnormal line to the core dump message
+        if len(seenAbnormalLines) > 0:
+            coreDumpReport += '; Abnormal line(s) seen just before core dump: ' + seenAbnormalLines[0]['message'][0:30] + '...[truncated] ' + '(see the jobReport)'
+
         # Core dumps are always fatal...
         msg.debug('Identified core dump - adding to error detail report')
         self._levelCounter['FATAL'] += 1
-        self._errorDetails['FATAL'].append({'message': coreDumpReport, 'firstLine': firstLineCount, 'count': 1})
+        self._errorDetails['FATAL'].append({'moreDetails': coreDumpDetailsReport, 'message': coreDumpReport, 'firstLine': firstLineCount, 'count': 1})
 
     def g494ExceptionParser(self, lineGenerator, firstline, firstLineCount):
         g4Report = firstline
@@ -488,7 +562,7 @@ class athenaLogFileReport(logFileReport):
                     msg.warning('G4 exception closing string not found within {0} log lines of line {1}'.format(g4lines, firstLineCount))
                     break
 
-        # G4 exceptions can be fatal or they can be warnings...
+        # G4 exceptions can be errors or they can be warnings...
         msg.debug('Identified G4 exception - adding to error detail report')
         if "just a warning" in g4Report:
             if self._levelCounter['WARNING'] <= self._msgLimit:
@@ -497,8 +571,8 @@ class athenaLogFileReport(logFileReport):
             elif self._levelCounter['WARNING'] == self._msgLimit + 1:
                 msg.warning("Found message number {0} at level WARNING - this and further messages will be supressed from the report".format(self._levelCounter['WARNING']))
         else:
-            self._levelCounter['FATAL'] += 1
-            self._errorDetails['FATAL'].append({'message': g4Report, 'firstLine': firstLineCount, 'count': 1})
+            self._levelCounter['ERROR'] += 1
+            self._errorDetails['ERROR'].append({'message': g4Report, 'firstLine': firstLineCount, 'count': 1})
 
     def g4ExceptionParser(self, lineGenerator, firstline, firstLineCount, g4ExceptionLineDepth):
         g4Report = firstline
@@ -513,7 +587,7 @@ class athenaLogFileReport(logFileReport):
                 msg.warning('G4 exception closing string not found within {0} log lines of line {1}'.format(g4lines, firstLineCount))
                 break
 
-        # G4 exceptions can be fatal or they can be warnings...
+        # G4 exceptions can be errors or they can be warnings...
         msg.debug('Identified G4 exception - adding to error detail report')
         if "-------- WWWW -------" in g4Report:
             if self._levelCounter['WARNING'] <= self._msgLimit:
@@ -522,8 +596,8 @@ class athenaLogFileReport(logFileReport):
             elif self._levelCounter['WARNING'] == self._msgLimit + 1:
                 msg.warning("Found message number {0} at level WARNING - this and further messages will be supressed from the report".format(self._levelCounter['WARNING'])) 
         else:
-            self._levelCounter['FATAL'] += 1
-            self._errorDetails['FATAL'].append({'message': g4Report, 'firstLine': firstLineCount, 'count': 1})
+            self._levelCounter['ERROR'] += 1
+            self._errorDetails['ERROR'].append({'message': g4Report, 'firstLine': firstLineCount, 'count': 1})
 
     def pythonExceptionParser(self, lineGenerator, firstline, firstLineCount):
         pythonExceptionReport = ""
diff --git a/Tools/PyJobTransforms/share/coreDumpKnowledgeFile.db b/Tools/PyJobTransforms/share/coreDumpKnowledgeFile.db
new file mode 100644
index 0000000000000000000000000000000000000000..02c1c72b7d9f735d0fe56774f12d9b57482d3c77
--- /dev/null
+++ b/Tools/PyJobTransforms/share/coreDumpKnowledgeFile.db
@@ -0,0 +1,18 @@
+# A knowledge file consist of abnormal lines  
+#
+# The main goal of reporting abnormal line(s) before core dump is to 
+# improve error reporting for exe65 with "Segmentation fault"
+# 
+# These abnormal lines normally do not appeare in successful jobs
+# and they don't have the standard logging structure
+#
+# List of abnormal lines:
+warn\s+\[frontier(.*)
+TBufferFile::CheckObject:0:\s(.*)
+Error\s+in\s<TExMap::Remove>:\s(.*)
+G4GDecay3::GetThreeBodyMomenta:\s(.*)
+generateSCMmuonAbsorption:\sGetThreeBodyMomenta\(\)\sfailed(.*)
+Failed\sretrieving\stool!!
+Warning:\spTpythia\swas\snegative
+tcmalloc:\slarge\salloc(.*)
+
diff --git a/Tools/PyJobTransforms/test/test_trfValidation.py b/Tools/PyJobTransforms/test/test_trfValidation.py
index 76364aad5546f6bc76d8b7adbef82fe3bd1597e2..292a3b345bd2f74c354beb38049ef04135564422 100755
--- a/Tools/PyJobTransforms/test/test_trfValidation.py
+++ b/Tools/PyJobTransforms/test/test_trfValidation.py
@@ -505,6 +505,78 @@ class athenaLogFileReportTests(unittest.TestCase):
 16:32:37 IOVDbSvc                                             INFO Total payload read from COOL: 123 bytes in ((    4.56 ))s
 16:32:39 IOVDbSvc                                             INFO Total payload read from COOL: 456 bytes in ((    7.89 ))s'''
 
+        testCoreDumpAbNormalLine ='''
+00:49:51 RelationalDatabase Info Release number backward compatibility - NO SCHEMA EVOLUTION REQUIRED: database with OLDER release number 2.2.2 will be opened using CURRENT client release number 3.1.8
+00:49:51 2018-07-04 00:45:52,400 IOVDbSvc             INFO HVS tag OFLCOND-MC16-SDR-16 resolved to ExtDCSMagnetsSensorData-001 for folder /EXT/DCS/MAGNETS/SENSORDATA
+00:49:51 2018-07-04 00:45:52,416 IOVDbSvc             INFO HVS tag OFLCOND-MC16-SDR-16 resolved to MDTDCSDROPPEDCH_2010_Run158116 for folder /MDT/DCS/DROPPEDCH
+00:49:51 2018-07-04 00:45:52,433 IOVDbSvc             INFO HVS tag OFLCOND-MC16-SDR-16 resolved to MDTDCSPSLVCHSTATE_RUN12_MC16_01 for folder /MDT/DCS/PSLVCHSTATE
+00:49:51 2018-07-04 00:45:53,471 IOVDbSvc             INFO HVS tag OFLCOND-MC16-SDR-16 resolved to PixDCSFSMState-SIM-RUN124-000-00 for folder /PIXEL/DCS/FSMSTATE
+00:49:51 warn  [frontier.c:1014]: Request 76 on chan 7 failed at Wed Jul  4 00:45:59 2018: -9 [fn-socket.c:125]: connect to 138.253.60.41 timed out after 5 seconds
+00:49:51 warn  [frontier.c:1114]: Trying next proxy lcgsquid.shef.ac.uk with same server lcgft-atlas.gridpp.rl.ac.uk
+00:49:51 -------------------------------------------------------------------------------------
+00:49:51 Core dump from CoreDumpSvc on r21-n20.ph.liv.ac.uk at Wed Jul  4 00:46:24 2018
+00:49:51 
+00:49:51 Caught signal 11(Segmentation fault). Details:
+00:49:51   errno = 0, code = 1 (address not mapped to object)
+00:49:51   pid   = 4, uid = 0
+00:49:51   value = (1069839440, 0x7ffe3fc47450)
+00:49:51   vmem = 1442.31 MB
+00:49:51   rss  = 265.988 MB
+00:49:51   total-ram = 48257.4 MB
+00:49:51   free-ram  = 286.988 MB
+00:49:51   buffer-ram= 31.6758 MB
+00:49:51   total-swap= 32075 MB
+00:49:51   free-swap = 29365.3 MB
+00:49:51   addr  = 0x4
+00:49:51 
+00:49:51 Event counter: 0
+00:49:51 EventID:
+00:49:51 Last incident: BkgEvent_2548_SG:StoreCleared
+00:49:51 Current algorithm: <NONE>
+00:49:51 Algorithm stack: <EMPTY>
+00:49:51 -------------------------------------------------------------------------------------
+00:49:51 | AtlasBaseDir :                         /cvmfs/atlas.cern.ch/repo/sw/software/21.0 |
+00:49:51 | AtlasVersion :                                                            21.0.71 |
+00:49:51 | CMTCONFIG    :                                              x86_64-slc6-gcc62-opt |
+00:49:51 -------------------------------------------------------------------------------------
+00:49:51  Note: to see line numbers in below stacktrace you might consider running following :
+00:49:51   atlasAddress2Line --file <logfile>
+00:49:51 -------------------------------------------------------------------------------------
+00:49:51 
+00:49:51  *** Break *** segmentation violation
+00:49:51 
+00:49:51 
+00:49:51 
+00:49:51 ===========================================================
+00:49:51 There was a crash.
+00:49:51 This is the entire stack trace of all threads:
+00:49:51 ===========================================================
+00:49:51 #0  0x00002afccfc2b86d in waitpid () from /lib64/libc.so.6
+00:49:51 #1  0x00002afccfbbd479 in do_system () from /lib64/libc.so.6
+00:49:51 #2  0x00002afccfbbd7b0 in system () from /lib64/libc.so.6
+00:49:51 #3  0x00002afcd6863868 in TUnixSystem::StackTrace() () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/LCG_88/ROOT/6.08.06/x86_64-slc6-gcc62-opt/lib/libCore.so
+00:49:51 #4  0x00002afcd6865d7c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/LCG_88/ROOT/6.08.06/x86_64-slc6-gcc62-opt/lib/libCore.so
+00:49:51 #5  0x00002afcef419c10 in CoreDumpSvcHandler::action(int, siginfo*, void*) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/Athena/21.0.71/InstallArea/x86_64-slc6-gcc62-opt/lib/libAthenaServices.so
+00:49:51 #6  <signal handler called>
+00:49:51 #7  frontierHttpClnt_usinglastproxyingroup (c=c
+00:49:51 entry=0x27a94000) at fn-htclient.c:904
+00:49:51 #8  0x00002afce97b7e6a in frontier_postRawData (u_channel=657625312, uri=0x31e5c100 "Frontier/type=frontier_request:1:DEFAULT&encoding=BLOBzip5&p1=eNplj0EKAyEMRa8Ssi7FOnTpImimIzg6GKF05f1vUSu0o3QRyH--JyTCgW2BgzLHUmNy7B2QAE4EL99Eoccc6KD5dvPBjQtG8PPP8UE3V15SfZTid.7uoBHWnHZAKoGk2pRCWkN1Vv"..., body=body
+00:49:51 entry=0x0) at frontier.c:1066
+        '''
+
+        testCoreDumpAbnormalPattern = '''
+10:15:20 Error in <TProtoClass::FindDataMember>: data member with index 0 is not found in class Identifier
+10:15:20 Error in <CreateRealData>: Cannot find data member # 0 of class Identifier for parent TileTrigger!
+10:15:20 Error in <TExMap::Remove>: key 980837730 not found at 305
+10:15:20 TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837730 pointer will be 0
+10:15:20 Error in <TExMap::Remove>: key 980837731 not found at 306
+10:15:20 TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837731 pointer will be 0
+10:15:20 -------------------------------------------------------------------------------------
+10:15:20 Core dump from CoreDumpSvc on t-cn0130.hpc2n.umu.se at Thu Nov  7 10:14:44 2019
+18:16:06 -------------------------------------------------------------------------------------
+18:16:06 Caught signal 11(Segmentation fault). Details:
+        '''
+
         with open('file1', 'w') as f1:
             print >> f1, 'This is test file 1 w/o meaning'
         with open('file2', 'w') as f2:
@@ -527,6 +599,10 @@ class athenaLogFileReportTests(unittest.TestCase):
         with open('file10', 'w') as f10:
             print >> f10, testLogExcerptMP
             print >> f10, testErrorExcerptMP
+        with open('file11', 'w') as f11:
+            print >> f11, testCoreDumpAbNormalLine
+        with open('file12', 'w') as f12:
+            print >> f12, testCoreDumpAbnormalPattern
 
         self.myFileReport1 = athenaLogFileReport('file1')
         self.myFileReport2 = athenaLogFileReport('file2')
@@ -538,9 +614,11 @@ class athenaLogFileReportTests(unittest.TestCase):
         self.myFileReport8 = athenaLogFileReport('file8')
         self.myFileReport9 = athenaLogFileReport('file9')
         self.myFileReport10 = athenaLogFileReport('file10')
+        self.myFileReport11 = athenaLogFileReport('file11')
+        self.myFileReport12 = athenaLogFileReport('file12')
 
     def tearDown(self):
-        for f in 'file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7', 'file8', 'file9', 'file10',\
+        for f in 'file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7', 'file8', 'file9', 'file10', 'file11', 'file12',\
                  'logWithSubstepNameSerial', 'logWithSubstepNameMP':
             try:
                 os.unlink(f)
@@ -624,11 +702,13 @@ ManagedAthenaTileMon reported an ERROR, but returned a StatusCode "SUCCESS"'''
 
     def test_coreDumpCurAlg(self):
         self.assertEqual(self.myFileReport6.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL,
-                                                           'firstError': {'count': 1, 'firstLine': 4,
-                                                               'message': 'Segmentation fault: Event counter: 41; Run: 204158; Evt: 70319934; Current algorithm: MuonCreatorAlg; Current Function: G4VoxelNavigation::ComputeStep'}})
+                                                           'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {}, 'lastNormalLine before CoreDump': {'message': 'ToolSvc.CombinedMuonTrackBuilder                  WARNING standaloneRefit:: no outer material', 'firstLine': 2, 'count': 1}}, 'message': 'Segmentation fault: Event counter: 41; Run: 204158; Evt: 70319934; Current algorithm: MuonCreatorAlg; Current Function: G4VoxelNavigation::ComputeStep', 'firstLine': 4, 'count': 1}})
         self.assertEqual(self.myFileReport7.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL,
-                                                           'firstError': {'count': 1, 'firstLine': 4,
-                                                                          'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown'}})
+                                                            'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {}, 'lastNormalLine before CoreDump': {'message': 'ToolSvc.CombinedMuonTrackBuilder                  WARNING standaloneRefit:: no outer material', 'firstLine': 2, 'count': 1}}, 'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown', 'firstLine': 4, 'count': 1}})
+        self.assertEqual(self.myFileReport11.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL,
+                                                            'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {'message0': 'warn  [frontier.c:1114]: Trying next proxy lcgsquid.shef.ac.uk with same server lcgft-atlas.gridpp.rl.ac.uk', 'firstLine0': 8, 'count0': 2}, 'lastNormalLine before CoreDump': {'message': 'IOVDbSvc             INFO HVS tag OFLCOND-MC16-SDR-16 resolved to PixDCSFSMState-SIM-RUN124-000-00 for folder /PIXEL/DCS/FSMSTATE', 'firstLine': 6, 'count': 1}}, 'message': 'Segmentation fault: Event counter: 0; Run: unknown; Evt: unknown; Current algorithm: <NONE>; Current Function: frontierHttpClnt_usinglastproxyingroup; Abnormal line(s) seen just before core dump: warn  [frontier.c:1114]: Tryin...[truncated] (see the jobReport)', 'firstLine': 10, 'count': 1}})
+        self.assertEqual(self.myFileReport12.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL,
+                                                            'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {'message0': 'TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837731 pointer will be 0', 'firstLine0': 7, 'count0': 2, 'message1': 'Error in <TExMap::Remove>: key 980837731 not found at 306', 'firstLine1': 6, 'count1': 2}, 'lastNormalLine before CoreDump': {'message': 'Error in <CreateRealData>: Cannot find data member # 0 of class Identifier for parent TileTrigger!', 'firstLine': 3, 'count': 1}}, 'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown; Abnormal line(s) seen just before core dump: TBufferFile::CheckObject:0: Ru...[truncated] (see the jobReport)', 'firstLine': 9, 'count': 1}})
 
     def test_dbMonitor(self):
         print self.myFileReport9 
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx
index 459ddd00d5ce85ea47922430d7c201882e364863..91c42e325a30c598d9f5dff31024bf3f827208ac 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx
@@ -628,6 +628,11 @@ void AnalysisConfig_Ntuple::loop() {
 			selectTracks<TruthParticleContainer>( &selectorTruth, "");
 			foundTruth = true;
 		}
+		else if (m_provider->evtStore()->contains<xAOD::TruthParticleContainer>("TruthParticles")) {
+		        /// anything else?
+		        selectTracks<xAOD::TruthParticleContainer>( &selectorTruth, "TruthParticles");
+		        foundTruth = true;
+		}
 		else { 
 			m_provider->msg(MSG::WARNING) << "Truth not found - none whatsoever!" << endmsg; 
 		}
@@ -791,13 +796,10 @@ void AnalysisConfig_Ntuple::loop() {
 
 	selectorRef.clear();
 
-#ifdef XAODTRACKING_TRACKPARTICLE_H
-	if (m_provider->evtStore()->contains<xAOD::TrackParticleContainer>("InDetTrackParticles")) {
+	if      (m_provider->evtStore()->contains<xAOD::TrackParticleContainer>("InDetTrackParticles")) {
 	  selectTracks<xAOD::TrackParticleContainer>( &selectorRef, "InDetTrackParticles" );
 	}
-	else
-#endif
-	if (m_provider->evtStore()->contains<Rec::TrackParticleContainer>("TrackParticleCandidate")) {
+	else if (m_provider->evtStore()->contains<Rec::TrackParticleContainer>("TrackParticleCandidate")) {
 	  selectTracks<Rec::TrackParticleContainer>( &selectorRef, "TrackParticleCandidate" );
         }
 	else { 
@@ -984,11 +986,9 @@ void AnalysisConfig_Ntuple::loop() {
 	  if (m_provider->evtStore()->contains<Rec::TrackParticleContainer>(collection_test)) {
 	    found = selectTracks<Rec::TrackParticleContainer>( &selectorTest, collectionname );
 	  }
-#ifdef XAODTRACKING_TRACKPARTICLE_H
 	  else if (m_provider->evtStore()->contains<xAOD::TrackParticleContainer>(collection_test)) {
 	    found = selectTracks<xAOD::TrackParticleContainer>( &selectorTest, collectionname );
 	  }
-#endif
 	  else if (m_provider->evtStore()->contains<TrigInDetTrackCollection>(collection_test)) {
 	    found = selectTracks<TrigInDetTrackCollection>( &selectorTest, collectionname );
 	  }
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt
index 398dedf0996e7d5d1f9d8b9af090eaf659a0970c..51a746c57c0db49715f0853e3d653cf2170a758d 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/CMakeLists.txt
@@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC
 			  Event/xAOD/xAODMuon
 			  Event/xAOD/xAODEgamma
 			  Event/xAOD/xAODTau
+			  Event/xAOD/xAODTruth
                           Tracking/TrkEvent/TrkParameters
                           Tracking/TrkEvent/TrkTrack
                           Tracking/TrkEvent/TrkTrackSummary
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h
index 6d88673dac50e1cce24a482be86a2384aad364fb..908adce343245f9f335e43c4169d14180c30020d 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TrigTrackSelector.h
@@ -33,6 +33,8 @@
 #include "HepMC/GenVertex.h"
 #include "HepMC/GenParticle.h"
 
+#include "xAODTruth/TruthParticleContainer.h"
+
 ///// stuff *merely* to get the particle charge!!!
 /// #include "HepPDT/ParticleData.hh"
 /// #include "HepMC/ParticleDataTable.h"
@@ -72,8 +74,11 @@ class TrigTrackSelector : public TrackSelector {
 
 public:
 
-  //  TrigTrackSelector( bool (*selector)(const TIDA::Track*)=NULL ) : TrackSelector(selector) {  } 
-  TrigTrackSelector( TrackFilter* selector );
+  /// use 47 mm as radius - this corresponds to the inner radius of the pixel detector in Run 1
+  /// for consistency of the definition for the monitoring between Run 1 and Run 2.
+  /// For Run 3 we should probably use the oportunity to update this at some point to use the 
+  /// inner layer radius of the IBL which is 32 mm
+  TrigTrackSelector( TrackFilter* selector, double radius=47 );
 
   ~TrigTrackSelector() { clear(); }
 
@@ -106,6 +111,9 @@ public:
   // extract all the tracks from a TrackParticle collection and add them
   void selectTracks( const TruthParticleContainer* truthtracks );
 
+  // extract all the tracks from a TrackParticle collection and add them
+  void selectTracks( const xAOD::TruthParticleContainer* truthtracks );
+
 
   // add a TruthParticle from a GenParticle - easy, bet it doesn't work 
   bool selectTrack( const HepMC::GenParticle* track );
@@ -117,6 +125,8 @@ public:
   // add a TruthParticle 
   bool selectTrack( const TruthParticle* track );
 
+  bool selectTrack( const xAOD::TruthParticle* track );
+
 
   // make a TIDA::Track from a GenParticle 
   TIDA::Track* makeTrack( const HepMC::GenParticle* track );
@@ -160,6 +170,8 @@ private:
 
   bool m_correctTrkTracks;
 
+  double m_radius;
+
 };
 
 
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx
index 77de4f87d2ca7eec25c4113c757a7d630c84c44f..a4b373a51da19d356213d898d13131db57183a0d 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx
@@ -10,11 +10,12 @@
 
 #include "TrigInDetAnalysisUtils/TrigTrackSelector.h"
 
-  //  TrigTrackSelector( bool (*selector)(const TIDA::Track*)=NULL ) : TrackSelector(selector) {  } 
-TrigTrackSelector::TrigTrackSelector( TrackFilter* selector ) : 
+#include "xAODTruth/TruthVertex.h"
+
+
+TrigTrackSelector::TrigTrackSelector( TrackFilter* selector, double radius ) : 
     TrackSelector(selector), m_id(0), m_xBeam(0), m_yBeam(0), m_zBeam(0),
-    //m_first(true),
-    m_correctTrkTracks(false) {  } 
+    m_correctTrkTracks(false), m_radius(radius) {  } 
 
 
 bool TrigTrackSelector::selectTrack( const TrigInDetTrack* track, const TrigInDetTrackTruthMap* truthMap ) {     
@@ -33,7 +34,7 @@ bool TrigTrackSelector::selectTrack( const TrigInDetTrack* track, const TrigInDe
 	double dpT     = track->param()->epT(); 
 	double dd0     = track->param()->ea0();
 
-	double theta = 2*std::atan( exp( (-1)*eta ) );
+	double theta = 2*std::atan( std::exp( -eta ) );
 	correctToBeamline( z0, dz0, d0, dd0, theta, phi );
 	
 	int   algoid  = track->algorithmId(); 	      
@@ -279,6 +280,25 @@ void TrigTrackSelector::selectTracks( const TruthParticleContainer* truthtracks
 }
 
 
+// extract all the tracks from a TrackParticle collection and add them
+void TrigTrackSelector::selectTracks( const xAOD::TruthParticleContainer* truthtracks ) { 
+    
+  xAOD::TruthParticleContainer::const_iterator  trackitr = truthtracks->begin();
+  xAOD::TruthParticleContainer::const_iterator  trackend = truthtracks->end();
+  
+  while ( trackitr!=trackend ) { 
+    
+      selectTrack( *trackitr );
+      
+      trackitr++;
+
+  } // loop over tracks
+    
+}
+
+
+
+
 
 // add a TruthParticle from a GenParticle - easy, bet it doesn't work 
 bool TrigTrackSelector::selectTrack( const HepMC::GenParticle* track ) {
@@ -317,6 +337,141 @@ bool TrigTrackSelector::selectTrack( const TruthParticle* track ) {
 }
 
 
+// add an xAOD::TruthParticle 
+bool TrigTrackSelector::selectTrack( const xAOD::TruthParticle* track ) { 
+
+    if ( track ) { 
+	    
+      /// lazy just to avoid a find-replace of measPer to track
+      const xAOD::TruthParticle* measPer = track;
+
+      double pT    = measPer->pt(); 
+      double eta   = measPer->eta();
+      double phi   = measPer->phi();
+  
+      // AAARCH!!!!! the TrackParticle pT is NOT SIGNED!!!! ( I ask you! ) 
+      if ( measPer->charge()<0 && pT>0 ) pT *= -1;
+
+      /// need to calculate the origin, and the beamline, and the d0 and z0 
+      /// with respect to the beamline
+      /// leave this in until we have checked whether everything is implemented correctly
+      //      double xbeam = getBeamX(); // track->vx(); 
+      //      double ybeam = getBeamY(); // track->vy(); 
+      //      double zbeam = getBeamZ(); // track->vz(); 
+      
+      if ( !track->hasProdVtx() ) return false; 
+
+      /// need to calculate d0 and z0 correctly.
+
+      double xp[3] = { measPer->prodVtx()->x(), measPer->prodVtx()->y(), measPer->prodVtx()->z() };
+
+      double theta = 2*std::atan( std::exp( -eta ) );
+      double z0 = xp[2] - (xp[0]*std::cos(phi) + xp[1]*std::sin(phi))/std::tan(theta);
+      double d0 = xp[1]*std::cos(phi) -  xp[0]*std::sin(phi);
+      
+      double xd[3] = { 0, 0, 0 };
+      
+      if ( track->hasDecayVtx() ) { 
+	xd[0] = track->decayVtx()->x();
+	xd[1] = track->decayVtx()->y();
+	xd[2] = track->decayVtx()->z();
+      }
+      
+      double rp = std::sqrt( xp[0]*xp[0] + xp[1]*xp[1] ); 
+      double rd = std::sqrt( xd[0]*xd[0] + xd[1]*xd[1] ); 
+      
+      
+      bool final_state = false; 
+      
+      /// the is our new "final state" requirement
+      /// the inner and outer radii are in some sense 
+      /// arbitrary - these correspond to an envelope
+      /// around the pixel detector, so the track must 
+      /// pass through the entire pixel detector 
+      /// NB: In order to ensure you don't miss any 
+      ///     tracks they really need to be the same
+      ///     ie if a track brems in your "volume"
+      ///     then you will miss that track, and
+      ///     also the resulting track, even if it is
+      ///     a high et track  
+      const double inner_radius = m_radius; /// was hardcoded as 47 - now this can be set from the constructor
+      const double outer_radius = m_radius;
+      if ( (  track->hasProdVtx() && rp<=inner_radius ) && 
+	   ( !track->hasDecayVtx() || rd>outer_radius ) ) final_state = true; 
+      
+      /// leave this in for the moment - we may need to uncomment this afterall
+      //    if ( track->status() == 3 ) final_state = false;         /// check its not a documentation particle
+      
+      if ( !final_state ) return 0; 
+    
+      double deta = 0;
+      double dphi = 0;
+      double dz0  = 0;
+      double dd0  = 0;
+
+      double dpT  = 0; 
+
+      int nBlayerHits = 0;
+      int nPixelHits  = 0;
+      int nSctHits    = 0;
+      int nStrawHits  = 0;
+      int nTrtHits    = 0;
+      
+      double chi2 = 0;
+      double dof  = 0;
+
+      bool expectBL = false;
+
+      nSctHits   += 0;
+      nPixelHits += 0;
+
+      /// get the total number of holes as well
+      int nSiHits     = 0;
+
+      unsigned long id = (unsigned long)track;
+
+      unsigned bitmap = 0;
+
+      int trackAuthor = 0;
+
+#if 0
+      std::cout << "\t\t\tSUTT TP track" 
+		<< "\teta=" << eta  
+		<< "\tphi=" << phi  
+		<< "\tz0="  << z0 
+		<< "\tpT="  << pT 
+		<< "\td0="  << d0
+		<< "\tfitter=" << fitter
+		<< "\tauthor=" << trackAuthor
+		<< "\tVTX x " << xp[0]<< "\ty " << xp[1] << "\tz " << xp[2] 
+		<< std::endl;
+#endif	
+
+      // Create and save Track
+      
+      TIDA::Track* t = new TIDA::Track( eta,   phi,  z0,  d0,  pT, chi2, dof,
+		 		        deta,  dphi, dz0, dd0, dpT,
+				        nBlayerHits, nPixelHits, nSctHits, nSiHits,
+				        nStrawHits,  nTrtHits,   bitmap, 0,
+				        trackAuthor,  false, -1, -1,  
+				        expectBL, id) ;  
+
+      /// useful debug info - leave in
+      //      std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl; 
+      
+      if ( !addTrack( t ) ){
+	delete t;
+	return false;
+      }
+      return true;
+      
+    }
+    return false;
+     
+}
+
+
+
 // make a TIDA::Track from a GenParticle 
 TIDA::Track* TrigTrackSelector::makeTrack( const HepMC::GenParticle* track ) { 
     unsigned long id = (unsigned long)track;
@@ -340,7 +495,6 @@ TIDA::Track* TrigTrackSelector::makeTrack( const TruthParticle* track, unsigned
     double xp[3] = { 0, 0, 0 };
 
     if ( track->genParticle()->production_vertex() ) { 
-      // std::cout << "ptr->production_vertex() " << ptr->production_vertex() << std::endl;
       xp[0] = track->genParticle()->production_vertex()->point3d().x();
       xp[1] = track->genParticle()->production_vertex()->point3d().y();
       xp[2] = track->genParticle()->production_vertex()->point3d().z();
@@ -354,8 +508,7 @@ TIDA::Track* TrigTrackSelector::makeTrack( const TruthParticle* track, unsigned
 
 
     // CHANGED BY JK - z0 with respect to (0,0)
-    //    double z0 = xp[2];
-    double theta = 2*std::atan( exp( (-1)*eta ) );
+    double theta = 2*std::atan( std::exp( -eta ) );
     double z0 = xp[2] - (xp[0]*std::cos(phi) + xp[1]*std::sin(phi))/std::tan(theta);
     
     double xd[3] = { 0, 0, 0 };
@@ -384,9 +537,8 @@ TIDA::Track* TrigTrackSelector::makeTrack( const TruthParticle* track, unsigned
     ///     then you will miss that track, and
     ///     also the resulting track, even if it is
     ///     a high et track  
-    const double inner_radius = 47;
-    //    const double outer_radius = 47;
-    const double outer_radius = 47;
+    const double inner_radius = m_radius; /// used to be hardcoded as 47 mm, now can be set in the constructor
+    const double outer_radius = m_radius;
     if ( ( track->genParticle()->production_vertex() && rp<=inner_radius ) && 
 	 ( track->genParticle()->end_vertex()==0 || rd>outer_radius ) ) final_state = true; 
       
@@ -939,7 +1091,6 @@ void TrigTrackSelector::correctToBeamline( double& z0,    double& dz0,
     //   }
     
     
-    //      double theta = 2*std::atan( exp( (-1)*eta ) );
     double z0t = z0 + ((std::cos(phi)*m_xBeam + std::sin(phi)*m_yBeam)/std::tan(theta));    
     double a0t = d0 +   std::sin(phi)*m_xBeam - std::cos(phi)*m_yBeam; 
     
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py
index 50ded42a6a0795b4cead71719965feba770deed7..a5cd1d951df2d8a23668ab9f554082c113d31a4c 100644
--- a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py
@@ -11,7 +11,8 @@
 #==============================================================
 #
 # Required libs:
-import os.path
+import os
+import re
 import threading
 
 import AthenaCommon.Logging as L
@@ -31,11 +32,19 @@ class TmpThr(threading.Thread):
             line = line.lower()
             if ' warning ' in line:
                 maxlevel = max(1,maxlevel)
-            if ' error ' in line and not 'connection refused' in line:
+            if re.search(r"warn\s*\[frontier",line) is not None:
+                # Catch frontier warnings which could contain the word "error" as
+                # frontier will retry connections - full log shown if run in debug
+                msg.info("Caught warning from frontier: %s", line)
+            elif ' error ' in line and not 'connection refused' in line:
                 maxlevel = max(2,maxlevel)
             elif ' fatal ' in line.lower() or 'exception ' in line.lower():
                 maxlevel = max(3,maxlevel)
         output = ''.join(output)
+        output = ('Log file from execution of command:\n'
+               + output
+               + '========================================'
+               + '\nEnd of log file from TrigConf2COOLLib.py')
         if maxlevel==1:
             msg.warning(output)
         elif maxlevel==2:
@@ -44,6 +53,7 @@ class TmpThr(threading.Thread):
             msg.fatal(output)
         else:
             msg.debug(output)
+            msg.info('Successful execution of command')
 
 class TrigConf2CoolSyncSvc(PyAthena.Svc):
     def __init__(self, name="TrigConf2CoolSyncSvc",**kw):
diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/TrigBjetHypo/TrigSuperRoiBuilderAllTE.h b/Trigger/TrigHypothesis/TrigBjetHypo/TrigBjetHypo/TrigSuperRoiBuilderAllTE.h
index 433a9f00610990054f8c904e0f14542dc2501023..6f1506bb74d4993dc3d93c2218b06d84ae4511c0 100755
--- a/Trigger/TrigHypothesis/TrigBjetHypo/TrigBjetHypo/TrigSuperRoiBuilderAllTE.h
+++ b/Trigger/TrigHypothesis/TrigBjetHypo/TrigBjetHypo/TrigSuperRoiBuilderAllTE.h
@@ -40,11 +40,13 @@ class TrigSuperRoiBuilderAllTE : public HLT::AllTEAlgo {
   double m_minJetEt; 
   double m_maxJetEta;
 
-  int m_nJetsMax;        
-  bool m_dynamicMinJetEt;  
-  int m_dynamicNJetsMax;  
+  int    m_nJetsMax;        
+  bool   m_dynamicMinJetEt;  
+  int    m_dynamicNJetsMax;  
   double m_dynamicEtFactor;  
 
+  bool   m_useFullScan;
+
 };
  
 
diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoiBuilderAllTE.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoiBuilderAllTE.cxx
index c25085df37a61a87aa6e13aa974b641eb0f9fc98..9fd9b6c417841fcb2c5eb9bb7f7afee1dfebefd7 100755
--- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoiBuilderAllTE.cxx
+++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigSuperRoiBuilderAllTE.cxx
@@ -34,7 +34,7 @@
 
 
 TrigSuperRoiBuilderAllTE::TrigSuperRoiBuilderAllTE(const std::string & name, ISvcLocator* pSvcLocator) :
-  HLT::AllTEAlgo(name, pSvcLocator)
+  HLT::AllTEAlgo(name, pSvcLocator), m_useFullScan(false)
 {
   declareProperty ("JetInputKey",     m_jetInputKey     = "TrigJetRec");
   declareProperty ("JetOutputKey",    m_jetOutputKey    = "SuperRoi");
@@ -46,6 +46,7 @@ TrigSuperRoiBuilderAllTE::TrigSuperRoiBuilderAllTE(const std::string & name, ISv
   declareProperty ("DynamicMinJetEt", m_dynamicMinJetEt = false); // if (X > -1 && nJets > X) minJetEt = m_minJetEt + (nJets-X)*Y
   declareProperty ("DynamicNJetsMax", m_dynamicNJetsMax = 9999); // variable X above
   declareProperty ("DynamicEtFactor", m_dynamicEtFactor = 0); // variable Y above
+  declareProperty ("UseFullScan",     m_useFullScan     = false ); // use fullscan rather than super Roi
 }
 
 
@@ -69,6 +70,7 @@ HLT::ErrorCode TrigSuperRoiBuilderAllTE::hltInitialize() {
   ATH_MSG_DEBUG( " DynamicMinJetEt = " << m_dynamicMinJetEt );
   ATH_MSG_DEBUG( " DynamicNJetsMax = " << m_dynamicNJetsMax );
   ATH_MSG_DEBUG( " DynamicEtFactor = " << m_dynamicEtFactor );
+  ATH_MSG_DEBUG( " UseFullScan     = " << m_useFullScan     );
 
   return HLT::OK;
 }
@@ -131,82 +133,89 @@ HLT::ErrorCode TrigSuperRoiBuilderAllTE::hltExecute(std::vector<std::vector<HLT:
   ATH_MSG_DEBUG( "Found " << jets->size() << " jets, creating corresponding RoIs" );
 
   // Create a superROI to add all the jet ROIs to.
-  TrigRoiDescriptor* superRoi = new TrigRoiDescriptor();
-  superRoi->setComposite(true);
+  TrigRoiDescriptor* superRoi = new TrigRoiDescriptor( m_useFullScan );
 
   //HLT::TriggerElement* initialTE = config()->getNavigation()->getInitialNode();
   //HLT::TriggerElement* outputTE  = config()->getNavigation()->addNode(initialTE,output);
-
+  
   std::vector<HLT::TriggerElement*> empty;
   HLT::TriggerElement* outputTE = config()->getNavigation()->addNode(empty, output);
-
+  
   outputTE->setActiveState(true);
   std::string key = "";
-
-  int i = 0;
-  for ( xAOD::JetContainer::const_iterator jetitr=jets->begin() ; jetitr!=jets->end() ; jetitr++ ) { 
   
-    ++i;
-    auto jet = *jetitr;
-
-    float jetEt  = jet->p4().Et()*0.001;
-    float jetEta = jet->eta();
-    float jetPhi = jet->phi();
 
-    if (jetEt < m_minJetEt) {
-      ATH_MSG_DEBUG( "Jet "<< i << " below the " << m_minJetEt << " GeV threshold; Et " << jetEt << "; skipping this jet." );
-      continue;
-    }
-
-    if (fabs(jetEta) > m_maxJetEta) {
-      ATH_MSG_DEBUG( "Jet "<< i << " outside the |eta| < " << m_maxJetEta << " requirement; Eta = " << jetEta << "; skipping this jet." );
-      continue;
-    }
+  if ( !m_useFullScan ) { 
    
-    // For high pile-up situations, raise the pT threshold of the jets considered after checking the first N (=m_dynamicNJetsMax) jets
-    if (m_dynamicMinJetEt && i > m_dynamicNJetsMax ) {
-      float dynamicMinJetEt = m_minJetEt + ((i - m_dynamicNJetsMax) * m_dynamicEtFactor); 
-      if (jetEt < dynamicMinJetEt) {
-	ATH_MSG_DEBUG( "Jet "<< i << " below the dynamic " << dynamicMinJetEt << " GeV ( = " 
-		       << m_minJetEt << " + (" << i << " - " << m_dynamicNJetsMax << ") * " << m_dynamicEtFactor << ")"
-		       << " threshold; Et " << jetEt << "; skipping this jet." );
-	continue;
-      }    
-    }
+    superRoi->setComposite(true);
 
-    if (m_nJetsMax > 0 && i > m_nJetsMax) {
-      ATH_MSG_DEBUG( "Maximum allowed jet multiplicity = "<< m_nJetsMax << "; skipping jet " << i << "." );
-      continue;
-    }
-
-    ATH_MSG_DEBUG( "Jet "<< i << "; Et " << jetEt << "; eta "<< jetEta << "; phi " << jetPhi );
-
-    // create RoI correspondinding to the jet
-    double phiMinus = HLT::wrapPhi(jetPhi-m_phiHalfWidth); 
-    double phiPlus  = HLT::wrapPhi(jetPhi+m_phiHalfWidth); 
-    double etaMinus = jetEta-m_etaHalfWidth;  
-    double etaPlus  = jetEta+m_etaHalfWidth;  
-
-    TrigRoiDescriptor* roi =  new TrigRoiDescriptor(jetEta, etaMinus, etaPlus, 
-						    jetPhi, phiMinus, phiPlus );
-
-    ATH_MSG_DEBUG( "Adding ROI descriptor to superROI!" );
-    superRoi->push_back( roi );
-
-    // ConstDataVector<xAOD::JetContainer>* jc = new ConstDataVector<xAOD::JetContainer>(SG::VIEW_ELEMENTS);
-    // jc->clear(SG::VIEW_ELEMENTS); 
-    // jc->push_back ( *jetitr );
-
-    // ... so for the time being do a deep copy
-    xAOD::JetTrigAuxContainer trigJetTrigAuxContainer;
-    xAOD::JetContainer* jc = new xAOD::JetContainer;
-    jc->setStore(&trigJetTrigAuxContainer);
-    jc->push_back ( new xAOD::Jet(**jetitr) );
-
-    HLT::ErrorCode hltStatus = attachFeature(outputTE, jc, m_jetOutputKey); 
-    if (hltStatus != HLT::OK) {
-      msg() << MSG::ERROR << "Failed to attach xAOD::JetContainer (" << m_jetOutputKey << ") as feature jet eta, phi " << jet->eta() << ", " << jet->phi() << endmsg;
-      return hltStatus;
+    
+    int i = 0;
+    for ( xAOD::JetContainer::const_iterator jetitr=jets->begin() ; jetitr!=jets->end() ; jetitr++ ) { 
+      
+      ++i;
+      auto jet = *jetitr;
+      
+      float jetEt  = jet->p4().Et()*0.001;
+      float jetEta = jet->eta();
+      float jetPhi = jet->phi();
+      
+      if (jetEt < m_minJetEt) {
+	ATH_MSG_DEBUG( "Jet "<< i << " below the " << m_minJetEt << " GeV threshold; Et " << jetEt << "; skipping this jet." );
+	continue;
+      }
+      
+      if (fabs(jetEta) > m_maxJetEta) {
+	ATH_MSG_DEBUG( "Jet "<< i << " outside the |eta| < " << m_maxJetEta << " requirement; Eta = " << jetEta << "; skipping this jet." );
+	continue;
+      }
+      
+      // For high pile-up situations, raise the pT threshold of the jets considered after checking the first N (=m_dynamicNJetsMax) jets
+      if (m_dynamicMinJetEt && i > m_dynamicNJetsMax ) {
+	float dynamicMinJetEt = m_minJetEt + ((i - m_dynamicNJetsMax) * m_dynamicEtFactor); 
+	if (jetEt < dynamicMinJetEt) {
+	  ATH_MSG_DEBUG( "Jet "<< i << " below the dynamic " << dynamicMinJetEt << " GeV ( = " 
+			 << m_minJetEt << " + (" << i << " - " << m_dynamicNJetsMax << ") * " << m_dynamicEtFactor << ")"
+			 << " threshold; Et " << jetEt << "; skipping this jet." );
+	  continue;
+	}    
+      }
+      
+      if (m_nJetsMax > 0 && i > m_nJetsMax) {
+	ATH_MSG_DEBUG( "Maximum allowed jet multiplicity = "<< m_nJetsMax << "; skipping jet " << i << "." );
+	continue;
+      }
+      
+      ATH_MSG_DEBUG( "Jet "<< i << "; Et " << jetEt << "; eta "<< jetEta << "; phi " << jetPhi );
+      
+      // create RoI correspondinding to the jet
+      double phiMinus = HLT::wrapPhi(jetPhi-m_phiHalfWidth); 
+      double phiPlus  = HLT::wrapPhi(jetPhi+m_phiHalfWidth); 
+      double etaMinus = jetEta-m_etaHalfWidth;  
+      double etaPlus  = jetEta+m_etaHalfWidth;  
+      
+      TrigRoiDescriptor* roi =  new TrigRoiDescriptor(jetEta, etaMinus, etaPlus, 
+						      jetPhi, phiMinus, phiPlus );
+      
+      ATH_MSG_DEBUG( "Adding ROI descriptor to superROI!" );
+      superRoi->push_back( roi );
+      
+      // ConstDataVector<xAOD::JetContainer>* jc = new ConstDataVector<xAOD::JetContainer>(SG::VIEW_ELEMENTS);
+      // jc->clear(SG::VIEW_ELEMENTS); 
+      // jc->push_back ( *jetitr );
+      
+      // ... so for the time being do a deep copy
+      xAOD::JetTrigAuxContainer trigJetTrigAuxContainer;
+      xAOD::JetContainer* jc = new xAOD::JetContainer;
+      jc->setStore(&trigJetTrigAuxContainer);
+      jc->push_back ( new xAOD::Jet(**jetitr) );
+      
+      HLT::ErrorCode hltStatus = attachFeature(outputTE, jc, m_jetOutputKey); 
+      if (hltStatus != HLT::OK) {
+	msg() << MSG::ERROR << "Failed to attach xAOD::JetContainer (" << m_jetOutputKey << ") as feature jet eta, phi " << jet->eta() << ", " << jet->phi() << endmsg;
+	return hltStatus;
+      }
+      
     }
 
   }
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py
index a4fabdf9f51ba0afd4bb642cb6493f4fc2b1d3e0..fe370bff5fe95da4394f3aa97876ef92a8949c72 100644
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonFlags.py
@@ -134,13 +134,6 @@ class doMinBias(JobProperty):
 	StoredValue=True
 list+=[doMinBias]
 
-class doIDJpsiMon(JobProperty):
-	""" ID JPsi switch for Monitoring """
-	statusOn=True
-	allowdTypes=['bool']
-	StoredValue=True
-list+=[doIDJpsiMon]
-
 class doDump(JobProperty):
 	""" DumpTools switch for monitoring """
 	statusOn=False
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/PackagesToInterrogate.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/PackagesToInterrogate.py
index 94890e608a3eb89ed1a719edf0d4fe02b0a42181..7fa2b3da6345b40d3dfc89cc06d67926ed765f7b 100644
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/PackagesToInterrogate.py
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/PackagesToInterrogate.py
@@ -16,7 +16,6 @@ class PackagesToInterrogate:
         "Bphys"       : { "PackageName" : "TrigBphysMonitoring.TrigBphysMonitoringConfig",     "ToolName" : "TrigBphysMonitoringTool",     "MonitCategoryName" : "TrigBphysMonitoring.TrigBphysMonitCategory",     "Dll" : "TrigBphysMonitoring"},
         "Calo"        : { "PackageName" : "TrigCaloMonitoring.TrigCaloMonitoringConfig",       "ToolName" : "HLTCaloMonitoringTool",       "MonitCategoryName" : "",                                               "Dll" : "TrigCaloMonitoring"},
         "Egamma"      : { "PackageName" : "TrigEgammaMonitoring.TrigEgammaMonitoringConfig",   "ToolName" : "TrigEgammaMonitoringTool",    "MonitCategoryName" : "TrigEgammaMonitoring.TrigEgammaMonitCategory",   "Dll" : "TrigEgammaAnalysisTools"},
-        "IDJpsi"      : { "PackageName" : "TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConfig",   "ToolName" : "TrigIDJpsiMonitoringTool",    "MonitCategoryName" : "",                                               "Dll" : "TrigIDJpsiMonitoring"},
         "IDtrk"       : { "PackageName" : "TrigIDtrkMonitoring.TrigIDtrkMonitoringConfig",     "ToolName" : "TrigIDtrkMonitoringTool",     "MonitCategoryName" : "",                                               "Dll" : "TrigInDetAnalysisExample"},
         "Jet"         : { "PackageName" : "TrigJetMonitoring.TrigJetMonitoringConfig",         "ToolName" : "TrigJetMonitoringTool",       "MonitCategoryName" : "TrigJetMonitoring.TrigJetMonitCategory",         "Dll" : "TrigJetMonitoring"},
         "MET"         : { "PackageName" : "TrigMETMonitoring.TrigMETMonitoringConfig",         "ToolName" : "HLTMETMonitoringTool",        "MonitCategoryName" : "TrigMETMonitoring.TrigMETMonitCategory",         "Dll" : "TrigMETMonitoring"},
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/HLTMonitoring_topOptions.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/HLTMonitoring_topOptions.py
index 0454383d6c0a3836ed000b647ac778c3a12d3875..3e43e9cab3e573e1be51608ae423ec633b2300e4 100755
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/HLTMonitoring_topOptions.py
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/HLTMonitoring_topOptions.py
@@ -25,7 +25,6 @@ if DQMonFlags.monManEnvironment == 'tier0Raw':
   HLTMonFlags.doMinBias  = False
   HLTMonFlags.doDump     = False
   HLTMonFlags.doOfflineTauTTP = False
-  HLTMonFlags.doIDJpsiMon  = False
   HLTMonFlags.doMaM = False
 elif DQMonFlags.monManEnvironment == 'tier0ESD':
   log.info('Environment is tier0ESD')
@@ -44,9 +43,6 @@ else :
   HLTMonFlags.doMonTier0 = False
   HLTMonFlags.doMaM = False
 
-# temporarily disabling IDJpsiMon to deal with ATR-12037
-HLTMonFlags.doIDJpsiMon = False
-
 log.info("HLTMonFlags are:")
 print HLTMonFlags
 
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py
index 060a9fae2665d273eafd2e100b84c76505d2fcae..7cbc889c12434a3b26ba4e2822acca51f6af778d 100755
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py
@@ -147,7 +147,6 @@ if data_type == 'pool':
         HLTMonFlags.doTau     = True
         HLTMonFlags.doMuon    = True
         HLTMonFlags.doIDtrk   = True
-        HLTMonFlags.doIDJpsiMon = True
         HLTMonFlags.doCalo    = True
         HLTMonFlags.doBphys   = False
         HLTMonFlags.doMinBias = False
diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py
index 21dcd16a61fe7fdb3f30a88a5677c62c990befe5..8cbb349f3bbfaba0f1adb6162a41191ba4e2fd65 100644
--- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py
+++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py
@@ -126,14 +126,6 @@ if HLTMonFlags.doMonTier0:
       except:
         log.info("Problems with HLTMinBiasDumpTool, tool not enabled")
 
-    # IDJpsi HLTMonTool
-    if HLTMonFlags.doIDJpsiMon:
-      try:
-        from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConfig import TrigIDJpsiMonitoringTool
-        HLTMonManager.AthenaMonTools += TrigIDJpsiMonitoringTool()
-      except:
-        log.info("Problems with TrigIDJpsiMonTool, tool not enabled")
-
 
 ################ Dump Tools ################
 
diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/database/MaDQM.py b/Trigger/TrigMonitoring/TrigJetMonitoring/database/MaDQM.py
index 49e4c2023f51aba7a0d6cf23ecc86d7ea37275e4..56821b0324910477adf318ecf8e7f0a3e2343d3f 100755
--- a/Trigger/TrigMonitoring/TrigJetMonitoring/database/MaDQM.py
+++ b/Trigger/TrigMonitoring/TrigJetMonitoring/database/MaDQM.py
@@ -137,14 +137,3 @@ if HLTMonFlags.doMinBias:
         for confattr,confvalue in toolconfig.items():
             tool.__setattr__(confattr, confvalue)
 
-if HLTMonFlags.doIDJpsiMon:
-  # here we check which entry there is in the DB for this slice
-  config_idjpsi = readSliceConfigFromDB('oracle','ACTIVE_KEY','Physics', 'IDJPSI' , 'ESD') 
-  # if entry is not None then we take monitoring config from DB, else it is taken from the release in a standard way 
-  if config_idjpsi != None:
-    for (toolname, toolconfig) in config_idjpsi['Config']:
-        # modify defaults according to config dictionary
-        tool = getattr(ToolSvc,toolname)
-        for confattr,confvalue in toolconfig.items():
-            tool.__setattr__(confattr, confvalue)
-
diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx
index f4da420f8bba779fbe43033fc5d3a6fdb00161bb..c6cd1ddd75a608f50b42aa907c5804ce6394d301 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/CTPEmulation.cxx
@@ -850,8 +850,8 @@ LVL1CTP::CTPEmulation::calculateEMMultiplicity( const TrigConf::TriggerThreshold
          int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1);
          int iphi = 0;
          const TrigConf::TriggerThresholdValue * thrV = confThr->triggerThresholdValue( ieta, iphi );
-         const ClusterThresholdValue *ctv = dynamic_cast<const ClusterThresholdValue *>(thrV);
-         float scale = ctv->caloInfo().globalEmScale();
+
+         float scale = 1; // eFEX clusters in 21.3 have an energy scale of 1 GeV
 
          bool clusterPasses = ( ((unsigned int) cl->et()) > thrV->ptcut()*scale ); // need to add cut on isolation and other variables, once available
          multiplicity +=  clusterPasses ? 1 : 0;
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_bjet_ttbar.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_bjet_ttbar.xml
deleted file mode 100644
index ca63bc97dbcf0a5b71a5c657ee6c49ad60d0148d..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_bjet_ttbar.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-         <athena trendId='FTKMergingTrend' userJobId='TrigInDetValidation_FTK_bjet_ttbar'>
-            <doc>Bjetslice, ttbar, FTK chains</doc>
-            <displayName>BjetSlice, ttbar, FYK chains</displayName>
-	    <commandLineFlags>EventMax=500;doFTK=True</commandLineFlags>
-            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice</options>
-            <package>Trigger/TrigValidation/TrigInDetValidation</package>
-            <group>TrigInDetValidation</group>
-            <queue>long</queue>
-	   
-#          include "samples/TrigInDetValidation_FTK_ttbar_sample4.xml"
-
-
-
-            <action position="01">
-                <modulename>RttLibraryTools</modulename>
-                <testname>ExeRunner</testname>
-                <arg>
-                    <argname>exeName</argname>
-                    <argvalue>TIDArdict.exe</argvalue>
-                </arg>
-                <arg>
-                    <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt.dat -f data-bjet-FTK.root -b Test_bin.dat </argvalue>
-                </arg>
-            </action>
-
-
-
-           <action position="02">
-                <modulename>RttLibraryTools</modulename> 
-                <testname>ExeRunner</testname> 
-                <arg> 
-                    <argname>exeName</argname>
-                    <argvalue>TIDArun.sh</argvalue> 
-                </arg>
-                <arg> 
-                    <argname>exeParamString</argname>
-                    <argvalue>data-bjet-FTK.root data-FTK_bjet_ttbar-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_FTF HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_SplitJet  HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_SplitJet -d HLTL2-plots </argvalue>
-                </arg>
-            </action>
-
-
-
-           <action position="03">
-                <modulename>RttLibraryTools</modulename> 
-                <testname>ExeRunner</testname> 
-                <arg> 
-                    <argname>exeName</argname>
-                    <argvalue>TIDArun.sh</argvalue> 
-                </arg>
-                <arg> 
-                    <argname>exeParamString</argname>
-                    <argvalue>data-bjet-FTK.root data-FTK_bjet_ttbar-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_IDTrig_SplitJet  HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_IDTrig_SplitJet -d HLTEF-plots </argvalue>
-                </arg>
-            </action>
-
-
-
-#	  include "TrigInDetValidation_expertMonitoring.xml"
-#	  include "TrigInDetValidation_costMonitoring.xml"
-#         include "TrigInDetValidation_extra.xml"
-
-
-
-        
-
-            <testToRemove>
-              <jobGroupName>RTT:Top</jobGroupName>
-              <testidentifier>CheckFileRunner0</testidentifier>
-            </testToRemove>
-
-
-#           include "TrigInDetValidation_aux.xml"
-
-   
-         <athenaCommonFlags /><alwaysRunPostProc /> 
-         </athena>
-
-
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_bjet_ttbar_offline.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_bjet_ttbar_offline.xml
deleted file mode 100644
index 68a4b58b4cf4884d62568c00422f51bfaf547d6e..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_bjet_ttbar_offline.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-         <athena trendId='FTKMergingTrend' userJobId='TrigInDetValidation_FTK_bjet_ttbar_offline'>
-            <doc>Bjetslice, ttbar, FTK chains</doc>
-            <displayName>BjetSlice, ttbar, FTK chains</displayName>
-	    <commandLineFlags>EventMax=500;doIDNewTracking=True;doFTK=True</commandLineFlags>
-            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice</options>
-            <package>Trigger/TrigValidation/TrigInDetValidation</package>
-            <group>TrigInDetValidation</group>
-            <queue>long</queue>
-	   
-#          include "samples/TrigInDetValidation_FTK_ttbar_sample4.xml"
-
-
-
-            <action position="01">
-                <modulename>RttLibraryTools</modulename>
-                <testname>ExeRunner</testname>
-                <arg>
-                    <argname>exeName</argname>
-                    <argvalue>TIDArdict.exe</argvalue>
-                </arg>
-                <arg>
-                    <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt-offline.dat -f data-bjet-FTK.root -b Test_bin.dat </argvalue>
-                </arg>
-            </action>
-
-
-
-           <action position="02">
-                <modulename>RttLibraryTools</modulename> 
-                <testname>ExeRunner</testname> 
-                <arg> 
-                    <argname>exeName</argname>
-                    <argvalue>TIDArun.sh</argvalue> 
-                </arg>
-                <arg> 
-                    <argname>exeParamString</argname>
-                    <argvalue>data-bjet-FTK.root data-FTK_bjet_ttbar_offline-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_FTF HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_SplitJet  HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_SplitJet -d HLTL2-plots </argvalue>
-                </arg>
-            </action>
-
-
-
-           <action position="03">
-                <modulename>RttLibraryTools</modulename> 
-                <testname>ExeRunner</testname> 
-                <arg> 
-                    <argname>exeName</argname>
-                    <argvalue>TIDArun.sh</argvalue> 
-                </arg>
-                <arg> 
-                    <argname>exeParamString</argname>
-                    <argvalue>data-bjet-FTK.root data-FTK_bjet_ttbar_offline-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_IDTrig  HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_IDTrig_SplitJet HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_IDTrig_SplitJet -d HLTEF-plots </argvalue>
-                </arg>
-            </action>
-
-
-
-#	  include "TrigInDetValidation_expertMonitoring.xml"
-#	  include "TrigInDetValidation_costMonitoring.xml"
-#         include "TrigInDetValidation_extra.xml"
-
-
-
-        
-
-            <testToRemove>
-              <jobGroupName>RTT:Top</jobGroupName>
-              <testidentifier>CheckFileRunner0</testidentifier>
-            </testToRemove>
-
-
-#           include "TrigInDetValidation_aux.xml"
-
-   
-         <athenaCommonFlags /><alwaysRunPostProc /> 
-         </athena>
-
-
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_tautau.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_tautau.xml
deleted file mode 100644
index 12a45db2f9babaa8cabbf8ee303105eb23d0d71d..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_tautau.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-         <athena trendId='FTKMergingTrend' userJobId='TrigInDetValidation_FTK_mu_tautau'>
-            <doc>Muon slice FTK tautau sample</doc>
-            <displayName>MuonSlice FTK tautau sample</displayName>
-	    <commandLineFlags>EventMax=5000;doFTK=True</commandLineFlags>
-            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice</options>
-            <package>Trigger/TrigValidation/TrigInDetValidation</package>
-            <group>TrigInDetValidation</group>
-            <queue>long</queue>
-
-#          include "samples/TrigInDetValidation_FTK_sample3.xml"
-
-
-
-
-            <action position="01">
-                <modulename>RttLibraryTools</modulename>
-                <testname>ExeRunner</testname>
-                <arg>
-                    <argname>exeName</argname>
-                    <argvalue>TIDArdict.exe</argvalue>
-                </arg>
-                <arg>
-                    <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt.dat -f data-muon-FTK.root -p 13  -b Test_bin.dat </argvalue>
-                </arg>
-            </action>
-
-
-
-
-     <action position="02">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_tautau-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF  HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK  -d HLTL2-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="03">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_tautau-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig  HLT_mu6_FTLJ_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig  -d HLTEF-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-#	  include "TrigInDetValidation_expertMonitoring.xml"
-#	  include "TrigInDetValidation_costMonitoring.xml"
-#         include "TrigInDetValidation_extra.xml"
-
-
-
-            <testToRemove>
-              <jobGroupName>RTT:Top</jobGroupName>
-              <testidentifier>CheckFileRunner0</testidentifier>
-            </testToRemove>
-
-            <auxFilePattern>TIDAdata*.dat</auxFilePattern>
-#           include "TrigInDetValidation_aux.xml"
-	    <auxFilePattern>Test_bin.dat</auxFilePattern>
-
-	  <athenaCommonFlags /><alwaysRunPostProc />
-
-	  </athena>
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_ttbar.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_ttbar.xml
deleted file mode 100644
index 052170fed9af7c1fae80cb1d0049e68876309f74..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_ttbar.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-         <athena trendId='FTKMergingTrend' userJobId='TrigInDetValidation_FTK_mu_ttbar'>
-            <doc>Muon slice FTK ttbar sample</doc>
-            <displayName>MuonSlice FTK ttbar sample</displayName>
-	    <commandLineFlags>EventMax=5000;doFTK=True</commandLineFlags>
-            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice</options>
-            <package>Trigger/TrigValidation/TrigInDetValidation</package>
-            <group>TrigInDetValidation</group>
-            <queue>long</queue>
-
-#          include "samples/TrigInDetValidation_FTK_ttbar_sample4.xml"
-
-
-
-
-            <action position="01">
-                <modulename>RttLibraryTools</modulename>
-                <testname>ExeRunner</testname>
-                <arg>
-                    <argname>exeName</argname>
-                    <argvalue>TIDArdict.exe</argvalue>
-                </arg>
-                <arg>
-                    <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt.dat -f data-muon-FTK.root -p 13  -b Test_bin.dat </argvalue>
-                </arg>
-            </action>
-
-
-
-
-     <action position="02">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar-reference.root  HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF  HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK  HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit  -d HLTL2-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="03">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar-reference.root  HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig  HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig   -d HLTEF-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="04">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF  HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit   -d HLTL2-plots-lowpt </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="05">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig  HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig    -d HLTEF-plots-lowpt </argvalue>
-              </arg>
-            </action>
-
-
-
-#	  include "TrigInDetValidation_expertMonitoring.xml"
-#	  include "TrigInDetValidation_costMonitoring.xml"
-#         include "TrigInDetValidation_extra.xml"
-
-
-
-            <testToRemove>
-              <jobGroupName>RTT:Top</jobGroupName>
-              <testidentifier>CheckFileRunner0</testidentifier>
-            </testToRemove>
-
-            <auxFilePattern>TIDAdata*.dat</auxFilePattern>
-#           include "TrigInDetValidation_aux.xml"
-	    <auxFilePattern>Test_bin.dat</auxFilePattern>
-
-	  <athenaCommonFlags /><alwaysRunPostProc />
-
-	  </athena>
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_ttbar_offline.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_ttbar_offline.xml
deleted file mode 100644
index eabf249f7c6e3e0416bc1ee1e112b7df08ddf101..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_mu_ttbar_offline.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-         <athena trendId='FTKMergingTrend' userJobId='TrigInDetValidation_FTK_mu_ttbar_offline'>
-            <doc>Muon slice FTK ttbar sample</doc>
-            <displayName>MuonSlice FTK ttbar sample</displayName>
-	    <commandLineFlags>EventMax=5000;doIDNewTracking=True;doFTK=True</commandLineFlags>
-            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice</options>
-            <package>Trigger/TrigValidation/TrigInDetValidation</package>
-            <group>TrigInDetValidation</group>
-            <queue>long</queue>
-
-#          include "samples/TrigInDetValidation_FTK_ttbar_sample4.xml"
-
-
-
-
-            <action position="01">
-                <modulename>RttLibraryTools</modulename>
-                <testname>ExeRunner</testname>
-                <arg>
-                    <argname>exeName</argname>
-                    <argvalue>TIDArdict.exe</argvalue>
-                </arg>
-                <arg>
-                    <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt-offline.dat -f data-muon-FTK.root -p 13  -b Test_bin.dat </argvalue>
-                </arg>
-            </action>
-
-
-
-
-     <action position="02">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root  HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF  HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK  HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit  -d HLTL2-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="03">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root  HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig  HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig   -d HLTEF-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="04">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF  HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit   -d HLTL2-plots-lowpt </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="05">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig  HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig    -d HLTEF-plots-lowpt </argvalue>
-              </arg>
-            </action>
-
-
-
-#	  include "TrigInDetValidation_expertMonitoring.xml"
-#	  include "TrigInDetValidation_costMonitoring.xml"
-#         include "TrigInDetValidation_extra.xml"
-
-
-
-            <testToRemove>
-              <jobGroupName>RTT:Top</jobGroupName>
-              <testidentifier>CheckFileRunner0</testidentifier>
-            </testToRemove>
-
-            <auxFilePattern>TIDAdata*.dat</auxFilePattern>
-#           include "TrigInDetValidation_aux.xml"
-	    <auxFilePattern>Test_bin.dat</auxFilePattern>
-
-	  <athenaCommonFlags /><alwaysRunPostProc />
-
-	  </athena>
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_tau_tautau.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_tau_tautau.xml
deleted file mode 100644
index d7027bd3b6c297c2748a08bbaed00d38846f7c20..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_tau_tautau.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-         <athena trendId='FTKMergingTrend' userJobId='TrigInDetValidation_FTK_tau_tautau'>
-            <doc>Tau slice FTK tautau sample</doc>
-            <displayName>TauSlice FTK tautau sample</displayName>
-	    <commandLineFlags>EventMax=5000;doFTK=True</commandLineFlags>
-            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice</options>
-            <package>Trigger/TrigValidation/TrigInDetValidation</package>
-            <group>TrigInDetValidation</group>
-            <queue>long</queue>
-
-#          include "samples/TrigInDetValidation_FTK_Ztautau_sample4.xml"
-
-
-
-
-            <action position="01">
-                <modulename>RttLibraryTools</modulename>
-                <testname>ExeRunner</testname>
-                <arg>
-                    <argname>exeName</argname>
-                    <argvalue>TIDArdict.exe</argvalue>
-                </arg>
-                <arg>
-                    <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt.dat -f data-tau-FTK.root   -b Test_bin.dat </argvalue>
-                </arg>
-            </action>
-
-
-
-
-     <action position="02">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-tau-FTK.root data-FTK_tau_tautau-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF  HLT_tau25_idperf_FTK:InDetTrigTrackingxAODCnv_Tau_FTK HLT_tau25_idperf_FTKRefit:InDetTrigTrackingxAODCnv_Tau_FTKRefit  -d HLTL2-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-     <action position="03">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-tau-FTK.root data-FTK_tau_tautau-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig  HLT_tau25_idperf_FTK:InDetTrigTrackingxAODCnv_Tau_FTK_IDTrig HLT_tau25_idperf_FTKRefit:InDetTrigTrackingxAODCnv_Tau_FTKRefit_IDTrig  -d HLTEF-plots </argvalue>
-              </arg>
-            </action>
-
-
-
-#	  include "TrigInDetValidation_expertMonitoring.xml"
-#	  include "TrigInDetValidation_costMonitoring.xml"
-#         include "TrigInDetValidation_extra.xml"
-
-
-
-            <testToRemove>
-              <jobGroupName>RTT:Top</jobGroupName>
-              <testidentifier>CheckFileRunner0</testidentifier>
-            </testToRemove>
-
-            <auxFilePattern>TIDAdata*.dat</auxFilePattern>
-#           include "TrigInDetValidation_aux.xml"
-	    <auxFilePattern>Test_bin.dat</auxFilePattern>
-
-	  <athenaCommonFlags /><alwaysRunPostProc />
-
-	  </athena>
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_TestConfiguration_main.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_TestConfiguration_main.xml
index b81a10ad18480a698795dc83db007365e6e2ee2b..9e7ef534cca1ea5d2f0660915f91383e95df8a64 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_TestConfiguration_main.xml
+++ b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_TestConfiguration_main.xml
@@ -38,6 +38,9 @@
 #     include   "TrigInDetValidation_beamspot_ttbar_pu40_zfinder.xml"
 #     include   "TrigInDetValidation_beamspot_ttbar_pu80_zfinder.xml"
 
+#     include   "TrigInDetValidation_beamspot_ttbar_pu80_fs.xml"
+#     include   "TrigInDetValidation_beamspot_ttbar_pu80_fsml.xml"
+
 #     include   "TrigInDetValidation_el_Jpsiee_pu40.xml"
 #     include   "TrigInDetValidation_el_single_e_7-80_larged0.xml"
 #     include   "TrigInDetValidation_el_single_e_7-80_larged0_PU.xml"
@@ -103,13 +106,6 @@
 <!-- #     include   "TrigInDetValidation_minBias_pileUp.xml" -->
 
 
-#     include   "TrigInDetValidation_FTK_mu_ttbar.xml"
-#     include   "TrigInDetValidation_FTK_tau_tautau.xml"
-#     include   "TrigInDetValidation_FTK_bjet_ttbar.xml"
-#     include   "TrigInDetValidation_FTK_beamspot_ttbar.xml"
-#     include   "TrigInDetValidation_FTK_mu_ttbar_offline.xml"
-#     include   "TrigInDetValidation_FTK_bjet_ttbar_offline.xml"
-
       </jobList>
 
       <jobGroups>
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_beamspot_ttbar_pu80_fs.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_beamspot_ttbar_pu80_fs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..70447d8020d8fc3bb878d9fbf8240c63f1fd929d
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_beamspot_ttbar_pu80_fs.xml
@@ -0,0 +1,62 @@
+         <athena trendId='all_pu80' userJobId='TrigInDetValidation_beamspot_ttbar_pu80_fs'>
+            <doc>BeamSpot slice, ttbar events, pu80</doc>
+            <displayName>BeamSpot slice, ttbar, pu80</displayName>
+	    <commandLineFlags>EventMax=1000;rec.doFloatingPointException.set_Value_and_Lock(False)</commandLineFlags>
+            <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice</options>
+            <package>Trigger/TrigValidation/TrigInDetValidation</package>
+            <group>TrigInDetValidation</group>
+            <queue>long</queue>
+
+#          include "samples/TrigInDetValidation_ttbar_sample3.xml"	   
+
+            <action position="01">
+                <modulename>RttLibraryTools</modulename>
+                <testname>ExeRunner</testname>
+                <arg>
+                    <argname>exeName</argname>
+                    <argvalue>TIDArdict.exe</argvalue>
+                </arg>
+                <arg>
+                    <argname>exeParamString</argname>
+                    <argvalue>TIDAdata11-rtt.dat  -f data-all.root -b Test_bin.dat  </argvalue>
+                </arg>
+            </action>
+
+
+           <action position="02">
+              <modulename>RttLibraryTools</modulename> 
+              <testname>ExeRunner</testname>  
+              <arg> 
+                <argname>exeName</argname>
+                <argvalue>TIDArun.sh</argvalue> 
+              </arg>
+              <arg> 
+                <argname>exeParamString</argname>
+                <argvalue>data-all.root data-beamspot_ttbar_pu80_fs-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  </argvalue>
+              </arg>
+            </action>
+
+
+
+
+#	  include "TrigInDetValidation_expertMonitoring.xml"
+#	  include "TrigInDetValidation_costMonitoring.xml"
+#         include "TrigInDetValidation_extra.xml"
+
+
+
+
+
+            <testToRemove>
+              <jobGroupName>RTT:Top</jobGroupName>
+              <testidentifier>CheckFileRunner0</testidentifier>
+            </testToRemove>
+
+
+#           include "TrigInDetValidation_aux.xml"
+
+   
+         <athenaCommonFlags /><alwaysRunPostProc /> 
+         </athena>
+
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_beamspot_ttbar.xml b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_beamspot_ttbar_pu80_fsml.xml
similarity index 52%
rename from Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_beamspot_ttbar.xml
rename to Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_beamspot_ttbar_pu80_fsml.xml
index da414d063eecd8e3d630c4abe937399187bd4dbb..728e2047110b66df1540721a4455aed10eef93ed 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_FTK_beamspot_ttbar.xml
+++ b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/TrigInDetValidation_beamspot_ttbar_pu80_fsml.xml
@@ -1,15 +1,13 @@
-         <athena trendId='all_pu46' userJobId='TrigInDetValidation_FTK_beamspot_ttbar'>
-            <doc>BeamSpot slice, ttbar events, FTK, pu46</doc>
-            <displayName>BeamSpot slice, ttbar, FTK, pu46</displayName>
-	    <commandLineFlags>EventMax=1000;doFTK=True;rec.doFloatingPointException.set_Value_and_Lock(False)</commandLineFlags>
+         <athena trendId='all_pu80' userJobId='TrigInDetValidation_beamspot_ttbar_pu80_fsml'>
+            <doc>BeamSpot slice, ttbar events, pu80</doc>
+            <displayName>BeamSpot slice, ttbar, pu80</displayName>
+	    <commandLineFlags>EventMax=1000;mlExtensions=True;rec.doFloatingPointException.set_Value_and_Lock(False)</commandLineFlags>
             <options>TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice</options>
             <package>Trigger/TrigValidation/TrigInDetValidation</package>
             <group>TrigInDetValidation</group>
             <queue>long</queue>
 
-#          include "samples/TrigInDetValidation_FTK_ttbar_sample4.xml"
-	   
-
+#          include "samples/TrigInDetValidation_ttbar_sample3.xml"	   
 
             <action position="01">
                 <modulename>RttLibraryTools</modulename>
@@ -20,12 +18,11 @@
                 </arg>
                 <arg>
                     <argname>exeParamString</argname>
-                    <argvalue>TIDAdata11-rtt.dat  -f data-beamspot-FTK.root -b Test_bin.dat  </argvalue>
+                    <argvalue>TIDAdata11-rtt.dat  -f data-all.root -b Test_bin.dat  </argvalue>
                 </arg>
             </action>
 
 
-
            <action position="02">
               <modulename>RttLibraryTools</modulename> 
               <testname>ExeRunner</testname>  
@@ -35,21 +32,7 @@
               </arg>
               <arg> 
                 <argname>exeParamString</argname>
-                <argvalue>data-beamspot-FTK.root data-FTK_beamspot_ttbar-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF  HLT_beamspot_idperf_FTK_InDetTrigTrackingxAODCnv_BeamSpot_FTKMon HLT_beamspot_allTE_FTKRefit_InDetTrigTrackingxAODCnv_BeamSpot_FTKRefit -d HLTL2-plots </argvalue>
-              </arg>
-            </action>
-
-
-           <action position="03">
-              <modulename>RttLibraryTools</modulename> 
-              <testname>ExeRunner</testname>  
-              <arg> 
-                <argname>exeName</argname>
-                <argvalue>TIDArun.sh</argvalue> 
-              </arg>
-              <arg> 
-                <argname>exeParamString</argname>
-                <argvalue>data-beamspot-FTK.root data-FTK_beamspot_ttbar-reference.root FTK_TrackParticleContainer -d HLTEF-plots  </argvalue>
+                <argvalue>data-all.root data-beamspot_ttbar_pu80_fsml-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  </argvalue>
               </arg>
             </action>
 
@@ -77,4 +60,3 @@
          </athena>
 
 
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/makefile b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/makefile
index f2ba0326a6e5af90097d815562e344190f3916f6..08ce168cc43b04474a9cadf836dd68d81c1737a0 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/makefile
+++ b/Trigger/TrigValidation/TrigInDetValidation/TIDAbuild/makefile
@@ -58,14 +58,7 @@ JOBS =  \
 	TrigInDetValidation_mu_bphys_IBL.xml                          \
                                                                       \
 	TrigInDetValidation_minBias.xml                               \
-	TrigInDetValidation_minBias_offline.xml                       \
-                                                                      \
-	TrigInDetValidation_FTK_mu_ttbar.xml                          \
-	TrigInDetValidation_FTK_tau_tautau.xml                        \
-	TrigInDetValidation_FTK_bjet_ttbar.xml                        \
-	TrigInDetValidation_FTK_beamspot_ttbar.xml                    \
-	TrigInDetValidation_FTK_mu_ttbar_offline.xml                  \
-	TrigInDetValidation_FTK_bjet_ttbar_offline.xml                
+	TrigInDetValidation_minBias_offline.xml
 
 
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_mu_tautau.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_mu_tautau.sh
deleted file mode 100755
index 4192384b12208b67f8027ce4107f5828338c4966..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_mu_tautau.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-get_files -jo TrigInDetValidation_RTT_topOptions_MuonSlice.py
-athena.py  -c 'XMLDataSet="TrigInDetValidation_FTK_mu_tautau";EventMax=5000;runMergedChain=True;doFTK=True' TrigInDetValidation_RTT_topOptions_MuonSlice.py 
-
-
-get_files -data TIDAdata11-rtt.dat
-get_files -data Test_bin.dat
-TIDArdict.exe TIDAdata11-rtt.dat -f data-muon-FTK.root -p 13 -b Test_bin.dat
-
-get_files -data data-FTK_mu_tautau-reference.root
-TIDAcomparitor.exe data-muon-FTK.root data-FTK_mu_tautau-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK -d HLTL2-plots
-
-get_files -data data-FTK_mu_tautau-reference.root
-TIDAcomparitor.exe data-muon-FTK.root data-FTK_mu_tautau-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu6_FTLJ_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots
-
-get_files -data expert-monitoring-FTK_mu_tautau-ref.root
-TIDAcpucost.exe expert-monitoring.root expert-monitoring-FTK_mu_tautau-ref.root --auto -o times
-
-RunTrigCostD3PD.exe -f trig_cost.root --outputTagFromAthena --monitorAllChainSeqAlg --monitorROI --linkOutputDir
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent" check_log.pl --conf checklogTriggerTest.conf %JOBLOG
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_mu_ttbar.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_mu_ttbar.sh
deleted file mode 100755
index 117f8a7bf9b8ed589a5175dcd8ae220e1c593b24..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_mu_ttbar.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-get_files -jo TrigInDetValidation_RTT_topOptions_MuonSlice.py
-athena.py  -c 'XMLDataSet="TrigInDetValidation_FTK_mu_ttbar";EventMax=5000;runMergedChain=True;doFTK=True' TrigInDetValidation_RTT_topOptions_MuonSlice.py 
-
-
-get_files -data TIDAdata11-rtt.dat
-get_files -data Test_bin.dat
-TIDArdict.exe TIDAdata11-rtt.dat -f data-muon-FTK.root -p 13 -b Test_bin.dat
-
-get_files -data data-FTK_mu_ttbar-reference.root
-TIDAcomparitor.exe data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK -d HLTL2-plots
-
-get_files -data data-FTK_mu_ttbar-reference.root
-TIDAcomparitor.exe data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots
-
-get_files -data expert-monitoring-FTK_mu_ttbar-ref.root
-TIDAcpucost.exe expert-monitoring.root expert-monitoring-FTK_mu_ttbar-ref.root --auto -o times
-
-RunTrigCostD3PD.exe -f trig_cost.root --outputTagFromAthena --monitorAllChainSeqAlg --monitorROI --linkOutputDir
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent" check_log.pl --conf checklogTriggerTest.conf %JOBLOG
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_tau_tautau.sh b/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_tau_tautau.sh
deleted file mode 100755
index aab219fc4f70fb8d04b612345f9d4b5149bab1e3..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/scripts/TrigInDetValidation_FTK_tau_tautau.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-get_files -jo TrigInDetValidation_RTT_topOptions_TauSlice.py
-athena.py  -c 'XMLDataSet="TrigInDetValidation_FTK_tau_tautau";EventMax=5000;runMergedChain=True;doFTK=True' TrigInDetValidation_RTT_topOptions_TauSlice.py 
-
-
-get_files -data TIDAdata11-rtt.dat
-get_files -data Test_bin.dat
-TIDArdict.exe TIDAdata11-rtt.dat -f data-tau-FTK.root -b Test_bin.dat
-
-get_files -data data-FTK_tau_tautau-reference.root
-TIDAcomparitor.exe data-tau-FTK.root data-FTK_tau_tautau-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots
-
-get_files -data expert-monitoring-FTK_tau_tautau-ref.root
-TIDAcpucost.exe expert-monitoring.root expert-monitoring-FTK_tau_tautau-ref.root --auto -o times
-
-RunTrigCostD3PD.exe -f trig_cost.root --outputTagFromAthena --monitorAllChainSeqAlg --monitorROI --linkOutputDir
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"
-
-TIDAcpucost.exe costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent" check_log.pl --conf checklogTriggerTest.conf %JOBLOG
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
index cc62ddab8cb9e86c484277eece7b8042124550af..9fef09d8b859e1432fd0b9d4698123764ead4579 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
@@ -57,3 +57,20 @@ if 'fastZFinder' in dir() and fastZFinder==True:
 
   print 'zfinder settings modified by TrigInDetValidation_RTT_topOptions_BeamspotSlice.py'
   print zfinder
+
+else:
+  FTF = topSequence.TrigSteer_HLT.TrigFastTrackFinder_BeamSpot_IDTrig
+  FTF.doZFinder = False
+
+  if 'mlExtensions' in dir() and mlExtensions==True:
+
+    FTF.doSeedRedundancyCheck = True
+    FTF.UseTrigSeedML  = 1 #can be 0, 1, 2, or 3, 0 means the ML-based seed filtering is off
+    FTF.TrigSeedML_LUT = 'trigseed_ML_medium.lut' #can be _loose, _medium, or _strict
+  
+# good options for any slice - leave here commented while for use in 
+# tests in the near future  
+#  FTF.UseTrigSeedML = 3 #all pixel clusters in PPP seeds will passed through the filter
+#  FTF.UseSCT_MiddleSP = False #effectively switch to PPP mode as PPS are switched off by default
+#  FTF.maxEC_Pixel_cluster_length = 0.65 #will be replaced by a trained endcap LUT when it's available
+  
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BjetSlice.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BjetSlice.py
index 2bb4dc76dc10a891e7d02938b4c7f9c881cb3cfa..c3b80a165b414c0d6987d7727270b261f34e1f5a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BjetSlice.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_BjetSlice.py
@@ -32,6 +32,8 @@ if 'doFTK' in dir() and doFTK==True:
   TriggerFlags.doFTK=True
   rFTK=True
 
+
+
 (idtrigChainlist, tidaAnalysischains) = bjetChains(rID,rFTK,rBperf)
 
 
@@ -85,6 +87,11 @@ if 'bjetDynamicNJetsMax' in dir():
 if 'bjetDynamicEtFactor' in dir():
     theSuperRoi.DynamicEtFactor = bjetDynamicEtFactor
 
+if 'useFullScan' in dir():
+    theSuperRoi.UseFullScan = useFullScan
+
+
+
 #####################################################
 ## b-tagging optimisations
 #####################################################
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_Bphysics.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_Bphysics.py
index 6b9710ca21cf9a75f5afc6f4b637a6b1eb6839d6..3b8e53d15a4cc10990f92cfd52eae8e924e180d0 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_Bphysics.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_Bphysics.py
@@ -53,48 +53,3 @@ PdgId=13
 include("TrigInDetValidation/TrigInDetValidation_RTT_Common.py")
 
 
-HLTMonManager = topSequence.HLTMonManager
-
-from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConf import TrigJpsiMonTool
-TPMonTool = TrigJpsiMonTool( name="TPMonTool")
-ToolSvc += TPMonTool
-HLTMonManager.AthenaMonTools += [ "TrigJpsiMonTool/TPMonTool" ]
-
-
-TPMonTool.matchR = 0.1
-TPMonTool.pTCutOffline = 4000.0
-TPMonTool.d0Cut = 1000.0
-TPMonTool.z0Cut = 2000.0
-TPMonTool.d0CutOffline = 1000.0
-TPMonTool.z0CutOffline = 2000.0
-#TPMonTool.pTCutOffline = 4000.0
-#TPMonTool.d0Cut = 1000.0
-#TPMonTool.d0CutOffline = 1000.0
-#TPMonTool.matchR = 1.0
-#TPMonTool.z0CutOffline = 2000.0
-
-#TPMonTool.Chain0 = "EF_2mu13_Zmumu_IDTrkNoCut"
-TPMonTool.Chain0 = "EF_mu24i_tight";
-#TPMonTool.Chain1 = "EF_2mu4T_Jpsimumu_IDTrkNoCut"
-TPMonTool.Chain1 = ""
-#TPMonTool.Chain2 = ""
-#TPMonTool.Chain3 = ""
-
-#TPMonTool.IDSCAN = "";
-#TPMonTool.SiTrack = "";
-TPMonTool.EF = "InDetTrigParticleCreation_Muon_EFID";
-#TPMonTool.StratA = "TrigL2SiTrackFinder_MuonA";
-#TPMonTool.StratB = "TrigL2SiTrackFinder_MuonB";
-#TPMonTool.StratC = "TrigL2SiTrackFinder_MuonC";
-TPMonTool.StratA = "";
-TPMonTool.StratB = "";
-TPMonTool.StratC = "";
-
-
-#TPMonTool.TRTSF = "";
-#TPMonTool.EFTRT = "";
-
-
-
-
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40.sh
index 8e6ccff91a367c7c45cd91e17ee6c2deaa51cdc0..73db89aafdf047ac7cac8fd4ea26e570a6258b86 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40.sh
@@ -87,9 +87,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -150,8 +148,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -165,15 +161,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -216,7 +209,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -228,8 +222,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py
-
 
 # run athena in separate directories
 
@@ -270,10 +262,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -318,7 +313,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40_art.sh
index 0ad08f91faaa7d613a87bc516b11c6e3e0d70893..a7649ba93b8982265de29a71ed77098b5ec76b72 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40_art.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu40_art.sh
@@ -1,7 +1,10 @@
 #!/bin/bash
 # art-description: art job for all_ttbar_pu40
-# art-type: grid
 # art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
 # art-output: HLTEF-plots-electron
 # art-output: HLTL2-plots-electron
 # art-output: HLTEF-plots-electron-lowpt
@@ -26,7 +29,8 @@
 # art-output: output-cost
 # art-output: output-logs
 # art-input-nfiles: 3
-# art-athena-mt: 3
+# art-cores: 3
+# art-memory: 4096
 
 
 
@@ -58,6 +62,7 @@ RUNPOST=-1
 DIRECTORY=
 LOCAL=0
 FORCE=0
+FORK=1
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -88,9 +93,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -151,8 +154,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -166,15 +167,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -213,24 +211,56 @@ export RTTJOBNAME=TrigInDetValidation_all_ttbar_pu40
 jobList=
 
 if [ $LOCAL -eq 1 ]; then
+
       echo "running locally"
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;doIDNewTracking=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
 else
+
       fileList="['${ArtInFile//,/', '}']"
       _jobList="'../${ArtInFile//,/' '../}'"
       echo "List of files = $fileList"
       for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
 fi
 
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py
-
+if [ $FORK -eq 1 ]; then
 
 # run athena in separate directories
 
@@ -271,10 +301,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -292,6 +325,8 @@ timestamp "waiting on athena jobs ..."
 
 waitonallproc
 
+fi
+
 echo "all done ! hooray !"
 
 timestamp "forking all athena jobs completed"
@@ -319,7 +354,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60.sh
index 4903f1291ddc52ccd65ccb493161806d26b1caf5..1450fc98eeef28c1466f2449566b51ff64ce9045 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60.sh
@@ -87,9 +87,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -150,8 +148,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -165,15 +161,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -216,7 +209,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -228,8 +222,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py
-
 
 # run athena in separate directories
 
@@ -321,7 +313,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..7bc6b78516b930cc40fde345e70b85108b4f7c4e
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu60_art.sh
@@ -0,0 +1,554 @@
+#!/bin/bash
+# art-description: art job for all_ttbar_pu60
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots-electron
+# art-output: HLTL2-plots-electron
+# art-output: HLTEF-plots-electron-lowpt
+# art-output: HLTL2-plots-electron-lowpt
+# art-output: HLTEF-plots-muon
+# art-output: HLTL2-plots-muon
+# art-output: HLTEF-plots-tau
+# art-output: HLTL2-plots-tau
+# art-output: HLTEF-plots-bjet
+# art-output: HLTL2-plots-bjet
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7194
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_all_ttbar_pu60
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;doIDNewTracking=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;doIDNewTracking=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -r Offline -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-electron  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-electron  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-electron-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-electron-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots-muon  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots-muon  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_Tau_IDTrig_forID3 -d HLTEF-plots-tau  2>&1 | tee TIDArun_8.log
+echo "art-result: $? TIDArun_8"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots-tau  2>&1 | tee TIDArun_9.log
+echo "art-result: $? TIDArun_9"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots-bjet  2>&1 | tee TIDArun_10.log
+echo "art-result: $? TIDArun_10"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu60-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi -d HLTL2-plots-bjet  2>&1 | tee TIDArun_11.log
+echo "art-result: $? TIDArun_11"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_12.log
+echo "art-result: $? TIDArun_12"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_13.log
+echo "art-result: $? TIDArun_13"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_14.log
+echo "art-result: $? RunTrigCostD3PD_14"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_15.log
+echo "art-result: $? TIDAcpucost_15"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_16.log
+echo "art-result: $? TIDAcpucost_16"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_17.log
+echo "art-result: $? TIDAcpucost_17"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_18.log
+echo "art-result: $? TIDAcpucost_18"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80.sh
index 8c3039ea081a11c01cec235d76be58f75ca2a363..2de2e293b9357e3e135e845c0e27502de8d7fdd2 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80.sh
@@ -87,9 +87,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -150,8 +148,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -165,15 +161,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -216,7 +209,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -228,8 +222,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py
-
 
 # run athena in separate directories
 
@@ -270,10 +262,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -318,7 +313,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d33679386c9549bbb8bfd58603cb64bcb2fea637
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_all_ttbar_pu80_art.sh
@@ -0,0 +1,554 @@
+#!/bin/bash
+# art-description: art job for all_ttbar_pu80
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots-electron
+# art-output: HLTL2-plots-electron
+# art-output: HLTEF-plots-electron-lowpt
+# art-output: HLTL2-plots-electron-lowpt
+# art-output: HLTEF-plots-muon
+# art-output: HLTL2-plots-muon
+# art-output: HLTEF-plots-tau
+# art-output: HLTL2-plots-tau
+# art-output: HLTEF-plots-bjet
+# art-output: HLTL2-plots-bjet
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_AllSlices.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_all_ttbar_pu80
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;doIDNewTracking=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;doIDNewTracking=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -r Offline -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-electron  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-electron  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-electron-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-electron-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots-muon  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots-muon  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_Tau_IDTrig_forID3 -d HLTEF-plots-tau  2>&1 | tee TIDArun_8.log
+echo "art-result: $? TIDArun_8"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots-tau  2>&1 | tee TIDArun_9.log
+echo "art-result: $? TIDArun_9"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots-bjet  2>&1 | tee TIDArun_10.log
+echo "art-result: $? TIDArun_10"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-all.root data-all_ttbar_pu80-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi -d HLTL2-plots-bjet  2>&1 | tee TIDArun_11.log
+echo "art-result: $? TIDArun_11"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_12.log
+echo "art-result: $? TIDArun_12"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_13.log
+echo "art-result: $? TIDArun_13"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_14.log
+echo "art-result: $? RunTrigCostD3PD_14"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_15.log
+echo "art-result: $? TIDAcpucost_15"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_16.log
+echo "art-result: $? TIDAcpucost_16"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_17.log
+echo "art-result: $? TIDAcpucost_17"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_18.log
+echo "art-result: $? TIDAcpucost_18"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40.sh
index d8e15e60aa1d49e059465bfdcc4b1a150d6fac26..41c8b400d9929242bb6910d45160a61af7d7d443 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40.sh
@@ -78,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -141,8 +139,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -156,15 +152,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -207,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -219,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
-
 
 # run athena in separate directories
 
@@ -261,10 +253,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -309,7 +304,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..e5c68a4d15347b9227bcbcb67c3553c900c9946f
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for beamspot_ttbar_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-test-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu40
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu40-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder.sh
index 4fc9483b7955e47d4af6481ac58f9529bbbc46d3..8810b08cdcdf68e4d762a5a221908f883b37434a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder.sh
@@ -78,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -141,8 +139,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -156,15 +152,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -207,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -219,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
-
 
 # run athena in separate directories
 
@@ -261,10 +253,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -309,7 +304,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..261f478860edd7064957d480cf5964120ed949af
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu40_zfinder_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for beamspot_ttbar_pu40_zfinder
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-test-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu40_zfinder
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;fastZFinder=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;fastZFinder=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu40_zfinder-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_beamspot_ttbar.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fs.sh
similarity index 83%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_beamspot_ttbar.sh
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fs.sh
index 27bcc4853c704be23baa4339acff949daad8df99..65ab5d5beaaddf51f25e374abd120fdec1a084cb 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_beamspot_ttbar.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fs.sh
@@ -1,23 +1,22 @@
 #!/bin/bash
-# art-description: art job for FTK_beamspot_ttbar
+# art-description: art job for beamspot_ttbar_pu80_fs
 # art-type: grid
-# art-output: HLTL2-plots
-# art-output: HLTEF-plots
+# art-output: HLTL2-test-plots
 # art-output: times
 # art-output: times-FTF
 # art-output: cost-perCall
 # art-output: cost-perEvent
 # art-output: cost-perCall-chain
 # art-output: cost-perEvent-chain
-# art-input:  mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.digit.RDO_FTK.e6337_e5984_s3126_d1480_d1471
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
 # art-output: *.dat 
 # art-output: *.root
 # art-output: *.log
 # art-output: output-dataset
 # art-output: output-cost
 # art-output: output-logs
-# art-input-nfiles: 4
-# art-ncores: 4
+# art-input-nfiles: 3
+# art-ncores: 3
 
 
 
@@ -79,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -155,7 +152,6 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
@@ -195,7 +191,7 @@ ls -l
 
 
 
-export RTTJOBNAME=TrigInDetValidation_FTK_beamspot_ttbar
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu80_fs
 
 jobList=
 
@@ -204,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -216,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
-
 
 # run athena in separate directories
 
@@ -228,7 +223,7 @@ i=0
 
 for git in $jobList ; do 
 
-    ARGS="$git;EventMax=500;doFTK=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+    ARGS="$git;EventMax=1000;rec.doFloatingPointException.set_Value_and_Lock(False)"
  
 #   echo "ARGS: $ARGS"
 
@@ -336,7 +331,7 @@ done
 if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
 
 
-TIDArdict TIDAdata11-rtt.dat -f data-beamspot-FTK.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
 echo "art-result: $? TIDArdict_1"
 
 
@@ -348,7 +343,7 @@ timestamp "TIDArdict"
 fi
 
 
-TIDArun-art.sh data-beamspot-FTK.root data-FTK_beamspot_ttbar-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF HLT_beamspot_idperf_FTK_InDetTrigTrackingxAODCnv_BeamSpot_FTKMon HLT_beamspot_allTE_FTKRefit_InDetTrigTrackingxAODCnv_BeamSpot_FTKRefit -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu80_fs-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
 echo "art-result: $? TIDArun_2"
 
 
@@ -357,7 +352,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-beamspot-FTK.root data-FTK_beamspot_ttbar-reference.root FTK_TrackParticleContainer -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
 echo "art-result: $? TIDArun_3"
 
 
@@ -366,7 +361,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
 echo "art-result: $? TIDArun_4"
 
 
@@ -375,25 +370,25 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
-echo "art-result: $? TIDArun_5"
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
 
 
 
-timestamp "TIDArun-art.sh"
+timestamp "RunTrigCostD3PD"
 
 
 
-RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
-echo "art-result: $? RunTrigCostD3PD_6"
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
 
 
 
-timestamp "RunTrigCostD3PD"
+timestamp "TIDAcpucost"
 
 
 
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
 echo "art-result: $? TIDAcpucost_7"
 
 
@@ -402,7 +397,7 @@ timestamp "TIDAcpucost"
 
 
 
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
 echo "art-result: $? TIDAcpucost_8"
 
 
@@ -411,20 +406,11 @@ timestamp "TIDAcpucost"
 
 
 
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
 echo "art-result: $? TIDAcpucost_9"
 
 
 
-timestamp "TIDAcpucost"
-
-
-
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
-echo "art-result: $? TIDAcpucost_10"
-
-
-
 
 timestamp "TIDAcpucost"
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fs_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fs_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..fd4f51e332691f08d457afad627a1d65ec794d0d
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fs_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for beamspot_ttbar_pu80_fs
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-test-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu80_fs
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu80_fs-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_tau_tautau.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fsml.sh
similarity index 82%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_tau_tautau.sh
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fsml.sh
index 1933e632c17021c7a978b898884215a99d0bdffc..8008a2c93306431b10a22caf30de42d58c5aa34a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_tau_tautau.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fsml.sh
@@ -1,23 +1,22 @@
 #!/bin/bash
-# art-description: art job for FTK_tau_tautau
+# art-description: art job for beamspot_ttbar_pu80_fsml
 # art-type: grid
-# art-output: HLTL2-plots
-# art-output: HLTEF-plots
+# art-output: HLTL2-test-plots
 # art-output: times
 # art-output: times-FTF
 # art-output: cost-perCall
 # art-output: cost-perEvent
 # art-output: cost-perCall-chain
 # art-output: cost-perEvent-chain
-# art-input:  mc16_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.digit.RDO_FTK.e3601_s3126_d1480_d1471
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
 # art-output: *.dat 
 # art-output: *.root
 # art-output: *.log
 # art-output: output-dataset
 # art-output: output-cost
 # art-output: output-logs
-# art-input-nfiles: 8
-# art-ncores: 8
+# art-input-nfiles: 3
+# art-ncores: 3
 
 
 
@@ -79,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -155,12 +152,11 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
-     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
      echo "art-result: $? athena_$1"
 
      pwd
@@ -195,7 +191,7 @@ ls -l
 
 
 
-export RTTJOBNAME=TrigInDetValidation_FTK_tau_tautau
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu80_fsml
 
 jobList=
 
@@ -204,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -216,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py
-
 
 # run athena in separate directories
 
@@ -228,7 +223,7 @@ i=0
 
 for git in $jobList ; do 
 
-    ARGS="$git;EventMax=2000;doFTK=True"
+    ARGS="$git;EventMax=1000;mlExtensions=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
  
 #   echo "ARGS: $ARGS"
 
@@ -336,7 +331,7 @@ done
 if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
 
 
-TIDArdict TIDAdata11-rtt.dat -f data-tau-FTK.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
 echo "art-result: $? TIDArdict_1"
 
 
@@ -348,7 +343,7 @@ timestamp "TIDArdict"
 fi
 
 
-TIDArun-art.sh data-tau-FTK.root data-FTK_tau_tautau-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_FTK:InDetTrigTrackingxAODCnv_Tau_FTK HLT_tau25_idperf_FTKRefit:InDetTrigTrackingxAODCnv_Tau_FTKRefit -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu80_fsml-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
 echo "art-result: $? TIDArun_2"
 
 
@@ -357,7 +352,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-tau-FTK.root data-FTK_tau_tautau-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_FTK:InDetTrigTrackingxAODCnv_Tau_FTK_IDTrig HLT_tau25_idperf_FTKRefit:InDetTrigTrackingxAODCnv_Tau_FTKRefit_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
 echo "art-result: $? TIDArun_3"
 
 
@@ -366,7 +361,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
 echo "art-result: $? TIDArun_4"
 
 
@@ -375,25 +370,25 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
-echo "art-result: $? TIDArun_5"
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
 
 
 
-timestamp "TIDArun-art.sh"
+timestamp "RunTrigCostD3PD"
 
 
 
-RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
-echo "art-result: $? RunTrigCostD3PD_6"
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
 
 
 
-timestamp "RunTrigCostD3PD"
+timestamp "TIDAcpucost"
 
 
 
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
 echo "art-result: $? TIDAcpucost_7"
 
 
@@ -402,7 +397,7 @@ timestamp "TIDAcpucost"
 
 
 
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
 echo "art-result: $? TIDAcpucost_8"
 
 
@@ -411,20 +406,11 @@ timestamp "TIDAcpucost"
 
 
 
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
 echo "art-result: $? TIDAcpucost_9"
 
 
 
-timestamp "TIDAcpucost"
-
-
-
-TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
-echo "art-result: $? TIDAcpucost_10"
-
-
-
 
 timestamp "TIDAcpucost"
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fsml_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fsml_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..831c255e45c668c48ce7c44f66b792cb282a49c8
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_fsml_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for beamspot_ttbar_pu80_fsml
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-test-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu80_fsml
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;mlExtensions=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;mlExtensions=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu80_fsml-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder.sh
index cad5c2467075feb0c1cabb26b9e1eb6b4e449e66..55320296723ac8cb3073e6d266a9baf89cf1c33f 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder.sh
@@ -78,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -141,8 +139,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -156,15 +152,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -207,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -219,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py
-
 
 # run athena in separate directories
 
@@ -261,10 +253,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -309,7 +304,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..26e939b5b928e468c973a38809ee298a2596d2f0
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_beamspot_ttbar_pu80_zfinder_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for beamspot_ttbar_pu80_zfinder
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-test-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BeamspotSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_beamspot_ttbar_pu80_zfinder
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;fastZFinder=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;fastZFinder=True;rec.doFloatingPointException.set_Value_and_Lock(False)"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-all.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-all.root data-beamspot_ttbar_pu80_zfinder-reference.root HLT_beamspot_allTE_trkfast_InDetTrigTrackingxAODCnv_BeamSpot_FTF -d HLTL2-test-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40.sh
index 54b64387fd93a829822f3936b0f67cc414eb807a..513c961ac3a718f43acad3daa2a98d5709925e2a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config.sh
index a83a6ce923342d5c09e3b113be03ed34f02afd47..3555777ec52a6030357e6420548d19a74ec86354 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..5fd5d969a046129e44f52dea3480e60e0132444f
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_2016config_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for bjet_IBL_pu40_2016config
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_bjet_IBL_pu40_2016config
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;minVtxTrackpT=1000;bjetEtaHalfWidth=0.2;bjetPhiHalfWidth=0.2;splitZHalfWidth=20;globalTag='OFLCOND-RUN12-SDR-17'"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;minVtxTrackpT=1000;bjetEtaHalfWidth=0.2;bjetPhiHalfWidth=0.2;splitZHalfWidth=20;globalTag='OFLCOND-RUN12-SDR-17'"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-bjet-pileup-merging.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40_2016config-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40_2016config-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..0758f296f3ea4d5721f2770a57e3362fbd24799f
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for bjet_IBL_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-comp
+# art-output: HLTL2-plots-comp
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_bjet_IBL_pu40
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;doBperf=True;globalTag='OFLCOND-RUN12-SDR-17'"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;doBperf=True;globalTag='OFLCOND-RUN12-SDR-17'"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-bjet-pileup-merging.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40-reference.root HLT_j55_bperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_bperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID -d HLTEF-plots-comp  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40-reference.root HLT_j55_bperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_bperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi -d HLTL2-plots-comp  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline.sh
index 2933eabc341a0076a5e4f83ae2d08e12c35f75bc..762ee073bd43ee70166180fcaea58756dab28de4 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline.sh
@@ -80,9 +80,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -143,8 +141,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -158,15 +154,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -209,7 +202,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -221,8 +215,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
 
 # run athena in separate directories
 
@@ -263,10 +255,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -311,7 +306,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config.sh
index 17e8d505fbcbf5051b59879c5125453ac2cc7d00..7d24078e36d516e62c89cf7fd181da1eb2f084a4 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f18d19abf05fddbf49b7bc6b1cba15dd571c3cdb
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_2016config_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for bjet_IBL_pu40_offline_2016config
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_bjet_IBL_pu40_offline_2016config
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;doIDNewTracking=True;minVtxTrackpT=1000;bjetEtaHalfWidth=0.2;bjetPhiHalfWidth=0.2;splitZHalfWidth=20;globalTag='OFLCOND-RUN12-SDR-17'"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;doIDNewTracking=True;minVtxTrackpT=1000;bjetEtaHalfWidth=0.2;bjetPhiHalfWidth=0.2;splitZHalfWidth=20;globalTag='OFLCOND-RUN12-SDR-17'"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline.dat -f data-bjet-pileup-merging.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40_offline_2016config-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu40_offline_2016config-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi_xPrimVx -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8d72f239dc364237cb27a6a1b2317a6bcb60c71c
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu40_offline_art.sh
@@ -0,0 +1,484 @@
+#!/bin/bash
+# art-description: art job for bjet_IBL_pu40_offline
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTL2-vtx
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_bjet_IBL_pu40_offline
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;doIDNewTracking=True;globalTag='OFLCOND-RUN12-SDR-17'"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;doIDNewTracking=True;globalTag='OFLCOND-RUN12-SDR-17'"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline.dat -f data-bjet-pileup.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-bjet-pileup.root data-bjet_IBL_pu40_offline-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup.root data-bjet_IBL_pu40_offline-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi_xPrimVx -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup.root data-bjet_IBL_pu40_offline-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi_xPrimVx/xPrimVx HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi_EFHistoVtx/EFHistoVtx -c TIDAvertex.dat -d HLTL2-vtx  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_7.log
+echo "art-result: $? RunTrigCostD3PD_7"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80.sh
index 10bf0dd9ea7ac839df67398380fd36dbc7ccfc94..a996c857e7ae294f3265e11d8fa120c7de311771 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..0b103cd4e81febb753f5f078558791b773f32424
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_bjet_ibl_pu80_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for bjet_IBL_pu80
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_bjet_IBL_pu80
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000;globalTag='OFLCOND-RUN12-SDR-17'"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000;globalTag='OFLCOND-RUN12-SDR-17'"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-bjet-pileup-merging.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu80-reference.root HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-bjet-pileup-merging.root data-bjet_IBL_pu80-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_BjetPrmVtx_FTF_SuperRoi -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40.sh
index cf90351176b8b6e13e970aef521cdd7b7634b0c7..57974f9133522a97e79d94f500c835cdddd74158 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b7f67a5c33140f47ef36d562fe3c0d9f4ca5df71
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_jpsiee_pu40_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for el_Jpsiee_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.129190.Pythia8_AU2CTEQ6L1_ppToJpsie3e3.recon.RDO.e3802_s2608_s2183_r7042
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 16
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_Jpsiee_pu40
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=500"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=500"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-electron-merge.root -p 11 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Jpsiee_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Jpsiee_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl.sh
index d36972714f0e99493e972f831014784fa327f2ad..a85a4e21bb7be3bb2c8153d7a36a33c2d5fc342f 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_mu_ttbar.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_art.sh
similarity index 76%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_mu_ttbar.sh
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_art.sh
index 538588b2d75fbf1625141aca338c7993daa786f1..0c37ec8500a591a96658d09e027ae0e2526c9eaa 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_mu_ttbar.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_art.sh
@@ -1,25 +1,30 @@
 #!/bin/bash
-# art-description: art job for FTK_mu_ttbar
+# art-description: art job for el_single_e_7-80_IBL
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
 # art-type: grid
-# art-output: HLTL2-plots
 # art-output: HLTEF-plots
-# art-output: HLTL2-plots-lowpt
 # art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots
+# art-output: HLTL2-plots-lowpt
 # art-output: times
 # art-output: times-FTF
 # art-output: cost-perCall
 # art-output: cost-perEvent
 # art-output: cost-perCall-chain
 # art-output: cost-perEvent-chain
-# art-input:  mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.digit.RDO_FTK.e6337_e5984_s3126_d1480_d1471
+# art-input:  mc15_13TeV.159010.ParticleGenerator_e_Et7to80.recon.RDO.e1948_s2726_r7728
 # art-output: *.dat 
 # art-output: *.root
 # art-output: *.log
 # art-output: output-dataset
 # art-output: output-cost
 # art-output: output-logs
-# art-input-nfiles: 16
-# art-ncores: 8
+# art-input-nfiles: 10
+# art-cores: 8
+# art-memory: 4096
 
 
 
@@ -51,6 +56,7 @@ RUNPOST=-1
 DIRECTORY=
 LOCAL=0
 FORCE=0
+FORK=1
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -81,9 +87,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -157,12 +161,11 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
-     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
      echo "art-result: $? athena_$1"
 
      pwd
@@ -197,29 +200,61 @@ ls -l
 
 
 
-export RTTJOBNAME=TrigInDetValidation_FTK_mu_ttbar
+export RTTJOBNAME=TrigInDetValidation_el_single_e_7-80_IBL
 
 jobList=
 
 if [ $LOCAL -eq 1 ]; then
+
       echo "running locally"
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
 else
+
       fileList="['${ArtInFile//,/', '}']"
       _jobList="'../${ArtInFile//,/' '../}'"
       echo "List of files = $fileList"
       for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
 fi
 
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
+if [ $FORK -eq 1 ]; then
 
 # run athena in separate directories
 
@@ -230,7 +265,7 @@ i=0
 
 for git in $jobList ; do 
 
-    ARGS="$git;EventMax=500;doFTK=True"
+    ARGS="$git;EventMax=2000"
  
 #   echo "ARGS: $ARGS"
 
@@ -284,6 +319,8 @@ timestamp "waiting on athena jobs ..."
 
 waitonallproc
 
+fi
+
 echo "all done ! hooray !"
 
 timestamp "forking all athena jobs completed"
@@ -338,7 +375,7 @@ done
 if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
 
 
-TIDArdict TIDAdata11-rtt.dat -f data-muon-FTK.root -p 13 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+TIDArdict TIDAdata11-rtt.dat -f data-electron-IBL.root -p 11 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
 echo "art-result: $? TIDArdict_1"
 
 
@@ -350,7 +387,7 @@ timestamp "TIDArdict"
 fi
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
 echo "art-result: $? TIDArun_2"
 
 
@@ -359,7 +396,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_3.log
 echo "art-result: $? TIDArun_3"
 
 
@@ -368,7 +405,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_4.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_4.log
 echo "art-result: $? TIDArun_4"
 
 
@@ -377,7 +414,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_5.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
 echo "art-result: $? TIDArun_5"
 
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40.sh
index 5add2cdbe8a822f5896cccb64fa36c743082191b..e51ad745c8ba03a9f82632f6b8ab4f924ac40e8b 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_mu_ttbar_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40_art.sh
similarity index 75%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_mu_ttbar_offline.sh
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40_art.sh
index edd64517608e526ec03390fba4c6f5a24848138f..bff12eb03967deeb534484afdafe3c40718c9058 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_mu_ttbar_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_ibl_pu40_art.sh
@@ -1,25 +1,30 @@
 #!/bin/bash
-# art-description: art job for FTK_mu_ttbar_offline
+# art-description: art job for el_single_e_7-80_IBL_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
 # art-type: grid
-# art-output: HLTL2-plots
 # art-output: HLTEF-plots
-# art-output: HLTL2-plots-lowpt
 # art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots
+# art-output: HLTL2-plots-lowpt
 # art-output: times
 # art-output: times-FTF
 # art-output: cost-perCall
 # art-output: cost-perEvent
 # art-output: cost-perCall-chain
 # art-output: cost-perEvent-chain
-# art-input:  mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.digit.RDO_FTK.e6337_e5984_s3126_d1480_d1471
+# art-input:  mc15_13TeV.159010.ParticleGenerator_e_Et7to80.recon.RDO.e1948_s2726_r7772
 # art-output: *.dat 
 # art-output: *.root
 # art-output: *.log
 # art-output: output-dataset
 # art-output: output-cost
 # art-output: output-logs
-# art-input-nfiles: 16
-# art-ncores: 8
+# art-input-nfiles: 10
+# art-cores: 8
+# art-memory: 4096
 
 
 
@@ -51,6 +56,7 @@ RUNPOST=-1
 DIRECTORY=
 LOCAL=0
 FORCE=0
+FORK=1
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -81,9 +87,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -157,12 +161,11 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
-     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
      echo "art-result: $? athena_$1"
 
      pwd
@@ -197,29 +200,61 @@ ls -l
 
 
 
-export RTTJOBNAME=TrigInDetValidation_FTK_mu_ttbar_offline
+export RTTJOBNAME=TrigInDetValidation_el_single_e_7-80_IBL_pu40
 
 jobList=
 
 if [ $LOCAL -eq 1 ]; then
+
       echo "running locally"
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
 else
+
       fileList="['${ArtInFile//,/', '}']"
       _jobList="'../${ArtInFile//,/' '../}'"
       echo "List of files = $fileList"
       for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
 fi
 
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
+if [ $FORK -eq 1 ]; then
 
 # run athena in separate directories
 
@@ -230,7 +265,7 @@ i=0
 
 for git in $jobList ; do 
 
-    ARGS="$git;EventMax=500;doIDNewTracking=True;doFTK=True"
+    ARGS="$git;EventMax=2000"
  
 #   echo "ARGS: $ARGS"
 
@@ -284,6 +319,8 @@ timestamp "waiting on athena jobs ..."
 
 waitonallproc
 
+fi
+
 echo "all done ! hooray !"
 
 timestamp "forking all athena jobs completed"
@@ -321,7 +358,7 @@ fi
 ls -lt
 
 
-get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata11-rtt.dat
 get_files -data TIDAdata_cuts.dat
 get_files -data TIDAdata_chains.dat
 get_files -data TIDAbeam.dat
@@ -338,7 +375,7 @@ done
 if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
 
 
-TIDArdict TIDAdata11-rtt-offline.dat -f data-muon-FTK.root -p 13 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+TIDArdict TIDAdata11-rtt.dat -f data-electron-IBL.root -p 11 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
 echo "art-result: $? TIDArdict_1"
 
 
@@ -350,7 +387,7 @@ timestamp "TIDArdict"
 fi
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL_pu40-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
 echo "art-result: $? TIDArun_2"
 
 
@@ -359,7 +396,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu24_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu24_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_3.log
 echo "art-result: $? TIDArun_3"
 
 
@@ -368,7 +405,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_4.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL_pu40-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_4.log
 echo "art-result: $? TIDArun_4"
 
 
@@ -377,7 +414,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-muon-FTK.root data-FTK_mu_ttbar_offline-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig HLT_mu6_FTK_idperf_InDetTrigTrackingxAODCnv_Muon_FTK_IDTrig HLT_mu6_FTKRefit_idperf_InDetTrigTrackingxAODCnv_Muon_FTKRefit_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_5.log
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_IBL_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
 echo "art-result: $? TIDArun_5"
 
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0.sh
index ca62ee7cb697897f7bacff79e0439a8e80a63c88..a660999ede78c0a03ae28124307fa44223c1c1b5 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b1bc27d8e26ff150ccfc639c1f921da438eb864e
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_single_e_7-80_larged0
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.159053.ParticleGenerator_e_Et7to80_vertxy20.recon.RDO.e3603_s2726_r7728
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 10
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_single_e_7-80_larged0
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-larged0-el.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin_larged0.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-larged0-el.dat -f data-electron-IBL.root -p 11 -b Test_bin_larged0.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu.sh
index 856ca09b78718e9dfdc53a0f4806c2e1838006e5..53f74f03f8bac6c521e929aa5d5b15c64b1f3cff 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..0750dd24ad8909fb53130041f86f8bf5c28f4e1d
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_single_e_7-80_larged0_pu_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_single_e_7-80_larged0_PU
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.159053.ParticleGenerator_e_Et7to80_vertxy20.recon.RDO.e3603_s2726_r7772
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 10
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_single_e_7-80_larged0_PU
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-larged0-el.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin_larged0.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-larged0-el.dat -f data-electron-IBL.root -p 11 -b Test_bin_larged0.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0_PU-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0_PU-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0_PU-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-IBL.root data-el_single_e_7-80_larged0_PU-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40.sh
index ea3b12cd0d60cb3058ab9c9aea5b40a52775182b..717b16b43274cfc8471cf726d41dc3e60672786a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4a7df1618185af3a9a6900e3d21d0807c49a2043
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu40_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_ttbar_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_ttbar_pu40
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-electron-merge.root -p 11 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu40-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu40-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80.sh
index 94e948f5a26478e6894b81ae392af21c2a0a6794..f2be22b4dd4a1a6f5968ae22589cfdba63bcc80f 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..09f67bfb1cd414c012010135e02d99ccbadf49c4
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_ttbar_pu80_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_ttbar_pu80
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_ttbar_pu80
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=1000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=1000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-electron-merge.root -p 11 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu80-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu80-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu80-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_ttbar_pu80-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40.sh
index fdb537747ac62db39eefb41ac38cc0a2847f2618..249743417cfe50622c516e584eb4cf2d07a40e3b 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..c9b60804a398a54ddc05448886fa45a2bd5b899a
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_Zee_IBL_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 8
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_Zee_IBL_pu40
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-electron-merge.root -p 11 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline.sh
index c4950df8e40cdda077d79b9bea4b7dfe1b2475da..c52e79c7eb87ff0241505ab67063a86e6fee07d8 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..199ccb45c116d993b9d69bad93575b4094e1f1c7
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_Zee_IBL_pu40_offline
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_Zee_IBL_pu40_offline
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;doIDNewTracking=True;PdgId=11"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;doIDNewTracking=True;PdgId=11"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline.dat -f data-electron-merge.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher.sh
index aca9132a16183f1433a3750836309f355fbc7c19..03c5e61e8aa1d1e708af6b6e641e2866feb82e58 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..51068c602440ca69e3490491bb6135ff7e901a2a
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_offline_rzmatcher_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_Zee_IBL_pu40_offline_rzMatcher
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_Zee_IBL_pu40_offline_rzMatcher
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;doIDNewTracking=True;PdgId=11"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;doIDNewTracking=True;PdgId=11"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline-rzMatcher.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline-rzMatcher.dat -f data-electron-merge.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline_rzMatcher-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline_rzMatcher-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline_rzMatcher-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_offline_rzMatcher-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher.sh
index fb323072b83fefdd34eff87ae636a30c50cddd1c..dcd3b5dde67b64ea954c68625302938059db8f5d 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher.sh
@@ -81,9 +81,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -144,8 +142,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -159,15 +155,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -210,7 +203,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -222,8 +216,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py
-
 
 # run athena in separate directories
 
@@ -264,10 +256,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -312,7 +307,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..28bafff0e3d1b6c47168aaf231bf1c026d933e87
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_el_zee_ibl_pu40_rzmatcher_art.sh
@@ -0,0 +1,494 @@
+#!/bin/bash
+# art-description: art job for el_Zee_IBL_pu40_rzMatcher
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots-lowpt
+# art-output: HLTL2-plots-lowpt
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 8
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_ElectronSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_el_Zee_IBL_pu40_rzMatcher
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;PdgId=11"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;PdgId=11"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-rzMatcher.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-rzMatcher.dat -f data-electron-merge.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_rzMatcher-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_rzMatcher-reference.root HLT_e24_medium_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_rzMatcher-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_IDTrig -d HLTEF-plots-lowpt  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-electron-merge.root data-el_Zee_IBL_pu40_rzMatcher-reference.root HLT_e5_loose_idperf_InDetTrigTrackingxAODCnv_Electron_FTF -d HLTL2-plots-lowpt  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_6.log
+echo "art-result: $? TIDArun_6"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_7.log
+echo "art-result: $? TIDArun_7"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_8.log
+echo "art-result: $? RunTrigCostD3PD_8"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_11.log
+echo "art-result: $? TIDAcpucost_11"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_12.log
+echo "art-result: $? TIDAcpucost_12"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias.sh
index 4c8c0dd2bb20ee091cd61bc569a74539d41ace73..c1b1791265876b6bac412f35cba41176740575b7 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias.sh
@@ -78,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -141,8 +139,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -156,15 +152,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MonitorSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -207,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -219,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MonitorSlice.py
-
 
 # run athena in separate directories
 
@@ -261,10 +253,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -309,7 +304,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..046dd8617ae30ce2d7813c42bf4418f22331cdfc
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for minBias
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361036.Pythia8_A2MSTW2008LO_minbias_inelastic.recon.RDO.e3580_s2726_r7011
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MonitorSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_minBias
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-monitor.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-monitor.root data-minBias-reference.root HLT_mb_idperf_L1RD1_FILLED_InDetTrigTrackingxAODCnv_minBias_EFID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline.sh
index 73faaba405c4aec3b758c7504b9879b21b02b880..aa0e86549dbbf56e1cc6839e347196a3b12fcf6d 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline.sh
@@ -78,9 +78,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -141,8 +139,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -156,15 +152,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MonitorSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -207,7 +200,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -219,8 +213,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MonitorSlice.py
-
 
 # run athena in separate directories
 
@@ -261,10 +253,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -309,7 +304,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..7b2f96e7845a4a9057154bdc7a163048de8ba17e
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_minbias_offline_art.sh
@@ -0,0 +1,464 @@
+#!/bin/bash
+# art-description: art job for minBias_offline
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361036.Pythia8_A2MSTW2008LO_minbias_inelastic.recon.RDO.e3580_s2726_r7011
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MonitorSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_minBias_offline
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;doIDNewTracking=True"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;doIDNewTracking=True"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline.dat -f data-minBias.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-minBias.root data-minBias_offline-reference.root HLT_mb_idperf_L1RD1_FILLED_InDetTrigTrackingxAODCnv_minBias_EFID -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_5.log
+echo "art-result: $? RunTrigCostD3PD_5"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_6.log
+echo "art-result: $? TIDAcpucost_6"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl.sh
index fafe0d74b17882935c85e32b373cd41a68e5972e..7a8135243e1f028c3e305edfada54a75ba25f7ea 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_bjet_ttbar_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl_art.sh
similarity index 78%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_bjet_ttbar_offline.sh
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl_art.sh
index 7bd21fbb88b0e813536b7274a058e537521b9c43..eb07e0b3b6afe5e4e01d709f253883878791bbfe 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_bjet_ttbar_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_bphys_ibl_art.sh
@@ -1,5 +1,9 @@
 #!/bin/bash
-# art-description: art job for FTK_bjet_ttbar_offline
+# art-description: art job for mu_bphys_IBL
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
 # art-type: grid
 # art-output: HLTL2-plots
 # art-output: HLTEF-plots
@@ -9,15 +13,16 @@
 # art-output: cost-perEvent
 # art-output: cost-perCall-chain
 # art-output: cost-perEvent-chain
-# art-input:  mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.digit.RDO_FTK.e6337_e5984_s3126_d1480_d1471
+# art-input:  mc15_13TeV.300401.Pythia8BPhotospp_A14_CTEQ6L1_Bs_Jpsimu3p5mu3p5_phi.recon.RDO.e4397_s2608_r6869
 # art-output: *.dat 
 # art-output: *.root
 # art-output: *.log
 # art-output: output-dataset
 # art-output: output-cost
 # art-output: output-logs
-# art-input-nfiles: 4
-# art-ncores: 4
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
 
 
 
@@ -49,6 +54,7 @@ RUNPOST=-1
 DIRECTORY=
 LOCAL=0
 FORCE=0
+FORK=1
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -79,9 +85,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -155,12 +159,11 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
-     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
      echo "art-result: $? athena_$1"
 
      pwd
@@ -195,29 +198,61 @@ ls -l
 
 
 
-export RTTJOBNAME=TrigInDetValidation_FTK_bjet_ttbar_offline
+export RTTJOBNAME=TrigInDetValidation_mu_bphys_IBL
 
 jobList=
 
 if [ $LOCAL -eq 1 ]; then
+
       echo "running locally"
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
 else
+
       fileList="['${ArtInFile//,/', '}']"
       _jobList="'../${ArtInFile//,/' '../}'"
       echo "List of files = $fileList"
       for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
 fi
 
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
+if [ $FORK -eq 1 ]; then
 
 # run athena in separate directories
 
@@ -228,7 +263,7 @@ i=0
 
 for git in $jobList ; do 
 
-    ARGS="$git;EventMax=500;doIDNewTracking=True;doFTK=True"
+    ARGS="$git;EventMax=2000"
  
 #   echo "ARGS: $ARGS"
 
@@ -282,6 +317,8 @@ timestamp "waiting on athena jobs ..."
 
 waitonallproc
 
+fi
+
 echo "all done ! hooray !"
 
 timestamp "forking all athena jobs completed"
@@ -319,7 +356,7 @@ fi
 ls -lt
 
 
-get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata11-rtt.dat
 get_files -data TIDAdata_cuts.dat
 get_files -data TIDAdata_chains.dat
 get_files -data TIDAbeam.dat
@@ -336,7 +373,7 @@ done
 if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
 
 
-TIDArdict TIDAdata11-rtt-offline.dat -f data-bjet-FTK.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+TIDArdict TIDAdata11-rtt.dat -f data-muon-bphys-merge.root -p 13 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
 echo "art-result: $? TIDArdict_1"
 
 
@@ -348,7 +385,7 @@ timestamp "TIDArdict"
 fi
 
 
-TIDArun-art.sh data-bjet-FTK.root data-FTK_bjet_ttbar_offline-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_FTF HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_SplitJet HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_SplitJet -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+TIDArun-art.sh data-muon-bphys-merge.root data-mu_bphys_IBL-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_2.log
 echo "art-result: $? TIDArun_2"
 
 
@@ -357,7 +394,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-bjet-FTK.root data-FTK_bjet_ttbar_offline-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_IDTrig_SplitJet HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_IDTrig_SplitJet -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+TIDArun-art.sh data-muon-bphys-merge.root data-mu_bphys_IBL-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
 echo "art-result: $? TIDArun_3"
 
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0.sh
index 569c18e758ba6b4a0e1f27e44c2f9b0633593dd2..eb22b69959b454ceaef8b36a1a5811569e4bb9d3 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f9cdbf6db19067135ca6a8082b1beaac4b879914
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for mu_single_mu_larged0
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.107237.ParticleGenerator_mu_Pt4to100_vertxy20.recon.RDO.e3603_s2726_r7728
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 10
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_mu_single_mu_larged0
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-larged0.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin_larged0.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-larged0.dat -f data-muon.root -p 13 -b Test_bin_larged0.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-muon.root data-mu_single_mu_larged0-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-muon.root data-mu_single_mu_larged0-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu.sh
index efd605936a19efc154de45678257e0272141c895..f87b61982463af4f36c241a1c51b8043e8afdd7a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f5505ea9b3eedd7aae17e5f8507ba32e231fb501
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_single_mu_larged0_pu_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for mu_single_mu_larged0_PU
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.107237.ParticleGenerator_mu_Pt4to100_vertxy20.recon.RDO.e3603_s2726_r7772
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 10
+# art-cores: 8
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_mu_single_mu_larged0_PU
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-larged0.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin_larged0.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-larged0.dat -f data-muon.root -p 13 -b Test_bin_larged0.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-muon.root data-mu_single_mu_larged0_PU-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-muon.root data-mu_single_mu_larged0_PU-reference.root HLT_mu6_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40.sh
index a2544cfef206933781fbc817a6ab604eda45d280..47fc5b97b469c6eb60119a023bcf4c2304121049 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_bjet_ttbar.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_art.sh
similarity index 79%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_bjet_ttbar.sh
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_art.sh
index e516799b748f14ddf7b3f7e5d860ca2ebf41d3a5..1e9b8b21de590f4e162fafd3ba96dd774710241d 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_ftk_bjet_ttbar.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_art.sh
@@ -1,5 +1,9 @@
 #!/bin/bash
-# art-description: art job for FTK_bjet_ttbar
+# art-description: art job for mu_Zmumu_IBL_pu40
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
 # art-type: grid
 # art-output: HLTL2-plots
 # art-output: HLTEF-plots
@@ -9,7 +13,7 @@
 # art-output: cost-perEvent
 # art-output: cost-perCall-chain
 # art-output: cost-perEvent-chain
-# art-input:  mc16_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.digit.RDO_FTK.e6337_e5984_s3126_d1480_d1471
+# art-input:  mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
 # art-output: *.dat 
 # art-output: *.root
 # art-output: *.log
@@ -17,7 +21,8 @@
 # art-output: output-cost
 # art-output: output-logs
 # art-input-nfiles: 4
-# art-ncores: 4
+# art-cores: 4
+# art-memory: 4096
 
 
 
@@ -49,6 +54,7 @@ RUNPOST=-1
 DIRECTORY=
 LOCAL=0
 FORCE=0
+FORK=1
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -79,9 +85,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -155,12 +159,11 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
-     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py  &> athena-local-$1.log
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
      echo "art-result: $? athena_$1"
 
      pwd
@@ -195,29 +198,61 @@ ls -l
 
 
 
-export RTTJOBNAME=TrigInDetValidation_FTK_bjet_ttbar
+export RTTJOBNAME=TrigInDetValidation_mu_Zmumu_IBL_pu40
 
 jobList=
 
 if [ $LOCAL -eq 1 ]; then
+
       echo "running locally"
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
 else
+
       fileList="['${ArtInFile//,/', '}']"
       _jobList="'../${ArtInFile//,/' '../}'"
       echo "List of files = $fileList"
       for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
 fi
 
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_BjetSlice.py
-
+if [ $FORK -eq 1 ]; then
 
 # run athena in separate directories
 
@@ -228,7 +263,7 @@ i=0
 
 for git in $jobList ; do 
 
-    ARGS="$git;EventMax=500;doFTK=True"
+    ARGS="$git;EventMax=2000"
  
 #   echo "ARGS: $ARGS"
 
@@ -282,6 +317,8 @@ timestamp "waiting on athena jobs ..."
 
 waitonallproc
 
+fi
+
 echo "all done ! hooray !"
 
 timestamp "forking all athena jobs completed"
@@ -336,7 +373,7 @@ done
 if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
 
 
-TIDArdict TIDAdata11-rtt.dat -f data-bjet-FTK.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+TIDArdict TIDAdata11-rtt.dat -f data-muon-pileup-merge.root -p 13 -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
 echo "art-result: $? TIDArdict_1"
 
 
@@ -348,7 +385,7 @@ timestamp "TIDArdict"
 fi
 
 
-TIDArun-art.sh data-bjet-FTK.root data-FTK_bjet_ttbar-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_FTF_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_FTF HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_SplitJet HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_SplitJet -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_2.log
 echo "art-result: $? TIDArun_2"
 
 
@@ -357,7 +394,7 @@ timestamp "TIDArun-art.sh"
 
 
 
-TIDArun-art.sh data-bjet-FTK.root data-FTK_bjet_ttbar-reference.root HLT_j55_boffperf_split_InDetTrigTrackingxAODCnv_Bjet_IDTrig_forID HLT_j55_boffperf_split_FTKVtx_InDetTrigTrackingxAODCnv_Bjet_IDTrig HLT_j55_boffperf_split_FTK_InDetTrigTrackingxAODCnv_Bjet_FTK_IDTrig_SplitJet HLT_j55_boffperf_split_FTKRefit_InDetTrigTrackingxAODCnv_Bjet_FTKRefit_IDTrig_SplitJet -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
 echo "art-result: $? TIDArun_3"
 
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline.sh
index c7d204658a875991c8972f8c30039323e8e19bc8..4844cf08b7f8cf68728dcab7b8ac234e9f41ae15 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..1000cf1ac735f9ce11f05a55be50b06fbb6d3751
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for mu_Zmumu_IBL_pu40_offline
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_mu_Zmumu_IBL_pu40_offline
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;doIDNewTracking=True;PdgId=13"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;doIDNewTracking=True;PdgId=13"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline.dat -f data-muon-pileup-merge.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40_offline-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40_offline-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher.sh
index 53505c5bd696aa338f31efb87b930054519d98c9..0577cc2879c93ad532525e009f8d8fe13af8cab9 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..7c056aac4ea60772263057fe92328ade59034c0a
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_offline_rzmatcher_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for mu_Zmumu_IBL_pu40_offline_rzMatcher
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_mu_Zmumu_IBL_pu40_offline_rzMatcher
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;doIDNewTracking=True;PdgId=13"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;doIDNewTracking=True;PdgId=13"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline-rzMatcher.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline-rzMatcher.dat -f data-muon-pileup-merge.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40_offline_rzMatcher-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40_offline_rzMatcher-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher.sh
index 9d00cc0474770b7bda4d048f7b02e9a878b04b6d..f346b8be9e9f4ac8d843500c43ef1a113a7a0795 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo             TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py
-
 
 # run athena in separate directories
 
@@ -262,10 +254,13 @@ done
 
 [ -e topp.log ] && rm topp.log
 
-ps -aF --pid $PPROCS | grep $USER >> topp.log
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
 
 echo >> topp.log
 
+sleep 20 
+
 top -b -n1 > top.log
 grep PID top.log >> topp.log
 for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
@@ -310,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a3f76c9aad316d8dabdcc051e8a948e0cd3b05ac
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_mu_zmumu_ibl_pu40_rzmatcher_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for mu_Zmumu_IBL_pu40_rzMatcher
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTL2-plots
+# art-output: HLTEF-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 4
+# art-cores: 4
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"               TrigInDetValidation/TrigInDetValidation_RTT_topOptions_MuonSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_mu_Zmumu_IBL_pu40_rzMatcher
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;PdgId=13"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;PdgId=13"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-rzMatcher.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-rzMatcher.dat -f data-muon-pileup-merge.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40_rzMatcher-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF -d HLTL2-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-muon-pileup-merge.root data-mu_Zmumu_IBL_pu40_rzMatcher-reference.root HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig -d HLTEF-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46.sh
index 5b6032e021decefdc4ab04c7b585d4fbb46648ab..ea77d7c71c8aa4f7da73bc371310c7f3d48fadd4 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py
-
 
 # run athena in separate directories
 
@@ -313,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..c3c0ed33538cfb01e3a68f5d0be8a6561088a2be
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for tau_IBL_pu46
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc16_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.recon.RDO.e3601_s3126_r9546
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_tau_IBL_pu46
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;PdgId=15"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;PdgId=15"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-tau-IBL.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_Tau_IDTrig_forID3 -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet.sh
index b1f0fc97bbd6916ed73ddf37e3eb9af76eaa89e3..03bd451bf0a0de270ab4f49952033190ea554b25 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py
-
 
 # run athena in separate directories
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..1788f96523cef48bef76923097bbf714f9011ff0
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_nodoublet_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for tau_IBL_pu46_NoDoublet
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc16_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.recon.RDO.e3601_s3126_r9546
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_tau_IBL_pu46_NoDoublet
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;PdgId=15;TauDoubletFilter=False"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;PdgId=15;TauDoubletFilter=False"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-tau-IBL.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_Tau_IDTrig_forID3 -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline.sh
index ec2f5cfb9f8dec1b0ef89c28156d930ee6e06278..7eeeee855321603b7c090c9adcef54a6954bf494 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py
-
 
 # run athena in separate directories
 
@@ -313,7 +305,9 @@ hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log
 # file to the check will fail. This creates a link so this 
 # test will pass
   
-for git in output-dataset/*.root ; do ln -s $git TrkNtuple-0000.root ; break ; done  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
 
 fi
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..84eddf3b2c417caa7567247723954bfd87dbd155
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_offline_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for tau_IBL_pu46_offline
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc16_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.recon.RDO.e3601_s3126_r9546
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_tau_IBL_pu46_offline
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;doIDNewTracking=True"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;doIDNewTracking=True"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt-offline.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt-offline.dat -f data-tau-IBL.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46_offline-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_Tau_IDTrig_forID3 -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46_offline-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam.sh
index dc16d6465fb9c41c041d21becd444251ae2ed7d9..110a6ae3375c0a7a5d0b14b19a02eb3339dd29bb 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam.sh
@@ -79,9 +79,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -142,8 +140,6 @@ function waitonallproc   {
 
 # run athena  
 
-iathena=0
-
 function runathena { 
    timestamp  "runathena:"
 
@@ -157,15 +153,12 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
      echo -e "\nrunning athena in athena-$1\n"
      athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
-     echo "art-result: $? athena_$iathena"
-
-     ((iathena++))
+     echo "art-result: $? athena_$1"
 
      pwd
      ls -lt
@@ -208,7 +201,8 @@ if [ $LOCAL -eq 1 ]; then
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
 else
       fileList="['${ArtInFile//,/', '}']"
@@ -220,8 +214,6 @@ fi
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo            TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py
-
 
 # run athena in separate directories
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam_art.sh b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam_art.sh
new file mode 100755
index 0000000000000000000000000000000000000000..0f9465222be2e53bc96776fc7dcce922948674df
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigindetvalidation_tau_ibl_pu46_roiparam_art.sh
@@ -0,0 +1,474 @@
+#!/bin/bash
+# art-description: art job for tau_IBL_pu46_RoiParam
+# art-include: 21.3/Athena
+# art-include: 21.9/Athena
+# art-include: master/Athena
+# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=
+# art-type: grid
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-input:  mc16_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.recon.RDO.e3601_s3126_r9546
+# art-output: *.dat 
+# art-output: *.root
+# art-output: *.log
+# art-output: output-dataset
+# art-output: output-cost
+# art-output: output-logs
+# art-input-nfiles: 3
+# art-cores: 3
+# art-memory: 4096
+
+
+
+RED='\033[0;31m'
+NC='\033[0m'
+
+
+function usage { 
+    [ $# -gt 1 ] && echo $2
+
+    echo "Usage: $(basename $0) [args]"
+    echo 
+    echo "-d, --directory  DIRECTORY \t run from the specified directory"
+    echo "-l, --local                \t run locally rather than on the grid"
+    echo "-x, --exclude              \t don't run athena or the post processing, only the plotting stages"
+    echo "-p, --post                 \t force running of post processingthe post processing, even if -x is set"
+    echo "-f, --force                \t disable protection against rerunning where you shouldn't be"
+    echo "-h, --help                 \t this help"
+    [ $# -gt 0 ] && exit $1
+    exit 0
+}
+
+args=$(getopt -ql "searchpath:" -o "d:lxph" -- "$@")
+
+# eval set -- "$args"
+
+RUNATHENA=1
+RUNPOST=-1
+DIRECTORY=
+LOCAL=0
+FORCE=0
+FORK=1
+
+while [ $# -ge 1 ]; do
+    case "$1" in
+        --) shift ; break ;;
+        -d | --directory )  if [ $# -lt 2 ]; then usage; fi ; DIRECTORY="$2" ; shift ;;
+        -x | --exclude )    RUNATHENA=0 ; [ $RUNPOST -eq -1 ] && RUNPOST=0;;
+        -p | --post )       RUNPOST=1 ;;
+        -f | --force )      FORCE=1 ;;
+        -l | --local )      LOCAL=1 ;;
+        -h | --help )       usage ;;
+     esac
+    shift
+done
+
+
+[ $RUNPOST -eq 0 ] || RUNPOST=1
+
+
+# generate a time stamp
+
+function timestamp { printf "${RED}Timestamp: $1 $(date)${NC}\n"  ; }
+
+# poor quality function to convert seconds to a proper time
+
+function converttime { 
+    local totes=$1
+    [ $totes -lt 0 ] && ((totes=$totes+86400))
+    ((H=$totes/3600))
+    ((M=($totes%3600)/60))
+    ((S=$totes%60))
+    printf "%d:%02d:%02d\n" $H $M $S
+}
+
+timestamp "starting"
+
+# reset seconds counter - not really needed, but hey 
+
+SECONDS=0
+
+
+# stuff to control running concurrent 
+# processes 
+
+PROCESS=0
+BGPROCS=
+NJOBS=8
+WAITING=60
+
+# is this needed ? or not ? 
+# export ATHENA_NUM_PROC=$NJOBS
+# export ATHENA_NUM_PROC=1
+
+unset  ATHENA_NUM_PROC
+unset  ATHENA_PROC_NUMBER
+ 
+env | grep ATHENA_NUM_PROC
+env | grep ATHENA_PROC_NUMBER
+
+
+
+
+# count how many jobs are running ...
+
+function running {
+     local IRUNNING=0
+     for BGPROC in $BGPROCS; do ( ps -p $BGPROC &> /dev/null ) && ((IRUNNING++)) ; done
+     echo $IRUNNING
+}
+
+
+# wait for an empty slot ...
+
+function waitonproc   {
+    echo "waitonproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -ge $NJOBS ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+# wait for all processes to finish ...
+
+function waitonallproc   {
+    echo "waitonallproc waiting ..."
+    local IRUNNING=$(running)
+    while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
+}
+
+
+
+# run athena  
+
+function runathena { 
+   timestamp  "runathena:"
+
+   if [ $# -gt 0 ]; then  
+
+     echo "input $1"
+
+     pwd 
+
+     local DIR=$PWD
+
+     mkdir -p athena-$1
+     cd  athena-$1
+
+     pwd
+     echo "ARGS: $ARGS"
+     echo -e "\nrunning athena in athena-$1\n"
+     athena.py  -c "$ARGS"              TrigInDetValidation/TrigInDetValidation_RTT_topOptions_TauSlice.py  &> athena-local-$1.log
+     echo "art-result: $? athena_$1"
+
+     pwd
+     ls -lt
+
+     cd $DIR
+
+   fi  
+
+   timestamp  "runathena done:"
+}
+
+
+
+# function to save the output from the separate 
+# athena runs
+
+function saveoutput {
+    [ $# -lt 2 ] && echo "not enough arguments for saveoutput" && exit -1  
+    mkdir -p $1
+    for git in athena-*/$2 ; do
+        FILE=$(echo  $git | sed 's|/|-|g')
+        cp $git $1/$FILE
+    done
+}
+
+
+
+
+
+ls -l
+
+
+
+export RTTJOBNAME=TrigInDetValidation_tau_IBL_pu46_RoiParam
+
+jobList=
+
+if [ $LOCAL -eq 1 ]; then
+
+      echo "running locally"
+      # get number of files 
+      NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
+      [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
+      for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;EventMax=2000;PdgId=15;TauDoubletFilter=False;TauRoiParam=True"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
+else
+
+      fileList="['${ArtInFile//,/', '}']"
+      _jobList="'../${ArtInFile//,/' '../}'"
+      echo "List of files = $fileList"
+      for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
+fi
+
+
+if [ $RUNATHENA -eq 1 ]; then 
+
+if [ $FORK -eq 1 ]; then
+
+# run athena in separate directories
+
+
+# loop over the inputs spawning the separate athena jobs
+
+i=0
+
+for git in $jobList ; do 
+
+    ARGS="$git;EventMax=2000;PdgId=15;TauDoubletFilter=False;TauRoiParam=True"
+ 
+#   echo "ARGS: $ARGS"
+
+    waitonproc
+    
+    timestamp "forking athena index: $i"
+
+    runathena $i & 
+    PID=$!
+    BGPROCS="$BGPROCS $PID"
+
+    ((i++))
+
+done
+
+
+# wait for all the jobs to finish
+
+sleep 10 
+
+
+PPROCS=$BGPROCS
+
+for PID in $BGPROCS ; do
+     for CHILD in $(ps --ppid $PID -o pid h) ; do PPROCS="$PPROCS $CHILD" ; done 
+done
+
+[ -e topp.log ] && rm topp.log
+
+echo -e "\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD" >> topp.log
+ps -aF --pid $PPROCS | grep $USER | grep -v grep | grep -v sed | sed 's| [^[:space:]]*/python | python |g' | sed 's| [^[:space:]]*/athena| athena|g' | sed 's|ARTConfig=.* |ARTConfig=... |g' | sed 's|eos/[^[:space:]]*/trigindet|eos/.../trigindet|g' >> topp.log
+
+echo >> topp.log
+
+sleep 20 
+
+top -b -n1 > top.log
+grep PID top.log >> topp.log
+for PID in $PPROCS ; do grep $PID top.log >> topp.log ; done
+
+cat topp.log
+
+# cat topp.log | mail sutt@cern.ch
+
+
+echo -e "\n\n"
+
+timestamp "waiting on athena jobs ..."
+
+# echo -e "\n\nwaiting on athena jobs...\n"
+
+waitonallproc
+
+fi
+
+echo "all done ! hooray !"
+
+timestamp "forking all athena jobs completed"
+
+
+# jobs have all finished, 
+# copy the output from the athena run subdirectories to 
+# single output data set directories etc
+
+saveoutput output-dataset "Trk*.root"
+saveoutput output-logs    "ath*.log"
+saveoutput output-cost     trig_cost.root
+
+grep ERROR   athena-*/ath*.log | grep -v ERRORS | grep -v MATRIX | grep -v DERIV &> errors.log 
+grep WARNING athena-*/ath*.log &> warnings.log
+
+timestamp "combining expert histograms ..."
+
+# add the expert timing histgrams
+hadd expert-monitoring.root athena-*/expert-monitoring.root &> hadd.log 
+
+# this is a hack to get the script to work without needing to fix 
+# TIDArun-art.sh which expects TrkNtple-0000.root
+# so if we run multiple jobs then we don;t get a Trk*.root 
+# file to the check will fail. This creates a link so this 
+# test will pass
+  
+for git in output-dataset/*.root ; do if [ -e $git ]; then ln -s $git TrkNtuple-0000.root ; break ; fi ; done  
+
+[ -e TrkNtuple-0000.root ] || echo "WARNING: all athena stages failed"
+
+fi
+
+
+ls -lt
+
+
+get_files -data TIDAdata11-rtt.dat
+get_files -data TIDAdata_cuts.dat
+get_files -data TIDAdata_chains.dat
+get_files -data TIDAbeam.dat
+get_files -data Test_bin.dat
+
+for DATFILE in *.dat ; do
+    if ( grep -q DataFile $DATFILE ); then
+         mv  $DATFILE  $DATFILE.bak
+         grep -v "\(DataSets\|DataFiles\)"  $DATFILE.bak > $DATFILE
+         echo "DataSets = { \"./output-dataset/\" };"   >> $DATFILE
+    fi
+done
+
+if [ $RUNATHENA -eq 1 -o $RUNPOST -eq 1 ]; then
+
+
+TIDArdict TIDAdata11-rtt.dat -f data-tau-IBL.root -b Test_bin.dat  2>&1 | tee TIDArdict_1.log
+echo "art-result: $? TIDArdict_1"
+
+
+
+timestamp "TIDArdict"
+
+
+
+fi
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_IDTrig HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_Tau_IDTrig_forID3 -d HLTEF-plots  2>&1 | tee TIDArun_2.log
+echo "art-result: $? TIDArun_2"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh data-tau-IBL.root data-tau_IBL_pu46-reference.root HLT_tau25_idperf_track_InDetTrigTrackingxAODCnv_Tau_FTF HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauCore_FTF_forID1 HLT_tau25_idperf_tracktwo_InDetTrigTrackingxAODCnv_TauIso_FTF_forID3 -d HLTL2-plots  2>&1 | tee TIDArun_3.log
+echo "art-result: $? TIDArun_3"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -o times  2>&1 | tee TIDArun_4.log
+echo "art-result: $? TIDArun_4"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+TIDArun-art.sh expert-monitoring.root expert-monitoring*-ref.root --auto -p FastTrack -o times-FTF  2>&1 | tee TIDArun_5.log
+echo "art-result: $? TIDArun_5"
+
+
+
+timestamp "TIDArun-art.sh"
+
+
+
+RunTrigCostD3PD --files output-cost/*trig_cost.root --outputTagFromAthena --costMode --linkOutputDir  2>&1 | tee RunTrigCostD3PD_6.log
+echo "art-result: $? RunTrigCostD3PD_6"
+
+
+
+timestamp "RunTrigCostD3PD"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall --auto -d "/Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_7.log
+echo "art-result: $? TIDAcpucost_7"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent --auto -d "/Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_8.log
+echo "art-result: $? TIDAcpucost_8"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perCall-chain --auto -d "/Chain_Algorithm" -p "_Time_perCall"  2>&1 | tee TIDAcpucost_9.log
+echo "art-result: $? TIDAcpucost_9"
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+TIDAcpucost costMon/TrigCostRoot_Results.root costMon/TrigCostRoot_Results.root -o cost-perEvent-chain --auto -d "/Chain_Algorithm" -p "_Time_perEvent"  2>&1 | tee TIDAcpucost_10.log
+echo "art-result: $? TIDAcpucost_10"
+
+
+
+
+timestamp "TIDAcpucost"
+
+
+
+printf "${RED}done: $SECONDS seconds${NC}\n"
+
+
+printf "${RED}done: job duration:  $(converttime $SECONDS)${NC}\n"
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/utils/art-events.dat b/Trigger/TrigValidation/TrigInDetValidation/utils/art-events.dat
index 7d37596bf79589c5169297c1c46e2dd6394821f9..8bef54ca6e4fe431f104c32b8fceac3f6a36b7a9 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/utils/art-events.dat
+++ b/Trigger/TrigValidation/TrigInDetValidation/utils/art-events.dat
@@ -4,6 +4,8 @@ test_trigindetvalidation_all_ttbar_pu80 1000
 test_trigindetvalidation_beamspot_ttbar_pu40 1000
 test_trigindetvalidation_beamspot_ttbar_pu40_zfinder 1000
 test_trigindetvalidation_beamspot_ttbar_pu80_zfinder 1000
+test_trigindetvalidation_beamspot_ttbar_pu80_fs 1000
+test_trigindetvalidation_beamspot_ttbar_pu80_fsml 1000
 test_trigindetvalidation_bjet_ibl_pu40_2016config 1000
 test_trigindetvalidation_bjet_ibl_pu40_offline_2016config 1000
 test_trigindetvalidation_bjet_ibl_pu40_offline 1000
diff --git a/Trigger/TrigValidation/TrigInDetValidation/utils/art-input.dat b/Trigger/TrigValidation/TrigInDetValidation/utils/art-input.dat
index 443daa53eefaeb28f8e42ec99e036eaeaefbf6f4..d0a96c801109339a6330ee6cea65503ef108064f 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/utils/art-input.dat
+++ b/Trigger/TrigValidation/TrigInDetValidation/utils/art-input.dat
@@ -4,6 +4,8 @@ test_trigindetvalidation_all_ttbar_pu80 mc15_13TeV.410000.PowhegPythiaEvtGen_P20
 test_trigindetvalidation_beamspot_ttbar_pu40 mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
 test_trigindetvalidation_beamspot_ttbar_pu40_zfinder mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
 test_trigindetvalidation_beamspot_ttbar_pu80_zfinder mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+test_trigindetvalidation_beamspot_ttbar_pu80_fs   mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+test_trigindetvalidation_beamspot_ttbar_pu80_fsml mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
 test_trigindetvalidation_bjet_ibl_pu40_2016config mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
 test_trigindetvalidation_bjet_ibl_pu40_offline_2016config mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
 test_trigindetvalidation_bjet_ibl_pu40_offline mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7193
diff --git a/Trigger/TrigValidation/TrigInDetValidation/utils/art-nfiles.dat b/Trigger/TrigValidation/TrigInDetValidation/utils/art-nfiles.dat
index 682dffc01411f3a981cf778c9a9ab98b4bf65dba..c365aba6f236450703916f107ab014ae0321e659 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/utils/art-nfiles.dat
+++ b/Trigger/TrigValidation/TrigInDetValidation/utils/art-nfiles.dat
@@ -4,6 +4,8 @@ test_trigindetvalidation_all_ttbar_pu80 3
 test_trigindetvalidation_beamspot_ttbar_pu40 3
 test_trigindetvalidation_beamspot_ttbar_pu40_zfinder 3
 test_trigindetvalidation_beamspot_ttbar_pu80_zfinder 3
+test_trigindetvalidation_beamspot_ttbar_pu80_fs 3
+test_trigindetvalidation_beamspot_ttbar_pu80_fsml 3
 test_trigindetvalidation_bjet_ibl_pu40_2016config 3
 test_trigindetvalidation_bjet_ibl_pu40_offline_2016config 3
 test_trigindetvalidation_bjet_ibl_pu40_offline 3
diff --git a/Trigger/TrigValidation/TrigInDetValidation/utils/mkart-template b/Trigger/TrigValidation/TrigInDetValidation/utils/mkart-template
index 5c2aec0e24d62f4bc4eeaef859edfe170d120762..0fca4d846047c705cad07760c6025826a45fb853 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/utils/mkart-template
+++ b/Trigger/TrigValidation/TrigInDetValidation/utils/mkart-template
@@ -8,6 +8,7 @@ function usage {
     echo "     -n, --noglob             do not overwrite existing files"
     echo "     -d, --dataset FILE       run on FILE"
     echo "     -c, --cleanup            clean up afterwards"
+    echo "     -a, --art                create test scripts for official ART"
     echo "     -h, --help               this help"
     if [ $# -lt 1 ]; then exit 0; fi ; exit $1 
 }
@@ -38,6 +39,7 @@ OUTDIR=$PWD
 NOGLOB=0
 DATASET=
 DELETE=0
+ART=0
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -46,6 +48,7 @@ while [ $# -ge 1 ]; do
         -d | --dataset ) if [ $# -lt 2 ]; then usage 1; fi ; DATASET=$2 ; shift ;;
         -n | --noglob )  NOGLOB=1 ;;
         -c | --cleanup ) DELETE=1 ;;
+        -a | --art ) ART=1 ;;
         -h | --help )   usage 0;;
         *)   
           DIR=$1
@@ -77,7 +80,12 @@ for xmlfile in $FILES; do
 
     file=test_$(echo $_file | tr '[:upper:]' '[:lower:]' )
       
-    outfile="$OUTDIR/$file.sh"
+    jobbase=$file
+    if [ $ART -ne 0 ]; then
+        outfile="$OUTDIR/${file}_art.sh"
+    else
+        outfile="$OUTDIR/$file.sh"
+    fi
 
     if [ -z $DATASET ]; then 
 	SAMPLE=$(grep include $xmlfile | grep sample | grep -v "<\!-" | head -1 | sed 's|.* \"||g' | sed 's|\".*||g')
@@ -112,6 +120,12 @@ for xmlfile in $FILES; do
     echo "#!/bin/bash" > $outfile
     
     echo "# art-description: art job for $(echo $_file | sed 's|TrigInDetValidation_||g')" >> $outfile 
+    if [ $ART -eq 1 ]; then
+      echo "# art-include: 21.3/Athena" >>  $outfile
+      echo "# art-include: 21.9/Athena" >>  $outfile
+      echo "# art-include: master/Athena" >>  $outfile
+      echo "# art-html: https://atlas-art-data.web.cern.ch/atlas-art-data/scripts/TrigInDetValidation/TIDAart/?jobdir=" >>  $outfile
+    fi
     echo "# art-type: grid"       >>  $outfile 
     echo "# art-input:  $(basename $(dirname $DATASET))" >>  $outfile 
     echo "# art-output: *.dat "   >>  $outfile 
@@ -123,6 +137,9 @@ for xmlfile in $FILES; do
 
     echo "# art-input-nfiles: 10" >> $outfile 
     echo "# art-cores:         8" >> $outfile 
+    if [ $ART -eq 1 ]; then
+      echo "# art-memory: 4096" >> $outfile 
+    fi
     echo ""                       >> $outfile 
     echo ""                       >> $outfile 
 
@@ -149,8 +166,6 @@ for xmlfile in $FILES; do
 
     	 if ( echo $cmdlineflags | grep -q EventMax ); then 
 
-	     jobbase=$( basename $outfile .sh)
-	    
  	     events=$(echo $cmdlineflags | sed 's|.*EventMax[[:space:]]*=[[:space:]]*\([0-9]*[[:space:]]*\);.*|\1|g' | sed 's|EventMax[[:space:]]*=[[:space:]]*\([0-9]*\)[[:space:]]*.*|\1|g' )
  	     newevents=$( echo "2*$events" | bc )
 	     [ -e utils/art-events.dat ] && newevents=$(grep "$jobbase " utils/art-events.dat | awk '{print $2}')
@@ -158,12 +173,18 @@ for xmlfile in $FILES; do
 	    
 	     if [ -e utils/art-nfiles.dat ]; then
 		 nfiles=$(grep "$jobbase " utils/art-nfiles.dat | awk '{print $2}')
-		 cat $outfile | sed  "s|# art-input-nfiles: .*|# art-input-nfiles: $nfiles|g" >> $outfile-
-		 mv $outfile{-,}
-
-                 ncores=8
-                 [ $nfiles -lt 8 ] && ncores=$nfiles
-		 cat $outfile | sed  "s|# art-cores: .*|# art-ncores: $ncores|g" >> $outfile-
+                 if [ -n "$nfiles" ]; then
+		     cat $outfile | sed  "s|# art-input-nfiles: .*|# art-input-nfiles: $nfiles|g" >> $outfile-
+		     mv $outfile{-,}
+
+                     ncores=8
+                     [ $nfiles -lt 8 ] && ncores=$nfiles
+                     if [ $ART -eq 1 ]; then
+		         cat $outfile | sed  "s|# art-cores: .*|# art-cores: $ncores|g" >> $outfile-
+                     else
+		         cat $outfile | sed  "s|# art-cores: .*|# art-ncores: $ncores|g" >> $outfile-
+                     fi
+                 fi
 		 mv $outfile{-,}
 
 	     fi
diff --git a/Trigger/TrigValidation/TrigInDetValidation/utils/mkartlist b/Trigger/TrigValidation/TrigInDetValidation/utils/mkartlist
index 21cb5c3a9844156b95e9c43df85fd0dac2c9432a..a2543ee9ef1cf5c3f1fce539db890cc0d89a1308 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/utils/mkartlist
+++ b/Trigger/TrigValidation/TrigInDetValidation/utils/mkartlist
@@ -39,6 +39,12 @@ function waitonallproc   {
     while [ $IRUNNING -gt 0 ]; do sleep $WAITING ; IRUNNING=$(running) ; done
 }
 
+suf=""
+for a in "$@"; do
+    case "$a" in
+        -a | --art ) suf="_art" ;;
+    esac
+done
 
 
 
@@ -46,7 +52,7 @@ for job in $(grep include TIDAbuild/TrigInDetValidation_TestConfiguration_main.x
 
     waitonproc
 
-    file=$(echo $job | tr '[:upper:]' '[:lower:]' | sed 's|\.xml|\.sh|g')
+    file=$(echo $job | tr '[:upper:]' '[:lower:]' | sed 's|\.xml|'"$suf"'\.sh|g')
 
 
     [ -e test/$file ] && continue
@@ -60,7 +66,7 @@ for job in $(grep include TIDAbuild/TrigInDetValidation_TestConfiguration_main.x
     if [ $BUILD -eq 1 ]; then
 	files="$files $job"
  	echo "TIDAbuild/$job -> test/$file"
-	utils/mkart-template -c TIDAbuild/$job -o test &
+	utils/mkart-template "$@" -c TIDAbuild/$job -o test &
 	PID=$!
         BGPROCS="$BGPROCS $PID"
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/utils/template.sh b/Trigger/TrigValidation/TrigInDetValidation/utils/template.sh
index afec9f3c1383eb66bc79f75618d9755b417b1dec..4e1864f7b1dc1b8be0a650b97f35eb9e62121c5a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/utils/template.sh
+++ b/Trigger/TrigValidation/TrigInDetValidation/utils/template.sh
@@ -27,6 +27,7 @@ RUNPOST=-1
 DIRECTORY=
 LOCAL=0
 FORCE=0
+FORK=1
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -57,9 +58,7 @@ function converttime {
     ((H=$totes/3600))
     ((M=($totes%3600)/60))
     ((S=$totes%60))
-    [ $M -lt 10 ] && M=0$M
-    [ $S -lt 10 ] && S=0$S
-    echo "$H:$M:$S"
+    printf "%d:%02d:%02d\n" $H $M $S
 }
 
 timestamp "starting"
@@ -133,7 +132,6 @@ function runathena {
 
      mkdir -p athena-$1
      cd  athena-$1
-     cp ../*.py .
 
      pwd
      echo "ARGS: $ARGS"
@@ -178,24 +176,56 @@ export RTTJOBNAME=@REPLACERTTJOBNAME
 jobList=
 
 if [ $LOCAL -eq 1 ]; then
+
       echo "running locally"
       # get number of files 
       NFILES=$(grep "^#[[:space:]]*art-input-nfiles:" $0 | sed 's|.*art-input-nfiles:[[:space:]]*||g')
       [ $NFILES -lt 1 ] && echo "not enough files: $NFILES" && exit -1
-      _jobList=$(TIDAdataset.py $RTTJOBNAME)
+      DATASET=$(grep "^#[[:space:]]*art-input:" $0 | sed 's|.*art-input:[[:space:]]*||g')
+      _jobList=$(\ls /eos/atlas/atlascerngroupdisk/proj-sit/trigindet/$DATASET/* )
       for git in $_jobList ; do [ $NFILES -gt 0 ] || break ; jobList="$jobList ARTConfig=['$git']" ; ((NFILES--)) ; echo "running over $git"  ; done
+
+elif [ -n "$ArtProcess" ]; then
+
+      # art-cores specified, so ART is already forking off subprocesses
+      FORK=0
+      case "$ArtProcess" in
+            start)
+                  timestamp "ART Starting (${ArtCores}-core)"
+                  exit 0   # nothing more to do this time round
+                  ;;
+            end)
+                  timestamp "ART Ending (${ArtCores}-core)"
+                  ;;       # skip to postprocessing
+            *)
+                  # runathena here and now, no forking
+                  timestamp "ART job $ArtProcess (${ArtCores}-core)"
+                  IFS=',' read -r -a file <<< "${ArtInFile}"
+                  file=${file[${ArtProcess}]}
+                  _jobList="'../$file'"
+                  echo "ART running over $_jobList"
+                  jobList="ARTConfig=[$_jobList]"
+                  if [ $RUNATHENA -eq 1 ]; then
+                      ARGS="$jobList;@REPLACECOMMAND"
+                      runathena "$ArtProcess"
+                  fi
+                  exit 0   # this thread is done
+                  ;;
+      esac
+
 else
+
       fileList="['${ArtInFile//,/', '}']"
       _jobList="'../${ArtInFile//,/' '../}'"
       echo "List of files = $fileList"
       for git in $_jobList ; do jobList="$jobList ARTConfig=[$git]" ; echo "ART running over $git"  ; done
+
 fi
 
 
 if [ $RUNATHENA -eq 1 ]; then 
 
-get_files -jo @REPLACEJOBOPTIONS
-
+if [ $FORK -eq 1 ]; then
 
 # run athena in separate directories
 
@@ -260,6 +290,8 @@ timestamp "waiting on athena jobs ..."
 
 waitonallproc
 
+fi
+
 echo "all done ! hooray !"
 
 timestamp "forking all athena jobs completed"
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/l1menu/ItemDef.py b/Trigger/TriggerCommon/TriggerMenu/python/l1menu/ItemDef.py
index 6a37edda2e4a6268b2bed88f829fdb582832f9c5..ad6a9f1236a03a136e671954090e0da92369d620 100755
--- a/Trigger/TriggerCommon/TriggerMenu/python/l1menu/ItemDef.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/l1menu/ItemDef.py
@@ -723,7 +723,7 @@ class ItemDef:
         LVL1MenuItem('L1_3jJ35.0ETA23' ).setLogic( jJ350ETA23.x(3) & physcond).setTriggerType(TT.calo)    # noqa: F821
         LVL1MenuItem('L1_3jJ50' ).setLogic( jJ50.x(3) & physcond).setTriggerType(TT.calo)    # noqa: F821
         LVL1MenuItem('L1_4jJ15' ).setLogic( jJ15.x(4) & physcond).setTriggerType(TT.calo)    # noqa: F821
-        LVL1MenuItem('L1_4jJ15.0ETA25' ).setLogic( jJ150ETA25.x(3) & physcond).setTriggerType(TT.calo)    # noqa: F821
+        LVL1MenuItem('L1_4jJ15.0ETA25' ).setLogic( jJ150ETA25.x(4) & physcond).setTriggerType(TT.calo)    # noqa: F821
         LVL1MenuItem('L1_jJ25.0ETA23_2jJ15.31ETA49' ).setLogic( jJ250ETA23 & jJ1531ETA49.x(2) & physcond).setTriggerType(TT.calo)    # noqa: F821
         LVL1MenuItem('L1_jJ40.0ETA25_2jJ25_jJ20.31ETA49' ).setLogic( jJ400ETA25 & jJ25.x(2) & jJ2031ETA49 & physcond).setTriggerType(TT.calo)    # noqa: F821
         LVL1MenuItem('L1_jJ85_3jJ30' ).setLogic( jJ85 & jJ30.x(3) & physcond).setTriggerType(TT.calo)    # noqa: F821
@@ -1871,17 +1871,20 @@ class ItemDef:
                     ##Combined L1Top
                     if not '_v8' in TriggerFlags.triggerMenuSetup():
                         LVL1MenuItem('L1_DR-MU10TAU12I_TAU12I-J25').setLogic( TOPO_0DR28_MU10ab_TAU12abi &  TOPO_1DISAMB_TAU12abi_J25ab & MU10 & physcond)    # noqa: F821
-                        LVL1MenuItem('L1_MU10_TAU12I-J25').setLogic( MU10 &  TOPO_1DISAMB_TAU12abi_J25ab & physcond)    # noqa: F821 
+                        LVL1MenuItem('L1_MU10_TAU12I-J25').setLogic( MU10 &  TOPO_1DISAMB_TAU12abi_J25ab & physcond)    # noqa: F821
+                        LVL1MenuItem('L1_J25_2J12_DR-MU10TAU12I').setLogic( J25 & J12.x(2) &  TOPO_0DR28_MU10ab_TAU12abi & MU10 & physcond)    # noqa: F821
+                        
                     #Added 2DISAMB for v8 ATR-17328
                     if '_v8' in TriggerFlags.triggerMenuSetup():
-                        LVL1MenuItem('L1_DR-MU10TAU12I_TAU12I-J25').setLogic( TOPO_0DR28_MU10ab_TAU12abi &  TOPO_2DISAMB_TAU12abi_J25ab & MU10 & physcond)    # noqa: F821
                         LVL1MenuItem('L1_MU10_TAU12I-J25').setLogic( MU10 &  TOPO_2DISAMB_TAU12abi_J25ab & physcond)    # noqa: F821
+                        #                        LVL1MenuItem('L1_DR-MU10TAU12I_TAU12I-J25').setLogic( TOPO_0DR28_MU10ab_TAU12abi &  TOPO_2DISAMB_TAU12abi_J25ab & MU10 & physcond)    # noqa: F821
+
                     #LVL1MenuItem('L1_XE35_EM15-TAU12I').setLogic( XE35 &  TOPO_DISAMB_EM15abhi_TAU12abi & physcond)  
                     #LVL1MenuItem('L1_XE40_EM15-TAU12I').setLogic( XE40 &  TOPO_DISAMB_EM15abhi_TAU12abiOB & physcond)  
                     #LVL1MenuItem('L1_XE45_TAU20-J20').setLogic( XE45 & TOPO_1DISAMB_TAU20ab_J20ab & physcond)    # noqa: F821
                     LVL1MenuItem('L1_J25_2J20_3J12_DR-TAU20ITAU12I').setLogic( J25 & J20.x(2) & J12.x(3) &  TOPO_0DR28_TAU20abi_TAU12abi & physcond)    # noqa: F821
                     #LVL1MenuItem('L1_J25_3J12_EM15-TAU12I').setLogic( J25 & J12.x(3) &  TOPO_DISAMB_EM15abhi_TAU12abi & physcond)  
-                    LVL1MenuItem('L1_J25_2J12_DR-MU10TAU12I').setLogic( J25 & J12.x(2) &  TOPO_0DR28_MU10ab_TAU12abi & MU10 & physcond)    # noqa: F821
+
                     if not '_v8' in TriggerFlags.triggerMenuSetup():                     
                         LVL1MenuItem('L1_J25_2J20_3J12_BOX-TAU20ITAU12I').setLogic( J25 & J20.x(2) & J12.x(3) & TOPO_0DETA20_0DPHI20_TAU20abi_TAU12abi & physcond)    # noqa: F821
 
@@ -1987,11 +1990,15 @@ class ItemDef:
 
                     LVL1MenuItem('L1_LLP-RO').setLogic( TOPO_100RATIO_0MATCH_TAU30si2_EMall & physcond)    # noqa: F821
                     LVL1MenuItem('L1_LLP-NOMATCH').setLogic( TOPO_NOT_0MATCH_TAU30si1_EMall & physcond)    # noqa: F821
-                    LVL1MenuItem('L1_DR-MU10TAU12I').setLogic( TOPO_0DR28_MU10ab_TAU12abi & physcond)    # noqa: F821
+
                     if not '_v8' in TriggerFlags.triggerMenuSetup():
                         LVL1MenuItem('L1_TAU12I-J25').setLogic( TOPO_1DISAMB_TAU12abi_J25ab & physcond)    # noqa: F821
+                        LVL1MenuItem('L1_DR-MU10TAU12I').setLogic( TOPO_0DR28_MU10ab_TAU12abi & physcond)    # noqa: F821
+                        
                     if '_v8' in TriggerFlags.triggerMenuSetup():
                         LVL1MenuItem('L1_TAU12I-J25').setLogic( TOPO_2DISAMB_TAU12abi_J25ab & physcond) #Added 2DISAMB ATR-17328    # noqa: F821
+
+                        
                     if not '_v8' in TriggerFlags.triggerMenuSetup():
                         LVL1MenuItem('L1_EM15TAU12I-J25').setLogic( TOPO_1DISAMB_EM15his2_TAU12abi_J25ab & physcond)    # noqa: F821
 
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_MC_pp_v8.py b/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_MC_pp_v8.py
index 803c40ff1fd9d0da684ab33806ef763756658906..4d0ac3bc43df81dfe114cf9841bd49ea553deb16 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_MC_pp_v8.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_MC_pp_v8.py
@@ -342,7 +342,6 @@ def defineMenu():
         #'0MATCH-4AJ20.ETA31-4AJj15.ETA31',
         '100RATIO-0MATCH-TAU30si2-EMall',
         'NOT-0MATCH-TAU30si1-EMall',
-        '0DR28-MU10ab-TAU12abi',
         '2DISAMB-TAU12abi-J25ab',
         #'1DISAMB-EM15his2-TAU12abi-J25ab',
         #'DISAMB-0DR28-EM15his2-TAU12abi',
@@ -521,7 +520,6 @@ def defineMenu():
         "L1_TAU20IM_2TAU12IM_4J12.0ETA25",
         "L1_TAU20IM_2TAU12IM_4J12.0ETA28",
         "L1_TAU25IM_2TAU20IM_2J25_3J20", 
-        'L1_DR-MU10TAU12I_TAU12I-J25',
         'L1_eTAU20IM_2jJ20_gXERHO45',
         'L1_eTAU20IM_2eTAU12IM_4jJ12.0ETA23',
         'L1_eTAU25IM_2eTAU20IM_2jJ25_3jJ20',
@@ -834,7 +832,6 @@ def defineMenu():
 #        'L1_J4-MATCH',
         'L1_LLP-RO',
         'L1_LLP-NOMATCH',
-        'L1_DR-MU10TAU12I',    
 #        'L1_TAU12I-J25',    
 #        'L1_EM15TAU12I-J25',
         'L1_DR-EM15TAU12I-J25',    
@@ -1086,7 +1083,6 @@ def defineMenu():
         'L1_TAU20IM_2TAU12IM_4J12.0ETA23' : 316,
         'L1_TAU20IM_2TAU12IM_4J12.0ETA25' : 317,
         'L1_TAU20IM_2TAU12IM_4J12.0ETA28' : 319,
-        'L1_DR-MU10TAU12I_TAU12I-J25' : 72,
         'L1_TAU20IM_2J20_XE45' : 74,
         'L1_TAU20IM_2J20_XE50' : 48,
         'L1_TAU30_UNPAIRED_ISO' :343,
@@ -1376,7 +1372,6 @@ def defineMenu():
 #        'L1_J4-MATCH' : 336,
         'L1_LLP-RO' : 338,
         'L1_LLP-NOMATCH' : 339,
-        'L1_DR-MU10TAU12I' : 340,
 #        'L1_TAU12I-J25' : 341,
 #        'L1_EM15TAU12I-J25' : 345,
         'L1_DR-EM15TAU12I-J25' : 346,
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_Physics_HI_v5.py b/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_Physics_HI_v5.py
index 192fcb633456b97c7def7e23ef5382fbd35297a2..b3bc8466279ac51c688d1abf00e13947ae076373 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_Physics_HI_v5.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/l1menu/Menu_Physics_HI_v5.py
@@ -300,7 +300,6 @@ def defineMenu():
         '0MATCH-4AJ20.ETA31-4AJj15.ETA31',
         '100RATIO-0MATCH-TAU30si2-EMall',
         'NOT-0MATCH-TAU30si1-EMall',
-        '0DR28-MU10ab-TAU12abi',
         '1DISAMB-TAU12abi-J25ab',
         '1DISAMB-EM15his2-TAU12abi-J25ab',
         'DISAMB-0DR28-EM15his2-TAU12abi',
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/Menu_MC_pp_v8.py b/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/Menu_MC_pp_v8.py
index 845be8b737334266266916b943ecc06bfbd5ff28..b7d1aee6e1631115fb3d345c1c377c5fa5fc68ab 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/Menu_MC_pp_v8.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/Menu_MC_pp_v8.py
@@ -16,19 +16,27 @@ def defineMenu():
     L1TopoFlags.algos = [
     
         
-        # module: 1, FPGA: 0
+        # module: 0, FPGA: 0
         TopoOutput( algoname='0DR25-TAU20abi-TAU12abi',                     module=0, fpga=0, clock=0, firstbit=0 ),
-        TopoOutput( algoname='2DISAMB-J25ab-0DR25-TAU20abi-TAU12abi',       module=0, fpga=0, clock=0, firstbit=1 ),
-        TopoOutput( algoname='INVM_DPHI_NFF',                               module=0, fpga=0, clock=0, firstbit=2 ), # 4 bits
-        TopoOutput( algoname='0INVM10-3MU4ab',                              module=0, fpga=0, clock=0, firstbit=6 ),
-        TopoOutput( algoname='CEP_CJ',                                      module=0, fpga=0, clock=0, firstbit=8 ), # 2 bits
+        TopoOutput( algoname='0DR28-TAU20abi-TAU12abi',                     module=0, fpga=0, clock=0, firstbit=1 ),
+        TopoOutput( algoname='2DISAMB-J25ab-0DR25-TAU20abi-TAU12abi',       module=0, fpga=0, clock=0, firstbit=2 ),
+        TopoOutput( algoname='2DISAMB-J25ab-0DR28-TAU20abi-TAU12abi',       module=0, fpga=0, clock=0, firstbit=3 ),
+        TopoOutput( algoname='INVM_DPHI_NFF',                               module=0, fpga=0, clock=0, firstbit=4 ), # 4 bits
+        TopoOutput( algoname='0INVM10-3MU4ab',                              module=0, fpga=0, clock=0, firstbit=9 ),
 
-        # module: 1, FPGA: 1
+
+    
+
+
+        # module: 0, FPGA: 1
         TopoOutput( algoname='KF-XE-AJall',                                 module=0, fpga=1, clock=0, firstbit=0 ), # 6 bits
         TopoOutput( algoname='ZAFB_DPHI',                                   module=0, fpga=1, clock=0, firstbit=6 ), # 2 bits
+        TopoOutput( algoname='CEP_CJ',                                      module=0, fpga=1, clock=0, firstbit=8 ), # 2 bits
+        TopoOutput( algoname='INVM_EMs6',                                   module=0, fpga=1, clock=0, firstbit=10 ), # 3bits to 2 bits
+        TopoOutput( algoname='27DPHI32-EMs1-EMs6',                          module=0, fpga=1, clock=0, firstbit=12 ),
 
 
-        # module: 2, FPGA: 0
+        # module: 1, FPGA: 0
         TopoOutput( algoname='HT190-J15s5.ETA21',                           module=1, fpga=0, clock=0, firstbit=0 ),
         TopoOutput( algoname='0DR03-EM7ab-CJ15ab',                          module=1, fpga=0, clock=0, firstbit=1 ),
         TopoOutput( algoname='INVM_NFF',                                    module=1, fpga=0, clock=0, firstbit=2 ), # 4 bits to 1 bit
@@ -41,23 +49,19 @@ def defineMenu():
         TopoOutput( algoname='SC111-CJ15ab.ETA26',                          module=1, fpga=0, clock=0, firstbit=9 ),
         TopoOutput( algoname='0DETA20-J50s1-Js2',                           module=1, fpga=0, clock=0, firstbit=10 ),
         TopoOutput( algoname='2DISAMB-J25ab-0DR28-EM15his2-TAU12abi',       module=1, fpga=0, clock=0, firstbit=11 ),
-        TopoOutput( algoname='2DISAMB-J25ab-0DR28-TAU20abi-TAU12abi',       module=1, fpga=0, clock=0, firstbit=12 ),
+        TopoOutput( algoname='0INVM9-EM7ab-EMab',                           module=1, fpga=0, clock=0, firstbit=12 ),
         TopoOutput( algoname='2DISAMB-TAU12abi-J25ab',                      module=1, fpga=0, clock=0, firstbit=13 ),
 
-        # module: 2, FPGA: 1
-        TopoOutput( algoname='0INVM9-EM7ab-EMab',                           module=1, fpga=1, clock=0, firstbit=0 ),
-        TopoOutput( algoname='INVM_EMs6',                                   module=1, fpga=1, clock=0, firstbit=1 ), # 3bits to 2 bits
-        TopoOutput( algoname='DISAMB-30INVM-EM20his2-TAU12ab',              module=1, fpga=1, clock=0, firstbit=3 ),
-        TopoOutput( algoname='100RATIO-0MATCH-TAU30si2-EMall',              module=1, fpga=1, clock=0, firstbit=4 ),
-        TopoOutput( algoname='NOT-0MATCH-TAU30si1-EMall',                   module=1, fpga=1, clock=0, firstbit=5 ),
-        TopoOutput( algoname='27DPHI32-EMs1-EMs6',                          module=1, fpga=1, clock=0, firstbit=6 ),
-        TopoOutput( algoname='0DR28-TAU20abi-TAU12abi',                     module=1, fpga=1, clock=0, firstbit=7 ),
-        TopoOutput( algoname='0DR28-MU10ab-TAU12abi',                       module=1, fpga=1, clock=0, firstbit=8 ),
-        TopoOutput( algoname='LATE-MU10s1',                                 module=1, fpga=1, clock=0, firstbit=9 ),
-        TopoOutput( algoname='MULT-CMU4ab',                                 module=1, fpga=1, clock=0, firstbit=10 ),#2bits
-        TopoOutput( algoname='MULT-CMU6ab',                                 module=1, fpga=1, clock=0, firstbit=12 ),#2bits        
-        TopoOutput( algoname='0DR15-2MU6ab',                                module=1, fpga=1, clock=0, firstbit=14 ),
-        TopoOutput( algoname='8INVM15-0DR22-2MU6ab',                        module=1, fpga=1, clock=0, firstbit=15 ),
+        # module: 1, FPGA: 1
+
+        TopoOutput( algoname='DISAMB-30INVM-EM20his2-TAU12ab',              module=1, fpga=1, clock=0, firstbit=0 ),
+        TopoOutput( algoname='100RATIO-0MATCH-TAU30si2-EMall',              module=1, fpga=1, clock=0, firstbit=1 ),
+        TopoOutput( algoname='NOT-0MATCH-TAU30si1-EMall',                   module=1, fpga=1, clock=0, firstbit=2 ),
+        TopoOutput( algoname='LATE-MU10s1',                                 module=1, fpga=1, clock=0, firstbit=3 ),
+        TopoOutput( algoname='MULT-CMU4ab',                                 module=1, fpga=1, clock=0, firstbit=4 ),#2bits
+        TopoOutput( algoname='MULT-CMU6ab',                                 module=1, fpga=1, clock=0, firstbit=6 ),#2bits        
+        TopoOutput( algoname='0DR15-2MU6ab',                                module=1, fpga=1, clock=0, firstbit=8 ),
+        TopoOutput( algoname='8INVM15-0DR22-2MU6ab',                        module=1, fpga=1, clock=0, firstbit=9 ),
 
         TopoOutput( algoname='8INVM15-0DR22-MU6ab-MU4ab',                   module=1, fpga=1, clock=1, firstbit=0 ),
         TopoOutput( algoname='2INVM9-0DR15-MU6ab-MU4ab',                    module=1, fpga=1, clock=1, firstbit=1 ),
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/TopoAlgoDef.py b/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/TopoAlgoDef.py
index 3e3e5fdf7e205c20670e038005211c8aabdb4e59..05b5b9a154dcb91d5e556f279971e6b7ae43cb4e 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/TopoAlgoDef.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/l1topomenu/TopoAlgoDef.py
@@ -553,7 +553,12 @@ class TopoAlgoDef:
                {"minDr": 0, "maxDr": 28, "otype1" : "MU" ,"ocut1": 10, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "inputwidth1": HW.OutputWidthSelectMU, "otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU},   # 0DR28-MU10ab-TAU12abi
                {"minDr": 0, "maxDr": 28, "otype1" : "TAU" ,"ocut1": 20, "olist1" : "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU,"otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, # 0DR28-TAU20abi-TAU12abi
                {"minDr": 0, "maxDr": 25, "otype1" : "TAU" ,"ocut1": 20, "olist1" : "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU,"otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, #	0DR25-TAU20abi-TAU12abi
-            ] 
+            ]
+        if usev8:
+            algolist=[
+                {"minDr": 0, "maxDr": 28, "otype1" : "TAU" ,"ocut1": 20, "olist1" : "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU,"otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, # 0DR28-TAU20abi-TAU12abi
+                {"minDr": 0, "maxDr": 25, "otype1" : "TAU" ,"ocut1": 20, "olist1" : "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU,"otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, #	0DR25-TAU20abi-TAU12abi
+            ]
 
 
         for x in algolist:
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/MC_pp_v8.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/MC_pp_v8.py
index aae29b13ad223c3a423cb17ffc84ecc5df54b1ac..62368c2220be7aebdf1199fc9f71988735f06433 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/menu/MC_pp_v8.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/MC_pp_v8.py
@@ -591,7 +591,6 @@ def setupMenu():
         ['tau50_mediumRNN_tracktwoMVA_xe80_pufit_xe50_L1TAU20IM_2J20_XE50', 'L1_TAU20IM_2J20_XE50',['L1_TAU20IM','',''], [PhysicsStream], ['RATE:TauMET', 'BW:Tau'], -1,['serial',-1,["tau50_mediumRNN_tracktwoMVA","xe80_pufit","xe50_L1TAU20IM_2J20_XE50"]]], # it should be reordered in athenaMT
         ['g90_loose_xe90noL1',           'L1_EM22VHI',  ['L1_EM22VHI',''], [PhysicsStream], ['RATE:EgammaMET', 'BW:Egamma', 'BW:MET'], -1,['serial',-1,["g90_loose","xe90noL1"]]],
         ['mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRtt',      'L1_MU10_TAU12IM_J25_2J12',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['RATE:MuonTau', 'BW:Tau', 'BW:Muon'], -1,['serial',-1,["mu14_ivarloose","tau25_mediumRNN_tracktwoMVA"]]],
-        ['mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRtt_L1DR-MU10TAU12I_TAU12I-J25', 'L1_DR-MU10TAU12I_TAU12I-J25',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['RATE:MuonTau', 'BW:Tau'], -1,['serial',-1,["mu14_ivarloose","tau25_mediumRNN_tracktwoMVA"]]],
         ['mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRtt_L1MU10_TAU12IM_3J12',      'L1_MU10_TAU12IM_3J12',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['RATE:MuonTau', 'BW:Tau', 'BW:Muon'], -1,['serial',-1,["mu14_ivarloose","tau25_mediumRNN_tracktwoMVA"]]],
         ['mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_xe50_03dRtt', 'L1_MU10_TAU12IM_XE35',['L1_MU10', 'L1_TAU12IM','L1_XE35'], [PhysicsStream], ['Legacy:Backup','RATE:TauMET', 'BW:Tau'], -1,['serial',-1,["mu14_ivarloose", "tau25_mediumRNN_tracktwoMVA","xe50"]]],
         ['mu14_ivarloose_tau35_mediumRNN_tracktwoMVA_03dRtt_L1MU10_TAU20IM_J25_2J20',      'L1_MU10_TAU20IM_J25_2J20',['L1_MU10','L1_TAU20IM'], [PhysicsStream], ['Legacy:Backup','RATE:MuonTau', 'BW:Tau', 'BW:Muon'], -1,['serial',-1,["mu14_ivarloose","tau35_mediumRNN_tracktwoMVA"]]],
diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v8.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v8.py
index 0315364e055dc9c31cc98e8357aab0dbf9c56c18..669d2f1da709ecafbf2c36af835e4a94062dec17 100644
--- a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v8.py
+++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v8.py
@@ -1769,9 +1769,6 @@ def setupMenu():
         ['mu14_ivarloose_tau25_medium1_tracktwo_L1MU10_TAU12IM_3J12',      'L1_MU10_TAU12IM_3J12',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:MuonTau', 'BW:Tau', 'BW:Muon'], -1,['serial',-1,["mu14_ivarloose","tau25_medium1_tracktwo"]]],
         ['mu14_ivarloose_tau25_medium1_tracktwo_L1MU10_TAU12IM',  'L1_MU10_TAU12IM',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Support','RATE:MuonTau', 'BW:Tau'], -1,['serial',-1,["mu14_ivarloose","tau25_medium1_tracktwo"]]],
 
-        # l1topo tau+mu chains
-        ['mu14_ivarloose_tau25_medium1_tracktwo_L1DR-MU10TAU12I_TAU12I-J25', 'L1_DR-MU10TAU12I_TAU12I-J25',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:MuonTau', 'BW:Tau'], -1,['serial',-1,["mu14_ivarloose","tau25_medium1_tracktwo"]]],
-
         
         # Tau + MET
         ['tau35_medium1_tracktwo_xe70_L1XE45',  'L1_TAU20IM_2J20_XE45',['L1_TAU20IM','L1_XE45'], [PhysicsStream], ['Legacy:Primary','RATE:TauMET', 'BW:Tau'], -1,['serial',-1,["tau35_medium1_tracktwo","xe70_L1XE45"]]],  
@@ -1796,8 +1793,6 @@ def setupMenu():
         ['e17_lhmedium_nod0_tau25_mediumRNN_tracktwoMVA_xe50', 'L1_EM15VHI_2TAU12IM_XE35',['L1_EM15VHI','L1_TAU12IM','L1_XE35'], [PhysicsStream], ['Legacy:Primary','RATE:TauMET', 'BW:Tau', 'BW:Egamma'], -1,['serial',-1,["e17_lhmedium_nod0","tau25_mediumRNN_tracktwoMVA", "xe50"]]],
         ['mu14_ivarloose_tau25_medium1_tracktwoEF',      'L1_MU10_TAU12IM_J25_2J12',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:MuonTau', 'BW:Tau', 'BW:Muon'], -1,['serial',-1,["mu14_ivarloose","tau25_medium1_tracktwoEF"]]],        
         ['mu14_ivarloose_tau25_mediumRNN_tracktwoMVA',      'L1_MU10_TAU12IM_J25_2J12',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:MuonTau', 'BW:Tau', 'BW:Muon'], -1,['serial',-1,["mu14_ivarloose","tau25_mediumRNN_tracktwoMVA"]]],        
-        ['mu14_ivarloose_tau25_medium1_tracktwoEF_L1DR-MU10TAU12I_TAU12I-J25', 'L1_DR-MU10TAU12I_TAU12I-J25',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:MuonTau', 'BW:Tau'], -1,['serial',-1,["mu14_ivarloose","tau25_medium1_tracktwoEF"]]],
-        ['mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_L1DR-MU10TAU12I_TAU12I-J25', 'L1_DR-MU10TAU12I_TAU12I-J25',['L1_MU10','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:MuonTau', 'BW:Tau'], -1,['serial',-1,["mu14_ivarloose","tau25_mediumRNN_tracktwoMVA"]]],
         ['e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwoEF_L1DR-EM15TAU12I-J25', 'L1_DR-EM15TAU12I-J25',['L1_EM15VHI','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:ElectronTau', 'BW:Tau'],-1,['serial',-1 ,["e17_lhmedium_nod0_ivarloose","tau25_medium1_tracktwoEF"]]],
         ['e17_lhmedium_nod0_ivarloose_tau25_mediumRNN_tracktwoMVA_L1DR-EM15TAU12I-J25', 'L1_DR-EM15TAU12I-J25',['L1_EM15VHI','L1_TAU12IM'], [PhysicsStream], ['Legacy:Primary','RATE:ElectronTau', 'BW:Tau'],-1,['serial',-1 ,["e17_lhmedium_nod0_ivarloose","tau25_mediumRNN_tracktwoMVA"]]],
         ['e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwoEF',  'L1_EM15VHI_2TAU12IM_J25_3J12',['L1_EM15VHI','L1_TAU12IM'], [PhysicsStream],['Legacy:Primary','RATE:ElectronTau', 'BW:Tau', 'BW:Egamma'], -1,['serial',-1,["e17_lhmedium_nod0_ivarloose","tau25_medium1_tracktwoEF"]]],