Skip to content

Commit 098df6d

Browse files
committed
use bash arrays in test/get*HLT.sh scripts
Update of the scripts HLTrigger/Configuration/test/getHLT.sh , and HLTrigger/Configuration/test/getFrozenHLT.sh to use an associative array to specify which HLT configurations should be downloaded from ConfDB. This allows for more flexibility for non-standard use cases (e.g. having to specify different version numbers for different subtables). In getFrozenHLT.sh , this change also avoids having to specify the list of configurations in a separate string (which was named TABLES prior to this commit): now, it is sufficient to add a new configuration to the associative array. The downside of using associative arrays is that the configurations are not downloaded anymore in a specific order, but said order is (and should be) unimportant in this context.
1 parent cf289c7 commit 098df6d

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

HLTrigger/Configuration/test/getFrozenHLT.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#!/bin/bash
22

33
# ConfDB configurations to use
4-
TABLES="Fake Fake1 Fake2 2023v12"
5-
HLT_Fake="/dev/CMSSW_13_0_0/Fake"
6-
HLT_Fake1="/dev/CMSSW_13_0_0/Fake1"
7-
HLT_Fake2="/dev/CMSSW_13_0_0/Fake2"
8-
HLT_2023v12="/frozen/2023/2e34/v1.2/HLT"
4+
# - if no explicit version, the most recent one is taken
5+
# - to use explicit version, specify it in the entries below
6+
# - to skip a given configuration, remove or comment the corresponding entry in the array TABLES
7+
# - new configurations can be added by expanding the array TABLES
8+
# - for new configurations, ensure that the corresponding "auto" GTs are defined in
9+
# Configuration/HLT/python/autoCondHLT.py , and
10+
# HLTrigger/Configuration/python/Tools/options.py
11+
declare -A TABLES=(
12+
["Fake"]="/dev/CMSSW_13_0_0/Fake"
13+
["Fake1"]="/dev/CMSSW_13_0_0/Fake1"
14+
["Fake2"]="/dev/CMSSW_13_0_0/Fake2"
15+
["2023v12"]="/frozen/2023/2e34/v1.2/HLT"
16+
)
917

1018
# command-line arguments
1119
VERBOSE=false # print extra messages to stdout
@@ -52,8 +60,8 @@ INITDIR="${PWD}"
5260
cd "${CMSSW_BASE}"/src/HLTrigger/Configuration/test
5361

5462
# create cff fragments and cfg configs
55-
for TABLE in ${TABLES}; do
56-
CONFIG=$(eval echo \$$(echo HLT_"${TABLE}"))
63+
for TABLE in "${!TABLES[@]}"; do
64+
CONFIG="${TABLES[${TABLE}]}"
5765
echo "${TABLE} (config: ${CONFIG})"
5866

5967
# cff fragment of each HLT menu (do not use any conditions or L1T override)
@@ -62,10 +70,10 @@ for TABLE in ${TABLES}; do
6270

6371
# GlobalTag
6472
AUTOGT="auto:run3_hlt_${TABLE}"
65-
if [ "${TABLE}" = "Fake1" ] || [ "${TABLE}" = "Fake2" ] || [ "${TABLE}" = "2018" ]; then
66-
AUTOGT="auto:run2_hlt_${TABLE}"
67-
elif [ "${TABLE}" = "Fake" ]; then
73+
if [ "${TABLE}" = "Fake" ]; then
6874
AUTOGT="auto:run1_hlt_${TABLE}"
75+
elif [ "${TABLE}" = "Fake1" ] || [ "${TABLE}" = "Fake2" ]; then
76+
AUTOGT="auto:run2_hlt_${TABLE}"
6977
fi
7078

7179
# standalone cfg file of each HLT menu

HLTrigger/Configuration/test/getHLT.sh

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
#!/bin/bash
22

