source: trunk/Mars/datacenter/scripts/runceres@ 9872

Last change on this file since 9872 was 9612, checked in by Daniela Dorner, 14 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.9 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 06/2010 <mailto:daniela.dorner@unige.ch>
21#
22# Copyright: MAGIC Software Development, 2000-2010
23#
24#
25# ========================================================================
26#
27# This script is launching ceres for corsika runs.
28#
29# The ceres.rc and other setup files are stored in the setup directory.
30#
31
32source `dirname $0`/sourcefile
33printprocesslog "INFO starting $0"
34program=ceres
35step=Ceres
36
37set -C
38
39# get sequence #
40gettodo "1"
41run=${primaries[0]}
42file=${primaries[1]}
43cereskey=${primaries[2]}
44
45# lock sequ for cal
46lockfile=$lockpath/lock-$step-$run.$file.$cereskey.txt
47checklock
48
49cd $mars
50
51# run calibration for sequence
52printprocesslog "INFO starting $program for run $run and file $file and ceres-setup $cereskey"
53
54setstatus "start"
55
56setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
57
58query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fFileNumber="$file" AND fCeresSetupKEY="$cereskey
59runkey=`sendquery`
60
61case $runkey in
62 2) printprocesslog "INFO run $run and file $file is a data run (key="$runkey")"
63 inputfile=$mcpath/corsika/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`/cer000`printf %06d $file | cut -c 4-6`
64 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
65 makedir $outpath
66 log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
67 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run $inputfile"
68 printprocesslog "INFO executing "$command
69 $command
70 check1=$?
71 ;;
72 3) printprocesslog "INFO run $run and file $file is a pedestal run (key="$runkey")"
73 drun=`echo "$run + 2 " | bc -l`
74 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
75 makedir $outpath
76 log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
77 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
78 printprocesslog "INFO executing "$command
79 $command
80 check1=$?
81 ;;
82 4) printprocesslog "INFO run $run and file $file is a calibration run (key="$runkey")"
83 drun=`echo "$run + 1 " | bc -l`
84 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
85 makedir $outpath
86 log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
87 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
88 printprocesslog "INFO executing "$command
89 $command
90 check1=$?
91 ;;
92 *) printprocesslog "WARN not valid fRunTypeKEY ("$runkey")was queried from the DB."
93 finish
94 ;;
95esac
96
97case $check1 in
98 0) printprocesslog "INFO $program finished successfully for run $run file $file cereskey $cereskey runtype $runkey (check1=$check1)"
99 ;;
100 *) printprocesslog "ERROR $program failed for run $run file $file cereskey $cereskey runtype $runkey (check1=$check1)"
101 check=$check1
102 ;;
103esac
104
105setstatus "stop"
106
107finish
108
Note: See TracBrowser for help on using the repository browser.