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

Last change on this file since 9969 was 9919, checked in by Daniela Dorner, 14 years ago
fixed queries for change from file based to run based processing
  • 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 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]}
42cereskey=${primaries[1]}
43
44# lock sequ for cal
45lockfile=$lockpath/lock-$step-$run.$cereskey.txt
46checklock
47
48cd $mars
49
50# run calibration for sequence
51printprocesslog "INFO starting $program for run $run and ceres-setup $cereskey"
52
53setstatus "start"
54
55setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
56
57query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey" GROUP BY fRunNumber"
58runkey=`sendquery`
59
60case $runkey in
61 2) printprocesslog "INFO run $run is a data run (key="$runkey")"
62 printprocesslog "INFO getting file numbers for run "$run
63 query="SELECT CONCAT('"$mcpath"/corsika/', LEFT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4),"
64 query=$query" '/', RIGHT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4), '/cer000', "
65 query=$query" RIGHT(LPAD(CeresInfo.fFileNumber, 6, '0'), 3)) from CeresInfo "
66 query=$query" WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey
67 inputfiles=`sendquery`
68 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
69 makedir $outpath
70 log=$outpath/ceres`printf %08d $run `
71 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run $inputfiles"
72 printprocesslog "INFO executing "$command
73 $command
74 check1=$?
75 ;;
76 3) printprocesslog "INFO run $run is a pedestal run (key="$runkey")"
77 drun=`echo "$run + 2 " | bc -l`
78 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
79 makedir $outpath
80 log=$outpath/ceres`printf %08d $run `
81 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
82 printprocesslog "INFO executing "$command
83 $command
84 check1=$?
85 ;;
86 4) printprocesslog "INFO run $run is a calibration run (key="$runkey")"
87 drun=`echo "$run + 1 " | bc -l`
88 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
89 makedir $outpath
90 log=$outpath/ceres`printf %08d $run `
91 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
92 printprocesslog "INFO executing "$command
93 $command
94 check1=$?
95 ;;
96 *) printprocesslog "WARN not valid fRunTypeKEY ("$runkey") was queried from the DB."
97 check="no"
98 ;;
99esac
100
101case $check1 in
102 0) printprocesslog "INFO $program finished successfully for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
103 ;;
104 *) printprocesslog "ERROR $program failed for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
105 check=$check1
106 ;;
107esac
108
109setstatus "stop"
110
111finish
112
Note: See TracBrowser for help on using the repository browser.