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