1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ========================================================================
|
---|
4 | #
|
---|
5 | # *
|
---|
6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | # * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | # * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | # *
|
---|
11 | # * Permission to use, copy, modify and distribute this software and its
|
---|
12 | # * documentation for any purpose is hereby granted without fee,
|
---|
13 | # * provided that the above copyright notice appear in all copies and
|
---|
14 | # * that both that copyright notice and this permission notice appear
|
---|
15 | # * in supporting documentation. It is provided "as is" without express
|
---|
16 | # * or implied warranty.
|
---|
17 | # *
|
---|
18 | #
|
---|
19 | #
|
---|
20 | # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | # Author(s): Stefan Ruegamer 08/2007 <mailto:snruegam@astro.uni-wuerzburg.de>
|
---|
22 | # Author(s): Daniel Hoehne 06/2008 <mailto:hoehne@astro.uni-wuerzburg.de>
|
---|
23 | #
|
---|
24 | # Copyright: MAGIC Software Development, 2000-2008
|
---|
25 | #
|
---|
26 | #
|
---|
27 | # ========================================================================
|
---|
28 | #
|
---|
29 | # This script is launching star for mc sequences.
|
---|
30 | #
|
---|
31 | # As star takes some time, only one mc sequence is processed at once.
|
---|
32 | # First the script gets a sequence number from the database for which
|
---|
33 | # star has to be done (function gettodo). After setting the status in the
|
---|
34 | # database (set fStartTime; to know that the sequence is already being
|
---|
35 | # processed), the image parameters are calculated for the sequence.
|
---|
36 | # Afterwards the status in the database is updated according to the return
|
---|
37 | # value of star.
|
---|
38 | # The important INFOs, WARNings and ERRORs are written not only to the
|
---|
39 | # scriptlog but also to the processlog.
|
---|
40 | #
|
---|
41 | # Atm the processing has to be done in a separate Mars directory because
|
---|
42 | # different sql.rc and steps.rc files are needed.
|
---|
43 | #
|
---|
44 | # The star.rc files are taken from the datacenter/setup/star directory
|
---|
45 | #
|
---|
46 |
|
---|
47 | source `dirname $0`/sourcefile
|
---|
48 | printprocesslog "INFO starting $0"
|
---|
49 | program=star
|
---|
50 | column=fStar
|
---|
51 |
|
---|
52 | set -C
|
---|
53 |
|
---|
54 | scriptlog=$runlogpath/runmc$program-$datetime.log
|
---|
55 | date >> $scriptlog 2>&1
|
---|
56 |
|
---|
57 | # get sequence #
|
---|
58 | gettodo >> $scriptlog 2>&1
|
---|
59 | sequence=$process
|
---|
60 |
|
---|
61 | # lock sequ
|
---|
62 | lockfile=$lockpath/lock-$table-$column-$sequence.txt
|
---|
63 | checklock >> $scriptlog 2>&1
|
---|
64 |
|
---|
65 | cd $mars
|
---|
66 |
|
---|
67 | echo "run $program for mc sequence $sequence..." >> $scriptlog 2>&1
|
---|
68 | printprocesslog "INFO starting $program for mc sequence $sequence"
|
---|
69 | no=`printf %08d $sequence | cut -c 0-4`
|
---|
70 | no2=`printf %08d $sequence`
|
---|
71 | outpath="$mcpath/$program/$no/$no2"
|
---|
72 | inpath=`echo $outpath | sed -e 's/star/callisto/'`
|
---|
73 | makedir $outpath >> $scriptlog 2>&1
|
---|
74 |
|
---|
75 | sequfile="$mcsequpath/$no/sequence$no2.txt"
|
---|
76 |
|
---|
77 | primvar=$no2
|
---|
78 | setstatus "start" >> $scriptlog 2>&1
|
---|
79 |
|
---|
80 | #echo "staging files..." >> $scriptlog 2>&1
|
---|
81 | #ssh -nx phoenix /opt/SUNWsamfs/bin/stage -V $inpath/19*_0*${run}_Y_*_E.root >> $scriptlog 2>&1
|
---|
82 |
|
---|
83 |
|
---|
84 | # define star.rc files
|
---|
85 | starrcnew=$setuppath/$program/star.rc
|
---|
86 | starrcmux=$setuppath/$program/star_mux.rc
|
---|
87 |
|
---|
88 | epoch=`grep Epoch $sequfile | cut -d: -f2 | grep Mux`
|
---|
89 | # link star.rc file
|
---|
90 | echo "linking the star.rc file to $outpath" >> $scriptlog 2>&1
|
---|
91 | if [ "$epoch" = "" ]
|
---|
92 | then
|
---|
93 | ln -vsf $starrcnew $outpath/star.rc >> $scriptlog 2>&1
|
---|
94 | else
|
---|
95 | ln -vsf $starrcmux $outpath/star.rc >> $scriptlog 2>&1
|
---|
96 | fi
|
---|
97 | starrcseq=$outpath/star.rc
|
---|
98 |
|
---|
99 | echo "./star -mc -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile --config=$starrcseq 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
|
---|
100 | ./star -mc -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile --config=$starrcseq 2>> $scriptlog> /dev/null
|
---|
101 | check1=$?
|
---|
102 |
|
---|
103 | case $check1 in
|
---|
104 | 0) echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
|
---|
105 | printprocesslog "INFO $program finished successfully for mc sequence $sequence"
|
---|
106 | ;;
|
---|
107 | *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
---|
108 | printprocesslog "ERROR $program failed for mc sequence $sequence"
|
---|
109 | com=$Fmcstar
|
---|
110 | check=$check1
|
---|
111 | ;;
|
---|
112 | esac
|
---|
113 |
|
---|
114 | setstatus "stop" >> $scriptlog 2>&1
|
---|
115 |
|
---|
116 | finish >> $scriptlog 2>&1
|
---|
117 |
|
---|