source: trunk/MagicSoft/Mars/datacenter/scripts/correcttime@ 8759

Last change on this file since 8759 was 8482, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.2 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#
22# Copyright: MAGIC Software Development, 2000-2007
23#
24#
25# ========================================================================
26#
27# This script runs the timing correction for all run, that need the timing
28# correction
29#
30# After checking if the script is already running the todolist is written.
31# Then for each run the timing correction is done
32# If this was successful, the status is inserted into the database using
33# the function setstatus.
34#
35# This script was needed for the data between 06/2004 and 02/2005 (including
36# this months).
37#
38
39source `dirname $0`/sourcefile
40printprocesslog "INFO starting $0"
41program=correct_raw_time
42column=fTimingCorrection
43
44scriptlog=$runlogpath/$program-$datetime.log
45date >> $scriptlog 2>&1
46
47if [ -e $todofile ]
48then
49 echo "$program is already running -> exit" >> $scriptlog 2>&1
50 exit
51fi
52
53# get todo list
54getdolist >> $scriptlog 2>&1
55
56# retrieving runs from todo file
57runs=(`cat $listpath/ToDo-$table-$column.txt`)
58if [ "$runs" = "" ]
59then
60 echo "nothing to do -> exit" >> $scriptlog 2>&1
61 finish >> $scriptlog 2>&1
62fi
63echo "runs: "${runs[@]} >> $scriptlog 2>&1
64
65cd $mars
66
67for run in ${runs[@]}
68do
69 printprocesslog "INFO run correct_raw_time for run $run"
70 no=`printf %08d $run | cut -c 1-5`
71 echo "getting path for run $run ... " >> $scriptlog 2>&1
72 infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[DCPS]_*`
73 echo "infile:"$infile >> $scriptlog 2>&1
74 outfile=`echo $infile | sed -e 's/-wrong-timing//g'`
75 echo "outfile:"$outfile >> $scriptlog 2>&1
76 outpath=`dirname $outfile`
77 echo "outpath:"$outpath >> $scriptlog 2>&1
78 makedir $outpath >> $scriptlog 2>&1
79
80 timecorrpath=$outpath"/timecorrlogs"
81 echo "timecorrpath: "$timecorrpath >> $scriptlog 2>&1
82 makedir $timecorrpath >> $scriptlog 2>&1
83
84 check1=0
85 echo "run $program..." >> $scriptlog 2>&1
86 primvar=$run
87 setstatus "start" >> $scriptlog 2>&1
88
89 /home/tape/MagicReadout/correct_raw_time $infile $outfile > $timecorrpath/$program-$run.log
90 check1=$?
91
92 case $check1 in
93 1) echo " check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1 ;;
94 *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
95 printprocesslog "ERROR $program failed"
96 com=$Ftimecorr
97 check=$check1
98 ;;
99 esac
100
101 setstatus "stop" >> $scriptlog 2>&1
102done
103
104finish >> $scriptlog 2>&1
105
Note: See TracBrowser for help on using the repository browser.