source: trunk/DataCheck/QuickLook/RunCallisto.sh@ 19846

Last change on this file since 19846 was 18769, checked in by Daniela Dorner, 8 years ago
improved logging
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6
7logfile=$2
8
9# make sure that no other RunCallisto.sh is started for this run
10touch $logfile
11
12cd $mars
13
14# check how many callistos are running
15callistocount=`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
17while [ $callistocount -ge $numcallistos ]
18do
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`
23done
24
25# get all needed paths and files
26delays="resources/delays-20150217.txt"
27drstimefiles=`ls $drstimepath | sort`
28night=`basename $3 | cut -c 1-8`
29for drstimefile in $drstimefiles
30do
31 num=`basename $drstimefile | cut -c 1-8`
32 if [ $num -gt $night ]
33 then
34 break
35 fi
36 drstime=$drstimepath/$drstimefile
37done
38
39case $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 ;;
63esac
64
65case $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 ;;
87esac
88
89finish
90
Note: See TracBrowser for help on using the repository browser.