| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 |
|
|---|
| 4 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 5 | printprocesslog "INFO starting $0"
|
|---|
| 6 | program=RunCallisto
|
|---|
| 7 | step=Callisto
|
|---|
| 8 |
|
|---|
| 9 | set -C
|
|---|
| 10 |
|
|---|
| 11 | for (( i=0; i<100; i++ ))
|
|---|
| 12 | do
|
|---|
| 13 | # get todo list
|
|---|
| 14 | gettodo "1"
|
|---|
| 15 |
|
|---|
| 16 | # get all needed variables
|
|---|
| 17 | night=${primaries[0]}
|
|---|
| 18 | seqid=${primaries[1]}
|
|---|
| 19 | nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
|
|---|
| 20 | seqnum=$night"_"`printf %03d $seqid`
|
|---|
| 21 |
|
|---|
| 22 | # check if script is already running
|
|---|
| 23 | lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
|
|---|
| 24 | checklock continue
|
|---|
| 25 | printprocesslog "INFO got todo with try #"$i
|
|---|
| 26 | break
|
|---|
| 27 | done
|
|---|
| 28 |
|
|---|
| 29 | # get all needed paths and files
|
|---|
| 30 | delays="resources/delays-20150217.txt"
|
|---|
| 31 | drstimefiles=`ls $drstimepath | sort`
|
|---|
| 32 | for drstimefile in $drstimefiles
|
|---|
| 33 | do
|
|---|
| 34 | num=`echo $drstimefile | cut -c 1-8`
|
|---|
| 35 | if [ $num -gt $night ]
|
|---|
| 36 | then
|
|---|
| 37 | break
|
|---|
| 38 | fi
|
|---|
| 39 | drstime=$drstimepath/$drstimefile
|
|---|
| 40 | done
|
|---|
| 41 |
|
|---|
| 42 | seqfile=$seqpath"/"$nightpath"/"$seqnum".seq"
|
|---|
| 43 | outpath=$datapath"/callisto/"$nightpath
|
|---|
| 44 | makedir $outpath
|
|---|
| 45 | logfile=$outpath"/"$seqnum"-calibration.log"
|
|---|
| 46 |
|
|---|
| 47 | cd $mars
|
|---|
| 48 |
|
|---|
| 49 | # run callisto
|
|---|
| 50 | printprocesslog "INFO starting callisto.C for sequence "$seqnum
|
|---|
| 51 | setstatus "start"
|
|---|
| 52 |
|
|---|
| 53 | printprocesslog "DEBUG root -q -b fact/analysis/callisto.C\("\"$seqfile\""\,"\"$outpath\""\,\""$drstime"\"\,\""$delays"\"\) | tee $logfile "
|
|---|
| 54 | check1=`root -q -b fact/analysis/callisto.C\("\"$seqfile\""\,"\"$outpath\""\,\""$drstime"\"\,\""$delays"\"\) | tee $logfile | intgrep`
|
|---|
| 55 |
|
|---|
| 56 | case $check1 in
|
|---|
| 57 | 0) printprocesslog "INFO callisto was successful for sequence "$seqnum" (check1=$check1)"
|
|---|
| 58 | ;;
|
|---|
| 59 | *) printprocesslog "ERROR callisto.C failed for sequence "$seqnum" (check1=$check1)"
|
|---|
| 60 | check=$check1
|
|---|
| 61 | ;;
|
|---|
| 62 | esac
|
|---|
| 63 |
|
|---|
| 64 | setstatus "stop"
|
|---|
| 65 |
|
|---|
| 66 | finish
|
|---|
| 67 |
|
|---|