Changeset 15400
- Timestamp:
- 04/21/13 01:50:22 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/Step2a.sh
r15383 r15400 3 3 source `dirname $0`/../Sourcefile.sh 4 4 printprocesslog "INFO starting $0" 5 6 #root=/opt/root_svn/bin/thisroot.sh7 #source $root8 #factpath=/home/fact/FACT++.in-run-fad-loss9 10 #anapath=/loc_data/analysis11 5 12 6 if [ "$1" = "" ] … … 21 15 night=`echo $datepath | sed -e 's/\///g'` 22 16 23 sources=( 1 2 5 7 )24 17 numganymeds=0 25 18 26 for source in ${sources[@]} 19 # getting all image files for this night 20 printprocesslog "INFO get file list for night "$datepath 21 files=( `find /loc_data/analysis/star/$datepath -type f -name '*_I.root' 2>/dev/null | sort` ) 22 if [ ${#files[@]} -eq 0 ] 23 then 24 printprocesslog "INFO no image files available for night "$datepath 25 continue 26 fi 27 # write data set file 28 #dspath=$anapath/$source/datasets`printf %03d $min`min/$datepath 29 #dspath=$anapath/$source/datasets_run/$datepath 30 dspath=$anapath/datasets_run/$datepath 31 makedir $dspath 32 33 for (( i=1 ; i<=${#files[@]} ; i++ )) 27 34 do 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]} 36 50 continue 37 51 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 44 56 night=`basename ${files[$i-1]} | cut -d_ -f1` 57 runid=`basename ${files[$i-1]} | cut -d_ -f2 | cut -d. -f1` 45 58 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 57 87 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 60 112 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 119 done 120 echo "found "$numganymeds" ganymeds." 71 121 72 122 # # get list of 5min-dataset-files as starting point … … 123 173 # done 124 174 125 echo "found "$numganymeds" ganymeds."126 175 # if [ $numganymeds -gt 0 ] 127 176 # then … … 136 185 # numganymeds=0 137 186 # fi 138 done187 #done 139 188 140 189 finish
Note:
See TracChangeset
for help on using the changeset viewer.