diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
index 3a10696ca2fbbccb14236b80502ce7523d99a900..be85e4b3005a8504e92f4c8a1cf749bf72258879 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: PhysVal_jobOptions.py 793030 2017-01-19 13:57:06Z sroe $
+# $Id: PhysVal_jobOptions.py 793586 2017-01-24 01:06:17Z mbaugh $
 
 # Set up the reading of the input xAOD:
 import getpass
@@ -78,7 +78,6 @@ ToolSvc += InDetTrackSelectorTool
 InDetTrackSelectorTool.CutLevel = "TightPrimary"
 
 #This section should control TTST  7-12-16                                                        
-
 from InDetPhysValMonitoring.InDetPhysValMonitoringConf import AthTruthSelectionTool
 AthTruthSelectionTool = AthTruthSelectionTool()
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx
index 99c8f4a1538b7b8671154311e4875fd206ce5612..71c6b1c30045de4b90bf76891e09205665ec7aa1 100755
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx
@@ -4,7 +4,7 @@
 
 /*==============================================================================
 
-   Regenerate 1D profile plots or histograms from 2D histograms (TH2D) in an
+   Regenerate 1D profile plots or histograms from 2D histograms in an
    existing InDetStandardPlots.root. The file is updated with new histograms
    overriding the old ones).
 
@@ -16,17 +16,33 @@
    create_registeredTH1F (etc) reads in existing histograms rather than creating
    new ones.
 
-   Usage (from ROOT command):
+   Usage: 
+   
+   1) summ the files produced from the separate (grid) runs
+   hadd summ.root file1.root file2.root ... fileN.root
+   <=== LMTODO : this will be different for TEfficiencties ; 
+   need a dedicated script at this step already 
 
-   root -l -b -q InDetStandardPlots.root postprocessHistos.cxx+
+   2) the post-processing will 
+   * loop over TProfiles 
+   * replace incorrect TProfiles in TEfficiencies inline
 
-   Usage (after compiling and linking against ROOT libraries):
+   to run use either of: 
 
-   ./postprocessHistos InDetStandardPlots.root
+   2.1) command-line:
+   root -l -b -q summ.root postprocessHistos.cxx+
 
-   Author: Soeren Prell
+   2.2) compiled code: 
+   NAME=postprocessHistos
+   g++ -O2 -Wall -fPIC $(root-config --cflags) -o ${NAME} ${NAME}.cxx $(root-config --libs)
+   ./$NAME summ.root
 
+   -----------------------------------------------------------------------------
+   Author: Soeren Prell, Liza Mijovic
    ==============================================================================*/
+#define RLN cout << "l" << __LINE__ << ": ";
+// 0, 1 or 2 in increasing order of verbosity
+#define PRINTDBG 2
 
 #include <iostream>
 #include <string>
@@ -56,10 +72,8 @@ class IDStandardPerformance {
 public:
   IDStandardPerformance(TDirectory *top,
                         const char *tracksName = "Tracks",
-                        const char *histDirectoryName = "SelectedGoodTracks",
-                        int verbose = 0,
-                        bool plotsVsAbsEta = false)
-    : m_d0_vs_eta{},
+                        const char *histDirectoryName = "SelectedGoodTracks") :
+    m_d0_vs_eta{},
     m_z0_vs_eta{},
     m_phi_vs_eta{},
     m_theta_vs_eta{},
@@ -129,39 +143,9 @@ public:
     m_theta_res_vs_pt{},
     m_z0st_res_vs_pt{},
 
-    m_eff_eta{},
-    m_eff_phi{},
-    m_eff_pt{},
-    m_eff_pti{},
-    m_eff_eta_pt{},
-    m_eff_eta_phi{},
-
-    m_effdenom_eta{},
-    m_effdenom_phi{},
-    m_effdenom_pt{},
-    m_effdenom_eta_pt{},
-    m_effdenom_eta_phi{},
-
-    m_effnum_eta{},
-    m_effnum_phi{},
-    m_effnum_pt{},
-    m_effnum_eta_pt{},
-    m_effnum_eta_phi{},
-    m_n_vs_jetDR_truth{},
-    m_n_vs_jetDR_reco{},
-    m_eff_jetDR{},
-
-    m_n_vs_jetPt_truth{},
-    m_n_vs_jetPt_reco{},
-    m_eff_jetPt{},
     m_top(top),
-    m_verbose(verbose),
     m_tracksName(tracksName),
