1 | #!/bin/bash
|
---|
2 |
|
---|
3 | source `dirname $0`/../Sourcefile.sh
|
---|
4 | printprocesslog "INFO starting "$0
|
---|
5 |
|
---|
6 | # setup to use ftools
|
---|
7 | source $HEADAS/headas-init.sh
|
---|
8 |
|
---|
9 | logfile=$runlogpath"/FillRatescan-"$datetime".log"
|
---|
10 | date >> $logfile
|
---|
11 |
|
---|
12 | # get last 3, 6 or 9 nights
|
---|
13 | dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
|
---|
14 | # `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
|
---|
15 | # `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
|
---|
16 | )
|
---|
17 | #dates=( `find -L $ziprawdata -mindepth 3 -type d | sort -r | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
|
---|
18 |
|
---|
19 | #dates=( "2013/01/31" )
|
---|
20 |
|
---|
21 | printprocesslog "INFO processing the following night(s): "${dates[@]}
|
---|
22 | echo `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
|
---|
23 |
|
---|
24 | echo ${dates[@]}
|
---|
25 |
|
---|
26 | cd $mars
|
---|
27 |
|
---|
28 | # do filling of aux data
|
---|
29 | for date in ${dates[@]}
|
---|
30 | do
|
---|
31 | auxdir=$auxdata/$date
|
---|
32 | runnumber=`echo $date | sed -e 's/\///g'`
|
---|
33 | echo $auxdir
|
---|
34 |
|
---|
35 | # check if aux files are available from that night
|
---|
36 | if ! [ -d $auxdir ]
|
---|
37 | then
|
---|
38 | printprocesslog "INFO no data available in "$auxdir
|
---|
39 | continue
|
---|
40 | else
|
---|
41 | printprocesslog "INFO processing files in "$auxdir
|
---|
42 | fi
|
---|
43 |
|
---|
44 | ratescanfile=$auxdir/$runnumber.RATE_SCAN_DATA.fits
|
---|
45 | ls $ratescanfile
|
---|
46 | if ! [ -e $ratescanfile ]
|
---|
47 | then
|
---|
48 | printprocesslog "WARN "$ratescanfile" not found."
|
---|
49 | continue
|
---|
50 | else
|
---|
51 | ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'`
|
---|
52 | if [ $ratescannumerrors -gt 0 ]
|
---|
53 | then
|
---|
54 | printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
|
---|
55 | fi
|
---|
56 | fi
|
---|
57 |
|
---|
58 | echo "run fillratescan.C for night "$runnumber
|
---|
59 | root -q -b -l fact/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\)
|
---|
60 |
|
---|
61 | done
|
---|
62 |
|
---|
63 | finish
|
---|
64 |
|
---|
65 |
|
---|