From e7f4a66b880042a62a84634d2a6c3a880129c1f9 Mon Sep 17 00:00:00 2001
From: Mark Sutton <mark.sutton@cern.ch>
Date: Fri, 26 Mar 2021 14:49:34 +0000
Subject: [PATCH] Allow setting of the truth PT threshold for the ntuple
 creation

---
 .../AnalysisConfigMT_Ntuple.h                         |  5 ++++-
 .../TrigInDetAnalysisExample/TrigTestMonToolAC.h      |  1 +
 .../src/AnalysisConfigMT_Ntuple.cxx                   |  4 ++--
 .../src/TrigTestMonToolAC.cxx                         |  1 +
 .../TrigInDetAnalysisUser/share/TIDAdata_cuts.dat     |  2 +-
 .../TrigInDetValidation/python/TrigInDetArtSteps.py   |  6 +++---
 .../share/TrigInDetValidation_AODtoTrkNtuple.py       |  3 +++
 .../share/TrigInDetValidation_Base.py                 | 11 +++++++----
 .../test/test_trigID_FSLRT_RHadron.py                 |  3 +--
 .../TrigInDetValidation/test/test_trigID_minbias.py   |  1 +
 .../test/test_trigID_muLRT_StauStau.py                |  3 +--
 .../test/test_trigID_muLRT_Zmumu_pu40.py              |  2 +-
 12 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h
index 2939ddb730be..b6104590d924 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h
@@ -38,12 +38,14 @@ public:
 			   const std::vector<std::string>& chainNames, std::string outputFileName="TrkNtuple.root", 
 			   double tauEtCutOffline=0.0, int TruthPdgId = 0, bool keepAllEvents_=false ) : 
     AnalysisConfig_Ntuple( roiInfo, chainNames, outputFileName, tauEtCutOffline, TruthPdgId, keepAllEvents_ ),
-    m_fiducial_radius(47)
+    m_fiducial_radius(47),
+    m_ptmin(1000)
   { }  
 
   virtual ~AnalysisConfigMT_Ntuple() { }
 
   void set_fiducial_radius( double d ) { m_fiducial_radius = d; }
+  void set_ptmin( double d ) { m_ptmin = d; }
 
 protected:
 
@@ -52,6 +54,7 @@ protected:
 private: 
   
   double m_fiducial_radius; 
+  double m_ptmin; 
 
 };
 
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/TrigTestMonToolAC.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/TrigTestMonToolAC.h
index 7c70b661b0f2..6d13a1a7867a 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/TrigTestMonToolAC.h
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/TrigTestMonToolAC.h
@@ -147,6 +147,7 @@ public:
   bool m_legacy;
 
   double m_fiducial_radius;
+
 };
 
 
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx
index cbae0534088f..5afb71ddef9d 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx
@@ -164,8 +164,8 @@ void AnalysisConfigMT_Ntuple::loop() {
 	/// FIXME: should really have hardcoded limits encoded as 
 	///        const variables 
 	Filter_etaPT       filterRef(5,500);   
-	Filter_etaPT       filter_etaPT(3.0,1000);
-	Filter_pdgIdpTeta  filter_pdgIdpTeta(m_TruthPdgId,3.0,1000); // |eta|<3, pt>1GeV 
+	Filter_etaPT       filter_etaPT(3.0,m_ptmin);
+	Filter_pdgIdpTeta  filter_pdgIdpTeta(m_TruthPdgId,3.0,m_ptmin); // |eta|<3, pt>1GeV 
 
 	TrackFilter*        truthFilter = &filter_etaPT;
 
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx
index 67e16003b751..9c024fba8b39 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/TrigTestMonToolAC.cxx
@@ -145,6 +145,7 @@ StatusCode TrigTestMonToolAC::init() {
 								 m_outputFileName, m_tauEtCutOffline, m_selectTruthPdgId, 
 								 m_keepAllEvents );
       ac->set_fiducial_radius( m_fiducial_radius );
+      ac->set_ptmin( m_pTCutOffline );
       m_sequences.push_back( ac );
     }
 
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat
index b73d35fb102d..bb90e62aed09 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat
@@ -1,6 +1,6 @@
 
 #ifdef MINBIAS 
