From ca23fe00dce105c7fa33a9e5be6d01f959ee19fe Mon Sep 17 00:00:00 2001
From: christos <christos@cern.ch>
Date: Fri, 11 Dec 2020 18:41:23 +0100
Subject: [PATCH] Add reference for the unit test. Fix ATLASRECTS-5837 the
 Geometry imports need some care. Also do a bit of cleanup in some python
 scripts

---
 .../scripts/EgammaARTmonitoring_plotsMaker.py | 271 ++++++++++--------
 .../share/egamma_art_checker_joboptions.py    |  13 +-
 .../share/ut_egammaARTJob_test.ref            |   2 +
 .../egammaValidation/test/test_gamma.sh       |   4 +-
 .../test/test_gamma_pileup.sh                 |   4 +-
 5 files changed, 171 insertions(+), 123 deletions(-)
 create mode 100644 Reconstruction/egamma/egammaValidation/share/ut_egammaARTJob_test.ref

diff --git a/Reconstruction/egamma/egammaValidation/scripts/EgammaARTmonitoring_plotsMaker.py b/Reconstruction/egamma/egammaValidation/scripts/EgammaARTmonitoring_plotsMaker.py
index 149cbbfe35a0..431c2e506968 100755
--- a/Reconstruction/egamma/egammaValidation/scripts/EgammaARTmonitoring_plotsMaker.py
+++ b/Reconstruction/egamma/egammaValidation/scripts/EgammaARTmonitoring_plotsMaker.py
@@ -27,17 +27,19 @@ cluster_list_photon = [
     {'name': 'clusterConvPhotonSi', 'title': 'Clusters Converted Photons - Si'},
     {'name': 'clusterConvPhotonSiSi', 'title': 'Clusters Converted Photons - SiSi'},
     {'name': 'clusterConvPhotonTRT', 'title': 'Clusters Converted Photons - TRT'},
-    {'name': 'clusterConvPhotonTRTTRT', 'title': 'Clusters Converted Photons - TRTTRT'},
+    {'name': 'clusterConvPhotonTRTTRT',
+        'title': 'Clusters Converted Photons - TRTTRT'},
     {'name': 'clusterConvPhotonSiTRT', 'title': 'Clusters Converted Photons - SiTRT'},
 ]
 
 photon_cluster_list = [
-     {'name': 'clusterUnconvPhoton', 'title': 'Clusters Unconverted Photons'},
+    {'name': 'clusterUnconvPhoton', 'title': 'Clusters Unconverted Photons'},
     {'name': 'clusterConvPhoton', 'title': 'Clusters Converted Photons'},
     {'name': 'clusterConvPhotonSi', 'title': 'Clusters Converted Photons - Si'},
     {'name': 'clusterConvPhotonSiSi', 'title': 'Clusters Converted Photons - SiSi'},
     {'name': 'clusterConvPhotonTRT', 'title': 'Clusters Converted Photons - TRT'},
-    {'name': 'clusterConvPhotonTRTTRT', 'title': 'Clusters Converted Photons - TRTTRT'},
+    {'name': 'clusterConvPhotonTRTTRT',
+        'title': 'Clusters Converted Photons - TRTTRT'},
     {'name': 'clusterConvPhotonSiTRT', 'title': 'Clusters Converted Photons - SiTRT'},
 
 ]
