source: branches/trigger_burst_research/QuickLook/RunCallisto.sh@ 20051

Last change on this file since 20051 was 18268, checked in by Daniela Dorner, 9 years ago
implemented usage of delays-file and general drs-time-file
  • Property svn:executable set to *
File size: 3.3 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`
28for drstimefile in $drstimefiles
29do
30 num=`echo $drstimefile | cut -c 1-8`
31 if [ $num -gt $night ]
32 then
33 break
34 fi
35 drstime=$drstimepath/$drstimefile
36done
37
38case $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 ;;
62esac
63
64case $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 ;;
84esac
85
86finish
87
Note: See TracBrowser for help on using the repository browser.