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 |
|
---|
29 | user=`whoami`
|
---|
30 | source /home/$user/Mars/datacenter/scripts/sourcefile
|
---|
31 |
|
---|
32 | table=RunProcessStatus
|
---|
33 | column=fTimingCorrection
|
---|
34 | date=NULL
|
---|
35 | datetime=`date +%F_%T`
|
---|
36 | year=`date +%Y`
|
---|
37 |
|
---|
38 | getstatuslogpath=$logpath/getstatus/correct_raw_time/$year
|
---|
39 | getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
|
---|
40 | makedir $getstatuslogpath >> $scriptlog 2>&1
|
---|
41 |
|
---|
42 | if [ -e $listpath/ToDo-$table-$column.txt ]
|
---|
43 | then
|
---|
44 | echo "correct_raw_time is already running -> exit"
|
---|
45 | exit
|
---|
46 | fi
|
---|
47 |
|
---|
48 | cd $mars
|
---|
49 |
|
---|
50 | echo "getting list..."
|
---|
51 | check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
|
---|
52 |
|
---|
53 | case $check0 in
|
---|
54 | 1) echo "check0=$check0 -> everything ok -> run correct_raw_time";;
|
---|
55 | *) echo "check0=$check0 -> ERROR -> step has to be repeated";;
|
---|
56 | esac
|
---|
57 |
|
---|
58 | runs=(`cat $listpath/ToDo-$table-$column.txt`)
|
---|
59 |
|
---|
60 | if [ "$runs" = "" ]
|
---|
61 | then
|
---|
62 | echo "nothing to do -> exit"
|
---|
63 | rm -v $listpath/ToDo-$table-$column.txt
|
---|
64 | exit
|
---|
65 | fi
|
---|
66 |
|
---|
67 | echo "runs: "${runs[@]}
|
---|
68 |
|
---|
69 | for run in ${runs[@]}
|
---|
70 | do
|
---|
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
|
---|
104 | done
|
---|
105 |
|
---|
106 | rm -v $listpath/ToDo-$table-$column.txt
|
---|
107 |
|
---|