| 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.C | 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 "$callistocound" callistos running ( "$numcallistos" allowed). "
|
|---|
| 21 | sleep $callistowait
|
|---|
| 22 | callistocount=`ps aux | grep callisto.C | 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 | # run callisto
|
|---|
| 28 | echo "fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"\""\,"\"$6\""\) | tee $logfile "
|
|---|
| 29 | check1=`root -q -b fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"\""\,"\"$6\""\) | tee $logfile | intgrep`
|
|---|
| 30 | ;;
|
|---|
| 31 | prun) # process pedestal run
|
|---|
| 32 | echo "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 | echo "fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$6\""\) | tee $logfile "
|
|---|
| 37 | check1=`root -q -b fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$6\""\) | tee $logfile | intgrep`
|
|---|
| 38 | ;;
|
|---|
| 39 | time) # do drs-calib
|
|---|
| 40 | echo "fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
|
|---|
| 41 | check1=`root -q -b fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
|
|---|
| 42 | ;;
|
|---|
| 43 | *) # default
|
|---|
| 44 | printprocesslog "WARN wrong parameter given to script RunCallisto.sh :"$1
|
|---|
| 45 | ;;
|
|---|
| 46 | esac
|
|---|
| 47 |
|
|---|
| 48 | case $check1 in
|
|---|
| 49 | 0) printprocesslog "INFO callisto was successful for file "$3" (check1=$check1)"
|
|---|
| 50 | if [ "$1" == "drun" ]
|
|---|
| 51 | then
|
|---|
| 52 | printprocesslog "INFO start RunStar.sh for file "$7
|
|---|
| 53 | starfile=`echo $7 | sed -e 's/callisto/star/g' -e 's/_C/_I/'`
|
|---|
| 54 | starlog=`echo $starfile | sed -e 's/_I.root/-images.log/'`
|
|---|
| 55 | outpath=`dirname $starfile`
|
|---|
| 56 | makedir $outpath
|
|---|
| 57 | `dirname $0`/RunStar.sh $starlog $7 $outpath $starfile
|
|---|
| 58 | fi
|
|---|
| 59 | ;;
|
|---|
| 60 | *) printprocesslog "ERROR callisto failed for file "$3" (check1=$check1)"
|
|---|
| 61 | ;;
|
|---|
| 62 | esac
|
|---|
| 63 |
|
|---|
| 64 | finish
|
|---|
| 65 |
|
|---|