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

Last change on this file since 7076 was 7030, checked in by Daniela Dorner, 20 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.9 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
29source /home/operator/Mars/datacenter/scripts/sourcefile
30
31table=RunProcessStatus
32column=fTimingCorrection
33date=NULL
34datetime=`date +%F_%T`
35year=`date +%Y`
36
37listdir=/magic/datacenter/lists
38getstatuslogpath=$logpath/getstatus/correct_raw_time/$year
39getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
40
41if [ ! -d $getstatuslogpath ]
42then
43 mkdir -pv $getstatuslogpath
44 if [ ! -d $getstatuslogpath ]
45 then
46 echo "could not make getstatuslogpath "$getstatuslogpath
47 exit
48 fi
49fi
50
51
52if [ -e $listdir/ToDo-$table-$column.txt ]
53then
54 echo "correct_raw_time is already running -> exit"
55 exit
56fi
57
58cd $mars
59
60echo "getting list..."
61check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
62
63case $check0 in
64 1) echo "check0=$check0 -> everthing ok -> run correct_raw_time";;
65 *) echo "check0=$check0 -> ERROR -> step has to be repeated";;
66esac
67
68runs=(`cat $listdir/ToDo-$table-$column.txt`)
69
70if [ "$runs" = "" ]
71then
72 echo "nothing to do -> exit"
73 rm -v $listdir/ToDo-$table-$column.txt
74 exit
75fi
76
77echo "runs: "${runs[@]}
78
79for run in ${runs[@]}
80do
81 echo "getting path for run $run ... "
82 infile=`find /magic/data/rawfiles-wrong-timing/ -name *${run}_[D,C,P,S]_*`
83 echo "infile:"$infile
84 outfile=`echo $infile | sed -e 's/-wrong-timing//g'`
85 echo "outfile:"$outfile
86 outpath=`dirname $outfile`
87 echo "outpath:"$outpath
88 if [ ! -d $outpath ]
89 then
90 mkdir -pv $outpath
91 if [ ! -d $outpath ]
92 then
93 echo "could not make outpath "$outpath
94 continue
95 fi
96 fi
97 timecorrpath=$outpath"/timecorrlogs"
98 echo "timecorrpath: "$timecorrpath
99 if [ ! -d $timecorrpath ]
100 then
101 mkdir -pv $timecorrpath
102 if [ ! -d $timecorrpath ]
103 then
104 echo "could not make timecorrpath "$timecorrpath
105 continue
106 fi
107 fi
108
109 check1=0
110 echo "run correct_raw_time..."
111 /home/tape/MagicReadout/correct_raw_time $infile $outfile > $timecorrpath/correct_raw_time-$run.log
112 check1=$?
113
114 case $check1 in
115 1) echo "check1=$check1 -> everthing ok -> setting status..."
116 no=`printf %08d $run | cut -c 1-5`
117 setstatuspath=$logpath/setstatus/correct_raw_time/$no
118 echo "setstatuspath: "$setstatuspath
119 if [ ! -d $setstatuspath ]
120 then
121 mkdir -pv $setstatuspath
122 if [ ! -d $setstatuspath ]
123 then
124 echo "could not make setstatuspath $setstatuspath -> continue "
125 continue
126 fi
127 fi
128 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)//'`
129 case $check2 in
130 0) echo "check2=0 -> ERROR -> step could not be set";;
131 1) echo "check2=1 -> everthing ok, status has been set";;
132 esac
133 ;;
134 *) echo "check1=$check1 -> ERROR -> step has to be repeated";;
135 esac
136done
137
138rm -v $listdir/ToDo-$table-$column.txt
139
Note: See TracBrowser for help on using the repository browser.