-pT     = 1000;
+pT     = 400;
 #else
 pT     = 3000;
 #endif
diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
index 3fdc4eb99b77..e0fb1c1c247d 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
@@ -156,7 +156,7 @@ class TrigInDetReco(ExecStep):
 ##################################################
 
 class TrigInDetAna(ExecStep):
-    def __init__(self, name='TrigInDetAna', lrt=False):
+    def __init__(self, name='TrigInDetAna', extra=None):
         ExecStep.__init__(self, name )
         self.type = 'athena'
         self.job_options = 'TrigInDetValidation/TrigInDetValidation_AODtoTrkNtuple.py'
@@ -167,8 +167,8 @@ class TrigInDetAna(ExecStep):
         self.input = ''
         self.perfmon=False
         self.imf=False
-        if (lrt):
-            self.args = ' -c "LRT=True" '
+        if extra is not None:
+            self.args = extra
 
 ##################################################
 # Additional exec (athena) steps - RDO to CostMonitoring
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py
index 0534d2237082..d9e0304dc0f2 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py
@@ -95,6 +95,9 @@ if ( True ) :
     if LRT == True :
       TestMonTool.FiducialRadius = 500.
 
+  if 'ptmin' in dir(): 
+     TestMonTool.pTCutOffline = ptmin
+
   TestMonTool.KeepAllEvents = False
   # TestMonTool.TrigConfigTool = "TrigConf::xAODConfigTool"
   TestMonTool.ntupleChainNames += [
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py
index 0819bc3b8719..440529279fe9 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py
@@ -107,10 +107,13 @@ if GridFiles:
 test = Test.Test()
 test.art_type = Art_type
 
-lrt_mode = False
-if 'LRT' in dir() :
-    lrt_mode = LRT
-aod_to_ntup = TrigInDetAna(lrt=lrt_mode)
+
+if 'Extra' not in locals() :
+    Extra = None
+
+aod_to_ntup = TrigInDetAna(extra=Extra)
+
+
 
 rdo_to_cost = TrigCostStep()
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py
index 2466c0f6cb80..377c60e047e8 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_FSLRT_RHadron.py
@@ -28,13 +28,12 @@
 
 
 Slices  = ['FSLRT']
-LRT     = True
 Events  = 8000 
 Threads = 8 
 Slots   = 8
 Input   = 'RHadron'    # defined in TrigValTools/share/TrigValInputs.json
 GridFiles = False
-
+Extra   = ' -c "LRT=True" '
 
 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 2662e32507af..104efc5ee3ae 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias.py
@@ -31,6 +31,7 @@ Events  = 8000
 Threads = 8 
 Slots   = 8
 Input   = 'minbias'    # defined in TrigValTools/share/TrigValInputs.json  
+Extra   = " -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
index 0c40f0bdd1e7..d10c5b840803 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_StauStau.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_StauStau.py
@@ -28,13 +28,12 @@
 
 
 Slices  = ['L2muonLRT']
-LRT     = True
 Events  = 8000 
 Threads = 8 
 Slots   = 8
 Input   = 'StauStau'    # defined in TrigValTools/share/TrigValInputs.json
 GridFiles = False
-
+Extra   = ' -c "LRT=True" '
 
 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
index 7961acd2e7f0..b25f6958416f 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_Zmumu_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_muLRT_Zmumu_pu40.py
@@ -28,7 +28,7 @@
 
 
 Slices  = ['L2muonLRT']
-LRT     = True
+Extra   = ' -c "LRT=True" ' 
 Events  = 8000 
 Threads = 8 
 Slots   = 8
-- 
GitLab