| 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 |
|
|---|
| 32 | source `dirname $0`/sourcefile
|
|---|
| 33 | printprocesslog "INFO starting $0"
|
|---|
| 34 | program=ceres
|
|---|
| 35 | step=Ceres
|
|---|
| 36 |
|
|---|
| 37 | set -C
|
|---|
| 38 |
|
|---|
| 39 | # get sequence #
|
|---|
| 40 | gettodo "1"
|
|---|
| 41 | run=${primaries[0]}
|
|---|
| 42 | file=${primaries[1]}
|
|---|
| 43 | cereskey=${primaries[2]}
|
|---|
| 44 |
|
|---|
| 45 | # lock sequ for cal
|
|---|
| 46 | lockfile=$lockpath/lock-$step-$run.$file.$cereskey.txt
|
|---|
| 47 | checklock
|
|---|
| 48 |
|
|---|
| 49 | cd $mars
|
|---|
| 50 |
|
|---|
| 51 | # run calibration for sequence
|
|---|
| 52 | printprocesslog "INFO starting $program for run $run and file $file and ceres-setup $cereskey"
|
|---|
| 53 |
|
|---|
| 54 | setstatus "start"
|
|---|
| 55 |
|
|---|
| 56 | outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
|
|---|
| 57 | makedir $outpath
|
|---|
| 58 | log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
|
|---|
| 59 | setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
|
|---|
| 60 |
|
|---|
| 61 | query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fFileNumber="$file" AND fCeresSetupKEY="$cereskey
|
|---|
| 62 | runkey=`sendquery`
|
|---|
| 63 |
|
|---|
| 64 | case $runkey in
|
|---|
| 65 | 2) printprocesslog "INFO run $run and file $file is a data run (key="$runkey")"
|
|---|
| 66 | 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`
|
|---|
| 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 | command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
|
|---|
| 74 | printprocesslog "INFO executing "$command
|
|---|
| 75 | $command
|
|---|
| 76 | check1=$?
|
|---|
| 77 | ;;
|
|---|
| 78 | 4) printprocesslog "INFO run $run and file $file is a calibration run (key="$runkey")"
|
|---|
| 79 | command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
|
|---|
| 80 | printprocesslog "INFO executing "$command
|
|---|
| 81 | $command
|
|---|
| 82 | check1=$?
|
|---|
| 83 | ;;
|
|---|
| 84 | *) printprocesslog "WARN not valid fRunTypeKEY ("$runkey")was queried from the DB."
|
|---|
| 85 | finish
|
|---|
| 86 | ;;
|
|---|
| 87 | esac
|
|---|
| 88 |
|
|---|
| 89 | case $check1 in
|
|---|
| 90 | 0) printprocesslog "INFO $program finished successfully for run $run file $file cereskey $cereskey runtype $runkey (check1=$check1)"
|
|---|
| 91 | ;;
|
|---|
| 92 | *) printprocesslog "ERROR $program failed for run $run file $file cereskey $cereskey runtype $runkey (check1=$check1)"
|
|---|
| 93 | check=$check1
|
|---|
| 94 | ;;
|
|---|
| 95 | esac
|
|---|
| 96 |
|
|---|
| 97 | setstatus "stop"
|
|---|
| 98 |
|
|---|
| 99 | finish
|
|---|
| 100 |
|
|---|