Changeset 18067 for trunk


Ignore:
Timestamp:
01/04/15 04:55:42 (10 years ago)
Author:
Daniela Dorner
Message:
added call of numevts.C, added getting of ra/dec
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/QuickLook/RunGanymed.sh

    r17111 r18067  
    88if ! [ "$1" = "" ]
    99then
    10    dsfile=$1
    11    ra=$2
    12    dec=$3
     10   starfile=$1
    1311fi
    1412
    15 if [ "$dsfile" = "" ]
     13if [ "$starfile" = "" ]
    1614then
    17    echo "ERROR variable dsfile empty."
    18    printprocesslog "ERROR variable dsfile empty."
     15   echo "ERROR variable starfile empty."
     16   printprocesslog "ERROR variable starfile empty."
    1917fi
    2018
    21 if [ "$ra" = "" ]
     19# getting coordinates from raw and drive
     20date=`echo $starfile | grep -o -E '20[0-9][0-9]/[0-3][0-9]/[0-2][0-9]'`
     21drivefile=$auxdata"/"$date"/"`basename $starfile | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
     22rawfile=$rawdata"/"$date"/"`basename $starfile | sed -e 's/_I.root/.fits.fz/'`
     23if [ -e $rawfile ]
     24then
     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}
     29fi
     30if  ls $drivefile >/dev/null 2>&1  && ! [ "$tstop" == "" ]
    2231then
    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
     46else
     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
    2570fi
     71ra=${coordinates[0]}
     72dec=${coordinates[1]}
    2673
    27 if [ "$dec" = "" ]
    28 then
    29    echo "ERROR variable dec empty."
    30    printprocesslog "ERROR variable dec empty."
    31 fi
    3274
    33 outpath=`dirname $dsfile | sed -e 's/datasets/ganymed/'`
     75outpath=`dirname $starfile | sed -e 's/star/ganymed_run/'`
    3476makedir $outpath
    3577
    36 dsnum=`basename $dsfile | sed -e 's/dataset//' -e 's/[.]txt//'`
    37 output=$outpath/$dsnum
     78output=$outpath/`basename $starfile | cut -dI -f1`
    3879logfile=$output"-ganymed.log"
     80ganymedfile=$output"-analysis.root"
    3981
    4082cd $mars
    4183
    4284# run ganymed
    43 printprocesslog "INFO starting ganymed.C for dataset "$dsfile
    44 #echo "INFO starting ganymed.C for dataset "$dsfile
     85printprocesslog "INFO starting ganymed.C for starfile "$starfile
    4586
    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`
     87printprocesslog "DEBUG root -q -b fact/analysis/ganymed.C\($ra\,$dec\,"\"$starfile\""\,"\"$output\""\) | tee $logfile | intgrep"
     88check1=`root -q -b fact/analysis/ganymed.C\($ra\,$dec\,"\"$starfile\""\,"\"$output\""\) | tee $logfile | intgrep`
    4889
    4990case $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
    51105        ;;
    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)"
    53107        ;;
    54108esac
Note: See TracChangeset for help on using the changeset viewer.