Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-21 03:40:58

0001 #! /bin/bash
0002 
0003 # ConfDB configurations to use
0004 MASTER="/dev/CMSSW_12_4_0/HLT"             # no explicit version, take the most recent
0005 TARGET="/dev/CMSSW_12_4_0/\$TABLE"         # no explicit version, take the most recent
0006 
0007 TABLES="GRun HIon PIon PRef"               # $TABLE in the above variable will be expanded to these TABLES
0008 
0009 # print extra messages ?
0010 VERBOSE=false
0011 
0012 # this is used for brace expansion
0013 TABLES_=$(echo $TABLES | sed -e's/ \+/,/g')
0014 
0015 [ "$1" == "-v" ] && { VERBOSE=true;  shift; }
0016 [ "$1" == "-q" ] && { VERBOSE=false; shift; }
0017 
0018 function log() {
0019   $VERBOSE && echo -e "$@"
0020 }
0021 
0022 function findHltScript() {
0023   local PACKAGE="HLTrigger/Configuration"
0024   local SCRIPT="$1"
0025 
0026   if [ -f "$SCRIPT" ]; then
0027     echo "./$SCRIPT"
0028   elif [ -f "$CMSSW_BASE/src/$PACKAGE/test/$SCRIPT" ]; then
0029     echo "$CMSSW_BASE/src/$PACKAGE/test/$SCRIPT"
0030   elif [ -f "$CMSSW_RELEASE_BASE/src/$PACKAGE/test/$SCRIPT" ]; then
0031     echo "$CMSSW_RELEASE_BASE/src/$PACKAGE/test/$SCRIPT"
0032   else
0033     echo "cannot find $SCRIPT, aborting" 
0034     exit 1
0035   fi
0036 }
0037 
0038 GETCONTENT=$(findHltScript getEventContent.py)
0039 GETDATASETS=$(findHltScript getDatasets.py)
0040 
0041 function getConfigForCVS() {
0042   local CONFIG="$1"
0043   local NAME="$2"
0044   log "  dumping HLT cffs for $NAME from $CONFIG"
0045 
0046   # do not use any conditions or L1 override
0047   hltGetConfiguration --cff --data $CONFIG --type $NAME > HLT_${NAME}_cff.py
0048 }
0049 
0050 function getContentForCVS() {
0051   local CONFIG="$1"
0052 
0053   log "  dumping EventContet"
0054   $GETCONTENT $CONFIG
0055   rm -f hltOutput*_cff.py* hltScouting_cff.py*
0056 }
0057 
0058 function getDatasetsForCVS() {
0059   local CONFIG="$1"
0060   local TARGET="$2"
0061 
0062   log "  dumping Primary Dataset"
0063   $GETDATASETS $CONFIG > $TARGET
0064 }
0065 
0066 function getConfigForOnline() {
0067   local CONFIG="$1"
0068   local NAME="$2"
0069 # local L1T="tag[,connect]" - record is hardwired as L1GtTriggerMenuRcd
0070 
0071 # local L1TPP="L1GtTriggerMenu_L1Menu_Collisions2012_v3_mc,sqlite_file:/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_Collisions2012_v3/sqlFile/L1Menu_Collisions2012_v3_mc.db"
0072 # local L1TPP="L1GtTriggerMenu_L1Menu_Collisions2012_v3_mc"
0073 # local L1TPP="L1GtTriggerMenu_L1Menu_Collisions2015_25ns_v1_mc,sqlite_file:/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_Collisions2015_25ns_v1/sqlFile/L1Menu_Collisions2015_25ns_v1_mc.db"
0074 # local L1THI="L1GtTriggerMenu_L1Menu_CollisionsHeavyIons2011_v0_mc,sqlite_file:/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_CollisionsHeavyIons2011_v0/sqlFile/L1Menu_CollisionsHeavyIons2011_v0_mc.db"
0075 # local L1THI="L1GtTriggerMenu_L1Menu_CollisionsHeavyIons2011_v0_mc"
0076 # local L1THI="L1GtTriggerMenu_L1Menu_Collisions2012_v3_mc"
0077 # local L1THI="L1GtTriggerMenu_L1Menu_Collisions2015_25ns_v1_mc,sqlite_file:/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_Collisions2015_25ns_v1/sqlFile/L1Menu_Collisions2015_25ns_v1_mc.db"
0078 # local L1TPI="L1GtTriggerMenu_L1Menu_CollisionsHeavyIons2013_v0_mc,sqlite_file:/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_CollisionsHeavyIons2013_v0/sqlFile/L1Menu_CollisionsHeavyIons2013_v0_mc.db"
0079 # local L1TPI="L1GtTriggerMenu_L1Menu_CollisionsHeavyIons2013_v0_mc"
0080 # local L1TPI="L1GtTriggerMenu_L1Menu_Collisions2012_v3_mc"
0081 # local L1TPI="L1GtTriggerMenu_L1Menu_Collisions2015_25ns_v1_mc,sqlite_file:/afs/cern.ch/user/g/ghete/public/L1Menu/L1Menu_Collisions2015_25ns_v1/sqlFile/L1Menu_Collisions2015_25ns_v1_mc.db"
0082 
0083   local L1TPP1=""
0084   local L1TPP2=""
0085 
0086   log "  dumping full HLT for $NAME from $CONFIG"
0087   # override L1 menus
0088   if [ "$NAME" == "Fake" ]; then
0089     hltGetConfiguration --full --data $CONFIG --type $NAME --unprescale --process HLT$NAME --globaltag "auto:run1_hlt_${NAME}" --input "file:RelVal_Raw_${NAME}_DATA.root" > OnLine_HLT_$NAME.py
0090   elif [ "$NAME" == "Fake1" ] || [ "$NAME" == "Fake2" ] || [ "$NAME" == "2018" ]; then
0091     hltGetConfiguration --full --data $CONFIG --type $NAME --unprescale --process HLT$NAME --globaltag "auto:run2_hlt_${NAME}" --input "file:RelVal_Raw_${NAME}_DATA.root" > OnLine_HLT_$NAME.py
0092   else
0093     hltGetConfiguration --full --data $CONFIG --type $NAME --unprescale --process HLT$NAME --globaltag "auto:run3_hlt_${NAME}" --input "file:RelVal_Raw_${NAME}_DATA.root" > OnLine_HLT_$NAME.py
0094   fi
0095 
0096 }
0097 
0098 # make sure we're using *this* working area
0099 eval `scramv1 runtime -sh`
0100 hash -r
0101 
0102 # cff python dumps, in CVS under HLTrigger/Configuration/pyhon
0103 log "Extracting cff python dumps"
0104 echo "Extracting cff python dumps"
0105 FILES=$(eval echo HLT_FULL_cff.py HLT_{$TABLES_}_cff.py HLTrigger_Datasets_{$TABLES_}_cff.py HLTrigger_EventContent_cff.py )
0106 rm -f $FILES
0107 getConfigForCVS  $MASTER FULL
0108 getContentForCVS $MASTER
0109 for TABLE in $TABLES; do
0110   log "$TABLE"
0111   echo "$TABLE"
0112   getConfigForCVS $(eval echo $TARGET) $TABLE
0113   getDatasetsForCVS $(eval echo $TARGET) HLTrigger_Datasets_${TABLE}_cff.py
0114 done
0115 log "Done"
0116 log "$(ls -l $FILES)"
0117 mv -f $FILES ../python/
0118 log
0119 
0120 # full config dumps, in CVS under HLTrigger/Configuration/test
0121 log "Extracting full configuration dumps"
0122 echo "Extracting full configuration dumps"
0123 FILES=$(eval echo OnLine_HLT_FULL.py OnLine_HLT_{$TABLES_}.py)
0124 rm -f $FILES
0125 getConfigForOnline $MASTER FULL
0126 for TABLE in $TABLES; do
0127   log "$TABLE"
0128   echo "$TABLE"
0129   getConfigForOnline $(eval echo $TARGET) $TABLE
0130 done
0131 log "Done"
0132 log "$(ls -l $FILES)"
0133 log