3-
# ConfDB configurations to use
4-
MASTER="/dev/CMSSW_13_0_0/HLT" # no explicit version, take the most recent
5-
TARGET="/dev/CMSSW_13_0_0/\$TABLE" # no explicit version, take the most recent
3+
# ConfDB directory hosting the HLT configurations
4+
CONFDBDIR="/dev/CMSSW_13_0_0"
65

7-
TABLES="GRun HIon PIon PRef" # $TABLE in the above variable will be expanded to these TABLES
6+
# ConfDB configurations to use
7+
# - if no explicit version, the most recent one is taken
8+
# - to use explicit version, specify it in the entries below
9+
# - to skip a given configuration, remove or comment the corresponding entry in the array TABLES
10+
# - new configurations can be added by expanding the array TABLES
11+
# - for new configurations, ensure that the corresponding "auto" GTs are defined in
12+
# Configuration/HLT/python/autoCondHLT.py , and
13+
# HLTrigger/Configuration/python/Tools/options.py
14+
declare -A TABLES=(
15+
["FULL"]="${CONFDBDIR}/HLT"
16+
["GRun"]="${CONFDBDIR}/GRun"
17+
["HIon"]="${CONFDBDIR}/HIon"
18+
["PIon"]="${CONFDBDIR}/PIon"
19+
["PRef"]="${CONFDBDIR}/PRef"
20+
)
821

922
# command-line arguments
1023
VERBOSE=false # print extra messages to stdout
@@ -51,26 +64,21 @@ INITDIR="${PWD}"
5164
cd "${CMSSW_BASE}"/src/HLTrigger/Configuration/test
5265

5366
# create cff fragments and cfg configs
54-
for TABLE in FULL ${TABLES}; do
55-
if [ "${TABLE}" = "FULL" ]; then
56-
CONFIG="${MASTER}"
57-
else
58-
CONFIG=$(eval echo ${TARGET})
59-
fi
60-
67+
for TABLE in "${!TABLES[@]}"; do
68+
CONFIG="${TABLES[${TABLE}]}"
6169
echo "${TABLE} (config: ${CONFIG})"
6270

6371
# cff fragment of each HLT menu (do not use any conditions or L1T override)
6472
log " creating cff fragment of HLT menu..."
6573
hltGetConfiguration "${CONFIG}" --cff --data --type "${TABLE}" ${DBPROXYOPTS} > ../python/HLT_"${TABLE}"_cff.py
6674

67-
# cff fragment of EventContents (only for MASTER config)
75+
# cff fragment of EventContents (only for FULL config)
6876
if [ "${TABLE}" = "FULL" ]; then
6977
log " creating cff fragment of EventContents..."
70-
./getEventContent.py "${MASTER}" ${DBPROXYOPTS} > ../python/HLTrigger_EventContent_cff.py
78+
./getEventContent.py "${CONFIG}" ${DBPROXYOPTS} > ../python/HLTrigger_EventContent_cff.py
7179
fi
7280

73-
# cff fragment of PrimaryDatasets of each HLT menu (except for MASTER config)
81+
# cff fragment of PrimaryDatasets of each HLT menu (except for FULL config)
7482
if [ "${TABLE}" != "FULL" ]; then
7583
log " creating cff fragment of Primary Datasets..."
7684
./getDatasets.py "${CONFIG}" ${DBPROXYOPTS} > ../python/HLTrigger_Datasets_"${TABLE}"_cff.py
@@ -84,7 +92,7 @@ for TABLE in FULL ${TABLES}; do
8492
AUTOGT="auto:run1_hlt_${TABLE}"
8593
fi
8694

87-
# standalone cfg file of each HLT menu (incl. MASTER config)
95+
# standalone cfg file of each HLT menu (incl. FULL config)
8896
log " creating full cfg of HLT menu..."
8997
hltGetConfiguration "${CONFIG}" --full --data --type "${TABLE}" --unprescale --process "HLT${TABLE}" --globaltag "${AUTOGT}" \
9098
--input "file:RelVal_Raw_${TABLE}_DATA.root" ${DBPROXYOPTS} > OnLine_HLT_"${TABLE}".py

0 commit comments

Comments
 (0)