- Timestamp:
- 01/04/15 04:55:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/RunGanymed.sh
r17111 r18067 8 8 if ! [ "$1" = "" ] 9 9 then 10 dsfile=$1 11 ra=$2 12 dec=$3 10 starfile=$1 13 11 fi 14 12 15 if [ "$ dsfile" = "" ]13 if [ "$starfile" = "" ] 16 14 then 17 echo "ERROR variable dsfile empty."18 printprocesslog "ERROR variable dsfile empty."15 echo "ERROR variable starfile empty." 16 printprocesslog "ERROR variable starfile empty." 19 17 fi 20 18 21 if [ "$ra" = "" ] 19 # getting coordinates from raw and drive 20 date=`echo $starfile | grep -o -E '20[0-9][0-9]/[0-3][0-9]/[0-2][0-9]'` 21 drivefile=$auxdata"/"$date"/"`basename $starfile | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits" 22 rawfile=$rawdata"/"$date"/"`basename $starfile | sed -e 's/_I.root/.fits.fz/'` 23 if [ -e $rawfile ] 24 then 25 printprocesslog "INFO processing "$rawfile 26 tstopi=`$factpath/fitsdump -h $rawfile 2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'` 27 tstopf=`$factpath/fitsdump -h $rawfile 2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'` 28 tstop=${tstopi}${tstopf} 29 fi 30 if ls $drivefile >/dev/null 2>&1 && ! [ "$tstop" == "" ] 22 31 then 23 echo "ERROR variable ra empty." 24 printprocesslog "ERROR variable ra empty." 32 printprocesslog "INFO getting coordinates from "$drivefile 33 coordinates=( `${factpath}/fitsdump ${drivefile} -c Ra_src Dec_src -r --filter='Time<'${tstop} 2>/dev/null | tail -1 2>&1` ) 34 if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ] 35 then 36 printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile 37 echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile 38 finish 39 fi 40 if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ] 41 then 42 printprocesslog "WARN coordinates "${coordinates[@]} 43 echo "WARN coordinates "${coordinates[@]} 44 finish 45 fi 46 else 47 printprocesslog "INFO getting coordinates from DB." 48 query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$night" AND fRunID="$runid 49 sourcekey=`sendquery` 50 if [ "$sourcekey" == "" ] 51 then 52 printprocesslog "WARN sourcekey empty - coordinates"${coordinates[@]} 53 #echo "WARN sourcekey empty - coordinates"${coordinates[@]}" for "$rawfile 54 finish 55 fi 56 query="SELECT Round(fRightAscension,6), Round(fDeclination,6) from Source WHERE fSourceKey="$sourcekey 57 coordinates=( `sendquery` ) 58 if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ] 59 then 60 printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from DB." 61 #echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile 62 finish 63 fi 64 if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ] 65 then 66 printprocesslog "WARN coordinates "${coordinates[@]} 67 #echo "WARN coordinates "${coordinates[@]} 68 finish 69 fi 25 70 fi 71 ra=${coordinates[0]} 72 dec=${coordinates[1]} 26 73 27 if [ "$dec" = "" ]28 then29 echo "ERROR variable dec empty."30 printprocesslog "ERROR variable dec empty."31 fi32 74 33 outpath=`dirname $ dsfile | sed -e 's/datasets/ganymed/'`75 outpath=`dirname $starfile | sed -e 's/star/ganymed_run/'` 34 76 makedir $outpath 35 77 36 dsnum=`basename $dsfile | sed -e 's/dataset//' -e 's/[.]txt//'` 37 output=$outpath/$dsnum 78 output=$outpath/`basename $starfile | cut -dI -f1` 38 79 logfile=$output"-ganymed.log" 80 ganymedfile=$output"-analysis.root" 39 81 40 82 cd $mars 41 83 42 84 # run ganymed 43 printprocesslog "INFO starting ganymed.C for dataset "$dsfile 44 #echo "INFO starting ganymed.C for dataset "$dsfile 85 printprocesslog "INFO starting ganymed.C for starfile "$starfile 45 86 46 printprocesslog " INFO command: root -q -b fact/analysis/ganymed.C\("\"$dsfile\""\,"\"$output\""\,$ra\,$dec\) | tee $logfile | intgrep"47 check1=`root -q -b fact/analysis/ganymed.C\( "\"$dsfile\""\,"\"$output\""\,$ra\,$dec\) | tee $logfile | intgrep`87 printprocesslog "DEBUG root -q -b fact/analysis/ganymed.C\($ra\,$dec\,"\"$starfile\""\,"\"$output\""\) | tee $logfile | intgrep" 88 check1=`root -q -b fact/analysis/ganymed.C\($ra\,$dec\,"\"$starfile\""\,"\"$output\""\) | tee $logfile | intgrep` 48 89 49 90 case $check1 in 50 0) printprocesslog "INFO ganymed.C was successful for dataset "$dsfile" ra "$ra" dec "$dec" (check1=$check1)" 91 0) printprocesslog "INFO ganymed.C was successful for starfile "$starfile" ra "$ra" dec "$dec" (check1=$check1)" 92 93 echo "run numevts.C for "$ganymedfile" for table "$resulttable1 >> $logfile 2>&1 94 printprocesslog "INFO run numevts.C for "$ganyemdfile" for table "$resulttable1 95 printprocesslog "DEBUG root -q -b -l fact/processing/numevents.C+\("\"$ganymedfile"\"\,"\"$starfile"\"\,"\"$resulttable1"\"\,kFALSE\)" 96 check1=`root -q -b -l fact/processing/numevents.C+\("\"$ganymedfile"\"\,"\"$starfile"\"\,"\"$resulttable1"\"\,kFALSE\) | tee $logfile | intgrep` 97 case $check1 in 98 1) printprocesslog "INFO filling numevts.C was successfully for "$ganymedfile" and table "$resulttable1" (check1=$check1)" 99 ;; 100 0) printprocesslog "WARN connection to DB failed in numevts.C (check1=$check1)" 101 ;; 102 *) printprocesslog "ERROR numevts.C failed for "$ganymedfile" and table "$resulttable1" (check1=$check1)" 103 ;; 104 esac 51 105 ;; 52 *) printprocesslog "ERROR ganymed.C failed for dataset "$dsfile" ra "$ra" dec "$dec" (check1=$check1)"106 *) printprocesslog "ERROR ganymed.C failed for starfile "$starfile" ra "$ra" dec "$dec" (check1=$check1)" 53 107 ;; 54 108 esac
Note:
See TracChangeset
for help on using the changeset viewer.