Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:17:07

0001 #!/bin/bash
0002 
0003 # ConfDB directory hosting the HLT configurations
0004 CONFDBDIR="/dev/CMSSW_14_0_0"
0005 
0006 # ConfDB configurations to use
0007 #  - if no explicit version, the most recent one is taken
0008 #  - to use explicit version, specify it in the entries below
0009 #  - to skip a given configuration, remove or comment the corresponding entry in the array TABLES
0010 #  - new configurations can be added by expanding the array TABLES
0011 #  - for new configurations, ensure that the corresponding "auto" GTs are defined in
0012 #     Configuration/HLT/python/autoCondHLT.py , and
0013 #     HLTrigger/Configuration/python/Tools/options.py
0014 declare -A TABLES=(
0015   ["FULL"]="${CONFDBDIR}/HLT"
0016   ["GRun"]="${CONFDBDIR}/GRun"
0017   ["HIon"]="${CONFDBDIR}/HIon"
0018   ["PIon"]="${CONFDBDIR}/PIon"
0019   ["PRef"]="${CONFDBDIR}/PRef"
0020   ["Special"]="${CONFDBDIR}/Special"
0021 )
0022 
0023 # command-line arguments
0024 VERBOSE=false # print extra messages to stdout
0025 DBPROXYOPTS="" # db-proxy configuration
0026 while [[ $# -gt 0 ]]; do
0027   case "$1" in
0028     -v) VERBOSE=true; shift;;
0029     --dbproxy) DBPROXYOPTS="${DBPROXYOPTS} --dbproxy"; shift;;
0030     --dbproxyhost) DBPROXYOPTS="${DBPROXYOPTS} --dbproxyhost $2"; shift; shift;;
0031     --dbproxyport) DBPROXYOPTS="${DBPROXYOPTS} --dbproxyport $2"; shift; shift;;
0032     *) shift;;
0033   esac
0034 done
0035 
0036 # remove spurious whitespaces and tabs from DBPROXYOPTS
0037 DBPROXYOPTS=$(echo "${DBPROXYOPTS}" | xargs)
0038 
0039 # log: print to stdout only if VERBOSE=true
0040 function log() {
0041   $VERBOSE && echo -e "$@"
0042 }
0043 
0044 # path to directory hosting this script
0045 TESTDIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
0046 
0047 # ensure that directory hosting this script corresponds to ${CMSSW_BASE}/src/HLTrigger/Configuration/test
0048 if [ "${TESTDIR}" != "${CMSSW_BASE}"/src/HLTrigger/Configuration/test ]; then
0049   printf "\n%s\n" "ERROR -- the directory hosting getHLT.sh [1] does not correspond to \${CMSSW_BASE}/src/HLTrigger/Configuration/test [2]"
0050   printf "%s\n"   "         [1] ${TESTDIR}"
0051   printf "%s\n\n" "         [2] ${CMSSW_BASE}/src/HLTrigger/Configuration/test"
0052   exit 1
0053 fi
0054 
0055 # ensure that the python/ directory hosting cff fragments exists
0056 if [ ! -d "${CMSSW_BASE}"/src/HLTrigger/Configuration/python ]; then
0057   printf "\n%s\n" "ERROR -- the directory \${CMSSW_BASE}/src/HLTrigger/Configuration/python [1] does not exist"
0058   printf "%s\n\n" "         [1] ${CMSSW_BASE}/src/HLTrigger/Configuration/python"
0059   exit 1
0060 fi
0061 
0062 INITDIR="${PWD}"
0063 
0064 # execute the ensuing steps from ${CMSSW_BASE}/src/HLTrigger/Configuration/test
0065 cd "${CMSSW_BASE}"/src/HLTrigger/Configuration/test
0066 
0067 # create cff fragments and cfg configs
0068 for TABLE in "${!TABLES[@]}"; do
0069   CONFIG="${TABLES[${TABLE}]}"
0070   echo "${TABLE} (config: ${CONFIG})"
0071 
0072   # cff fragment of each HLT menu (do not use any conditions or L1T override)
0073   log "  creating cff fragment of HLT menu..."
0074   hltGetConfiguration "${CONFIG}" --cff --data --type "${TABLE}" ${DBPROXYOPTS} > ../python/HLT_"${TABLE}"_cff.py
0075 
0076   # cff fragment of EventContents (only for FULL config)
0077   if [ "${TABLE}" = "FULL" ]; then
0078     log "  creating cff fragment of EventContents..."
0079     ./getEventContent.py "${CONFIG}" ${DBPROXYOPTS} > ../python/HLTrigger_EventContent_cff.py
0080   fi
0081 
0082   # cff fragment of PrimaryDatasets of each HLT menu (except for FULL config)
0083   if [ "${TABLE}" != "FULL" ]; then
0084     log "  creating cff fragment of Primary Datasets..."
0085     ./getDatasets.py "${CONFIG}" ${DBPROXYOPTS} > ../python/HLTrigger_Datasets_"${TABLE}"_cff.py
0086   fi
0087 
0088   # GlobalTag
0089   AUTOGT="auto:run3_hlt_${TABLE}"
0090   if [ "${TABLE}" = "Fake1" ] || [ "${TABLE}" = "Fake2" ] || [ "${TABLE}" = "2018" ]; then
0091     AUTOGT="auto:run2_hlt_${TABLE}"
0092   elif [ "${TABLE}" = "Fake" ]; then
0093     AUTOGT="auto:run1_hlt_${TABLE}"
0094   fi
0095 
0096   # standalone cfg file of each HLT menu (incl. FULL config)
0097   log "  creating full cfg of HLT menu..."
0098   hltGetConfiguration "${CONFIG}" --full --data --type "${TABLE}" --unprescale --process "HLT${TABLE}" --globaltag "${AUTOGT}" \
0099     --input "file:RelVal_Raw_${TABLE}_DATA.root" ${DBPROXYOPTS} > OnLine_HLT_"${TABLE}".py
0100 done
0101 
0102 cd "${INITDIR}"