Ignore:
Timestamp:
04/21/13 01:50:22 (11 years ago)
Author:
Daniela Dorner
Message:
implemented sourcekey to get ra and dec for ganymed.C
File:
1 edited

Legend:

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

    r15383 r15400  
    33source `dirname $0`/../Sourcefile.sh
    44printprocesslog "INFO starting $0"
    5 
    6 #root=/opt/root_svn/bin/thisroot.sh
    7 #source $root
    8 #factpath=/home/fact/FACT++.in-run-fad-loss
    9 
    10 #anapath=/loc_data/analysis
    115
    126if [ "$1" = "" ]
     
    2115night=`echo $datepath | sed -e 's/\///g'`
    2216
    23 sources=( 1 2 5 7 )
    2417numganymeds=0
    2518
    26 for source in ${sources[@]}
     19# getting all image files for this night
     20printprocesslog "INFO get file list for night "$datepath
     21files=( `find /loc_data/analysis/star/$datepath -type f -name '*_I.root' 2>/dev/null | sort` )
     22if [ ${#files[@]} -eq 0 ]
     23then
     24   printprocesslog "INFO no image files available for night "$datepath
     25   continue
     26fi
     27# write data set file
     28#dspath=$anapath/$source/datasets`printf %03d $min`min/$datepath
     29#dspath=$anapath/$source/datasets_run/$datepath
     30dspath=$anapath/datasets_run/$datepath
     31makedir $dspath
     32
     33for (( i=1 ; i<=${#files[@]} ; i++ ))
    2734do
    28    ## doing first 5min datasets, i.e. one image file per dataset
    29    #min=5
    30    # getting all image files for this source and night
    31    printprocesslog "INFO get file list for source "$source
    32    files=( `find /loc_data/analysis/$source/star/$datepath -type f -name '*_I.root' 2>/dev/null | sort` )
    33    if [ ${#files[@]} -eq 0 ]
    34    then
    35       printprocesslog "INFO no image files available for source "$source" on "$datepath
     35   night=`basename ${files[$i-1]} | cut -d_ -f1`
     36   echo "night: "$night
     37   run=`basename ${files[$i-1]} | cut -d_ -f2`
     38   echo "run: "$run
     39   dsfile=$dspath"/dataset"$night"_"$run".txt"
     40   echo $dsfile
     41   printprocesslog "INFO writing dataset file "$dsfile
     42   # write dataset only if merpp-log is available to make sure that star-file is complete
     43   merpplog=`echo ${files[$i-1]} | sed -e 's/_I.root/-merpp.log/'`
     44   stillrunning=`find $merpplog -mmin -1 2>/dev/null`
     45   if [ -e $merpplog ] && [ "$stillrunning" == "" ]
     46   then
     47      echo `dirname ${files[$i-1]}`" "`basename ${files[$i-1]}` > $dsfile
     48   else
     49      echo "merpp still running - wait with file "${files[$i-1]}
    3650      continue
    3751   fi
    38    # write data set file
    39    #dspath=$anapath/$source/datasets`printf %03d $min`min/$datepath
    40    dspath=$anapath/$source/datasets_run/$datepath
    41    makedir $dspath
    42    for (( i=1 ; i<=${#files[@]} ; i++ ))
    43    do
     52   # process only if ganymedlogfiles is not yet there
     53   logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
     54   if ! ls $logfile >/dev/null 2>&1
     55   then
    4456      night=`basename ${files[$i-1]} | cut -d_ -f1`
     57      runid=`basename ${files[$i-1]} | cut -d_ -f2 | cut -d. -f1`
    4558      echo "night: "$night
    46       run=`basename ${files[$i-1]} | cut -d_ -f2`
    47       echo "run: "$run
    48       dsfile=$dspath"/dataset"$night"_"$run".txt"
    49       echo $dsfile
    50       printprocesslog "INFO writing dataset file "$dsfile
    51       # write dataset only if merpp-log is available to make sure that star-file is complete
    52       merpplog=`echo ${files[$i-1]} | sed -e 's/_I.root/-merpp.log/'`
    53       stillrunning=`find $merpplog -mmin -1 2>/dev/null`
    54       if [ -e $merpplog ] && [ "$stillrunning" == "" ]
    55       then
    56          echo `dirname ${files[$i-1]}`" "`basename ${files[$i-1]}` > $dsfile
     59      echo "runid: "$runid
     60      rawfilepath=$rawdata"/"$datepath"/"
     61      rawfilename=`basename ${files[$i-1]} | sed -e 's/_I.root/.fits/'`
     62      echo $rawfilepath
     63      echo $rawfilename
     64      rawfile=`find $rawfilepath -name $rawfilename*`
     65      ls $rawfile
     66      drivefile=$auxdata"/"$datepath"/"`basename ${files[$i-1]} | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
     67      ls $drivefile
     68      tstopi=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
     69      tstopf=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'`
     70      tstop=${tstopi}${tstopf}
     71      #echo "tstop: "$tstop
     72      if ls $drivefile >/dev/null 2>&1
     73         then
     74         coordinates=( `${factpath}/fitsdump ${drivefile} -c Ra_src Dec_src -r --filter='Time<'${tstop}  2>/dev/null | tail -1 2>&1` )
     75         if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
     76         then
     77            printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     78            echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     79            continue
     80         fi
     81         if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ]
     82         then
     83            printprocesslog "WARN coordinates "${coordinates[@]}
     84            echo "WARN coordinates "${coordinates[@]}
     85            continue
     86         fi
    5787      else
    58          echo "merpp still running - wait with file "${files[$i-1]}
    59          continue
     88         printprocesslog "DEBUG coordinates "${coordinates[@]}
     89         echo "DEBUG coordinates "${coordinates[@]}
     90         query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$night" AND fRunID="$runid
     91         sourcekey=`sendquery`
     92         if [ "$sourcekey" == "" ]
     93         then
     94            printprocesslog "WARN sourcekey empty - coordinates"${coordinates[@]}
     95            echo "WARN sourcekey empty - coordinates"${coordinates[@]}" for "$rawfile
     96            continue
     97         fi
     98         query="SELECT Round(fRightAscension,6), Round(fDeclination,6) from source WHERE fSourceKey="$sourcekey
     99         coordinates=( `sendquery` )
     100         if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
     101         then
     102            printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     103            echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     104            continue
     105         fi
     106         if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ]
     107         then
     108            printprocesslog "WARN coordinates "${coordinates[@]}
     109            echo "WARN coordinates "${coordinates[@]}
     110            continue
     111         fi
    60112      fi
    61       # process only if ganymedlogfiles is not yet there
    62       logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
    63       if ! ls $logfile >/dev/null 2>&1
    64       then
    65          echo $logfile" "${files[$i-1]}
    66          echo "`dirname $0`/RunGanymed.sh $source $dsfile"
    67          `dirname $0`/RunGanymed.sh $source $dsfile
    68          numganymeds=`echo " $numganymeds + 1 " | bc -l`
    69       fi
    70    done
     113
     114      echo $logfile" "${files[$i-1]}" -"${coordinates[0]}"-"${coordinates[1]}
     115      echo "`dirname $0`/RunGanymed.sh $dsfile "${coordinates[0]}" "${coordinates[1]}
     116      `dirname $0`/RunGanymed.sh $dsfile ${coordinates[0]} ${coordinates[1]}
     117      numganymeds=`echo " $numganymeds + 1 " | bc -l`
     118   fi
     119done
     120echo "found "$numganymeds" ganymeds."
    71121   
    72122#   # get list of 5min-dataset-files as starting point
     
    123173#   done
    124174
    125     echo "found "$numganymeds" ganymeds."
    126175#   if [ $numganymeds -gt 0 ]
    127176#   then
     
    136185#      numganymeds=0
    137186#   fi
    138 done
     187#done
    139188
    140189finish
Note: See TracChangeset for help on using the changeset viewer.