source: trunk/Mars/datacenter/scripts/runmccallisto@ 18066

Last change on this file since 18066 was 9221, checked in by hoehne, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.1 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): Daniel Hoehne-Moench 01/2009 <mailto:hoehne@astro.uni-wuerzburg.de>
22#
23# Copyright: MAGIC Software Development, 2000-2009
24#
25#
26# ========================================================================
27#
28# This script is launching the calibration of mc sequences.
29#
30# As callisto takes some time, only one sequence is processed at once.
31# First the script gets a sequence number from the mc database, for which
32# the calibration has to be done (function gettodo). After setting the
33# status in the database (set fStartTime to know, that the sequence is
34# already being processed), the sequence is calibrated. Afterwards
35# the status in the mc database is updated according to the return value
36# of the program.
37# The important INFOs, WARNings and ERRORs are written not only to the
38# scriptlog but also to the processlog.
39#
40# Atm the processing has to be done in a separate Mars directory because
41# different sql.rc and steps.rc files are needed.
42#
43# The callisto.rc files are stored in the setup directory
44#
45
46source `dirname $0`/sourcefile
47printprocesslog "INFO starting $0"
48program=callisto
49column=fCallisto
50
51set -C
52
53scriptlog=$runlogpath/runmc$program-$datetime.log
54date >> $scriptlog 2>&1
55
56# get sequence #
57gettodo "1" >> $scriptlog 2>&1
58sequence=${primaries[0]}
59
60# lock sequ for cal
61lockfile=$lockpath/lock-$table-$column-$sequence.txt
62checklock >> $scriptlog 2>&1
63
64cd $mars
65
66# run calibration for sequence
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"
72makedir $outpath >> $scriptlog 2>&1
73sequfile="$mcsequpath/$no/sequence$no2.txt"
74
75# define callisto.rc files
76callistorcnew=$setuppath/$program/callisto.rc
77callistorcmux=$setuppath/$program/callisto_mux.rc
78
79epoch=`grep Epoch $sequfile | cut -d: -f2 | grep Mux`
80# find callisto.rc file
81if [ -e $outpath/callisto.rc ]
82then
83 echo "found $program.rc in $outpath -> using this " >> $scriptlog 2>&1
84 callistorcseq=$outpath/callisto.rc
85else
86 echo "no $program.rc found in $outpath -> making link " >> $scriptlog 2>&1
87 if [ "$epoch" = "" ]
88 then
89 ln -vs $callistorcnew $outpath/callisto.rc >> $scriptlog 2>&1
90 else
91 ln -vs $callistorcmux $outpath/callisto.rc >> $scriptlog 2>&1
92 fi
93 callistorcseq=$outpath/callisto.rc
94fi
95
96primvar=$no2
97setstatus "start" >> $scriptlog 2>&1
98
99echo "./callisto -mc -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile 2>> $scriptlog > /dev/null" >> $scriptlog 2>&1
100./callisto -mc -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile 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 (return code $check1)"
109 com=$Fmccallisto
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.