From f441869f0629634da43d5f8ace1e783341dac1fc Mon Sep 17 00:00:00 2001
From: Julie Kirk <julie.kirk@stfc.ac.uk>
Date: Mon, 5 Apr 2021 06:05:08 +0000
Subject: [PATCH] TrigInDetValidation: remove LRT specific flags and add more
 general ones

---
 .../python/TrigInDetArtSteps.py               | 20 +++++++++----------
 .../share/TIDAlrt_preinclude.py               | 11 ++++++++++
 .../share/TrigInDetValidation_Base.py         |  8 +++-----
 .../test/test_trigID_bjet_nopps_pu40.py       |  2 +-
 .../test/test_trigID_el_zee_clones_pu40.py    |  2 +-
 .../test/test_trigID_fsjet_ml2_pu40.py        |  2 +-
 .../test/test_trigID_fsjet_ml_pu40.py         |  2 +-
 .../test/test_trigID_fsjet_nopps_pu40.py      |  2 +-
 .../test/test_trigID_fsjet_vtx_pu40.py        |  2 +-
 ...Hadron.py => test_trigID_fslrt_rhadron.py} |  4 +++-
 .../test/test_trigID_minbias.py               |  2 +-
 ...uStau.py => test_trigID_mulrt_staustau.py} |  6 +++++-
 ...u40.py => test_trigID_mulrt_zmumu_pu40.py} |  3 ++-
 13 files changed, 40 insertions(+), 26 deletions(-)
 create mode 100644 Trigger/TrigValidation/TrigInDetValidation/share/TIDAlrt_preinclude.py
 rename Trigger/TrigValidation/TrigInDetValidation/test/{test_trigID_FSLRT_RHadron.py => test_trigID_fslrt_rhadron.py} (94%)
 rename Trigger/TrigValidation/TrigInDetValidation/test/{test_trigID_muLRT_StauStau.py => test_trigID_mulrt_staustau.py} (94%)
 rename Trigger/TrigValidation/TrigInDetValidation/test/{test_trigID_muLRT_Zmumu_pu40.py => test_trigID_mulrt_zmumu_pu40.py} (94%)

diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
index e0fb1c1c247d..29916149dada 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
@@ -74,10 +74,7 @@ class TrigInDetReco(ExecStep):
     def configure(self, test):
         chains = '['
         flags = ''
-        lrt = False
         for i in self.slices:
-            if ('LRT' in i):
-                lrt = True
             if (i=='L2muonLRT') :
                 chains += "'HLT_mu6_LRT_idperf_l2lrt_L1MU6',"
                 chains += "'HLT_mu6_idperf_L1MU6',"
@@ -110,15 +107,15 @@ class TrigInDetReco(ExecStep):
             if (i=='minbias') :
                 chains += "'HLT_mb_sptrk_L1RD0_FILLED',"
                 flags  += "doMinBiasSlice=True;setMenu='LS2_v1';"
-
+            if (i=='cosmic') :
+                chains += "'HLT_mu4_cosmic_L1MU4_EMPTY'"
+                flags  += "doMuonSlice=True;setMenu='Cosmic_run3_v1';"
         if ( flags=='' ) : 
             print( "ERROR: no chains configured" )
 
         chains += ']'
         self.preexec_trig = 'doEmptyMenu=True;'+flags+'selectChains='+chains
 
-        if (lrt):
-            self.preexec_all += ';from InDetRecExample.InDetJobProperties import InDetFlags; InDetFlags.doR3LargeD0.set_Value_and_Lock(True);InDetFlags.storeSeparateLargeD0Container.set_Value_and_Lock(False)'
 
         if (self.release == 'current'):
             print( "Using current release for offline Reco steps  " )
@@ -145,9 +142,9 @@ class TrigInDetReco(ExecStep):
         if (self.postexec_trig != ' '):
             self.args += ' --postExec "RDOtoRDOTrigger:{:s};" "RAWtoESD:{:s};" '.format(self.postexec_trig, self.postexec_reco)
         if (self.postinclude_trig != ''):
-            self.args += ' --postInclude "RDOtoRDOTrigger:{:s}" '.format(self.postinclude_trig)
+            self.args += ' --postInclude "{:s}" '.format(self.postinclude_trig)
         if (self.preinclude_trig != ''):
-            self.args += ' --preInclude "RDOtoRDOTrigger:{:s}" '.format(self.preinclude_trig)
+            self.args += ' --preInclude "{:s}" '.format(self.preinclude_trig)
         super(TrigInDetReco, self).configure(test)
 
 
