From 02441b99acd8bd88f336e6e162cadb85db303955 Mon Sep 17 00:00:00 2001
From: Rafal Bielski <rafal.bielski@cern.ch>
Date: Mon, 19 Oct 2020 11:39:59 +0200
Subject: [PATCH] Update/add ART tests for Run-2 MC reprocessing r22-r21
 workflow

1. Changes to the existing test with RDOtoRDOTrigger running in 21.0,latest:
   * Change lumi settings (run number, timestamp)
   * Change 21.0 release to CC7
   * Change trigger settings to generate menu instead of running from DB
2. Add new tests with RDOtoRDOTrigger in 21.0-mc16a and 21.0-mc16d (both SLC6)
---
 .../test_trigAna_HITtoAOD_trigRel21_build.py  | 34 ++++++--
 ..._trigAna_HITtoAOD_trigRel21_mc16a_build.py | 79 +++++++++++++++++++
 ..._trigAna_HITtoAOD_trigRel21_mc16d_build.py | 79 +++++++++++++++++++
 3 files changed, 185 insertions(+), 7 deletions(-)
 create mode 100755 Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16a_build.py
 create mode 100755 Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16d_build.py

diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_build.py
index f19cbac7bad..dfb1c6c6f49 100755
--- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_build.py
+++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_build.py
@@ -14,10 +14,31 @@ from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps
 hit2rdo = ExecStep.ExecStep('HITtoRDO')
 hit2rdo.type = 'Reco_tf'
 hit2rdo.input = 'ttbar_HITS'
-hit2rdo.args = '--outputRDOFile=RDO.pool.root'
+
+hit2rdo_lumidict = {
+  'run': 310000,
+  'startmu': 40.0,
+  'endmu': 70.0,
+  'stepmu': 1.0,
+  'startlb': 1,
+  'timestamp': 1550000000
+}
+
+hit2rdo_preexec = ';'.join([
+  'userRunLumiOverride={:s}'.format(str(hit2rdo_lumidict)),
+  'ScaleTaskLength=0.1'
+]) + ';'
+
+hit2rdo_preinclude= ','.join([
+  'Digitization/ForceUseOfPileUpTools.py',
+  'SimulationJobOptions/preInlcude.PileUpBunchTrainsMC16c_2017_Config1.py',
+  'RunDependentSimData/configLumi_muRange.py'
+])
 
 pu_low = Input.get_input('pileup_low')
 pu_high = Input.get_input('pileup_high')
+
+hit2rdo.args = '--outputRDOFile=RDO.pool.root'
 hit2rdo.args += ' --inputLowPtMinbiasHitsFile=' + pu_low.paths[0]
 hit2rdo.args += ' --inputHighPtMinbiasHitsFile=' + pu_high.paths[0]
 hit2rdo.args += ' --numberOfCavernBkg="0"'
@@ -25,10 +46,8 @@ hit2rdo.args += ' --numberOfHighPtMinBias="0.15520183"'
 hit2rdo.args += ' --numberOfLowPtMinBias="59.3447981771"'
 hit2rdo.args += ' --pileupFinalBunch="6"'
 hit2rdo.args += ' --jobNumber="1"'
-
-hit2rdo.args += ' --preExec "HITtoRDO:userRunLumiOverride={\'run\':300000, \'startmu\':40.0, \'endmu\':70.0, \'stepmu\':1.0, \'startlb\':1, \'timestamp\': 1500000000};ScaleTaskLength=0.1" '
-
-hit2rdo.args += ' --preInclude "HITtoRDO:Digitization/ForceUseOfPileUpTools.py,SimulationJobOptions/preInlcude.PileUpBunchTrainsMC16c_2017_Config1.py,RunDependentSimData/configLumi_muRange.py"'
+hit2rdo.args += ' --preExec "HITtoRDO:{:s}"'.format(hit2rdo_preexec)
+hit2rdo.args += ' --preInclude "HITtoRDO:{:s}"'.format(hit2rdo_preinclude)
 
 # RDO -> RDO_TRIG step in 21.0
 rdo2rdotrig = ExecStep.ExecStep('RDOtoRDOTrigger')
@@ -37,8 +56,8 @@ rdo2rdotrig.input = ''
 rdo2rdotrig.imf = False
 rdo2rdotrig.explicit_input = True
 rdo2rdotrig.args = '--inputRDOFile=RDO.pool.root --outputRDO_TRIGFile=RDO_TRIG.pool.root'
