Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added unit test to check availability of EDM files used in HLT tests
- Loading branch information
Showing
7 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!-- test access to EDM files used in HLT-AddOnTests and HLT-Validation tests --> | ||
<test name="test_AccessToEDMInputsOfHLTTests" command="testAccessToEDMInputsOfHLTTests.sh"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
The `test/` directory of the `HLTrigger/Configuration` package contains | ||
|
||
- scripts to copy HLT menus from the `ConfDB` database into CMSSW, | ||
as both `cff` fragments (loadable via `cmsDriver.py`) and standalone `cfg` configurations (usable with `cmsRun`); | ||
|
||
- scripts to run tests with these HLT menus | ||
(a version of these tests runs in CMSSW integration buils as the so-called "HLT-Validation" tests); | ||
|
||
- a unit test to verify the availability of the EDM input files used in the HLT tests maintained in CMSSW by the Trigger Studies Group | ||
(see `test_AccessToEDMInputsOfHLTTests` below). | ||
|
||
_Important_ : when the names of the EDM files hard-coded | ||
in `HLTrigger/Configuration/test/cmsDriver.csh` and/or `Configuration/HLT/python/addOnTestsHLT.py` are changed, | ||
make sure to execute the script `HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests.sh` | ||
to update the list of files to be cached in the IB-EOS area (see `test_AccessToEDMInputsOfHLTTests` below). | ||
|
||
--- | ||
|
||
Unit test: `test_AccessToEDMInputsOfHLTTests` | ||
--- | ||
|
||
This unit test executes `cmsRun` jobs to verify the availability | ||
of the EDM files listed in `HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests_filelist.txt`. | ||
|
||
To run the unit test via `scram`, execute | ||
```bash | ||
scram b runtests_test_AccessToEDMInputsOfHLTTests | ||
``` | ||
To run the unit test locally, execute | ||
```bash | ||
LOCALTOP="${CMSSW_BASE}" "${CMSSW_BASE}"/src/HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests.sh | ||
``` | ||
|
||
The unit test does not modify the content of the file `testAccessToEDMInputsOfHLTTests_filelist.txt`. | ||
The latter can be updated by manually executing the script `testAccessToEDMInputsOfHLTTests_update_filelist.sh`. | ||
The file `testAccessToEDMInputsOfHLTTests_filelist.txt` lists | ||
the Logical File Name (LFN) of the EDM files used in HLT tests | ||
for the main CMSSW development branches (name format: `CMSSW_[0-9]*_[0-9]*_X`). | ||
The list includes only EDM files which are available either in the IB-EOS cache at the CERN T2, or at any T2/T3 site. |
30 changes: 30 additions & 0 deletions
30
HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Pass in name and status | ||
function die { | ||
echo $1: status $2 | ||
echo === Log file === | ||
cat ${3:-/dev/null} | ||
echo === End log file === | ||
exit $2 | ||
} | ||
|
||
# run test job | ||
TESTDIR="${LOCALTOP}"/src/HLTrigger/Configuration/test | ||
|
||
inputFileList="${TESTDIR}"/testAccessToEDMInputsOfHLTTests_filelist.txt | ||
|
||
if [ ! -f "${inputFileList}" ]; then | ||
printf "%s\n" "ERROR -- invalid path to file listing EDM input files: ${inputFileList}" | ||
exit 1 | ||
fi | ||
|
||
rm -f log_testAccessToEDMInputsOfHLTTests | ||
|
||
for inputFile in $(cat "${inputFileList}"); do | ||
cmsRun "${TESTDIR}"/testAccessToEDMInputsOfHLTTests_cfg.py inputFiles="${inputFile}" &>> log_testAccessToEDMInputsOfHLTTests \ | ||
|| die "Failure running testAccessToEDMInputsOfHLTTests_cfg.py" $? log_testAccessToEDMInputsOfHLTTests | ||
done | ||
unset inputFile | ||
|
||
cat log_testAccessToEDMInputsOfHLTTests |
20 changes: 20 additions & 0 deletions
20
HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests_cfg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
## VarParsing | ||
import FWCore.ParameterSet.VarParsing as VarParsing | ||
options = VarParsing.VarParsing('analysis') | ||
options.setDefault('maxEvents', 1) | ||
options.parseArguments() | ||
|
||
process = cms.Process('TEST') | ||
|
||
process.options.numberOfThreads = 1 | ||
process.options.numberOfStreams = 0 | ||
process.options.wantSummary = False | ||
process.maxEvents.input = options.maxEvents | ||
|
||
## Source | ||
process.source = cms.Source('PoolSource', | ||
fileNames = cms.untracked.vstring(options.inputFiles), | ||
inputCommands = cms.untracked.vstring('drop *') | ||
) |
24 changes: 24 additions & 0 deletions
24
HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests_filelist.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root | ||
/store/data/Run2015D/MuonEG/RAW/v1/000/256/677/00000/80950A90-745D-E511-92FD-02163E011C5D.root | ||
/store/data/Run2016B/JetHT/RAW/v1/000/272/762/00000/C666CDE2-E013-E611-B15A-02163E011DBE.root | ||
/store/data/Run2017A/HLTPhysics4/RAW/v1/000/295/606/00000/36DE5E0A-3645-E711-8FA1-02163E01A43B.root | ||
/store/data/Run2018D/EphemeralHLTPhysics1/RAW/v1/000/323/775/00000/2E066536-5CF2-B340-A73B-209640F29FF6.root | ||
/store/data/Run2018D/HIMinimumBias0/RAW/v1/000/325/112/00000/660F62BB-9932-D645-A4A4-0BBBDA3963E8.root | ||
/store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root | ||
/store/group/dpg_trigger/comm_trigger/TriggerStudiesGroup/STORM/GEN-SIM/CMSSW_5/143C21CD-E8A2-E311-87BE-0025904C66E8.root | ||
/store/hidata/HIRun2011/HIHighPt/RAW/v1/000/182/838/F20AAF66-F71C-E111-9704-BCAEC532971D.root | ||
/store/hidata/HIRun2015/HIHardProbes/RAW-RECO/HighPtJet-PromptReco-v1/000/263/689/00000/1802CD9A-DDB8-E511-9CF9-02163E0138CA.root | ||
/store/hidata/HIRun2015/HIHardProbes/RAW/v1/000/263/718/00000/08057733-02A5-E511-9C7D-02163E014606.root | ||
/store/hidata/HIRun2018A/HIHardProbes/RAW/v1/000/326/479/00000/0E2CC5D5-9D87-7348-9219-B00CD718C847.root | ||
/store/hidata/HIRun2022A/HITestRaw0/RAW/v1/000/362/321/00000/f467ee64-fc64-47a6-9d8a-7ca73ebca2bd.root | ||
/store/relval/CMSSW_10_3_0_pre5/RelValZEEMM_13_HI/GEN-SIM/103X_upgrade2018_realistic_v7-v1/10000/E288668E-A2D1-D446-A401-D71EA43DD796.root | ||
/store/relval/CMSSW_11_2_0_pre8/RelValTTbar_13/GEN-SIM/112X_mcRun3_2021_design_v10-v1/00000/3ee9ba1e-0ef8-4242-8343-cff886c9f7b3.root | ||
/store/relval/CMSSW_11_2_0_pre8/RelValZEE_14_HI_2021/GEN-SIM/112X_mcRun3_2021_realistic_HI_v11-v1/00000/65e018bc-2a25-4f53-b9cf-aba35a7b212d.root | ||
/store/relval/CMSSW_12_3_0_pre6/RelValTTbar_14TeV/GEN-SIM/123X_mcRun3_2021_realistic_v11-v1/10000/29297788-21c3-4bf2-afe0-5382f08fbcd5.root | ||
/store/relval/CMSSW_12_3_0_pre6/RelValZEE_14_HI_2021/GEN-SIM/123X_mcRun3_2021_realistic_HI_v11-v2/10000/3c102f6f-4b70-4b09-b646-504bc104414d.root | ||
/store/relval/CMSSW_5_3_16/RelValPyquen_ZeemumuJets_pt10_2760GeV/GEN-SIM/PU_STARTHI53_LV1_mar03-v2/00000/143C21CD-E8A2-E311-87BE-0025904C66E8.root | ||
/store/relval/CMSSW_5_3_6-START53_V14/RelValProdTTbar/GEN-SIM/v2/00000/DE03BB7E-F429-E211-A0B4-001A928116CC.root | ||
/store/relval/CMSSW_8_0_11/RelValProdTTbar/GEN-SIM/80X_mcRun1_realistic_v4-v1/10000/06A6C86B-C634-E611-93A5-0CC47A74525A.root | ||
/store/relval/CMSSW_8_0_16/RelValProdTTbar_13/GEN-SIM/80X_mcRun2_asymptotic_v16_gs7120p2-v1/10000/06F2C3AC-8957-E611-9DDF-0025905B85D8.root | ||
/store/relval/CMSSW_8_0_16/RelValZEEMM_13_HI/GEN-SIM/80X_mcRun2_HeavyIon_v9-v1/10000/F8FC5F64-1657-E611-A57E-002590A887F0.root | ||
/store/relval/CMSSW_9_0_0_pre5/RelValTTbar_13/GEN-SIM/90X_upgrade2017_realistic_v15-v1/00000/14F749AC-8AFE-E611-9821-0CC47A78A4A0.root |
64 changes: 64 additions & 0 deletions
64
HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests_update_filelist.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash -e | ||
|
||
# This script updates the file "${CMSSW_BASE}"/src/HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests_filelist.txt | ||
# with the list of EDM files potentially used by HLT tests in the main release cycles of CMSSW (i.e. branches named CMSSW_\d_\d_X). | ||
|
||
# path to output file | ||
outputFile="${CMSSW_BASE}"/src/HLTrigger/Configuration/test/testAccessToEDMInputsOfHLTTests_filelist.txt | ||
|
||
# path to directory hosting this script | ||
TESTDIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) | ||
|
||
# ensure that directory hosting this script corresponds to ${CMSSW_BASE}/src/HLTrigger/Configuration/test | ||
if [ "${TESTDIR}" != "${CMSSW_BASE}"/src/HLTrigger/Configuration/test ]; then | ||
printf "\n%s\n" "ERROR -- the directory hosting testAccessToHLTTestInputs.sh [1] does not correspond to \${CMSSW_BASE}/src/HLTrigger/Configuration/test [2]" | ||
printf "%s\n" " [1] ${TESTDIR}" | ||
printf "%s\n\n" " [2] ${CMSSW_BASE}/src/HLTrigger/Configuration/test" | ||
exit 1 | ||
fi | ||
|
||
# files in CMSSW using EDM inputs for HLT tests | ||
cmsswFiles=( | ||
HLTrigger/Configuration/test/cmsDriver.csh | ||
Configuration/HLT/python/addOnTestsHLT.py | ||
Utilities/ReleaseScripts/scripts/addOnTests.py | ||
) | ||
|
||
# list of CMSSW branches to be checked | ||
# official-cmssw is the default name of the remote corresponding to the central CMSSW repository | ||
cmsswBranches=$(git branch -a | grep 'remotes/official-cmssw/CMSSW_[0-9]*_[0-9]*_X$') | ||
cmsswBranches+=("HEAD") # add HEAD to include updates committed locally | ||
|
||
# create 1st temporary file (list of EDM input files incl. duplicates) | ||
TMPFILE1=$(mktemp) | ||
|
||
# grep from base directory | ||
cd "${CMSSW_BASE}"/src | ||
|
||
# loop over CMSSW branches to be grep-d | ||
for cmsswBranch in "${cmsswBranches[@]}"; do | ||
git grep -h "[='\" ]/store/.*.root" ${cmsswBranch} -- ${cmsswFiles[*]} | | ||
sed 's|=/store/| /store/|g' | sed "s|'| |g" | sed 's|"| |g' | \ | ||
awk '{ for(i=1;i<=NF;i++) if ($i ~ /\/store\/.*.root/) print $i }' >> "${TMPFILE1}" | ||
done; unset cmsswBranch | ||
|
||
# create 2nd temporary file with list of available files (without duplicates) | ||
TMPFILE2=$(mktemp) | ||
|
||
# a file is considered as available if present in the ibeos cache (CERN T2), or at any T2/T3 site | ||
for inputFile in $(cat "${TMPFILE1}" | sort -u); do | ||
if [ $(ls /eos/cms/store/user/cmsbuild/"${inputFile}" 2> /dev/null | wc -l) -eq 0 ]; then | ||
if [ $(dasgoclient -query "site file=${inputFile}" | grep -E '(T2|T3)_' | wc -l) -eq 0 ]; then | ||
printf "%s\n" "File not available: ${inputFile}" | ||
continue | ||
fi | ||
fi | ||
echo "${inputFile}" >> "${TMPFILE2}" | ||
done | ||
unset inputFile | ||
|
||
# create/update output file | ||
cat "${TMPFILE2}" > "${outputFile}" | ||
|
||
# return to test/ directory | ||
cd "${TESTDIR}" |