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 | # get all needed paths and files
|
---|
26 | delays="resources/delays-20150217.txt"
|
---|
27 | drstimefiles=`ls $drstimepath | sort`
|
---|
28 | for drstimefile in $drstimefiles
|
---|
29 | do
|
---|
30 | num=`echo $drstimefile | cut -c 1-8`
|
---|
31 | if [ $num -gt $night ]
|
---|
32 | then
|
---|
33 | break
|
---|
34 | fi
|
---|
35 | drstime=$drstimepath/$drstimefile
|
---|
36 | done
|
---|
37 |
|
---|
38 | case $1 in
|
---|
39 | drun) # process data run
|
---|
40 | printprocesslog "DEBUG fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$drstime\""\,"\"$delays\""\,"\"$5\""\) | tee $logfile "
|
---|
41 | check1=`root -q -b fact/analysis/callisto_data.C\("\"$3\""\,"\"$4\""\,"\"$drstime\""\,"\"$delays\""\,"\"$5\""\) | tee $logfile | intgrep`
|
---|
42 | ;;
|
---|
43 | prun) # process pedestal run
|
---|
44 | # currently not done (s Step1.sh)
|
---|
45 | echo "processing pedetal runs currently not implemented"
|
---|
46 | # printprocesslog "DEBUG fact/analysis/callisto_pedestal.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
|
---|
47 | #check1=`root -q -b fact/analysis/callisto_pedestal.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
|
---|
48 | ;;
|
---|
49 | crun) # process light-pulser run
|
---|
50 | # currently not done (s Step1.sh)
|
---|
51 | echo "processing light-pulser runs currently not implemented"
|
---|
52 | #printprocesslog "DEBUG fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$5\""\) | tee $logfile "
|
---|
53 | #check1=`root -q -b fact/analysis/callisto_lightpulser.C\("\"$3\""\,"\"$4\""\,"\"$5\""\,"\"$5\""\) | tee $logfile | intgrep`
|
---|
54 | ;;
|
---|
55 | time) # do drs-time-calib
|
---|
56 | printprocesslog "DEBUG fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile "
|
---|
57 | check1=`root -q -b fact/analysis/callisto_drstime.C\("\"$3\""\,"\"$4\"","\"$5\""\) | tee $logfile | intgrep`
|
---|
58 | ;;
|
---|
59 | *) # default
|
---|
60 | printprocesslog "WARN wrong parameter given to script RunCallisto.sh :"$1
|
---|
61 | ;;
|
---|
62 | esac
|
---|
63 |
|
---|
64 | case $check1 in
|
---|
65 | 0) printprocesslog "INFO callisto was successful for file "$3" (check1=$check1)"
|
---|
66 | if [ "$1" == "drun" ]
|
---|
67 | then
|
---|
68 | printprocesslog "INFO start RunStar.sh for file "$6
|
---|
69 | starfile=`echo $6 | sed -e 's/callisto/star/g' -e 's/_C/_I/'`
|
---|
70 | starlog=`echo $starfile | sed -e 's/_I.root/-images.log/'`
|
---|
71 | outpath=`dirname $starfile`
|
---|
72 | makedir $outpath
|
---|
73 | `dirname $0`/RunStar.sh $starlog $6 $outpath $starfile
|
---|
74 | fi
|
---|
75 | ;;
|
---|
76 | *) printprocesslog "ERROR callisto failed for file "$3" (check1=$check1)"
|
---|
77 | # allow for reprocessing in case callisto fails once
|
---|
78 | cplogfile=$logfile.cp
|
---|
79 | if ! ls $cplogfile >/dev/null 2>/dev/null
|
---|
80 | then
|
---|
81 | mv $logfile $cplogfile
|
---|
82 | fi
|
---|
83 | ;;
|
---|
84 | esac
|
---|
85 |
|
---|
86 | finish
|
---|
87 |
|
---|