-rdo2rdotrig.args += ' --asetup="RDOtoRDOTrigger:Athena,21.0,latest,slc6"'
-rdo2rdotrig.args += ' --triggerConfig="MCRECO:DBF:TRIGGERDBMC:2233,87,279"'
+rdo2rdotrig.args += ' --asetup="RDOtoRDOTrigger:Athena,21.0,latest"'
+rdo2rdotrig.args += ' --triggerConfig="MCRECO:MC_pp_v7_BulkMCProd_mc_prescale"'
 rdo2rdotrig.args += ' --imf="all:True"'
 
 # RDO_TRIG -> AOD step in master
@@ -49,6 +68,7 @@ rdotrig2aod.explicit_input = True
 rdotrig2aod.args = '--inputRDO_TRIGFile=RDO_TRIG.pool.root --outputESDFile=ESD.pool.root --outputAODFile=AOD.pool.root --steering="doRDO_TRIG"'
 rdotrig2aod.args += ' --preExec="all:from TriggerJobOpts.TriggerFlags import TriggerFlags; TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\");"'
 
+# Define the test with the above steps
 test = Test.Test()
 test.art_type = 'build'
 test.exec_steps = [hit2rdo, rdo2rdotrig, rdotrig2aod]
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16a_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16a_build.py
new file mode 100755
index 00000000000..f23a9372e04
--- /dev/null
+++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16a_build.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+# art-description: Test running HITS->RDO in master, then RDO->RDO_TRIG in 21.0-mc16a, then RDO_TRIG->AOD in master
+# art-type: build
+# art-include: master/Athena
+# Skipping art-output which has no effect for build tests.
+# If you create a grid version, check art-output in existing grid tests.
+
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Input
+from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps
+
+# HITS -> RDO step in master
+hit2rdo = ExecStep.ExecStep('HITtoRDO')
+hit2rdo.type = 'Reco_tf'
+hit2rdo.input = 'ttbar_HITS'
+
+hit2rdo_lumidict = {
+  'run': 284500,
+  'startmu': 40.0,
+  'endmu': 70.0,
+  'stepmu': 1.0,
+  'startlb': 1,
+  'timestamp': 1446539185
+}
+
+hit2rdo_preexec = ';'.join([
+  'userRunLumiOverride={:s}'.format(str(hit2rdo_lumidict)),
+  'ScaleTaskLength=0.1'
+]) + ';'
+
+hit2rdo_preinclude= ','.join([
+  'Digitization/ForceUseOfPileUpTools.py',
+  'SimulationJobOptions/preInlcude.PileUpBunchTrainsMC16c_2017_Config1.py',
+  'RunDependentSimData/configLumi_muRange.py'
+])
+
+pu_low = Input.get_input('pileup_low')
+pu_high = Input.get_input('pileup_high')
+
+hit2rdo.args = '--outputRDOFile=RDO.pool.root'
+hit2rdo.args += ' --inputLowPtMinbiasHitsFile=' + pu_low.paths[0]
+hit2rdo.args += ' --inputHighPtMinbiasHitsFile=' + pu_high.paths[0]
+hit2rdo.args += ' --numberOfCavernBkg="0"'
+hit2rdo.args += ' --numberOfHighPtMinBias="0.15520183"'
+hit2rdo.args += ' --numberOfLowPtMinBias="59.3447981771"'
+hit2rdo.args += ' --pileupFinalBunch="6"'
+hit2rdo.args += ' --jobNumber="1"'
+hit2rdo.args += ' --preExec "HITtoRDO:{:s}"'.format(hit2rdo_preexec)
+hit2rdo.args += ' --preInclude "HITtoRDO:{:s}"'.format(hit2rdo_preinclude)
+
+# RDO -> RDO_TRIG step in 21.0
+rdo2rdotrig = ExecStep.ExecStep('RDOtoRDOTrigger')
+rdo2rdotrig.type = 'Reco_tf'
+rdo2rdotrig.input = ''
+rdo2rdotrig.imf = False
+rdo2rdotrig.explicit_input = True
+rdo2rdotrig.args = '--inputRDOFile=RDO.pool.root --outputRDO_TRIGFile=RDO_TRIG.pool.root'
+rdo2rdotrig.args += ' --asetup="RDOtoRDOTrigger:Athena,21.0-mc16a,slc6,latest"'
+rdo2rdotrig.args += ' --triggerConfig="MCRECO:MC_pp_v7_tight_mc_prescale"'
+rdo2rdotrig.args += ' --imf="all:True"'
+
+# RDO_TRIG -> AOD step in master
+rdotrig2aod = ExecStep.ExecStep('RDOTriggertoAOD')
+rdotrig2aod.type = 'Reco_tf'
+rdotrig2aod.input = ''
+rdotrig2aod.explicit_input = True
+rdotrig2aod.args = '--inputRDO_TRIGFile=RDO_TRIG.pool.root --outputESDFile=ESD.pool.root --outputAODFile=AOD.pool.root --steering="doRDO_TRIG"'
+rdotrig2aod.args += ' --preExec="all:from TriggerJobOpts.TriggerFlags import TriggerFlags; TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\");"'
+
+# Define the test with the above steps
+test = Test.Test()
+test.art_type = 'build'
+test.exec_steps = [hit2rdo, rdo2rdotrig, rdotrig2aod]
+test.check_steps = CheckSteps.default_check_steps(test)
+add_analysis_steps(test)
+
+import sys
+sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16d_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16d_build.py
new file mode 100755
index 00000000000..a5cd4c76222
--- /dev/null
+++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoAOD_trigRel21_mc16d_build.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#
+# art-description: Test running HITS->RDO in master, then RDO->RDO_TRIG in 21.0-mc16d, then RDO_TRIG->AOD in master
+# art-type: build
+# art-include: master/Athena
+# Skipping art-output which has no effect for build tests.
+# If you create a grid version, check art-output in existing grid tests.
+
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Input
+from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps
+
+# HITS -> RDO step in master
+hit2rdo = ExecStep.ExecStep('HITtoRDO')
+hit2rdo.type = 'Reco_tf'
+hit2rdo.input = 'ttbar_HITS'
+
+hit2rdo_lumidict = {
+  'run': 300000,
+  'startmu': 40.0,
+  'endmu': 70.0,
+  'stepmu': 1.0,
+  'startlb': 1,
+  'timestamp': 1500000000
+}
+
+hit2rdo_preexec = ';'.join([
+  'userRunLumiOverride={:s}'.format(str(hit2rdo_lumidict)),
+  'ScaleTaskLength=0.1'
+]) + ';'
+
+hit2rdo_preinclude= ','.join([
+  'Digitization/ForceUseOfPileUpTools.py',
+  'SimulationJobOptions/preInlcude.PileUpBunchTrainsMC16c_2017_Config1.py',
+  'RunDependentSimData/configLumi_muRange.py'
+])
+
+pu_low = Input.get_input('pileup_low')
+pu_high = Input.get_input('pileup_high')
+
+hit2rdo.args = '--outputRDOFile=RDO.pool.root'
+hit2rdo.args += ' --inputLowPtMinbiasHitsFile=' + pu_low.paths[0]
+hit2rdo.args += ' --inputHighPtMinbiasHitsFile=' + pu_high.paths[0]
+hit2rdo.args += ' --numberOfCavernBkg="0"'
+hit2rdo.args += ' --numberOfHighPtMinBias="0.15520183"'
+hit2rdo.args += ' --numberOfLowPtMinBias="59.3447981771"'
+hit2rdo.args += ' --pileupFinalBunch="6"'
+hit2rdo.args += ' --jobNumber="1"'
+hit2rdo.args += ' --preExec "HITtoRDO:{:s}"'.format(hit2rdo_preexec)
+hit2rdo.args += ' --preInclude "HITtoRDO:{:s}"'.format(hit2rdo_preinclude)
+
+# RDO -> RDO_TRIG step in 21.0
+rdo2rdotrig = ExecStep.ExecStep('RDOtoRDOTrigger')
+rdo2rdotrig.type = 'Reco_tf'
+rdo2rdotrig.input = ''
+rdo2rdotrig.imf = False
+rdo2rdotrig.explicit_input = True
+rdo2rdotrig.args = '--inputRDOFile=RDO.pool.root --outputRDO_TRIGFile=RDO_TRIG.pool.root'
+rdo2rdotrig.args += ' --asetup="RDOtoRDOTrigger:Athena,21.0-mc16d,slc6,latest"'
+rdo2rdotrig.args += ' --triggerConfig="MCRECO:MC_pp_v7_tight_mc_prescale"'
+rdo2rdotrig.args += ' --imf="all:True"'
+
+# RDO_TRIG -> AOD step in master
+rdotrig2aod = ExecStep.ExecStep('RDOTriggertoAOD')
+rdotrig2aod.type = 'Reco_tf'
+rdotrig2aod.input = ''
+rdotrig2aod.explicit_input = True
+rdotrig2aod.args = '--inputRDO_TRIGFile=RDO_TRIG.pool.root --outputESDFile=ESD.pool.root --outputAODFile=AOD.pool.root --steering="doRDO_TRIG"'
+rdotrig2aod.args += ' --preExec="all:from TriggerJobOpts.TriggerFlags import TriggerFlags; TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\");"'
+
+# Define the test with the above steps
+test = Test.Test()
+test.art_type = 'build'
+test.exec_steps = [hit2rdo, rdo2rdotrig, rdotrig2aod]
+test.check_steps = CheckSteps.default_check_steps(test)
+add_analysis_steps(test)
+
+import sys
+sys.exit(test.run())
-- 
GitLab