| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 |
|
|---|
| 4 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 5 | printprocesslog "INFO starting $0"
|
|---|
| 6 |
|
|---|
| 7 | logfile=$2
|
|---|
| 8 |
|
|---|
| 9 | # make sure that no other RunCallisto.sh is started for this run
|
|---|
| 10 | touch $logfile
|
|---|
| 11 |
|
|---|
| 12 | cd $mars
|
|---|
| 13 |
|
|---|
| 14 | # check how many callistos are running
|
|---|
| 15 | callistocount=`ps aux | grep callisto_ | grep -E -o '20[12][0-9][01][0-9][0-3][0-9]_[0-9][0-9][0-9]' | sort | uniq | wc -l`
|
|---|
| 16 |
|
|---|
| 17 | while [ $callistocount -ge $numcallistos ]
|
|---|
| 18 | do
|
|---|
| 19 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 20 | printprocesslog "INFO wait "$callistowait" as "$callistocount" callistos running ( "$numcallistos" allowed). "
|
|---|
| 21 | sleep $callistowait
|
|---|
| 22 | callistocount=`ps aux | grep callisto_ | grep -E -o '20[12][0-9][01][0-9][0-3][0-9]_[0-9][0-9][0-9]' | sort | uniq | wc -l`
|
|---|
| 23 | done
|
|---|
| 24 |
|
|---|
| 25 | case $1 in
|
|---|
| 26 | drun) # process data run
|
|---|
| 27 | printprocesslog "DEBUG fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"\""\,"\"$6\""\) | tee $logfile "
|
|---|
| 28 | check1=`root -q -b fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"\""\,"\"$6\""\) | tee $logfile | intgrep`
|
|---|
| 29 | ;;
|
|---|
| 30 | prun) # process pedestal run
|
|---|
| 31 | # currently not done (s Step1.sh)
|
|---|
| 32 | printprocesslog "DEBUG fact/analysis/callisto_pedestal.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
|
|---|
| 33 | check1=`root -q -b fact/analysis/callisto_pedestal.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
|
|---|
| 34 | ;;
|
|---|
| 35 | crun) # process light-pulser run
|
|---|
| 36 | # currently not done (s Step1.sh)
|
|---|
| 37 | printprocesslog "DEBUG fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$6\""\) | tee $logfile "
|
|---|
| 38 | check1=`root -q -b fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$6\""\) | tee $logfile | intgrep`
|
|---|
| 39 | ;;
|
|---|
| 40 | time) # do drs-calib
|
|---|
| 41 | printprocesslog "DEBUG fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
|
|---|
| 42 | check1=`root -q -b fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
|
|---|
| 43 | ;;
|
|---|
| 44 | *) # default
|
|---|
| 45 | printprocesslog "WARN wrong parameter given to script RunCallisto.sh :"$1
|
|---|
| 46 | ;;
|
|---|
| 47 | esac
|
|---|
| 48 |
|
|---|
| 49 | case $check1 in
|
|---|
| 50 | 0) printprocesslog "INFO callisto was successful for file "$3" (check1=$check1)"
|
|---|
| 51 | if [ "$1" == "drun" ]
|
|---|
| 52 | then
|
|---|
| 53 | printprocesslog "INFO start RunStar.sh for file "$7
|
|---|
| 54 | starfile=`echo $7 | sed -e 's/callisto/star/g' -e 's/_C/_I/'`
|
|---|
| 55 | starlog=`echo $starfile | sed -e 's/_I.root/-images.log/'`
|
|---|
| 56 | outpath=`dirname $starfile`
|
|---|
| 57 | makedir $outpath
|
|---|
| 58 | `dirname $0`/RunStar.sh $starlog $7 $outpath $starfile
|
|---|
| 59 | fi
|
|---|
| 60 | ;;
|
|---|
| 61 | *) printprocesslog "ERROR callisto failed for file "$3" (check1=$check1)"
|
|---|
| 62 | # allow for reprocessing in case callisto fails once
|
|---|
| 63 | cplogfile=$logfile.cp
|
|---|
| 64 | if ! ls $cplogfile >/dev/null
|
|---|
| 65 | then
|
|---|
| 66 | mv $logfile $cplogfile
|
|---|
| 67 | fi
|
|---|
| 68 | ;;
|
|---|
| 69 | esac
|
|---|
| 70 |
|
|---|
| 71 | finish
|
|---|
| 72 |
|
|---|