Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:12:55

0001 #! /bin/bash
0002 
0003 # The script is used to query file list from DBS
0004 # use ./getrun.sh -h for help on the usage
0005 #
0006 #                           Dayong WANG June, 2009
0007 
0008 function usage {
0009 
0010     echo "Usage: "
0011     echo "    1) query file list with run number and dataset name: ./getrun.sh -r RUNNUMBER (datasetname)"
0012     echo "    2) query file list with run number range [MIN, MAX) and dataset name:  ./getrun.sh  RUNNUMBER_MIN  RUNNUMBER_MAX (datasetname)"
0013 
0014 }
0015 
0016 
0017 while getopts ":r:h" opt; do
0018     case $opt in
0019 
0020         r)
0021             if [ $# -eq 2 ]; then
0022                 mydataset="/Cosmics/Commissioning08_CRAFT_ALL_V9_225_ReReco_FromTrackerPointing_v1/RECO"
0023             elif [ $# -eq 3 ]; then
0024                 mydataset=$3
0025             elif [ $# -eq 0 ]; then
0026                 echo "please provide the run number and (data set name) to query!"
0027                 exit 2
0028             fi
0029 
0030             ./DDSearchCLI.py --verbose=0 --limit=-1 --input="find file where run=$OPTARG and dataset=$mydataset" | grep "root"
0031             ;;
0032         \?)
0033             echo "Invalid option: -$OPTARG" >&2
0034             exit 1
0035             ;;
0036         h)
0037             usage
0038             ;;
0039         :)
0040             echo "Option -$OPTARG requires an argument to specify run number query  mode" >&2
0041             exit 1
0042             ;;
0043     esac
0044     exit 0
0045 done
0046 
0047 if [ $# -eq 2 ]; then
0048     mydataset="/Cosmics/Commissioning08_CRAFT_ALL_V9_225_ReReco_FromTrackerPointing_v1/RECO"
0049 elif [ $# -eq 3 ]; then
0050     mydataset=$3
0051 elif [ $# -lt 2 ]; then
0052     echo "please provide the range of run numbers and (data set name) to query!"
0053     exit 2
0054 fi
0055 
0056 ./DDSearchCLI.py --verbose=0 --limit=-1 --input="find file where run >= $1 and run < $2 and dataset=$mydataset" | grep "root"
0057 
0058 
0059 
0060 
0061