| 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-2006
|
|---|
| 23 | #
|
|---|
| 24 | #
|
|---|
| 25 | # ========================================================================
|
|---|
| 26 | #
|
|---|
| 27 | # This script launches the datacheck for all runs, which are not yet
|
|---|
| 28 | # checked
|
|---|
| 29 | #
|
|---|
| 30 | # Get todo file
|
|---|
| 31 | # Then for each run the following steps are done:
|
|---|
| 32 | # - filldotraw.C
|
|---|
| 33 | # - sinope (once for data and once for calibration events)
|
|---|
| 34 | # - fillsinope
|
|---|
| 35 | # - reset ExclusionsDone, so that the result from the datacheck can be
|
|---|
| 36 | # taken into account when doexclusions is running the next time
|
|---|
| 37 | # If this was successful, the status is inserted into the database using
|
|---|
| 38 | # the macro setstatus.C
|
|---|
| 39 | #
|
|---|
| 40 |
|
|---|
| 41 | source `dirname $0`/sourcefile
|
|---|
| 42 | program=datacheck
|
|---|
| 43 | column=fDataCheckDone
|
|---|
| 44 |
|
|---|
| 45 | set -C
|
|---|
| 46 |
|
|---|
| 47 | scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
|
|---|
| 48 | makedir $scriptlogpath
|
|---|
| 49 | scriptlog=$scriptlogpath/$program-$datetime.log
|
|---|
| 50 |
|
|---|
| 51 | date >> $scriptlog 2>&1
|
|---|
| 52 |
|
|---|
| 53 | # get run #
|
|---|
| 54 | gettodo >> $scriptlog 2>&1
|
|---|
| 55 | run=$process
|
|---|
| 56 |
|
|---|
| 57 | # lock sequ
|
|---|
| 58 | lockfile=$lockpath/lock-$table-$column-$run.txt
|
|---|
| 59 | checklock >> $scriptlog 2>&1
|
|---|
| 60 |
|
|---|
| 61 | cd $mars
|
|---|
| 62 |
|
|---|
| 63 | echo "do $program for run "$run >> $scriptlog 2>&1
|
|---|
| 64 | no=`printf %08d $run | cut -c 0-2`
|
|---|
| 65 | no2=`printf %08d $run`
|
|---|
| 66 | var1=$date
|
|---|
| 67 | var2=$no2
|
|---|
| 68 | rawfile=`find /magic/data/rawfiles/ -name *${run}_[D,P,C,S]_*_E.raw -o -name *${run}_[D,P,C,S]_*_E.raw.gz`
|
|---|
| 69 | echo "rawfile: "$rawfile >> $scriptlog 2>&1
|
|---|
| 70 | date=`echo $rawfile | cut -c 22-31`
|
|---|
| 71 | # for sinope the date is needed in the format YYYY-MM-DD
|
|---|
| 72 | date2=`echo $date | sed -e 's/\//-/g'`
|
|---|
| 73 |
|
|---|
| 74 | setstatus "start" >> $scriptlog 2>&1
|
|---|
| 75 |
|
|---|
| 76 | # running filldotraw
|
|---|
| 77 | echo "doing filldotraw..." >> $scriptlog 2>&1
|
|---|
| 78 | filldotrawpath=$logpath/filldotraw/$date
|
|---|
| 79 | makedir $filldotrawpath >> $scriptlog 2>&1
|
|---|
| 80 | filldotrawlogfile=$filldotrawpath/filldotraw-$no2.log
|
|---|
| 81 |
|
|---|
| 82 | check1=`root -q -b $macrospath/filldotraw.C+\("\"$rawfile\""\,kFALSE\) | tee $filldotrawlogfile | grep int | sed -e 's/.*(int)//'`
|
|---|
| 83 |
|
|---|
| 84 | case $check1 in
|
|---|
| 85 | 1) echo " check1=$check1 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
|
|---|
| 86 | ;;
|
|---|
| 87 | 0) echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
|
|---|
| 88 | check="no"
|
|---|
| 89 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 90 | continue ;;
|
|---|
| 91 | *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
|---|
| 92 | com=$Ffillraw
|
|---|
| 93 | check=$check1
|
|---|
| 94 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 95 | continue ;;
|
|---|
| 96 | esac
|
|---|
| 97 |
|
|---|
| 98 | # running sinope
|
|---|
| 99 | sinopepath=$datapath/sinope/$date
|
|---|
| 100 | makedir $sinopepath >> $scriptlog 2>&1
|
|---|
| 101 |
|
|---|
| 102 | sins=( "-dat" "-cal")
|
|---|
| 103 | for sin in ${sins[@]}
|
|---|
| 104 | do
|
|---|
| 105 | sinopefile=sinope$sin$no2
|
|---|
| 106 |
|
|---|
| 107 | echo "running sinope $sin..." >> $scriptlog 2>&1
|
|---|
| 108 | ./sinope -b -q -v4 -f $sin --outf=$sinopefile --out=$sinopepath --log=$sinopepath/$sinopefile.log --html=$sinopepath/$sinopefile.html --run=$run --date=$date2 2>> $scriptlog > /dev/null
|
|---|
| 109 | check2=$?
|
|---|
| 110 |
|
|---|
| 111 | case $check2 in
|
|---|
| 112 | 0) echo " check2=$check2 -> everything ok -> go on with $program..." >> $scriptlog 2>&1
|
|---|
| 113 | ;;
|
|---|
| 114 | *) echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
|---|
| 115 | com=$Fsinope
|
|---|
| 116 | # comadd=
|
|---|
| 117 | check=$check2
|
|---|
| 118 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 119 | continue 2;;
|
|---|
| 120 | esac
|
|---|
| 121 | check2=1
|
|---|
| 122 | done
|
|---|
| 123 |
|
|---|
| 124 | # running fillsinope
|
|---|
| 125 | fillsinopepath=$logpath/fillsinope/$date
|
|---|
| 126 | makedir $fillsinopepath >> $scriptlog 2>&1
|
|---|
| 127 | fillsinopelogfile=$fillsinopepath/fillsinope-$no2.log
|
|---|
| 128 |
|
|---|
| 129 | echo "doing fillsinope..." >> $scriptlog 2>&1
|
|---|
| 130 | check3=`root -q -b $macrospath/fillsinope.C+\($run\,"\"$datapath\""\,kFALSE\) | tee $fillsinopelogfile | grep int | sed -e 's/.*(int)//'`
|
|---|
| 131 |
|
|---|
| 132 | case $check3 in
|
|---|
| 133 | 1) echo " check3=$check3 -> everything ok -> set status..." >> $scriptlog 2>&1
|
|---|
| 134 | ;;
|
|---|
| 135 | 0) echo " check3=$check3 -> no connection to db -> continue..." >> $scriptlog 2>&1
|
|---|
| 136 | check="no"
|
|---|
| 137 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 138 | continue ;;
|
|---|
| 139 | *) echo " check3=$check3 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
|---|
| 140 | com=$Ffillsinope
|
|---|
| 141 | check=$check3
|
|---|
| 142 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 143 | continue ;;
|
|---|
| 144 | esac
|
|---|
| 145 |
|
|---|
| 146 | # resetting the status for exclusions
|
|---|
| 147 | echo "resetting the status for fExclusionsDone for date $date2" >> $scriptlog 2>&1
|
|---|
| 148 | resetlogpath=$logpath/resetexclusions/$date
|
|---|
| 149 | makedir $resetlogpath >> $scriptlog 2>&1
|
|---|
| 150 | resetlog=$resetlogpath/reset-exclusions-$no2-$date2.log
|
|---|
| 151 |
|
|---|
| 152 | check5=`root -q -b $macrospath/resetcolumn.C+\("\"fExclusionsDone\""\,"\"SequenceBuildStatus\""\,"\"$date2\""\,"\"$date2\""\,kFALSE\) | tee $resetlog | grep int | sed -e 's/(int)//'`
|
|---|
| 153 | case $check5 in
|
|---|
| 154 | 1) echo " check5=$check5 -> everything ok, fExclusions have been reset " >> $scriptlog 2>&1
|
|---|
| 155 | ;;
|
|---|
| 156 | 0) echo " check5=$check5 -> no connection to db -> continue..." >> $scriptlog 2>&1
|
|---|
| 157 | check="no"
|
|---|
| 158 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 159 | continue ;;
|
|---|
| 160 | *) echo " check5=$check5 -> ERROR -> step could not be resetted -> repeat step " >> $scriptlog 2>&1
|
|---|
| 161 | com=$Fresetexcl
|
|---|
| 162 | comadd=`echo $date2 | sed -e 's/-//g'`
|
|---|
| 163 | check=$check5
|
|---|
| 164 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 165 | continue ;;
|
|---|
| 166 | esac
|
|---|
| 167 |
|
|---|
| 168 | # set status
|
|---|
| 169 | statustime="Now()"
|
|---|
| 170 | failed="NULL"
|
|---|
| 171 | starttime="NULL"
|
|---|
| 172 | failedtime="NULL"
|
|---|
| 173 | var1=$date
|
|---|
| 174 | var2=$no2
|
|---|
| 175 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 176 |
|
|---|
| 177 | finish >> $scriptlog 2>&1
|
|---|
| 178 |
|
|---|