Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-11-23 02:07:48

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