@@ -156,7 +153,7 @@ class TrigInDetReco(ExecStep):
 ##################################################
 
 class TrigInDetAna(ExecStep):
-    def __init__(self, name='TrigInDetAna', extra=None):
+    def __init__(self, name='TrigInDetAna', extraArgs=None):
         ExecStep.__init__(self, name )
         self.type = 'athena'
         self.job_options = 'TrigInDetValidation/TrigInDetValidation_AODtoTrkNtuple.py'
@@ -167,8 +164,9 @@ class TrigInDetAna(ExecStep):
         self.input = ''
         self.perfmon=False
         self.imf=False
-        if extra is not None:
-            self.args = extra
+        if extraArgs is not None:
+            self.args = extraArgs
+
 
 ##################################################
 # Additional exec (athena) steps - RDO to CostMonitoring
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TIDAlrt_preinclude.py b/Trigger/TrigValidation/TrigInDetValidation/share/TIDAlrt_preinclude.py
new file mode 100644
index 000000000000..c768b77fbafe
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TIDAlrt_preinclude.py
@@ -0,0 +1,11 @@
+
+from AthenaCommon.Logging import logging 
+log = logging.getLogger("TrigInDetValidation")
+
+log.info( "preinclude: TIDAlrt_preinclude.py" ) 
+
+from InDetRecExample.InDetJobProperties import InDetFlags
+InDetFlags.doR3LargeD0.set_Value_and_Lock(True)
+InDetFlags.storeSeparateLargeD0Container.set_Value_and_Lock(False)
+
+
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py
index 440529279fe9..8127a5336b54 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py
@@ -108,11 +108,9 @@ test = Test.Test()
 test.art_type = Art_type
 
 
-if 'Extra' not in locals() :
-    Extra = None
-
-aod_to_ntup = TrigInDetAna(extra=Extra)
-
+if 'ExtraAna' not in locals() :
+    ExtraAna = None
+aod_to_ntup = TrigInDetAna(extraArgs = ExtraAna)
 
 
 rdo_to_cost = TrigCostStep()
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40.py
index d881c3ff9b55..ef7be3e6b4b6 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40.py
@@ -33,7 +33,7 @@ Slices = ['bjet']
 Events  = 4000
 Threads = 8 
 Slots   = 8
-postinclude_file = 'dopps.py'
+postinclude_file = 'RDOtoRDOTrigger:dopps.py'
 Input = 'ttbar_ID'    # defined in TrigValTools/share/TrigValInputs.json  
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                    -o data-hists.root" ),
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_clones_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_clones_pu40.py
index 3f6297822872..dd4239faa4f3 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_clones_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_clones_pu40.py
@@ -34,7 +34,7 @@ Slots   = 8
 Input   = 'Zee_pu40'    # defined in TrigValTools/share/TrigValInputs.json
 Release = "current"
 GridFiles = True
-postinclude_file = "TrigInDetValidation/TIDAcloneremoval.py"
+postinclude_file = "RDOtoRDOTrigger:TrigInDetValidation/TIDAcloneremoval.py"
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                    -o data-hists.root -p 11" ),
          ( "Offline",     " TIDAdata-run3-offline.dat -r Offline -o data-hists-offline.root" ) ]
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml2_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml2_pu40.py
index f6801bd23a50..af022aa6df3b 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml2_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml2_pu40.py
@@ -32,7 +32,7 @@ Threads = 1
 Slots   = 1 # what about the mt: 4 art directive ? nfiles: 3 ?
 Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
 
-postinclude_file = 'TrigInDetValidation/TIDAml2_extensions.py'
+postinclude_file = 'RDOtoRDOTrigger:TrigInDetValidation/TIDAml2_extensions.py'
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                        -o data-hists.root" ),
          ( "Offline",     " TIDAdata-run3-offline.dat     -r Offline -o data-hists-offline.root" ),
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py
index 2a9a6b8fe213..50951e8a6505 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py
@@ -32,7 +32,7 @@ Threads = 1
 Slots   = 1 # what about the mt: 4 art directive ? nfiles: 3 ?
 Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
 
-postinclude_file = 'TrigInDetValidation/TIDAml_extensions.py'
+postinclude_file = 'RDOtoRDOTrigger:TrigInDetValidation/TIDAml_extensions.py'
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                        -o data-hists.root" ),
          ( "Offline",     " TIDAdata-run3-offline.dat     -r Offline -o data-hists-offline.root" ),
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_nopps_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_nopps_pu40.py
index 239bfe93dbb4..4483836d36fe 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_nopps_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_nopps_pu40.py
@@ -33,7 +33,7 @@ Slices  = ['fsjet']
 Events  = 2000 
 Threads = 8 
 Slots   = 8
