source: trunk/Mars/datacenter/scripts/runmcstar@ 15487

Last change on this file since 15487 was 9221, checked in by hoehne, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.0 KB
Line 
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
47source `dirname $0`/sourcefile
48printprocesslog "INFO starting $0"
49program=star
50column=fStar
51
52set -C
53
54scriptlog=$runlogpath/runmc$program-$datetime.log
55date >> $scriptlog 2>&1
56
57# get sequence #
58gettodo "1" >> $scriptlog 2>&1
59sequence=${primaries[0]}
60
61# lock sequ
62lockfile=$lockpath/lock-$table-$column-$sequence.txt
63checklock >> $scriptlog 2>&1
64
65cd $mars
66
67echo "run $program for mc sequence $sequence..." >> $scriptlog 2>&1
68printprocesslog "INFO starting $program for mc sequence $sequence"
69no=`printf %08d $sequence | cut -c 0-4`
70no2=`printf %08d $sequence`
71outpath="$mcpath/$program/$no/$no2"
72inpath=`echo $outpath | sed -e 's/star/callisto/'`
73makedir $outpath >> $scriptlog 2>&1
74
75sequfile="$mcsequpath/$no/sequence$no2.txt"
76
77primvar=$no2
78setstatus "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
85starrcnew=$setuppath/$program/star.rc
86starrcmux=$setuppath/$program/star_mux.rc
87
88epoch=`grep Epoch $sequfile | cut -d: -f2 | grep Mux`
89# link star.rc file
90echo "linking the star.rc file to $outpath" >> $scriptlog 2>&1
91if [ "$epoch" = "" ]
92then
93 ln -vsf $starrcnew $outpath/star.rc >> $scriptlog 2>&1
94else
95 ln -vsf $starrcmux $outpath/star.rc >> $scriptlog 2>&1
96fi
97starrcseq=$outpath/star.rc
98
99echo "./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
101check1=$?
102
103case $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 ;;
112esac
113
114setstatus "stop" >> $scriptlog 2>&1
115
116finish >> $scriptlog 2>&1
117
Note: See TracBrowser for help on using the repository browser.