-    m_histDirectoryName(histDirectoryName),
-    m_trackPtBins(10),
-    m_trackEtaBins(20),
-    m_maxTrackEta(2.5),
-    m_plotsVsAbsEta(plotsVsAbsEta) {
+    m_histDirectoryName(histDirectoryName) {
     m_owned.SetOwner();
   }
 
@@ -187,111 +171,81 @@ public:
 
 private:
   // 2D histograms
-  TH2D *m_d0_vs_eta;
-  TH2D *m_z0_vs_eta;
-  TH2D *m_phi_vs_eta;
-  TH2D *m_theta_vs_eta;
-  TH2D *m_z0st_vs_eta;
-  TH2D *m_qopt_vs_eta;
-
-  TH2D *m_d0_vs_pt;
-  TH2D *m_z0_vs_pt;
-  TH2D *m_phi_vs_pt;
-  TH2D *m_theta_vs_pt;
-  TH2D *m_z0st_vs_pt;
-  TH2D *m_qopt_vs_pt;
-
-  TH2D *m_d0pull_vs_eta;
-  TH2D *m_z0pull_vs_eta;
-  TH2D *m_phipull_vs_eta;
-  TH2D *m_thetapull_vs_eta;
-  TH2D *m_z0stpull_vs_eta;
-  TH2D *m_qoptpull_vs_eta;
+  TH2F *m_d0_vs_eta;
+  TH2F *m_z0_vs_eta;
+  TH2F *m_phi_vs_eta;
+  TH2F *m_theta_vs_eta;
+  TH2F *m_z0st_vs_eta;
+  TH2F *m_qopt_vs_eta;
+
+  TH2F *m_d0_vs_pt;
+  TH2F *m_z0_vs_pt;
+  TH2F *m_phi_vs_pt;
+  TH2F *m_theta_vs_pt;
+  TH2F *m_z0st_vs_pt;
+  TH2F *m_qopt_vs_pt;
+
+  TH2F *m_d0pull_vs_eta;
+  TH2F *m_z0pull_vs_eta;
+  TH2F *m_phipull_vs_eta;
+  TH2F *m_thetapull_vs_eta;
+  TH2F *m_z0stpull_vs_eta;
+  TH2F *m_qoptpull_vs_eta;
 
   // summary plots of track parameter resolutions and means versus eta
-  TH1D *m_d0_mean_vs_eta;
-  TH1D *m_phi_mean_vs_eta;
-  TH1D *m_qopt_mean_vs_eta;
-  TH1D *m_z0_mean_vs_eta;
-  TH1D *m_theta_mean_vs_eta;
-  TH1D *m_z0st_mean_vs_eta;
-
-  TH1D *m_d0_width_vs_eta;
-  TH1D *m_phi_width_vs_eta;
-  TH1D *m_qopt_width_vs_eta;
-  TH1D *m_z0_width_vs_eta;
-  TH1D *m_theta_width_vs_eta;
-  TH1D *m_z0st_width_vs_eta;
-
-  TH1D *m_d0pull_mean_vs_eta;
-  TH1D *m_phipull_mean_vs_eta;
-  TH1D *m_qoptpull_mean_vs_eta;
-  TH1D *m_z0pull_mean_vs_eta;
-  TH1D *m_thetapull_mean_vs_eta;
-  TH1D *m_z0stpull_mean_vs_eta;
-
-  TH1D *m_d0pull_width_vs_eta;
-  TH1D *m_phipull_width_vs_eta;
-  TH1D *m_qoptpull_width_vs_eta;
-  TH1D *m_z0pull_width_vs_eta;
-  TH1D *m_thetapull_width_vs_eta;
-  TH1D *m_z0stpull_width_vs_eta;
+  TH1F *m_d0_mean_vs_eta;
+  TH1F *m_phi_mean_vs_eta;
+  TH1F *m_qopt_mean_vs_eta;
+  TH1F *m_z0_mean_vs_eta;
+  TH1F *m_theta_mean_vs_eta;
+  TH1F *m_z0st_mean_vs_eta;
+
+  TH1F *m_d0_width_vs_eta;
+  TH1F *m_phi_width_vs_eta;
+  TH1F *m_qopt_width_vs_eta;
+  TH1F *m_z0_width_vs_eta;
+  TH1F *m_theta_width_vs_eta;
+  TH1F *m_z0st_width_vs_eta;
+
+  TH1F *m_d0pull_mean_vs_eta;
+  TH1F *m_phipull_mean_vs_eta;
+  TH1F *m_qoptpull_mean_vs_eta;
+  TH1F *m_z0pull_mean_vs_eta;
+  TH1F *m_thetapull_mean_vs_eta;
+  TH1F *m_z0stpull_mean_vs_eta;
+
+  TH1F *m_d0pull_width_vs_eta;
+  TH1F *m_phipull_width_vs_eta;
+  TH1F *m_qoptpull_width_vs_eta;
+  TH1F *m_z0pull_width_vs_eta;
+  TH1F *m_thetapull_width_vs_eta;
+  TH1F *m_z0stpull_width_vs_eta;
 
   // summary plots of track parameter resolutions vs pt
-  TH1D *m_d0_mean_vs_pt;
-  TH1D *m_phi_mean_vs_pt;
-  TH1D *m_qopt_mean_vs_pt;
-  TH1D *m_z0_mean_vs_pt;
-  TH1D *m_theta_mean_vs_pt;
-  TH1D *m_z0st_mean_vs_pt;
-
-  TH1D *m_d0_width_vs_pt;
-  TH1D *m_phi_width_vs_pt;
-  TH1D *m_qopt_width_vs_pt;
-  TH1D *m_z0_width_vs_pt;
-  TH1D *m_theta_width_vs_pt;
-  TH1D *m_z0st_width_vs_pt;
-
-  TH1D *m_d0_res_vs_pt;
-  TH1D *m_phi_res_vs_pt;
-  TH1D *m_qopt_res_vs_pt;
-  TH1D *m_z0_res_vs_pt;
-  TH1D *m_theta_res_vs_pt;
-  TH1D *m_z0st_res_vs_pt;
-
-  // efficiency histograms / TProfiles
-
-  TH1D *m_eff_eta;
-  TH1D *m_eff_phi;
-  TH1D *m_eff_pt;
-  TH1D *m_eff_pti;
-  TH2D *m_eff_eta_pt;
-  TH2D *m_eff_eta_phi;
-
-  TH1D *m_effdenom_eta;
-  TH1D *m_effdenom_phi;
-  TH1D *m_effdenom_pt;
-  TH2D *m_effdenom_eta_pt;
-  TH2D *m_effdenom_eta_phi;
-
-  TH1D *m_effnum_eta;
-  TH1D *m_effnum_phi;
-  TH1D *m_effnum_pt;
-  TH2D *m_effnum_eta_pt;
-  TH2D *m_effnum_eta_phi;
-
-  TProfile *m_n_vs_jetDR_truth;
-  TProfile *m_n_vs_jetDR_reco;
-  TH1D *m_eff_jetDR;
-
-  TProfile *m_n_vs_jetPt_truth;
-  TProfile *m_n_vs_jetPt_reco;
-  TH1D *m_eff_jetPt;
+  TH1F *m_d0_mean_vs_pt;
+  TH1F *m_phi_mean_vs_pt;
+  TH1F *m_qopt_mean_vs_pt;
+  TH1F *m_z0_mean_vs_pt;
+  TH1F *m_theta_mean_vs_pt;
+  TH1F *m_z0st_mean_vs_pt;
+
+  TH1F *m_d0_width_vs_pt;
+  TH1F *m_phi_width_vs_pt;
+  TH1F *m_qopt_width_vs_pt;
+  TH1F *m_z0_width_vs_pt;
+  TH1F *m_theta_width_vs_pt;
+  TH1F *m_z0st_width_vs_pt;
+
+  TH1F *m_d0_res_vs_pt;
+  TH1F *m_phi_res_vs_pt;
+  TH1F *m_qopt_res_vs_pt;
+  TH1F *m_z0_res_vs_pt;
+  TH1F *m_theta_res_vs_pt;
+  TH1F *m_z0st_res_vs_pt;
 
   TH1F *create_registeredTH1F(MonGroup &mon, const char *name);
   TH1D *create_registeredTH1D(MonGroup &mon, const char *name);
   TH2F *create_registeredTH2F(MonGroup &mon, const char *name);
-  TH2D *create_registeredTH2D(MonGroup &mon, const char *name);
   TProfile *create_registeredTProfile(MonGroup &mon, const char *name);
 
   void SetSafeMinimumMaximum(TH1 *h1, float min, float max);
@@ -299,23 +253,18 @@ private:
   void CopyProfile(const TProfile *p, TH1 *h);
   void projectStandardProfileY(const TH2 *h, TH1 *profMean, TH1 *profWidth = 0,
                                const char *fitfun = 0, Double_t cut_tail = 3.0);
-  void projectStandardProfileY(const std::vector<TH1D *> &hvec, TH1 *profMean, TH1 *profWidth = 0,
+  void projectStandardProfileY(const std::vector<TH1F *> &hvec, TH1 *profMean, TH1 *profWidth = 0,
                                Int_t fold = -1, const char *fitfun = 0, Double_t cut_tail = 3.0);
 
-  void calculateEfficiency(TH1 *hEff, TH1 *hDenom, TH1 *hNum);
   void calculateIntegrated(TH1 *puri, TH1 *matched, TH1 *all);
   void inverseSum(TH1 *in, TH1 *out);
 
   TList m_owned, m_update;
   TDirectory *m_top;
-  int m_verbose;
 
   std::string m_tracksName;
   std::string m_histDirectoryName;
-  int m_trackPtBins;
-  int m_trackEtaBins;
-  float m_maxTrackEta;
-  bool m_plotsVsAbsEta;
+
 };
 
 
@@ -331,6 +280,12 @@ GetPath(const TDirectory *dir, TString &path) {
   path += dir->GetName();
 }
 
+// 
+bool FileExists(const char *name) {
+  return (gSystem->AccessPathName(name, kFileExists))?
+    false : true;    
+}
+
 void
 PrintHist(const TH1 *h, int detail = 1) {
   if (detail >= 1) {
@@ -376,16 +331,16 @@ PrintHist(const TH1 *h, int detail = 1) {
 
 class MonGroup {
 public:
-  MonGroup(IDStandardPerformance *tool, const std::string &system, int level, int interval)
-    : m_tool(tool), m_system(system), m_level(level), m_interval(interval) {
+  MonGroup(IDStandardPerformance *tool, const std::string &system, int level)
+    : m_tool(tool), m_system(system), m_level(level) {
   }
 
   TH1 *
   regHist(const char *name) {
     TString path = Form("%s/%s", m_system.c_str(), name);
 
-    //    cout << "Path: " << path << endl;
-    //    cout << "m_level " << m_level << endl;
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << "Path: " << path << endl;}
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << "m_level " << m_level << endl;}
 
     TH1 *h = 0;
 
@@ -399,16 +354,16 @@ public:
       //      cout << "Histo added " << h->GetName() << endl;
       //      cout << "Path " << path << endl;
     } else if (m_level >= 0) {
-      ;
-    }      //      cerr << "TH1::"<<path<<" not found" << endl;
-    //    cout << "Return h " << h << endl;
+      if (PRINTDBG) { cout <<"\t"; RLN; cout << "TH1::"<<path<<" not found " << endl; }
+    }
+    if (PRINTDBG) {cout <<"\t MonGroup regHist "; RLN; cout << "Return h " << h << endl;}
     return h;
   }
 
 private:
   IDStandardPerformance *m_tool;
   std::string m_system;
-  int m_level, m_interval;
+  int m_level;
 };
 
 
@@ -439,16 +394,14 @@ IDStandardPerformance::create_registeredTH1D(MonGroup &mon, const char *name) {
 TH2F *
 IDStandardPerformance::create_registeredTH2F(MonGroup &mon, const char *name) {
   TH2F *hist = 0;
-
+  if (PRINTDBG) { cout <<"\t"; RLN; cout <<" create_registeredTH2 for " << name << endl; }
   hist = dynamic_cast<TH2F *>(mon.regHist(name));
-  return hist;
-}
-
-TH2D *
-IDStandardPerformance::create_registeredTH2D(MonGroup &mon, const char *name) {
-  TH2D *hist = 0;
-
-  hist = dynamic_cast<TH2D *>(mon.regHist(name));
+  if (hist) {
+    if (PRINTDBG) { cout <<"\t"; RLN; cout <<" returning " << hist->GetName() << endl; }
+  }
+  else {
+    if (PRINTDBG) { cout <<"\t"; RLN; cout <<" IDStandardPerformance::create_registeredTH2F dynamic_cast<TH2F *> failed. returning null pointer " << endl; }
+  }
   return hist;
 }
 
@@ -462,140 +415,92 @@ IDStandardPerformance::create_registeredTProfile(MonGroup &mon, const char *name
 
 void
 IDStandardPerformance::bookHistograms(bool isNewRun) {
-  //  if (m_verbose>=1) cout << "bookHistograms "<<m_histDirectoryName<<endl;
-  //  cout << "bookHistograms "<<m_histDirectoryName<<endl;
-  int expert = m_verbose, debug = m_verbose, shift = m_verbose, run = 0;
-  // MsgStream log( msgSvc(), name() );
 
+  cout <<"\t"; RLN; cout << "bookHistograms "<<m_histDirectoryName<<endl;
   std::string outputDirName = "IDPerformanceMon/" + m_tracksName + "/" + m_histDirectoryName;
-
-  MonGroup al_expert(this, outputDirName, expert, run);
-  MonGroup al_shift(this, outputDirName, shift, run);
-  MonGroup al_debug(this, outputDirName, debug, run);
-  MonGroup effdenom(this, outputDirName + "Tracks/" + m_histDirectoryName + "Denom", expert, run);
-  MonGroup effnum(this, outputDirName + "Tracks/" + m_histDirectoryName + "Num", expert, run);
+  int run = 0;
+  
+  MonGroup al_expert(this, outputDirName, run);
+  MonGroup al_shift(this, outputDirName, run);
+  MonGroup al_debug(this, outputDirName, run);
 
   if (isNewRun) {
-    char name_tmp[100];
-
-    m_d0_vs_eta = create_registeredTH2D(al_debug, "res_d0_vs_eta");
-    m_z0_vs_eta = create_registeredTH2D(al_debug, "res_z0_vs_eta");
-    m_phi_vs_eta = create_registeredTH2D(al_debug, "res_phi_vs_eta");
-    m_theta_vs_eta = create_registeredTH2D(al_debug, "res_theta_vs_eta");
-    m_z0st_vs_eta = create_registeredTH2D(al_debug, "res_z0*sin(theta)_vs_eta");
-    m_qopt_vs_eta = create_registeredTH2D(al_debug, "res_qOverP_vs_eta");
-
-    m_d0_vs_pt = create_registeredTH2D(al_debug, "res_d0_vs_logpt");
-    m_z0_vs_pt = create_registeredTH2D(al_debug, "res_z0_vs_logpt");
-    m_phi_vs_pt = create_registeredTH2D(al_debug, "res_phi_vs_logpt");
-    m_theta_vs_pt = create_registeredTH2D(al_debug, "res_theta_vs_logpt");
-    m_z0st_vs_pt = create_registeredTH2D(al_debug, "res_z0*sin(theta)_vs_logpt");
-    m_qopt_vs_pt = create_registeredTH2D(al_debug, "res_qOverP_vs_logpt");
-
-    m_d0pull_vs_eta = create_registeredTH2D(al_debug, "pull_d0_vs_eta");
-    m_z0pull_vs_eta = create_registeredTH2D(al_debug, "pull_z0_vs_eta");
-    m_phipull_vs_eta = create_registeredTH2D(al_debug, "pull_phi_vs_eta");
-    m_thetapull_vs_eta = create_registeredTH2D(al_debug, "pull_theta_vs_eta");
-    m_z0stpull_vs_eta = create_registeredTH2D(al_debug, "pull_z0*sin(theta)_vs_eta");
-    m_qoptpull_vs_eta = create_registeredTH2D(al_debug, "pull_qOverP_vs_eta");
-
-    int nbins_eta = m_trackEtaBins;
-    float min_eta = -m_maxTrackEta;
-    float max_eta = +m_maxTrackEta;
-    int nbins_pt = 20;
-    int min_pt, max_pt;
-
-    if (m_plotsVsAbsEta) {
-      nbins_eta = m_trackEtaBins / 2;
-      min_eta = 0;
-    }
-
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << " isNewRun" << endl; }
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << "  m_d0_vs_eta = create_registeredTH2F " << endl; }
+    m_d0_vs_eta = create_registeredTH2F(al_debug, "res_d0_vs_eta");
+    m_z0_vs_eta = create_registeredTH2F(al_debug, "res_z0_vs_eta");
+    m_phi_vs_eta = create_registeredTH2F(al_debug, "res_phi_vs_eta");
+    m_theta_vs_eta = create_registeredTH2F(al_debug, "res_theta_vs_eta");
+    m_z0st_vs_eta = create_registeredTH2F(al_debug, "res_z0*sin(theta)_vs_eta");
+    m_qopt_vs_eta = create_registeredTH2F(al_debug, "res_qOverP_vs_eta");
+
+    m_d0_vs_pt = create_registeredTH2F(al_debug, "res_d0_vs_logpt");
+    m_z0_vs_pt = create_registeredTH2F(al_debug, "res_z0_vs_logpt");
+    m_phi_vs_pt = create_registeredTH2F(al_debug, "res_phi_vs_logpt");
+    m_theta_vs_pt = create_registeredTH2F(al_debug, "res_theta_vs_logpt");
+    m_z0st_vs_pt = create_registeredTH2F(al_debug, "res_z0*sin(theta)_vs_logpt");
+    m_qopt_vs_pt = create_registeredTH2F(al_debug, "res_qOverP_vs_logpt");
+
+    m_d0pull_vs_eta = create_registeredTH2F(al_debug, "pull_d0_vs_eta");
+    m_z0pull_vs_eta = create_registeredTH2F(al_debug, "pull_z0_vs_eta");
+    m_phipull_vs_eta = create_registeredTH2F(al_debug, "pull_phi_vs_eta");
+    m_thetapull_vs_eta = create_registeredTH2F(al_debug, "pull_theta_vs_eta");
+    m_z0stpull_vs_eta = create_registeredTH2F(al_debug, "pull_z0*sin(theta)_vs_eta");
+    m_qoptpull_vs_eta = create_registeredTH2F(al_debug, "pull_qOverP_vs_eta");
 
     // ------------------------------------------------------------------
     // summary plots of track parameter resolutions amnd means versus eta
     // ------------------------------------------------------------------
 
-    m_d0_mean_vs_eta = create_registeredTH1D(al_shift, "resmean_d0_vs_eta");
-    m_z0_mean_vs_eta = create_registeredTH1D(al_shift, "resmean_z0_vs_eta");
-    m_phi_mean_vs_eta = create_registeredTH1D(al_shift, "resmean_phi_vs_eta");
-    m_theta_mean_vs_eta = create_registeredTH1D(al_shift, "resmean_theta_vs_eta");
-    m_z0st_mean_vs_eta = create_registeredTH1D(al_shift, "resmean_z0*sin(theta)_vs_eta");
-    //    m_qopt_mean_vs_eta = create_registeredTH1D(al_shift, "resmean_qOverP_vs_eta");
-
-    m_d0_width_vs_eta = create_registeredTH1D(al_shift, "reswidth_d0_vs_eta");
-    m_z0_width_vs_eta = create_registeredTH1D(al_shift, "reswidth_z0_vs_eta");
-    m_phi_width_vs_eta = create_registeredTH1D(al_shift, "reswidth_phi_vs_eta");
-    m_theta_width_vs_eta = create_registeredTH1D(al_shift, "reswidth_theta_vs_eta");
-    m_z0st_width_vs_eta = create_registeredTH1D(al_shift, "reswidth_z0*sin(theta)_vs_eta");
-    //    m_qopt_width_vs_eta = create_registeredTH1D(al_shift, "reswidth_qOverP_vs_eta");
-
-    m_d0pull_mean_vs_eta = create_registeredTH1D(al_shift, "pullmean_d0_vs_eta");
-    m_z0pull_mean_vs_eta = create_registeredTH1D(al_shift, "pullmean_z0_vs_eta");
-    m_phipull_mean_vs_eta = create_registeredTH1D(al_shift, "pullmean_phi_vs_eta");
-    m_thetapull_mean_vs_eta = create_registeredTH1D(al_shift, "pullmean_theta_vs_eta");
-    m_z0stpull_mean_vs_eta = create_registeredTH1D(al_shift, "pullmean_z0*sin(theta)_vs_eta");
-    //    m_qoptpull_mean_vs_eta = create_registeredTH1D(al_shift, "pullmean_qopt_vs_eta");
-
-    m_d0pull_width_vs_eta = create_registeredTH1D(al_shift, "pullwidth_d0_vs_eta");
-    m_z0pull_width_vs_eta = create_registeredTH1D(al_shift, "pullwidth_z0_vs_eta");
-    m_phipull_width_vs_eta = create_registeredTH1D(al_shift, "pullwidth_phi_vs_eta");
-    m_thetapull_width_vs_eta = create_registeredTH1D(al_shift, "pullwidth_theta_vs_eta");
-    m_z0stpull_width_vs_eta = create_registeredTH1D(al_shift, "pullwidth_z0*sin(theta)_vs_eta");
-    //    m_qoptpull_width_vs_eta = create_registeredTH1D(al_shift, "pullwidth_qopt_vs_eta");
+    m_d0_mean_vs_eta = create_registeredTH1F(al_shift, "resmean_d0_vs_eta");
+    m_z0_mean_vs_eta = create_registeredTH1F(al_shift, "resmean_z0_vs_eta");
+    m_phi_mean_vs_eta = create_registeredTH1F(al_shift, "resmean_phi_vs_eta");
+    m_theta_mean_vs_eta = create_registeredTH1F(al_shift, "resmean_theta_vs_eta");
+    m_z0st_mean_vs_eta = create_registeredTH1F(al_shift, "resmean_z0*sin(theta)_vs_eta");
+    //    m_qopt_mean_vs_eta = create_registeredTH1F(al_shift, "resmean_qOverP_vs_eta");
+
+    m_d0_width_vs_eta = create_registeredTH1F(al_shift, "reswidth_d0_vs_eta");
+    m_z0_width_vs_eta = create_registeredTH1F(al_shift, "reswidth_z0_vs_eta");
+    m_phi_width_vs_eta = create_registeredTH1F(al_shift, "reswidth_phi_vs_eta");
+    m_theta_width_vs_eta = create_registeredTH1F(al_shift, "reswidth_theta_vs_eta");
+    m_z0st_width_vs_eta = create_registeredTH1F(al_shift, "reswidth_z0*sin(theta)_vs_eta");
+    //    m_qopt_width_vs_eta = create_registeredTH1F(al_shift, "reswidth_qOverP_vs_eta");
+
+    m_d0pull_mean_vs_eta = create_registeredTH1F(al_shift, "pullmean_d0_vs_eta");
+    m_z0pull_mean_vs_eta = create_registeredTH1F(al_shift, "pullmean_z0_vs_eta");
+    m_phipull_mean_vs_eta = create_registeredTH1F(al_shift, "pullmean_phi_vs_eta");
+    m_thetapull_mean_vs_eta = create_registeredTH1F(al_shift, "pullmean_theta_vs_eta");
+    m_z0stpull_mean_vs_eta = create_registeredTH1F(al_shift, "pullmean_z0*sin(theta)_vs_eta");
+    //    m_qoptpull_mean_vs_eta = create_registeredTH1F(al_shift, "pullmean_qopt_vs_eta");
+
+    m_d0pull_width_vs_eta = create_registeredTH1F(al_shift, "pullwidth_d0_vs_eta");
+    m_z0pull_width_vs_eta = create_registeredTH1F(al_shift, "pullwidth_z0_vs_eta");
+    m_phipull_width_vs_eta = create_registeredTH1F(al_shift, "pullwidth_phi_vs_eta");
+    m_thetapull_width_vs_eta = create_registeredTH1F(al_shift, "pullwidth_theta_vs_eta");
+    m_z0stpull_width_vs_eta = create_registeredTH1F(al_shift, "pullwidth_z0*sin(theta)_vs_eta");
+    //    m_qoptpull_width_vs_eta = create_registeredTH1F(al_shift, "pullwidth_qopt_vs_eta");
 
     // ------------------------------------------------------------------
     // summary plots of track parameter resolutions versus pt
     // ------------------------------------------------------------------
 
-    m_d0_mean_vs_pt = create_registeredTH1D(al_shift, "resmean_d0_vs_logpt");
-    m_z0_mean_vs_pt = create_registeredTH1D(al_shift, "resmean_z0_vs_logpt");
-    m_phi_mean_vs_pt = create_registeredTH1D(al_shift, "resmean_phi_vs_logpt");
-    m_theta_mean_vs_pt = create_registeredTH1D(al_shift, "resmean_theta_vs_logpt");
-    m_z0st_mean_vs_pt = create_registeredTH1D(al_shift, "resmean_z0*sin(theta)_vs_logpt");
-    //    m_qopt_mean_vs_pt = create_registeredTH1D(al_shift, "resmean_qOverP_vs_logpt")'
-
-    m_d0_width_vs_pt = create_registeredTH1D(al_shift, "reswidth_d0_vs_logpt");
-    m_z0_width_vs_pt = create_registeredTH1D(al_shift, "reswidth_z0_vs_logpt");
-    m_phi_width_vs_pt = create_registeredTH1D(al_shift, "reswidth_phi_vs_logpt");
-    m_theta_width_vs_pt = create_registeredTH1D(al_shift, "reswidth_theta_vs_logpt");
-    m_z0st_width_vs_pt = create_registeredTH1D(al_shift, "reswidth_z0*sin(theta)_vs_logpt");
-    //    m_qopt_width_vs_pt = create_registeredTH1D(al_shift, "reswidth_qOverP_vs_logpt");
-
-    // ------------------------------------------------------------------
-    // track efficiency plots
-    // ------------------------------------------------------------------
-
-    m_eff_eta = create_registeredTH1D(al_shift, "Eff_eta");
-    m_effdenom_eta = create_registeredTH1D(effdenom, "eta");
-    m_effnum_eta = create_registeredTH1D(effnum, "eta");
-
-    m_eff_phi = create_registeredTH1D(al_shift, "Eff_phi");
-    m_effdenom_phi = create_registeredTH1D(effdenom, "phi");
-    m_effnum_phi = create_registeredTH1D(effnum, "phi");
+    m_d0_mean_vs_pt = create_registeredTH1F(al_shift, "resmean_d0_vs_logpt");
+    m_z0_mean_vs_pt = create_registeredTH1F(al_shift, "resmean_z0_vs_logpt");
+    m_phi_mean_vs_pt = create_registeredTH1F(al_shift, "resmean_phi_vs_logpt");
+    m_theta_mean_vs_pt = create_registeredTH1F(al_shift, "resmean_theta_vs_logpt");
+    m_z0st_mean_vs_pt = create_registeredTH1F(al_shift, "resmean_z0*sin(theta)_vs_logpt");
+    //    m_qopt_mean_vs_pt = create_registeredTH1F(al_shift, "resmean_qOverP_vs_logpt")'
 
-    m_eff_pt = create_registeredTH1D(al_shift, "Eff_pt");
-    m_eff_pti = create_registeredTH1D(al_shift, "Eff_pti");
-    m_effdenom_pt = create_registeredTH1D(effdenom, "pt");
-    m_effnum_pt = create_registeredTH1D(effnum, "pt");
+    m_d0_width_vs_pt = create_registeredTH1F(al_shift, "reswidth_d0_vs_logpt");
+    m_z0_width_vs_pt = create_registeredTH1F(al_shift, "reswidth_z0_vs_logpt");
+    m_phi_width_vs_pt = create_registeredTH1F(al_shift, "reswidth_phi_vs_logpt");
+    m_theta_width_vs_pt = create_registeredTH1F(al_shift, "reswidth_theta_vs_logpt");
+    m_z0st_width_vs_pt = create_registeredTH1F(al_shift, "reswidth_z0*sin(theta)_vs_logpt");
+    //    m_qopt_width_vs_pt = create_registeredTH1F(al_shift, "reswidth_qOverP_vs_logpt");
 
-    m_eff_eta_pt = create_registeredTH2D(al_shift, "Eff_eta_pt");
-    m_effdenom_eta_pt = create_registeredTH2D(effdenom, "eta_pt");
-    m_effnum_eta_pt = create_registeredTH2D(effnum, "eta_pt");
-
-    m_eff_eta_phi = create_registeredTH2D(al_shift, "Eff_eta_phi");
-    m_effdenom_eta_phi = create_registeredTH2D(effdenom, "eta_phi");
-    m_effnum_eta_phi = create_registeredTH2D(effnum, "eta_phi");
-
-    m_n_vs_jetDR_truth = create_registeredTProfile(al_shift, "NTracks_vs_jetDR_truth");
-    m_n_vs_jetDR_reco = create_registeredTProfile(al_shift, "NTracks_vs_jetDR_reco");
-    m_eff_jetDR = create_registeredTH1D(al_shift, "NTracks_vs_jetDR_eff");
-
-    m_n_vs_jetPt_truth = create_registeredTProfile(al_shift, "NTracks_vs_jetPt_truth");
-    m_n_vs_jetPt_reco = create_registeredTProfile(al_shift, "NTracks_vs_jetPt_reco");
-    m_eff_jetPt = create_registeredTH1D(al_shift, "NTracks_vs_jetPt_eff");
   }
-  if (m_verbose >= 1) {
-    cout << "bookHistograms " << m_histDirectoryName << " Done." << endl;
+  if (PRINTDBG > 1) {
+    cout <<"\t"; RLN; cout << "bookHistograms " << m_histDirectoryName << " Done." << endl;
   }
 }
 
@@ -659,7 +564,7 @@ SetProfileBin(Int_t i, TH1 *h1, TH1 *pm, TH1 *pw, const char *fitfun = 0, Double
   }
 }
 
-// projects a TH2 into a profile, expressed as a TH1D.
+// projects a TH2 into a profile, expressed as a TH1F.
 // This is similar to the TH2::ProfileX method with the difference
 // that only the error within 3RMS around the mean is considered in the profile.
 // Specify a different range with cut_tail (>0:mean+/-RMS, <0:0+/-RMS).
@@ -667,12 +572,17 @@ SetProfileBin(Int_t i, TH1 *h1, TH1 *pm, TH1 *pw, const char *fitfun = 0, Double
 void
 IDStandardPerformance::projectStandardProfileY(const TH2 *h, TH1 *profMean, TH1 *profWidth,
                                                const char *fitfun, Double_t cut_tail) {
+  if (PRINTDBG) { cout <<"\t"; RLN; cout << " projectStandardProfileY" << endl;}
+
   if (!h) {
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << " no TH2 h. No processing. " << endl; }
     return;
   }
   if (!profMean && !profWidth) {
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << " !profMean && !profWidth No processing. " << endl;}
     return;
   }
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << "processing for " << h->GetName() << endl;}
   Int_t nb = h->GetNbinsX();
   Double_t xlo = h->GetXaxis()->GetXmin(), xhi = h->GetXaxis()->GetXmax();
   if (profMean) {
@@ -697,7 +607,7 @@ IDStandardPerformance::projectStandardProfileY(const TH2 *h, TH1 *profMean, TH1
 }
 
 void
-IDStandardPerformance::projectStandardProfileY(const std::vector<TH1D *> &hvec, TH1 *profMean, TH1 *profWidth,
+IDStandardPerformance::projectStandardProfileY(const std::vector<TH1F *> &hvec, TH1 *profMean, TH1 *profWidth,
                                                Int_t fold, const char *fitfun, Double_t cut_tail) {
   TH1 *hx = profMean ? profMean : profWidth;
 
@@ -730,7 +640,7 @@ IDStandardPerformance::projectStandardProfileY(const std::vector<TH1D *> &hvec,
     if (!(j1 >= 0 && hvec[j1])) {
       continue;
     }
-    TH1D *h1 = dynamic_cast<TH1D *>(hvec[j1]->Clone(Form("%s_mod", hvec[j1]->GetName())));
+    TH1F *h1 = dynamic_cast<TH1F *>(hvec[j1]->Clone(Form("%s_mod", hvec[j1]->GetName())));
     if (j2 >= 0 && hvec[j2]) {
       h1->Add(hvec[j2]);
     }
@@ -749,29 +659,6 @@ IDStandardPerformance::projectStandardProfileY(const std::vector<TH1D *> &hvec,
   }
 }
 
-void
-IDStandardPerformance::calculateEfficiency(TH1 *hEff, TH1 *hDenom, TH1 *hNum) {
-  if (!hEff) {
-    return;
-  }
-  if (!hDenom) {
-    return;
-  }
-  if (!hNum) {
-    return;
-  }
-
-  hEff->Reset();
-
-  hEff->Add(hNum);
-  if (!hEff->GetSumw2N()) {
-    hEff->Sumw2();
-  }
-  hEff->Divide(hEff, hDenom, 1, 1, "B");
-
-  Update(hEff);
-}
-
 void
 IDStandardPerformance::calculateIntegrated(TH1 *puri, TH1 *all, TH1 *matched) {
   if (!matched) {
@@ -818,21 +705,14 @@ IDStandardPerformance::inverseSum(TH1 *in, TH1 *out) {
 
 void
 IDStandardPerformance::procHistograms(bool isEndOfRun) {
-  if (m_verbose >= 1) {
-    cout << "procHistograms " << m_histDirectoryName << endl;
+  if (PRINTDBG >= 1) {
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << "procHistograms " << m_histDirectoryName << endl;}
   }
-  // MsgStream log( msgSvc(), name() );
-  //  if (m_idHelper) delete m_idHelper;
 
   if (isEndOfRun) {
-    int halfEtaBins = m_trackEtaBins / 2;
-    int fold = m_plotsVsAbsEta ? halfEtaBins : 0;
-
-    //    cout << "procHistos" << endl;
 
     char fitter[5] = "iter";
-    //    cout << "Fitter: " << fitter << endl;
-
+    if (PRINTDBG) { cout <<"\t"; RLN; cout << "trying m_d0_vs_eta " << endl;}
     projectStandardProfileY(m_d0_vs_eta, m_d0_mean_vs_eta, m_d0_width_vs_eta, fitter);
     projectStandardProfileY(m_z0_vs_eta, m_z0_mean_vs_eta, m_z0_width_vs_eta, fitter);
     projectStandardProfileY(m_phi_vs_eta, m_phi_mean_vs_eta, m_phi_width_vs_eta, fitter);
@@ -852,27 +732,15 @@ IDStandardPerformance::procHistograms(bool isEndOfRun) {
     projectStandardProfileY(m_phipull_vs_eta, m_phipull_mean_vs_eta, m_phipull_width_vs_eta, fitter);
     projectStandardProfileY(m_thetapull_vs_eta, m_thetapull_mean_vs_eta, m_thetapull_width_vs_eta, fitter);
     projectStandardProfileY(m_z0stpull_vs_eta, m_z0stpull_mean_vs_eta, m_z0stpull_width_vs_eta, fitter);
-    //    projectStandardProfileY (m_qoptpull_vs_eta,  m_qoptpull_mean_vs_eta,  m_qoptpull_width_vs_eta,  fitter);
-
-    calculateEfficiency(m_eff_eta, m_effdenom_eta, m_effnum_eta);
-    calculateEfficiency(m_eff_phi, m_effdenom_phi, m_effnum_phi);
-    calculateEfficiency(m_eff_pt, m_effdenom_pt, m_effnum_pt);
-    calculateIntegrated(m_eff_pti, m_effdenom_pt, m_effnum_pt);
-    calculateEfficiency(m_eff_eta_pt, m_effdenom_eta_pt, m_effnum_eta_pt);
-    calculateEfficiency(m_eff_eta_phi, m_effdenom_eta_phi, m_effnum_eta_phi);
-
-    calculateEfficiency(m_eff_jetDR, m_n_vs_jetDR_truth, m_n_vs_jetDR_reco);
-    calculateEfficiency(m_eff_jetPt, m_n_vs_jetPt_truth, m_n_vs_jetPt_reco);
 
     SetSafeMinimumMaximum(m_d0_mean_vs_eta, -0.03, 0.03);
     SetSafeMinimumMaximum(m_phi_mean_vs_eta, -0.001, 0.001);
     SetSafeMinimumMaximum(m_theta_mean_vs_eta, -0.001, 0.001);
     SetSafeMinimumMaximum(m_z0st_mean_vs_eta, -0.05, 0.05);
-    //    SetSafeMinimumMaximum(m_qopt_mean_vs_eta, -0.01, 0.01);
   }
 
-  if (m_verbose >= 1) {
-    cout << "procHistograms " << m_histDirectoryName << " Done." << endl;
+  if (PRINTDBG >= 1) {
+    cout <<"\t"; RLN; cout << "procHistograms " << m_histDirectoryName << " Done." << endl;
   }
 }
 
@@ -911,7 +779,7 @@ IDStandardPerformance::updateFile() {
     if (!d) {
       continue;
     }
-    if (m_verbose >= 1) {
+    if (PRINTDBG > 1) {
       cout << "Updated ";
       PrintHist(h);
     }
@@ -922,49 +790,30 @@ IDStandardPerformance::updateFile() {
   return n;
 }
 
-int
-postprocessHistos(TDirectory *file, const char *tracksName, const char *dirname, int verbose = 0) {
+int postprocessHistos(TDirectory *file, const char *tracksName, const char *dirname) {
+  
   TString dir;
-
   dir.Form("IDPerformanceMon/%s/%s", tracksName, dirname);
-  TH1 *h = 0;
-
-  cout << "Now searching for " << dir << endl;
-  file->GetObject(dir + "/res_d0_vs_eta", h);
-  if (!h) {
-    file->GetObject(dir + "/HitContent_NBlayerHits", h);
-  }
-  if (!h) {
-    file->GetObject(dir + "/jetpT", h);
-  }
 
-  if (!h) {
-    return 0;
-  }
-  bool plotsVsAbsEta = (h->GetXaxis()->GetXmin() == 0.0);
-  delete h;
+  if (PRINTDBG>0) 
+    cout << "Now processing histograms in " << dir << endl;
 
-  IDStandardPerformance idsp(file, tracksName, dirname, verbose, plotsVsAbsEta);
+  IDStandardPerformance idsp(file, tracksName, dirname);
   idsp.bookHistograms();
   idsp.procHistograms();
   int n = idsp.updateFile();
 
-  if (verbose >= 0) {
-    cout << "Updated " << n << " histograms in " << dir;
-    if (plotsVsAbsEta) {
-      cout << " with |eta| range";
-    }
-    cout << endl;
-    cout << endl;
-  }
+  if (PRINTDBG > 0) 
+    cout << "\t Updated " << n << " histograms in " << dir << "\n " << endl;
+  
   return 1;
 }
 
 int
-ScanDir(TList &dirs, TDirectory *file, TDirectory *dir, const char *tracksName = 0, int verbose = 0) {
+ScanDir(TList &dirs, TDirectory *file, TDirectory *dir, const char *tracksName = 0) {
   int n = 0;
 
-  if (verbose >= 1) {
+  if (PRINTDBG  > 0) {
     TString path;
     GetPath(dir, path);
     cout << "Scan directory " << path << endl;
@@ -976,7 +825,7 @@ ScanDir(TList &dirs, TDirectory *file, TDirectory *dir, const char *tracksName =
     }
     if (TDirectory *subdir = dynamic_cast<TDirectory *>(k->ReadObj())) {
       if (!tracksName) {
-        n += ScanDir(dirs, file, subdir, subdir->GetName(), verbose);
+        n += ScanDir(dirs, file, subdir, subdir->GetName());
       } else {
         dirs.Add(new TNamed(tracksName, subdir->GetName()));
       }
@@ -986,86 +835,62 @@ ScanDir(TList &dirs, TDirectory *file, TDirectory *dir, const char *tracksName =
   return n;
 }
 
-int
-postprocessHistos(TDirectory *file, int verbose = 0) {
-  int n = 0;
+int postprocessHistos(const char *name) {
 
-  if (verbose >= 0) {
-    cout << "Process file " << file->GetName() << endl;
+  if (PRINTDBG>0) 
+    cout << "Process file " << name << endl;
+
+  if (!FileExists(name)) {
+    cerr << "No such file: " << name << endl;
+    return 1;
   }
+  TFile *file = TFile::Open(name, "UPDATE");
+  if (!file) {
+    cerr << "Could not UPDATE file " << name << endl;
+    return 1;
+  }
+  
+  int n = 0;
   TDirectory *dir = 0;
   file->GetObject("IDPerformanceMon", dir);
   if (dir) {
     TList dirs;
     dirs.SetOwner();
-    n += ScanDir(dirs, file, dir, 0, verbose);
+    n += ScanDir(dirs, file, dir, 0);
     delete dir;
     for (TIter it = &dirs; TNamed *name = dynamic_cast<TNamed *>(it()); ) {
-      n += postprocessHistos(file, name->GetName(), name->GetTitle(), verbose);
+      cout << "processing this directory " << name->GetName() << " , " << name->GetTitle() << endl;
+      //n += postprocessHistos(file, name->GetName(), name->GetTitle());
     }
   }
   if (!n) {
     cerr << "No histogram directories found in file " << file->GetName() << endl;
+    return 1;
   }
-  return n;
-}
-
-int
-postprocessHistos(const char *name, int verbose = 0) {
-  if (gSystem->AccessPathName(name, kFileExists)) {
-    cerr << "File " << name << " does not exist" << endl;
-    return 2;
-  }
-  TFile *file = TFile::Open(name, "UPDATE");
-  if (!file) {
-    cerr << "Could not open file " << name << endl;
-    return 3;
-  }
-  int n = postprocessHistos(file, verbose);
-  delete file;
-  return n ? 0 : 4;
+  return 0;
 }
 
-void
-postprocessHistos(int verbose = 0) {
+// for command-line running
+void postprocessHistos() {
   for (TIter it = gROOT->GetListOfFiles(); TObject *o = it(); ) {
     TFile *file = dynamic_cast<TFile *>(o);
     if (!file) {
       continue;
     }
-    postprocessHistos(file->GetName(), verbose);
+    postprocessHistos(file->GetName());
   }
 }
 
 #if !defined(__CINT__) && !defined(__ACLIC__)
-int
-main(int argc, const char * *argv) {
-  int i = 1, verbose = 0;
-
-  for (; i < argc; i++) {
-    if (argv[i][0] != '-') {
-      break;
-    }
-    for (const char *a = argv[i] + 1; *a; ) {
-      switch (*a++) {
-      case 'v': verbose++;
-        break;
+int main(int argc, const char * *argv) {
 
-      case 'q': verbose--;
-        break;
-
-      default:  i = argc;
-        break;
-      }
-    }
-  }
-  if (i >= argc) {
-    cout << "Usage: " << argv[0] << " [-vq] FILE.root [FILE.root...]" << endl;
+  if (argc<2) {
+    cout << "Usage: " << argv[0] << " FILE.root [FILE.root...]" << endl;
     return 1;
   }
   int err = 0;
-  for (; i < argc; i++) {
-    int stat = postprocessHistos(argv[i], verbose);
+  for (int i=0; i < argc; i++) {
+    int stat = postprocessHistos(argv[i]);
     if (!err) {
       err = stat;
     }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos_updt.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos_updt.cxx
new file mode 100755
index 0000000000000000000000000000000000000000..1d6a16e43e678e8d907b868da7019c7511193442
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos_updt.cxx
@@ -0,0 +1,139 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/*
+  ____________________________________________________________________________
+
+  merge root files from several (grid) runs
+  dedicated treatment of profiles and efficiencies
+  Author: Liza Mijovic
+   ____________________________________________________________________________
+*/
+#define RLN cout << "l" << __LINE__ << ": ";
+// 0, 1 or 2 in increasing order of verbosity
+#define PRINTDBG 2
+
+#include <iostream>
+#include <iterator>
+
+#include <boost/program_options.hpp>
+#include <boost/algorithm/string.hpp>
+
+#include "TFile.h"
+#include "TSystem.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TProfile.h"
+#include "TMath.h"
+#include "TROOT.h"
+#include "TKey.h"
+#include "TClass.h"
+#include "TObject.h"
+#include "TObjString.h"
+
+using namespace std;
+
+namespace po = boost::program_options;
+
+bool file_exists(const string name) {
+  return (gSystem->AccessPathName(name.c_str(), kFileExists))?
+    false : true;    
+}
+
+void process_histos(string p_infile, string p_ofile) {
+  if (PRINTDBG>0)
+    cout << "merging file " << p_infile << "into "<< p_ofile << endl;
+  return;
+}
+
+int main(int ac, char* av[]) {
+  
+  vector<string> infiles;
+  string ofile="";
+  
+  try {
+    po::options_description desc("Allowed arguments: ");
+    desc.add_options()
+      ("h", "print help")
+      ("o", po::value<string>(), "output root file 'summ.root'")
+      ("i", po::value<string>(), "inputs 'file1.root,file2.root,file3.root'")
+      ;
+    
+    po::variables_map vm;        
+    po::store(po::parse_command_line(ac, av, desc), vm);
+    po::notify(vm);    
+    
+    if (vm.count("h")) {
+
+      cout << "\n" << desc << "\n" << endl;
+      const char* ex_compile =  "g++ -O2 -Wall -fPIC -std=c++11"
+	" $(root-config --cflags) -o ${NAME} ${NAME}.cxx "
+	" $(root-config --libs) -lboost_program_options";
+      const char* ex_run = "./postprocessHistos_updt --i \"summ.root\" "
+	"--o \"file1.root,file2.root,file3.root\" ";
+      cout << "\n------- compile -------" << endl;
+      cout << "NAME=postprocessHistos_updt" << endl;
+      cout << ex_compile << endl;
+      cout << "\n------- run -------" << endl;
+      cout << ex_run << endl;
+      cout << "\n";
+      return 0;
+    }
+    
+    if (vm.count("o")) {
+      ofile=vm["o"].as<string>();
+      cout << "Output file set to "<< ofile << endl;
+    }
+    
+    if (vm.count("i")) {
+      string infiles_cl=vm["i"].as<string>();
+      boost::split(infiles , infiles_cl, boost::is_any_of(","));
+      cout << "Summing input files ";
+      for (auto inf : infiles)
+       	cout << inf << " " ;
+      cout << endl;
+    }
+
+    if ("" == ofile) {
+      cout << "Invalid arguments. No output file passed.";
+      cout << "\n" << desc <<"\n" << endl;
+      return 1;
+    }
+    
+    if (infiles.empty()) {
+      cout << "Invalid arguments. No inputs to summ passed.";
+      cout << desc <<" \n " << endl;
+      return 1;
+    }
+    
+  }
+  catch(exception& e) {
+    cerr << __FILE__  << "error: " << e.what() << "\n";
+    return 1;
+  }
+  catch(...) {
+    cerr << __FILE__  << "Exception of unknown type!\n";
+    return 1;
+  }
+
+  if (file_exists(ofile)) {
+    
+  }
+    
+  for (auto infile : infiles) {
+    if (infile == infiles[0]) {
+      if (!file_exists(infile)) {
+      	cout << __FILE__ << "error: input file does not exist: " << infile << endl;
+	return 1;	
+      }
+      cout << "creating initial contents of " << ofile << " from " << infile << endl;
+      gSystem->CopyFile(infile.c_str(),ofile.c_str());
+    }
+    else
+      process_histos(ofile,infile);
+  }
+  return 0;
+  
+}
+
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
index 1ef7cf6131ae6275b0b188e6d128b76bf3d21590..41ab2f18dbab817b61f7f440f094125d7f5bf0aa 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
@@ -1168,9 +1168,28 @@
 </h>
 <h id="brem_spectrum" type="TH2" title="log of the Energy of Brem Photons vs Radius of Emission">
   <x title="Radius of Emission [mm]" n="100" lo="0" hi="1500"/>
-  <y title="log (Energy (GeV))" n="100" lo="-0.5" hi="3"/>
+  <y title="log (Energy (GeV))" n="100" lo="-3" hi="3"/>
+</h>
+<h id="energy_remaining" type="TH2" title="Fraction of electron/positron energy left at ECal vs production radius">
+  <x title="Radius of Initial Conversion [mm]" n="100" lo="0" hi="1500"/>
+  <y title="Fraction of Energy Remaining" n="100" lo="0" hi="1.25"/>
+</h>
+<h id="energy_remaining_vs_eta" type="TH2" title="Fraction of electron/positron energy left at ECal vs Initial #eta">
+  <x title="#eta" n="20" lo="-2.5" hi="2.5"/>
+  <y title="Fraction of Energy Remaining" n="100" lo="0" hi="1.25"/>
+</h>
+<h id="energy_remaining_vs_prodR_low_eta" type="TH2" title="Fraction of electron/positron energy left at ECal vs production radius (low #eta)">
+  <x title="Radius of Initial Conversion [mm]" n="100" lo="0" hi="1500"/>
+  <y title="Fraction of Energy Remaining" n="100" lo="0" hi="1.25"/>
+</h>
+<h id="energy_remaining_vs_prodR_medium_eta" type="TH2" title="Fraction of electron/positron energy left at ECal vs production radius (medium #eta)">
+  <x title="Radius of Initial Conversion [mm]" n="100" lo="0" hi="1500"/>
+  <y title="Fraction of Energy Remaining" n="100" lo="0" hi="1.25"/>
+</h>
+<h id="energy_remaining_vs_prodR_high_eta" type="TH2" title="Fraction of electron/positron energy left at ECal vs production radius (high #eta)">
+  <x title="Radius of Initial Conversion [mm]" n="100" lo="0" hi="1500"/>
+  <y title="Fraction of Energy Remaining" n="100" lo="0" hi="1.25"/>
 </h>
-
 
 <!-- -->
 <!-- Track Parameter Resolution Plots -->
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef
index 5b331faa23cb22d4d603209912c111b9f23cf097..750b41bd37bebbc2e280164d61516b7f31c3afda 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef
@@ -139,7 +139,12 @@ TH2 brem_photon_eta_vs_radius_of_conversion "Brem Photon #eta vs Radius of Conve
 TH2 brem_photon_pt_vs_radius_of_origin_of_conversion "Brem Photon p_{T} vs Radius of Origin of Conversion" 100 0 1500 100 0 500 "Radius of Origin of Conversion [mm]" "p_{T} (GeV)" default
 TH1F lepton_disappearance_radius "Radius at which electrons and positrons from the primary disappear" 100 0 1500 "Radius of Disappearance [mm]" "Entries" default
 TH1F nOut_of_lepdeath "Number of Particles out of the electron/positron endpoint" 6 0 5 "Number of Particles" "Entries" default
-TH2 brem_spectrum "log of the Energy of Brem Photons vs Radius of Emission" 100 0 1500 100 -0.5 3 "Radius of Emission [mm]" "log(Energy (GeV))" default
+TH2 brem_spectrum "log of the Energy of Brem Photons vs Radius of Emission" 100 0 1500 100 -3 3 "Radius of Emission [mm]" "log(Energy (GeV))" default
+TH2 energy_remaining "Fraction of electron/positron energy left at ECal vs production radius" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default
+TH2 energy_remaining_vs_eta "Fraction of electron/positron energy left at ECal vs Initial #eta" 20 -2.5 2.5 100 0 1.25 "#eta" "Fraction of Energy Remaining" default
+TH2 energy_remaining_vs_prodR_low_eta "Fraction of electron/positron energy left at ECal vs production radius (low #eta)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default
+TH2 energy_remaining_vs_prodR_medium_eta "Fraction of electron/positron energy left at ECal vs production radius (medium #eta)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default
+TH2 energy_remaining_vs_prodR_high_eta "Fraction of electron/positron energy left at ECal vs production radius (high #eta)" 100 0 1500 100 0 1.25 "Radius of Initial Conversion [mm]" "Fraction of Energy Remaining" default
 
 # Track Parameter Resolution Plots
 #Track Parameter TH2s vs eta
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx
index c4554f2e31ce4362f75997c519b4178d5b723d38..6bd15944c237575a0547e413eaa0d60b3ed3a934 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx
@@ -14,6 +14,11 @@ InDetDummyPlots::InDetDummyPlots(InDetPlotBase* pParent, const std::string& sDir
   m_low_Pt_lepton_frac{},
   m_nOut_of_lepdeath{},
   m_brem_spectrum{},
+  m_energy_remaining{},
+  m_energy_remaining_vs_eta{},
+  m_energy_remaining_vs_prodR_low_eta{},
+  m_energy_remaining_vs_prodR_medium_eta{},
+  m_energy_remaining_vs_prodR_high_eta{},
   m_primary_photon_eta_vs_conversion_radius{},
   m_primary_photon_pt_vs_decay_radius{},
   m_primary_photon_pt{},
@@ -28,6 +33,11 @@ InDetDummyPlots::initializePlots() {
   book(m_low_Pt_lepton_frac, "low_Pt_lepton_frac");
   book(m_nOut_of_lepdeath, "nOut_of_lepdeath");
   book(m_brem_spectrum, "brem_spectrum");
+  book(m_energy_remaining, "energy_remaining");
+  book(m_energy_remaining_vs_eta, "energy_remaining_vs_eta");
+  book(m_energy_remaining_vs_prodR_low_eta, "energy_remaining_vs_prodR_low_eta");
+  book(m_energy_remaining_vs_prodR_medium_eta, "energy_remaining_vs_prodR_medium_eta");
+  book(m_energy_remaining_vs_prodR_high_eta, "energy_remaining_vs_prodR_high_eta");
   book(m_primary_photon_eta_vs_conversion_radius, "primary_photon_eta_vs_conversion_radius");
   book(m_primary_photon_pt_vs_decay_radius, "primary_photon_pt_vs_decay_radius");
   book(m_primary_photon_pt, "primary_photon_pt");
@@ -38,6 +48,8 @@ InDetDummyPlots::initializePlots() {
 void
 InDetDummyPlots::lepton_fill(const xAOD::TruthParticle& truth, float weight) {
   double R = truth.auxdata<float>("prodR");
+  double eta = truth.eta();
+  double abseta = fabs(eta);
 
   fillHisto(m_low_Pt_lepton_frac, R, weight);
   if (truth.hasProdVtx()) {
@@ -61,6 +73,59 @@ InDetDummyPlots::lepton_fill(const xAOD::TruthParticle& truth, float weight) {
         }
       }
     }
+    double ECal(1000);            //Inner radius of the ECal, not sure this is correct
+    double e_init = truth.e();    //initial electron/positron total energy
+    double e_lost(0);             //energy the electron/positron has lost so far
+    
+    std::vector<const xAOD::TruthParticle*> pers_truth; //Not sure if this is right
+    pers_truth.push_back(&truth);
+   
+    std::vector<double> decays;
+
+    std::cout<<"Tarkin: You may fire when ready \n";
+    if(prod_rad < ECal){
+      do {
+	if(pers_truth.back()->hasDecayVtx()){
+	  const xAOD::TruthVertex * decay = pers_truth.back()->decayVtx();
+	  double dec_rad = decay->perp();
+	  decays.push_back(dec_rad);
+	  int temp_nOut = decay->nOutgoingParticles();
+	  std::vector<const xAOD::TruthParticle*> outs;
+	  for(int i=0; i<temp_nOut; i++){
+	    const xAOD::TruthParticle * temp_out = decay->outgoingParticle(i);
+	    outs.push_back(temp_out);
+	  }
+	  if(temp_nOut == 2){
+	    if(outs[0]->pdgId() == 22){
+	      e_lost += outs[0]->e();
+	      pers_truth.push_back(outs[1]);  //Adding electron/positron to pers_truth vector
+	    }else if(outs[1]->pdgId() == 22){
+	      e_lost += outs[1]->e();
+	      pers_truth.push_back(outs[0]);
+	    }else{
+	      break;
+	    }
+	  }else{
+	    break;
+	  }
+	  outs.clear();
+	}else{
+	  break;
+	}
+      }while(decays.back() < ECal);  
+    }
+    double e_left = ((e_init - e_lost)/e_init);  //fraction of origina electron/positron energy left when it reaches the ECal
+    std::cout<<"Fraction of electron/positron energy remaining: "<<e_left<<"\n";
+    fillHisto(m_energy_remaining, prod_rad, e_left);
+    fillHisto(m_energy_remaining_vs_eta, eta, e_left);
+    if(abseta < 1.0){
+      fillHisto(m_energy_remaining_vs_prodR_low_eta, prod_rad, e_left);
+    }else if(abseta < 1.8){
+      fillHisto(m_energy_remaining_vs_prodR_medium_eta, prod_rad, e_left);
+    }else{
+      fillHisto(m_energy_remaining_vs_prodR_high_eta, prod_rad, e_left);
+    }
+
   }
 }
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.h
index 7cb671fd61665565d4e4d625bda4f54237ad3956..57278826e467eb0e3ecb94b394266d0b4a594218 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.h
@@ -40,7 +40,11 @@ private:
   TH1* m_nOut_of_lepdeath;
 
   TH2* m_brem_spectrum;
-
+  TH2* m_energy_remaining;
+  TH2* m_energy_remaining_vs_eta;
+  TH2* m_energy_remaining_vs_prodR_low_eta;
+  TH2* m_energy_remaining_vs_prodR_medium_eta;
+  TH2* m_energy_remaining_vs_prodR_high_eta;
   TH2* m_primary_photon_eta_vs_conversion_radius;
   TH2* m_primary_photon_pt_vs_decay_radius;
   TH1* m_primary_photon_pt;
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx
index d8dc208d83226ed4584694234bbe31239c767e46..c69cd52a4fe0b264824994d7f7c28c21c8f1d39b 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx
@@ -58,7 +58,7 @@ InDetPerfPlot_resITk::InDetPerfPlot_resITk(PlotBase* pParent, const std::string&
   m_resITk_resHelperpt_neg{},
   m_resITk_Resolution_vs_pt_neg{},
 
-  m_resITk_resHelperetapt{},
+//  m_resITk_resHelperetapt{},
   m_resITk_pullHelperpt{},
   m_resITk_pullHelpereta{},
 
@@ -257,10 +257,14 @@ InDetPerfPlot_resITk::initializePlots() {
   int nBinsEta = 50.0;
   float nMinEta = -5.0;
   float nMaxEta = fabs(nMinEta);
-  int nBinsPt = 500.0;
+  int nBinsPt = 50.0;
   float nMinPt = 0.0;
   float nMaxPt = 500.0;
 
+  Float_t ptlimits[50];
+  for (int i=0; i<50; ++i) {
+    ptlimits[i] = 1000.0* TMath::Exp((i-49.0)/6.804);
+  }
 
   for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) {
     ///pull
@@ -354,11 +358,12 @@ InDetPerfPlot_resITk::initializePlots() {
     m_resITk_resHelperpt[iparam] =
       Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
                0), m_paramProp[iparam].limRes.at(1), false);
+    m_resITk_resHelperpt[iparam]->GetXaxis()->Set(49,ptlimits);
     tmpName = "pullHelperpt_" + m_paramProp[iparam].paraName;
     tmpTitle = tmpName + "; true track p_{T} [GeV]; (" + m_paramProp[iparam].paraLabel + "^{reco}-" +
                m_paramProp[iparam].paraLabel + "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
     m_resITk_pullHelperpt[iparam] = Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, 200, -10.0, 10.0, false);
-
+    m_resITk_pullHelperpt[iparam]->GetXaxis()->Set(49,ptlimits);
     tmpName = "pullHelpereta_" + m_paramProp[iparam].paraName;
     tmpTitle = tmpName + "; true track #eta; (" + m_paramProp[iparam].paraLabel + "^{reco}-" +
                m_paramProp[iparam].paraLabel + "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
@@ -415,6 +420,7 @@ InDetPerfPlot_resITk::initializePlots() {
     m_resITk_resHelperpt_pos[iparam] =
       Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
                0), m_paramProp[iparam].limRes.at(1), false);
+    m_resITk_resHelperpt_pos[iparam]->GetXaxis()->Set(49,ptlimits);
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
       tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_pos";
       tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
@@ -428,6 +434,7 @@ InDetPerfPlot_resITk::initializePlots() {
     m_resITk_resHelperpt_neg[iparam] =
       Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
                0), m_paramProp[iparam].limRes.at(1), false);
+    m_resITk_resHelperpt_neg[iparam]->GetXaxis()->Set(49,ptlimits);
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
       tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_neg";
       tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
@@ -439,10 +446,10 @@ InDetPerfPlot_resITk::initializePlots() {
     tmpName = "resHelperetapt_" + m_paramProp[iparam].paraName;
     tmpTitle = tmpName + "; true track p_{T}; true track #eta; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
                m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
-    m_resITk_resHelperetapt[iparam] = Book3D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, nBinsEta, nMinEta, nMaxEta,
+/*    m_resITk_resHelperetapt[iparam] = Book3D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, nBinsEta, nMinEta, nMaxEta,
                                              m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0),
                                              m_paramProp[iparam].limRes.at(1), false);
-
+*/
     for (unsigned int ires = 0; ires < 2; ires++) {
       for (int ibin = 0; ibin < 4; ibin++) {
         int tmpInt = ibin + 1;
@@ -476,7 +483,8 @@ InDetPerfPlot_resITk::initializePlots() {
     tmpTitle = tmpName + "; true track p_{T}; #sigma_{" + m_paramProp[iparam].paraLabel + "} " +
                m_paramProp[iparam].paraUnit;
     m_resITk_meanProfpt[iparam] = BookTProfile(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, -1.0, 1.0, false);
-    m_resITk_meanProfpt[iparam]->GetXaxis()->Set(m_nPtBins, m_PtBins);
+    m_resITk_meanProfpt[iparam]->GetXaxis()->Set(49,ptlimits);
+//    m_resITk_meanProfpt[iparam]->GetXaxis()->Set(m_nPtBins, m_PtBins);
 
     tmpName = "DEBUG_D0dep_" + m_paramProp[iparam].paraName;
     tmpTitle = tmpName + "; " + m_paramProp[iparam].paraLabel + "^{reco} " + m_paramProp[iparam].paraUnit +
@@ -495,7 +503,8 @@ InDetPerfPlot_resITk::initializePlots() {
                                     nBinsEta, nMinEta, nMaxEta, false);
   m_resITk_chargeID_vs_pt = Book1D("chargeID_vs_pt", "chargeID_vs_pt; truth track p_{T} [GeV]; Fraction of misID [%]",
                                    nBinsPt, nMaxPt, nMaxPt, false);
-  m_resITk_chargeID_vs_pt->GetXaxis()->Set(m_nPtBins, m_PtBins);
+    m_resITk_chargeID_vs_pt->GetXaxis()->Set(49,ptlimits);
+//  m_resITk_chargeID_vs_pt->GetXaxis()->Set(m_nPtBins, m_PtBins);
 
   m_resITk_momTail = Book1D("momTail", "momTail", 2, 0., 2., false);
   m_resITk_momTail->GetXaxis()->SetBinLabel(1, "Core");
@@ -505,6 +514,7 @@ InDetPerfPlot_resITk::initializePlots() {
                                    nBinsEta, nMinEta, nMaxEta, false);
   m_resITk_momTail_vs_pt = Book1D("momTail_vs_pt", "momTail_vs_pt; truth track p_{T} [GeV]; Fraction of p_{T}-tail [%]",
                                   nBinsPt, nMinPt, nMaxPt, false);
+    m_resITk_momTail_vs_pt->GetXaxis()->Set(49,ptlimits);
   m_resITk_momTail_vs_pt->GetXaxis()->Set(m_nPtBins, m_PtBins);
   m_resITk_momTail_vs_phi = Book1D("momTail_vs_phi", "momTail_vs_phi; truth track #phi; Fraction of p_{T}-tail [%]",
                                    nBinsEta, nMinEta, nMaxEta, false);
@@ -684,7 +694,7 @@ InDetPerfPlot_resITk::getPlots() {
     m_resITk_meanProfpt[iparam]->Fill(m_truetrkP[PT], m_sigP[iparam]);
     m_resITk_resHelpereta[iparam]->Fill(eta, m_resP[iparam]);
     m_resITk_resHelperpt[iparam]->Fill(m_truetrkP[PT], m_resP[iparam]);
-    m_resITk_resHelperetapt[iparam]->Fill(m_truetrkP[PT], eta, m_resP[iparam]);
+//    m_resITk_resHelperetapt[iparam]->Fill(m_truetrkP[PT], eta, m_resP[iparam]);
 
     m_resITk_pullHelperpt[iparam]->Fill(m_truetrkP[PT], m_pullP[iparam]);
     m_resITk_pullHelpereta[iparam]->Fill(eta, m_pullP[iparam]);
@@ -860,9 +870,9 @@ InDetPerfPlot_resITk::finalizePlots() {
     makeResolutions(m_resITk_resHelperpt_neg[iparam], m_resITk_Resolution_vs_pt_neg[iparam]);
     makeResolutions(m_resITk_resHelpereta_pos[iparam], m_resITk_Resolution_vs_eta_pos[iparam]);
     makeResolutions(m_resITk_resHelpereta_neg[iparam], m_resITk_Resolution_vs_eta_neg[iparam]);
-    makeResolutions(m_resITk_resHelperetapt[iparam], m_resITk_Resolution_vs_pt_EtaBin[iparam],
+/*    makeResolutions(m_resITk_resHelperetapt[iparam], m_resITk_Resolution_vs_pt_EtaBin[iparam],
                     m_resITk_Resolution_vs_eta_PtBin[iparam]);
-
+*/
     // add for the pull vs pT
     makeResolutions(m_resITk_pullHelperpt[iparam], m_resITk_pullResolution_vs_pt[iparam],
                     m_resITk_pullProjections_vs_pt[iparam], true);
@@ -1112,10 +1122,11 @@ InDetPerfPlot_resITk::getResolution(TH1* h, std::string s) {
   // Stolen from Max
   itr_rms = rms + 1.0;
   if (s == "RMS") {
-    while (fabs(itr_rms - rms) > 0.001) {
+    int tries = 0;
+    while (fabs(itr_rms - rms) > 0.001 && tries < 10) {
       rms = h->GetRMS();
-      double min = -3.0 * rms;
-      double max = 3.0 * rms;
+      double min = -3.0 * rms + mean;
+      double max = 3.0 * rms + mean;
       if (min < h->GetBinLowEdge(1)) {
         min = h->GetBinLowEdge(1);
       }
@@ -1130,6 +1141,7 @@ InDetPerfPlot_resITk::getResolution(TH1* h, std::string s) {
     rms = itr_rms;
     meanErr = h->GetMeanError();
     rmsErr = h->GetRMSError();
+    tries++;
   } else if (s == "GAUS") {
     int fitStatus = h->Fit("gaus", "QS0");
     TFitResultPtr r = h->Fit("gaus", "QS0");
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h
index 76cb6b5af2f76097622f9836b0057807765731e8..50f3a22de82c044ec05ed46c01fdc4bba29fb494 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h
@@ -142,7 +142,7 @@ private:
   TH1* m_resITk_Resolution_vs_pt_neg[NPARAMS][m_nResHist];
 
 
-  TH3* m_resITk_resHelperetapt[NPARAMS];
+//  TH3* m_resITk_resHelperetapt[NPARAMS];
 
   TH2* m_resITk_pullHelperpt[NPARAMS]; // pull width as a function of pT
   TH2* m_resITk_pullHelpereta[NPARAMS]; // pull width as a function of pT
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
index 2e5bb0cbb70099a4d7c376deba61e8fa4c2b3067..07ba66ad748a159ea4fd3479fb49fd8ddbd5a1f3 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
@@ -413,14 +413,8 @@ InDetPhysValMonitoringTool::fillHistograms() {
 
     if (thisTruth->pdgId() == 22) {
       if (thisTruth->nParents() == 0) {
-        if (debugBacktracking) {
-          std::cout << "Han: about to fill primary photon \n";
-        }
         m_monPlots->prim_photon_fill(*thisTruth);
       } else {
-        if (debugBacktracking) {
-          std::cout << "Han: about to fill brem photon \n";
-        }
         m_monPlots->brem_photon_fill(*thisTruth);
       }
     }
@@ -441,7 +435,6 @@ InDetPhysValMonitoringTool::fillHistograms() {
 
       double lepton_w(0);
       if (debugBacktracking) {
-        // std::cout<<"Rey: these are the numbers for this truthParticle \n";
         std::cout << "Barcode: " << thisTruth->barcode() << "\n";
         std::cout << "PDGId: " << thisTruth->pdgId() << "\n";
         std::cout << "Number of Parents: " << thisTruth->nParents() << "\n";
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXmlDom.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXmlDom.cxx
index a95ded3c4d26afc1b68ac637a13bf9f818df7a49..56a7641ec4650772f63d1e14356d0c0fafa58345 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXmlDom.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ReadFromXmlDom.cxx
@@ -162,8 +162,9 @@ ReadFromXmlDom::parseXmlElement(const xercesc::DOMElement* element) {
   // only allow two axes, but could be ordered x-y or y-x
   std::string axisName0 = toNative(axisDef0->getTagName());
   std::string axisName1 = toNative(axisDef1->getTagName());
-  if (validAxisName(axisName0, allowedAxisNames) and validAxisName(axisName1,
-                                                                   allowedAxisNames) and(axisName1 != axisName0)) {
+  if (validAxisName(axisName0, allowedAxisNames) 
+   and validAxisName(axisName1,allowedAxisNames) 
+   and (axisName1 != axisName0)) {
     // default order
     unsigned int xIndex = 0, yIndex = 1;
     if (axisName0 == allowedAxisNames[1]) {
@@ -187,7 +188,7 @@ ReadFromXmlDom::parseXmlElement(const xercesc::DOMElement* element) {
       return toNative(s);
     });
     // numerical values are required for some quantities
-    constexpr float NaN = std::nanf(""); // default 'invalid' float is not-a-number (NaN)
+    const float NaN = std::nanf(""); // default 'invalid' float is not-a-number (NaN)
     const unsigned int nx = stringValues[NX].empty() ? 0 : (unsigned int) (std::stoul(stringValues[NX]));
     const unsigned int ny = stringValues[NY].empty() ? 0 : (unsigned int) (std::stoul(stringValues[NY]));
     const float xlo = stringValues[XLO].empty() ? NaN : std::stof(stringValues[XLO]);