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

Last change on this file since 7413 was 7265, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.3 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-2004
23#
24#
25# ========================================================================
26#
27#
28
29user=`whoami`
30source /home/$user/Mars/datacenter/scripts/sourcefile
31
32table=RunProcessStatus
33column=fTimingCorrection
34date=NULL
35datetime=`date +%F_%T`
36year=`date +%Y`
37
38getstatuslogpath=$logpath/getstatus/correct_raw_time/$year
39getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
40makedir $getstatuslogpath >> $scriptlog 2>&1
41
42if [ -e $listpath/ToDo-$table-$column.txt ]
43then
44 echo "correct_raw_time is already running -> exit"
45 exit
46fi
47
48cd $mars
49
50echo "getting list..."
51check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
52
53case $check0 in
54 1) echo "check0=$check0 -> everything ok -> run correct_raw_time";;
55 *) echo "check0=$check0 -> ERROR -> step has to be repeated";;
56esac
57
58runs=(`cat $listpath/ToDo-$table-$column.txt`)
59
60if [ "$runs" = "" ]
61then
62 echo "nothing to do -> exit"
63 rm -v $listpath/ToDo-$table-$column.txt
64 exit
65fi
66
67echo "runs: "${runs[@]}
68
69for run in ${runs[@]}
70do
71 echo "getting path for run $run ... "
72 infile=`find $datapath/rawfiles-wrong-timing/ -name *${run}_[D,C,P,S]_*`
73 echo "infile:"$infile
74 outfile=`echo $infile | sed -e 's/-wrong-timing//g'`
75 echo "outfile:"$outfile
76 outpath=`dirname $outfile`
77 echo "outpath:"$outpath
78 makedir $outpath
79
80 timecorrpath=$outpath"/timecorrlogs"
81 echo "timecorrpath: "$timecorrpath
82 make dir $timecorrpath
83
84 check1=0
85 echo "run correct_raw_time..."
86 /home/tape/MagicReadout/correct_raw_time $infile $outfile > $timecorrpath/correct_raw_time-$run.log
87 check1=$?
88
89 case $check1 in
90 1) echo "check1=$check1 -> everything ok -> setting status..."
91 no=`printf %08d $run | cut -c 1-5`
92 setstatuspath=$logpath/setstatus/correct_raw_time/$no
93 echo "setstatuspath: "$setstatuspath
94 makedir $setstatuspath
95
96 check2=`root -q -b $macrospath/setstatus.C+\("\"$run\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuspath/setstatus-correct_raw_time-$run.log | grep int | sed -e 's/(int)//'`
97 case $check2 in
98 0) echo "check2=0 -> ERROR -> step could not be set";;
99 1) echo "check2=1 -> everything ok, status has been set";;
100 esac
101 ;;
102 *) echo "check1=$check1 -> ERROR -> step has to be repeated";;
103 esac
104done
105
106rm -v $listpath/ToDo-$table-$column.txt
107
Note: See TracBrowser for help on using the repository browser.