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