Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#! /bin/bash

function usage() {
  echo "Usage: hltInfo FILE"
  echo
  echo "Print the CMSSW process names, releases, global tags, and the HLT menu, used to collect or simulate FILE."
}


if ! [ "$1" ]; then
  usage
  exit 1
fi

if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
  usage
  exit 0
fi

FILE="$1"

edmProvDump "$FILE" | awk '
  BEGIN {keep=0}
  /Producers with data in file/ {keep=0}
  /^Processing History:/ {keep=1; next}
  keep && NF >= 4 {
    proc = $1;
    rel  = gensub(/["'\'']/, "", "g", $2);
    hash = gensub(/[()]/, "", "g", $4);
    print proc, rel, hash;
  }
' | while read PROC REL HASH; do
  echo "process $PROC (release $REL)"
  edmProvDump "$FILE" --dumpPSetID "$HASH" 2>/dev/null | \
    grep -E '^\s*tableName:|^\s*globaltag:' | \
    sed -E -e 's/.*tableName:[^=]*= */   HLT menu:   /' \
           -e 's/.*globaltag:[^=]*= */   global tag: /'
  echo
done