source: trunk/DataCheck/Processing/RunCeres.sh@ 13449

Last change on this file since 13449 was 13399, checked in by Daniela Dorner, 13 years ago
added (scripts and setup for MC processing)
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/bash
2#
3#
4# This script is launching ceres for corsika runs.
5#
6# The ceres.rc and other setup files are stored in the setup directory.
7#
8
9source `dirname $0`/../Sourcefile.sh
10printprocesslog "INFO starting $0"
11program=ceres
12step=Ceres
13
14set -C
15
16# get run #
17numchanged=0
18while (( 0 < 21 ))
19do
20 if ! [ $numchanged -eq 1 ]
21 then
22 if ! [ "$run" = "" ] && ! [ "$cereskey" = "" ]
23 then
24 printprocesslog "INFO $program for run $run cereskey $cereskey is already running => request new number "
25 fi
26 gettodo "1"
27 run=${primaries[0]}
28 cereskey=${primaries[1]}
29 if [ "$run" = "" ] || [ "$cereskey" = "" ]
30 then
31 printprocesslog "INFO nothing to do for $program "
32 fi
33 else
34 printprocesslog "INFO starting $program for run $run cereskey $cereskey"
35 break
36 fi
37 setstatus "start"
38done
39
40cd $mars
41
42# run ceres for run
43
44setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
45
46query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey" GROUP BY fRunNumber"
47runkey=`sendquery`
48
49case $runkey in
50 2) printprocesslog "INFO run $run is a data run (key="$runkey")"
51 printprocesslog "INFO getting file numbers for run "$run
52 query="SELECT CONCAT('"$mcpath"/corsika/', LEFT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4),"
53 query=$query" '/', RIGHT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4), '/cer000', "
54 query=$query" RIGHT(LPAD(CeresInfo.fFileNumber, 6, '0'), 3)) from CeresInfo "
55 query=$query" WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey
56 inputfiles=`sendquery`
57 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
58 makedir $outpath
59 log=$outpath/ceres`printf %08d $run `
60 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run $inputfiles"
61 printprocesslog "INFO executing "$command
62 $command
63 check1=$?
64 ;;
65 3) printprocesslog "INFO run $run is a pedestal run (key="$runkey")"
66 drun=`echo "$run + 2 " | bc -l`
67 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
68 makedir $outpath
69 log=$outpath/ceres`printf %08d $run `
70 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
71 printprocesslog "INFO executing "$command
72 $command
73 check1=$?
74 ;;
75 4) printprocesslog "INFO run $run is a calibration run (key="$runkey")"
76 drun=`echo "$run + 1 " | bc -l`
77 outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
78 makedir $outpath
79 log=$outpath/ceres`printf %08d $run `
80 command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
81 printprocesslog "INFO executing "$command
82 $command
83 check1=$?
84 ;;
85 *) printprocesslog "WARN not valid fRunTypeKEY ("$runkey") was queried from the DB."
86 check="no"
87 ;;
88esac
89
90case $check1 in
91 0) printprocesslog "INFO $program finished successfully for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
92 ;;
93 *) printprocesslog "ERROR $program failed for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
94 check=$check1
95 ;;
96esac
97
98setstatus "stop"
99
100finish
101
Note: See TracBrowser for help on using the repository browser.