@@ -49,80 +51,127 @@ electron_comparison_list = [
     {'name': 'isolationAll', 'title': 'Isolation'},
     {'name': 'recoElectronAll', 'title': 'Reconstructed Electron'},
     {'name': 'truthRecoElectronLooseLH', 'title': 'Reconstructed Electron LooseLH'},
-    {'name': 'truthRecoElectronMediumLH', 'title': 'Reconstructed Electron MediumLH'},
+    {'name': 'truthRecoElectronMediumLH',
+        'title': 'Reconstructed Electron MediumLH'},
     {'name': 'truthRecoElectronTightLH', 'title': 'Reconstructed Electron TightLH'},
     {'name': 'truthElectronAll', 'title': 'True Electron'},
     {'name': 'truthPromptElectronAll', 'title': 'True Prompt Electron'},
-    {'name': 'truthElectronRecoElectronAll', 'title': 'True Electron Reconstructed as Electron'},
-    {'name': 'truthPromptElectronWithTrack', 'title': 'True Prompt Electron with Track'},
-    {'name': 'truthPromptElectronWithGSFTrack', 'title': 'True Prompt Electron with GSFTrack'},
-    {'name': 'truthPromptElectronWithReco', 'title': 'True Prompt Electron with Reco Electron'},
-    {'name': 'recoElectronIsoFixedCutTight', 'title': 'Reconstructed Electron FixedCutTight'},
-    {'name': 'recoElectronIsoFixedCutTightTrackOnly', 'title': 'Reconstructed Electron FixedCutTightTrackOnly'},
-    {'name': 'recoElectronIsoFixedCutLoose', 'title': 'Reconstructed Electron FixedCutLoose'},
+    {'name': 'truthElectronRecoElectronAll',
+        'title': 'True Electron Reconstructed as Electron'},
+    {'name': 'truthPromptElectronWithTrack',
+        'title': 'True Prompt Electron with Track'},
+    {'name': 'truthPromptElectronWithGSFTrack',
+        'title': 'True Prompt Electron with GSFTrack'},
+    {'name': 'truthPromptElectronWithReco',
+        'title': 'True Prompt Electron with Reco Electron'},
+    {'name': 'recoElectronIsoFixedCutTight',
+        'title': 'Reconstructed Electron FixedCutTight'},
+    {'name': 'recoElectronIsoFixedCutTightTrackOnly',
+        'title': 'Reconstructed Electron FixedCutTightTrackOnly'},
+    {'name': 'recoElectronIsoFixedCutLoose',
+        'title': 'Reconstructed Electron FixedCutLoose'},
     {'name': 'trackingEfficiency', 'title': 'Tracking Efficiency'},
     {'name': 'GSFEfficiency', 'title': 'GSF Efficiency'},
     {'name': 'matchingEfficiency', 'title': 'Matching  Efficiency'},
     {'name': 'reconstructionEfficiency', 'title': 'Reconstruction Efficiency'},
-    {'name': 'recoElectronLooseLHEfficiency', 'title': 'Reconstructed Electron LooseLH Efficiency'},
-    {'name': 'recoElectronMediumLHEfficiency', 'title': 'Reconstructed Electron MediumLH Efficiency'},
-    {'name': 'recoElectronTightLHEfficiency', 'title': 'Reconstructed Electron TightLH Efficiency'},
-    {'name': 'recoElectronIsoFixedCutTightEfficiency', 'title': 'Reconstructed Electron FixedCutTight Efficiency'},
-    {'name': 'recoElectronIsoFixedCutTightTrackOnlyEfficiency', 'title': 'Reconstructed Electron FixedCutTighTrackOnly Efficiency'},
-    {'name': 'recoElectronIsoFixedCutLooseEfficiency', 'title': 'Reconstructed Electron FixedCutLoose Efficiency'},
+    {'name': 'recoElectronLooseLHEfficiency',
+        'title': 'Reconstructed Electron LooseLH Efficiency'},
+    {'name': 'recoElectronMediumLHEfficiency',
+        'title': 'Reconstructed Electron MediumLH Efficiency'},
+    {'name': 'recoElectronTightLHEfficiency',
+        'title': 'Reconstructed Electron TightLH Efficiency'},
+    {'name': 'recoElectronIsoFixedCutTightEfficiency',
+        'title': 'Reconstructed Electron FixedCutTight Efficiency'},
+    {'name': 'recoElectronIsoFixedCutTightTrackOnlyEfficiency',
+        'title': 'Reconstructed Electron FixedCutTighTrackOnly Efficiency'},
+    {'name': 'recoElectronIsoFixedCutLooseEfficiency',
+        'title': 'Reconstructed Electron FixedCutLoose Efficiency'},
 ]
 
 photon_comparison_list = [
     {'name': 'recoPhotonAll', 'title': 'Reconstructed Photon'},
     {'name': 'truthPhotonRecoPhoton', 'title': 'True photon reconstructed as photon'},
     {'name': 'truthConvPhoton', 'title': 'True converted photon'},
-    {'name': 'truthConvRecoConv', 'title': 'True conversion reconstructed as converted photon'},
-    {'name': 'truthConvRecoConv1Si', 'title': 'True conversion reconstructed as 1 Si conv'},
-    {'name': 'truthConvRecoConv1TRT', 'title': 'True conversion reconstructed as 1 TRT conv'},
-    {'name': 'truthConvRecoConv2Si', 'title': 'True conversion reconstructed as Si-Si conv'},
-    {'name': 'truthConvRecoConv2TRT', 'title': 'True conversion reconstructed as TRT-TRT conv'},
-    {'name': 'truthConvRecoConv2SiTRT', 'title': 'True conversion reconstructed as Si-TRT conv'},
-    {'name': 'truthConvRecoUnconv', 'title': 'True conversion reconstructed as unconverted photon'},
+    {'name': 'truthConvRecoConv',
+        'title': 'True conversion reconstructed as converted photon'},
+    {'name': 'truthConvRecoConv1Si',
+        'title': 'True conversion reconstructed as 1 Si conv'},
+    {'name': 'truthConvRecoConv1TRT',
+        'title': 'True conversion reconstructed as 1 TRT conv'},
+    {'name': 'truthConvRecoConv2Si',
+        'title': 'True conversion reconstructed as Si-Si conv'},
+    {'name': 'truthConvRecoConv2TRT',
+        'title': 'True conversion reconstructed as TRT-TRT conv'},
+    {'name': 'truthConvRecoConv2SiTRT',
+        'title': 'True conversion reconstructed as Si-TRT conv'},
+    {'name': 'truthConvRecoUnconv',
+        'title': 'True conversion reconstructed as unconverted photon'},
     {'name': 'truthUnconvPhoton', 'title': 'True unconverted photon'},
-    {'name': 'truthUnconvRecoConv', 'title': 'True unconverted reconstructed as conv photon'},
-    {'name': 'truthUnconvRecoUnconv', 'title': 'True unconverted reconstructed as unconverted photon'},
+    {'name': 'truthUnconvRecoConv',
+        'title': 'True unconverted reconstructed as conv photon'},
+    {'name': 'truthUnconvRecoUnconv',
+        'title': 'True unconverted reconstructed as unconverted photon'},
     {'name': 'showerShapesAll', 'title': 'Shower Shape - Inclusive'},
     {'name': 'showerShapes10GeV', 'title': 'Shower Shape - 10 GeV'},
     {'name': 'isolationAll', 'title': 'Isolation'},
-    {'name': 'recoPhotonUnconvIsoFixedCutTight', 'title': 'FixedCutTight Unconverted Photon'},
-    {'name': 'recoPhotonUnconvIsoFixedCutTightCaloOnly', 'title': 'FixedCutTightCaloOnly Unconverted Photon'},
-    {'name': 'recoPhotonUnconvIsoFixedCutLoose', 'title': 'FixedCutLoose Unconverted Photon'},
-    {'name': 'recoPhotonConvIsoFixedCutTight', 'title': 'FixedCutTight Converted Photon'},
-    {'name': 'recoPhotonConvIsoFixedCutTightCaloOnly', 'title': 'FixedCutTightCaloOnly Converted Photon'},
-    {'name': 'recoPhotonConvIsoFixedCutLoose', 'title': 'FixedCutLoose Converted Photon'},
-    {'name': 'truthPhotonUnconvRecoUnconvEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'truthPhotonRecoConvEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'recoPhotonUnconvIsoFixedCutTightEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'recoPhotonUnconvIsoFixedCutTightCaloOnlyEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'recoPhotonUnconvIsoFixedCutLooseEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'recoPhotonConvIsoFixedCutTightEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'recoPhotonConvIsoFixedCutTightCaloOnlyEfficiency', 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'recoPhotonConvIsoFixedCutLooseEfficiency', 'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonUnconvIsoFixedCutTight',
+        'title': 'FixedCutTight Unconverted Photon'},
+    {'name': 'recoPhotonUnconvIsoFixedCutTightCaloOnly',
+        'title': 'FixedCutTightCaloOnly Unconverted Photon'},
+    {'name': 'recoPhotonUnconvIsoFixedCutLoose',
+        'title': 'FixedCutLoose Unconverted Photon'},
+    {'name': 'recoPhotonConvIsoFixedCutTight',
+        'title': 'FixedCutTight Converted Photon'},
+    {'name': 'recoPhotonConvIsoFixedCutTightCaloOnly',
+        'title': 'FixedCutTightCaloOnly Converted Photon'},
+    {'name': 'recoPhotonConvIsoFixedCutLoose',
+        'title': 'FixedCutLoose Converted Photon'},
+    {'name': 'truthPhotonUnconvRecoUnconvEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'truthPhotonRecoConvEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonUnconvIsoFixedCutTightEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonUnconvIsoFixedCutTightCaloOnlyEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonUnconvIsoFixedCutLooseEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonConvIsoFixedCutTightEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonConvIsoFixedCutTightCaloOnlyEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
+    {'name': 'recoPhotonConvIsoFixedCutLooseEfficiency',
+        'title': 'True Conv #rightarrow Conv'},
 ]
 
 photon_fraction_list = [
-    {'name': 'truthPhotonConvRecoConvEfficiency', 'color': kBlack, 'title': 'True Conv #rightarrow Conv'},
-    {'name': 'truthPhotonConvRecoConv1SiEfficiency', 'color': kBlue + 2, 'title': 'True Conv #rightarrow 1 Si Conv'},
-    {'name': 'truthPhotonConvRecoConv1TRTEfficiency', 'color': kRed + 2, 'title': 'True Conv #rightarrow 1 TRT Conv'},
-    {'name': 'truthPhotonConvRecoConv2SiEfficiency', 'color': kGreen + 2, 'title': 'True Conv #rightarrow Si-Si Conv'},
+    {'name': 'truthPhotonConvRecoConvEfficiency',
+        'color': kBlack, 'title': 'True Conv #rightarrow Conv'},
+    {'name': 'truthPhotonConvRecoConv1SiEfficiency', 'color': kBlue +
+        2, 'title': 'True Conv #rightarrow 1 Si Conv'},
+    {'name': 'truthPhotonConvRecoConv1TRTEfficiency', 'color': kRed +
+        2, 'title': 'True Conv #rightarrow 1 TRT Conv'},
+    {'name': 'truthPhotonConvRecoConv2SiEfficiency', 'color': kGreen +
+        2, 'title': 'True Conv #rightarrow Si-Si Conv'},
     {'name': 'truthPhotonConvRecoConv2TRTEfficiency', 'color': kOrange + 2,
      'title': 'True Conv #rightarrow TRT-TRT Conv'},
     {'name': 'truthPhotonConvRecoConv2SiTRTEfficiency', 'color': kCyan + 2,
      'title': 'True Conv #rightarrow Si-TRT Conv'},
-    {'name': 'truthPhotonConvRecoUnconvEfficiency', 'color': kPink + 2, 'title': 'True Conv #rightarrow Unconv'}
+    {'name': 'truthPhotonConvRecoUnconvEfficiency',
+        'color': kPink + 2, 'title': 'True Conv #rightarrow Unconv'}
 ]
 
 photon_conversion_list = [
-    {'name': 'truthConvRecoConv2Si', 'color': kGreen + 2, 'title': 'True Conv #rightarrow Si-Si Conv'},
-    {'name': 'truthConvRecoConv1Si', 'color': kBlue + 2, 'title': 'True Conv #rightarrow 1 Si Conv'},
-    {'name': 'truthConvRecoConv1TRT', 'color': kRed + 2, 'title': 'True Conv #rightarrow 1 TRT Conv'},
-    {'name': 'truthConvRecoConv2TRT', 'color': kOrange + 2, 'title': 'True Conv #rightarrow TRT-TRT Conv'},
-    {'name': 'truthConvRecoConv2SiTRT', 'color': kCyan + 2, 'title': 'True Conv #rightarrow Si-TRT Conv'},
+    {'name': 'truthConvRecoConv2Si', 'color': kGreen +
+        2, 'title': 'True Conv #rightarrow Si-Si Conv'},
+    {'name': 'truthConvRecoConv1Si', 'color': kBlue +
+        2, 'title': 'True Conv #rightarrow 1 Si Conv'},
+    {'name': 'truthConvRecoConv1TRT', 'color': kRed +
+        2, 'title': 'True Conv #rightarrow 1 TRT Conv'},
+    {'name': 'truthConvRecoConv2TRT', 'color': kOrange +
+        2, 'title': 'True Conv #rightarrow TRT-TRT Conv'},
+    {'name': 'truthConvRecoConv2SiTRT', 'color': kCyan +
+        2, 'title': 'True Conv #rightarrow Si-TRT Conv'},
 ]
 
 
@@ -150,11 +199,11 @@ def make_comparison_plots(type, f_base, f_nightly, result_file):
         for histo in get_key_names(f_nightly, folder['name']):
             h_base = f_base.Get(folder['name'] + '/' + histo)
             h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
-            if h_base.GetEntries() == 0 or h_nightly.GetEntries() == 0: continue
+            if h_base.GetEntries() == 0 or h_nightly.GetEntries() == 0:
+                continue
             make_ratio_plot(h_base, h_nightly, folder['title'], result_file)
 
 
-
 def makeIQEPlots(inHist, name):
     outHist = inHist.QuantilesX(0.75, "EResolution_IQE_mu")
     outHist.GetXaxis().SetTitle("<#mu>")
@@ -162,45 +211,49 @@ def makeIQEPlots(inHist, name):
     outHist25 = inHist.QuantilesX(0.25, "EResolutio_IQE_mu_25")
     outHist.Add(outHist25, -1)
     outHist.Scale(1/1.349)
-    
-    return outHist.Clone(inHist.GetName() + "_"+ name)
-
 
+    return outHist.Clone(inHist.GetName() + "_" + name)
 
 
 def make_profile_plots(f_base, f_nightly, result_file, particle_type):
 
     cluster_list_to_loop = cluster_list
 
-    if particle_type == "gamma": cluster_list_to_loop = cluster_list + cluster_list_photon
+    if particle_type == "gamma":
+        cluster_list_to_loop = cluster_list + cluster_list_photon
 
     for i, folder in enumerate(cluster_list_to_loop):
         for histo in get_key_names(f_nightly, folder['name']):
             if '2D' not in histo:
                 continue
             if 'mu' in histo:
-              h_base = f_base.Get(folder['name'] + '/' + histo)
-              h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
-              if h_base.GetEntries() == 0 or h_nightly.GetEntries() == 0: continue
-              h_base = makeIQEPlots(h_base,'IQE')
-              h_nightly = makeIQEPlots(h_nightly,'IQE')
-              make_ratio_plot(h_base, h_nightly, folder['title'], result_file, 'IQE')
-
-            else: 
-              h_base = f_base.Get(folder['name'] + '/' + histo)
-              h_base_profile = h_base.ProfileX(histo+"_ProfileB")
-              h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
-              h_nightly_profile = h_nightly.ProfileX(histo+"_Profile")
-              h_base_profile.SetDirectory(0)
-              h_nightly_profile.SetDirectory(0)
-              if h_base.GetEntries() == 0 or h_nightly.GetEntries() == 0: continue 
-              y_axis_label = "Mean %s" % (h_base_profile.GetTitle() )
-              h_base_profile.SetTitle("")
-              make_ratio_plot(h_base_profile, h_nightly_profile, folder['title'], result_file, y_axis_label)
+                h_base = f_base.Get(folder['name'] + '/' + histo)
+                h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
+                if h_base.GetEntries() == 0 or h_nightly.GetEntries() == 0:
+                    continue
+                h_base = makeIQEPlots(h_base, 'IQE')
+                h_nightly = makeIQEPlots(h_nightly, 'IQE')
+                make_ratio_plot(h_base, h_nightly,
+                                folder['title'], result_file, 'IQE')
+
+            else:
+                h_base = f_base.Get(folder['name'] + '/' + histo)
+                h_base_profile = h_base.ProfileX(histo+"_ProfileB")
+                h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
+                h_nightly_profile = h_nightly.ProfileX(histo+"_Profile")
+                h_base_profile.SetDirectory(0)
+                h_nightly_profile.SetDirectory(0)
+                if h_base.GetEntries() == 0 or h_nightly.GetEntries() == 0:
+                    continue
+                y_axis_label = "Mean %s" % (h_base_profile.GetTitle())
+                h_base_profile.SetTitle("")
+                make_ratio_plot(h_base_profile, h_nightly_profile,
+                                folder['title'], result_file, y_axis_label)
+
 
 def make_conversion_plot(f_base, f_nightly, result_file):
     """
-    This function creates conversion plots to study reco vs true 
+    This function creates conversion plots to study reco vs true
     converion radius for the various conversion categoried
     """
     for histo in get_key_names(f_nightly, 'truthConvRecoConv2Si'):
@@ -216,9 +269,11 @@ def make_conversion_plot(f_base, f_nightly, result_file):
 
         for i, folder in enumerate(photon_conversion_list):
 
-            baseline = f_base.Get(folder['name'] + '/' + folder['name'] + "_" + variable_name)
+            baseline = f_base.Get(
+                folder['name'] + '/' + folder['name'] + "_" + variable_name)
             baseline.SetDirectory(0)
-            nightly = f_nightly.Get(folder['name'] + '/' + folder['name'] + "_" + variable_name)
+            nightly = f_nightly.Get(
+                folder['name'] + '/' + folder['name'] + "_" + variable_name)
             nightly.SetDirectory(0)
 
             if baseline.Integral() != 0:
@@ -226,10 +281,13 @@ def make_conversion_plot(f_base, f_nightly, result_file):
             if nightly.Integral() != 0:
                 nightly.Scale(1/nightly.Integral())
 
-            baseline.SetMinimum(min(baseline.GetMinimum(), baseline.GetMinimum()) * 0.7)
-            baseline.SetMaximum(max(baseline.GetMaximum(), baseline.GetMaximum()) * 1.3)
+            baseline.SetMinimum(
+                min(baseline.GetMinimum(), baseline.GetMinimum()) * 0.7)
+            baseline.SetMaximum(
+                max(baseline.GetMaximum(), baseline.GetMaximum()) * 1.3)
 
-            baseline.GetXaxis().SetTitle("R^{reco}_{conv. vtx} - R^{true}_{conv. vtx} [mm]")
+            baseline.GetXaxis().SetTitle(
+                "R^{reco}_{conv. vtx} - R^{true}_{conv. vtx} [mm]")
             baseline.GetYaxis().SetTitle("normalized to unity")
 
             baseline.SetLineColor(folder['color'])
@@ -279,13 +337,17 @@ def make_photon_fraction_plot(f_base, f_nightly, result_file):
 
         for i, folder in enumerate(photon_fraction_list):
 
-            baseline = f_base.Get(folder['name'] + '/' + folder['name'] + "_" + variable_name)
+            baseline = f_base.Get(
+                folder['name'] + '/' + folder['name'] + "_" + variable_name)
             baseline.SetDirectory(0)
-            nightly = f_nightly.Get(folder['name'] + '/' + folder['name'] + "_" + variable_name)
+            nightly = f_nightly.Get(
+                folder['name'] + '/' + folder['name'] + "_" + variable_name)
             nightly.SetDirectory(0)
 
-            baseline.SetMinimum(min(baseline.GetMinimum(), baseline.GetMinimum()) * 0.7)
-            baseline.SetMaximum(max(baseline.GetMaximum(), baseline.GetMaximum()) * 1.3)
+            baseline.SetMinimum(
+                min(baseline.GetMinimum(), baseline.GetMinimum()) * 0.7)
+            baseline.SetMaximum(
+                max(baseline.GetMaximum(), baseline.GetMaximum()) * 1.3)
 
             baseline.GetYaxis().SetTitle("Efficiency and fraction")
 
@@ -324,7 +386,8 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
     :param h_nightly: Nightly histogram
     :param name: Human-readable name of the histogram
     :param result_file: TFile where the output is saved
-    :param y_axis_label: Y axis label is case is needed (fraction vs efficiency)
+    :param y_axis_label: Y axis label is case is needed
+    (fraction vs efficiency)
     """
     histogram_name = h_nightly.GetName()
 
@@ -353,15 +416,11 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
     h_base.SetLineColor(4)
     h_base.SetLineWidth(2)
 
-
     h_nightly.SetMarkerStyle(8)
     h_nightly.SetMarkerSize(0.5)
 
     main_pad.cd()
 
-
-
-
     if y_axis_label != None:
         h_base.GetYaxis().SetTitle(y_axis_label)
         h_base.GetYaxis().SetTitle(y_axis_label)
@@ -369,7 +428,8 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
     if not '2D' in variable_name or 'Profile' in variable_name:
         h_base.Draw()
 
-    h_nightly.Draw("same p" if not '2D'  in variable_name or 'Profile' in variable_name else 'colz')
+    h_nightly.Draw(
+        "same p" if not '2D' in variable_name or 'Profile' in variable_name else 'colz')
 
     c1.Update()
 
@@ -379,7 +439,6 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
     h_base.SetMinimum(min(h_base.GetMinimum(), h_nightly.GetMinimum()) * 0.7)
     h_base.SetMaximum(max(h_base.GetMaximum(), h_nightly.GetMaximum()) * 1.3)
 
-
     leg = TLegend(0.4, 0.88, 0.9, 0.95)
     leg.SetHeader(name, "C")
     leg.SetNColumns(2)
@@ -399,7 +458,7 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
     h1clone.Divide(h_base)
     h1clone.SetMarkerColor(1)
     h1clone.SetMarkerStyle(20)
-    h1clone.GetYaxis().SetRangeUser( 0.95, 1.05)
+    h1clone.GetYaxis().SetRangeUser(0.95, 1.05)
     gStyle.SetOptStat(0)
     h1clone.GetXaxis().SetLabelSize(0.10)
     h1clone.GetXaxis().SetTitleSize(0.17)
@@ -414,8 +473,6 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
 
     c1.Update()
 
-
-
     result_file.cd()
 
     c1.SaveAs(type_name + '_' + variable_name + ".png")
@@ -423,7 +480,6 @@ def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
     c1.Write(type_name + '_' + variable_name)
 
 
-
 if __name__ == '__main__':
 
     gROOT.SetBatch(kTRUE)
@@ -431,30 +487,17 @@ if __name__ == '__main__':
 
     baseline_file = TFile(sys.argv[1])
     nightly_file = TFile(sys.argv[2])
-    particle_type = sys.argv[3] # it can be 'electron' or 'gamma'
+    particle_type = sys.argv[3]  # it can be 'electron' or 'gamma'
 
-    output_file = TFile("BN_ComparisonPlots_" + particle_type + ".hist.root", "RECREATE")
+    output_file = TFile("BN_ComparisonPlots_" +
+                        particle_type + ".hist.root", "RECREATE")
 
     if particle_type == 'gamma':
 
-        make_photon_fraction_plot(baseline_file, nightly_file,output_file)
+        make_photon_fraction_plot(baseline_file, nightly_file, output_file)
         make_conversion_plot(baseline_file, nightly_file, output_file)
 
-    make_comparison_plots(particle_type, baseline_file, nightly_file, output_file)
+    make_comparison_plots(particle_type, baseline_file,
+                          nightly_file, output_file)
 
     make_profile_plots(baseline_file, nightly_file, output_file, particle_type)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Reconstruction/egamma/egammaValidation/share/egamma_art_checker_joboptions.py b/Reconstruction/egamma/egammaValidation/share/egamma_art_checker_joboptions.py
index 6570b2a068df..159c4806e1ba 100755
--- a/Reconstruction/egamma/egammaValidation/share/egamma_art_checker_joboptions.py
+++ b/Reconstruction/egamma/egammaValidation/share/egamma_art_checker_joboptions.py
@@ -2,15 +2,14 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
 #
 
-from AtlasGeoModel import GeoModelInit
-from AtlasGeoModel import SetGeometryVersion
-from AthenaCommon.GlobalFlags import jobproperties
-from AthenaCommon.DetFlags import DetFlags
-from AthenaCommon.GlobalFlags import globalflags
+
 from AthenaCommon.AppMgr import theApp
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr
 from AthenaCommon.AlgSequence import AlgSequence
 from GaudiSvc.GaudiSvcConf import THistSvc
+from AthenaCommon.GlobalFlags import jobproperties
+from AthenaCommon.DetFlags import DetFlags
+from AthenaCommon.GlobalFlags import globalflags
 import AthenaPoolCnvSvc.ReadAthenaPool
 
 from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier
@@ -28,6 +27,10 @@ DetFlags.ID_setOff()
 
 jobproperties.Global.DetDescrVersion = Geometry
 
+# We need the following two here to properly have
+# Geometry
+from AtlasGeoModel import GeoModelInit
+from AtlasGeoModel import SetGeometryVersion
 include("CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
 include("LArDetDescr/LArDetDescr_joboptions.py")
 
diff --git a/Reconstruction/egamma/egammaValidation/share/ut_egammaARTJob_test.ref b/Reconstruction/egamma/egammaValidation/share/ut_egammaARTJob_test.ref
new file mode 100644
index 000000000000..23b61a41da50
--- /dev/null
+++ b/Reconstruction/egamma/egammaValidation/share/ut_egammaARTJob_test.ref
@@ -0,0 +1,2 @@
+Reco tf success
+Merge success
diff --git a/Reconstruction/egamma/egammaValidation/test/test_gamma.sh b/Reconstruction/egamma/egammaValidation/test/test_gamma.sh
index 22ff7aca1b01..290e318639d5 100755
--- a/Reconstruction/egamma/egammaValidation/test/test_gamma.sh
+++ b/Reconstruction/egamma/egammaValidation/test/test_gamma.sh
@@ -30,7 +30,7 @@ case $ArtProcess in
         echo "Unsetting ATHENA_NUM_PROC=${ATHENA_NUM_PROC}"
         unset  ATHENA_NUM_PROC
 
-        AODMerge_tf.py --inputAODFile=art_core_*/Nightly_AOD_gamma.pool.root --outputAOD_MRGFile=Nightly_AOD_gamma.pool.root  --preExec "rec.doTrigger=False; from RecExConfig.RecAlgsFlags import recAlgs; recAlgs.doTrigger=False" --postInclude "all:egammaValidation/egammaArtCaloCalPostInclude.py"
+        AODMerge_tf.py --inputAODFile=art_core_*/Nightly_AOD_gamma.pool.root --outputAOD_MRGFile=Nightly_AOD_gamma.pool.root  --preExec "from egammaValidation.egammaOnlyPreExec import setRunEgammaOnlyMergeFlags; setRunEgammaOnlyMergeFlags()" --postInclude "all:egammaValidation/egammaArtCaloCalPostInclude.py"
 	
 	echo  "art-result: $? AODMerge"
 
@@ -67,7 +67,7 @@ case $ArtProcess in
 	echo "Unsetting ATHENA_NUM_PROC=${ATHENA_NUM_PROC}"
 	unset  ATHENA_NUM_PROC
 	
-	Reco_tf.py --inputRDOFile=$x --outputAODFile=Nightly_AOD_gamma.pool.root --maxEvents=2000 --autoConfiguration="everything" --preExec="from ParticleBuilderOptions.AODFlags import AODFlags; AODFlags.ThinGeantTruth.set_Value_and_Lock(False);AODFlags.egammaTrackSlimmer.set_Value_and_Lock(False);AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False);AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False);rec.doTrigger=False; rec.doMuon=False ; rec.doTau=False ; rec.doBTagging=False ; from RecExConfig.RecAlgsFlags import recAlgs; recAlgs.doMuonSpShower=False ; recAlgs.doEFlow=False ; recAlgs.doEFlowJet=False ; recAlgs.doMissingET=False ; recAlgs.doMissingETSig=False ; recAlgs.doTrigger=False ; from JetRec.JetRecFlags import jetFlags ; jetFlags.Enabled=False ;"  --postInclude "ESDtoAOD:egammaValidation/egammaArtCaloCalPostInclude.py" "POOLMergeAthenaMPAOD0:egammaValidation/egammaArtCaloCalPostInclude.py"
+	Reco_tf.py --inputRDOFile=$x --outputAODFile=Nightly_AOD_gamma.pool.root --maxEvents=2000 --autoConfiguration="everything" --preExec="from egammaValidation.egammaOnlyPreExec import setRunEgammaOnlyRecoFlags; setRunEgammaOnlyRecoFlags()"  --postInclude "ESDtoAOD:egammaValidation/egammaArtCaloCalPostInclude.py" "POOLMergeAthenaMPAOD0:egammaValidation/egammaArtCaloCalPostInclude.py"
 
 	echo  "art-result: $? reconstruction"
 
diff --git a/Reconstruction/egamma/egammaValidation/test/test_gamma_pileup.sh b/Reconstruction/egamma/egammaValidation/test/test_gamma_pileup.sh
index 8b7be4f921ad..33fc545a4a0a 100755
--- a/Reconstruction/egamma/egammaValidation/test/test_gamma_pileup.sh
+++ b/Reconstruction/egamma/egammaValidation/test/test_gamma_pileup.sh
@@ -30,7 +30,7 @@ case $ArtProcess in
         echo "Unsetting ATHENA_NUM_PROC=${ATHENA_NUM_PROC}"
         unset  ATHENA_NUM_PROC
 
-        AODMerge_tf.py --inputAODFile=art_core_*/Nightly_AOD_gamma.pool.root --outputAOD_MRGFile=Nightly_AOD_gamma.pool.root --preExec "rec.doTrigger=False; from RecExConfig.RecAlgsFlags import recAlgs; recAlgs.doTrigger=False" --postInclude "all:egammaValidation/egammaArtCaloCalPostInclude.py" 
+        AODMerge_tf.py --inputAODFile=art_core_*/Nightly_AOD_gamma.pool.root --outputAOD_MRGFile=Nightly_AOD_gamma.pool.root --preExec "from egammaValidation.egammaOnlyPreExec import setRunEgammaOnlyMergeFlags; setRunEgammaOnlyMergeFlags()" --postInclude "all:egammaValidation/egammaArtCaloCalPostInclude.py" 
 
 	echo  "art-result: $? AODMerge"
 
@@ -67,7 +67,7 @@ case $ArtProcess in
 	echo "Unsetting ATHENA_NUM_PROC=${ATHENA_NUM_PROC}"
 	unset  ATHENA_NUM_PROC
 	
-	Reco_tf.py --inputRDOFile=$x --outputAODFile=Nightly_AOD_gamma.pool.root --maxEvents=2000 --autoConfiguration="everything" --preExec="from ParticleBuilderOptions.AODFlags import AODFlags; AODFlags.ThinGeantTruth.set_Value_and_Lock(False);AODFlags.egammaTrackSlimmer.set_Value_and_Lock(False);AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False);AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False); rec.doTrigger=False; rec.doMuon=False ; rec.doTau=False ; rec.doBTagging=False ; from RecExConfig.RecAlgsFlags import recAlgs; recAlgs.doMuonSpShower=False ; recAlgs.doEFlow=False ; recAlgs.doEFlowJet=False ; recAlgs.doMissingET=False ; recAlgs.doMissingETSig=False ; recAlgs.doTrigger=False ; from JetRec.JetRecFlags import jetFlags ; jetFlags.Enabled=False ; "  --postInclude "ESDtoAOD:egammaValidation/egammaArtCaloCalPostInclude.py" "POOLMergeAthenaMPAOD0:egammaValidation/egammaArtCaloCalPostInclude.py" 
+	Reco_tf.py --inputRDOFile=$x --outputAODFile=Nightly_AOD_gamma.pool.root --maxEvents=2000 --autoConfiguration="everything" --preExec="from egammaValidation.egammaOnlyPreExec import setRunEgammaOnlyRecoFlags; setRunEgammaOnlyRecoFlags()"  --postInclude "ESDtoAOD:egammaValidation/egammaArtCaloCalPostInclude.py" "POOLMergeAthenaMPAOD0:egammaValidation/egammaArtCaloCalPostInclude.py" 
 	
 	echo  "art-result: $? reconstruction"
 
-- 
GitLab