-postinclude_file = 'dopps.py'
+postinclude_file = 'RDOtoRDOTrigger:dopps.py'
 Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                        -o data-hists.root" ), 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_vtx_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_vtx_pu40.py
index 960c33176d28..20ece9fe110f 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_vtx_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_vtx_pu40.py
@@ -32,7 +32,7 @@ Threads = 8
 Slots   = 8
 Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
 
-preinclude_file = "TrigInDetValidation/TIDAvtx_preinclude.py"
+preinclude_file = "RDOtoRDOTrigger:TrigInDetValidation/TIDAvtx_preinclude.py"
 
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                        -o data-hists.root" ), 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fslrt_rhadron.py
similarity index 94%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fslrt_rhadron.py
index 377c60e047e8..5cc8ef87f51e 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fslrt_rhadron.py
@@ -33,7 +33,9 @@ Threads = 8
 Slots   = 8
 Input   = 'RHadron'    # defined in TrigValTools/share/TrigValInputs.json
 GridFiles = False
-Extra   = ' -c "LRT=True" '
+ExtraAna = ' -c LRT="True" '
+
+preinclude_file = 'all:TrigInDetValidation/TIDAlrt_preinclude.py'
 
 Jobs = [ ( "Truth",  " TIDAdata-run3-lrt.dat -o data-hists.root ", "Test_bin_lrt.dat" ),
          ( "Offline",    " TIDAdata-run3-offline-lrt.dat -r Offline -o data-hists-offline.root", "Test_bin_lrt.dat" ) ]
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias.py
index 104efc5ee3ae..2c53dde16204 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias.py
@@ -31,7 +31,7 @@ Events  = 8000
 Threads = 8 
 Slots   = 8
 Input   = 'minbias'    # defined in TrigValTools/share/TrigValInputs.json  
-Extra   = " -c 'ptmin=400' "
+ExtraAna   = " -c 'ptmin=400' "
 
 Jobs = [ ( "Truth",       " TIDAdata-run3-minbias.dat                    -o data-hists.root" ),
          ( "Offline",     " TIDAdata-run3-offline.dat -r Offline -o data-hists-offline.root" ) ]
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_StauStau.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mulrt_staustau.py
similarity index 94%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_StauStau.py
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mulrt_staustau.py
index d10c5b840803..1b0c4a25336a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_StauStau.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mulrt_staustau.py
@@ -33,7 +33,11 @@ Threads = 8
 Slots   = 8
 Input   = 'StauStau'    # defined in TrigValTools/share/TrigValInputs.json
 GridFiles = False
-Extra   = ' -c "LRT=True" '
+
+ExtraAna = ' -c LRT="True" '
+
+preinclude_file = 'all:TrigInDetValidation/TIDAlrt_preinclude.py'
+
 
 Jobs = [ ( "Truth",  " TIDAdata-run3-lrt.dat -o data-hists.root -p 13", "Test_bin_lrt.dat" ),
          ( "Offline",    " TIDAdata-run3-offline-lrt.dat -r Offline -o data-hists-offline.root", "Test_bin_lrt.dat" ) ]
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_Zmumu_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mulrt_zmumu_pu40.py
similarity index 94%
rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_Zmumu_pu40.py
rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mulrt_zmumu_pu40.py
index b25f6958416f..f8bf73485015 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_Zmumu_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mulrt_zmumu_pu40.py
@@ -28,13 +28,14 @@
 
 
 Slices  = ['L2muonLRT']
-Extra   = ' -c "LRT=True" ' 
 Events  = 8000 
 Threads = 8 
 Slots   = 8
 Input   = 'Zmumu_pu40'    # defined in TrigValTools/share/TrigValInputs.json
 GridFiles = True
+ExtraAna = ' -c LRT="True" '
 
+preinclude_file = 'all:TrigInDetValidation/TIDAlrt_preinclude.py'
 
 Jobs = [ ( "Truth",  " TIDAdata-run3-lrt.dat -o data-hists.root -p 13", "Test_bin_lrt.dat" ),
          ( "Offline",    " TIDAdata-run3-offline-lrt.dat -r Offline -o data-hists-offline.root", "Test_bin_lrt.dat" ) ]
-- 
GitLab