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"/FillTemp-"$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 |
|
---|
34 | # check if aux files are available from that night
|
---|
35 | if ! [ -d $auxdir ]
|
---|
36 | then
|
---|
37 | printprocesslog "INFO no data available in "$auxdir
|
---|
38 | continue
|
---|
39 | else
|
---|
40 | printprocesslog "INFO processing files in "$auxdir
|
---|
41 | fi
|
---|
42 |
|
---|
43 | ratescanfile=$auxdir/$runnumber.RATE_SCAN_DATA.fits
|
---|
44 | if ! [ -e $ratescanfile ]
|
---|
45 | then
|
---|
46 | printprocesslog "WARN "$ratescanfile" not found."
|
---|
47 | continue
|
---|
48 | else
|
---|
49 | ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'`
|
---|
50 | if [ $ratescannumerrors -gt 0 ]
|
---|
51 | then
|
---|
52 | printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
|
---|
53 | fi
|
---|
54 | fi
|
---|
55 |
|
---|
56 | echo "run fillratescan.C for night "$runnumber
|
---|
57 | root -q -b -l fact/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\)
|
---|
58 |
|
---|
59 | done
|
---|
60 |
|
---|
61 | finish
|
---|
62 |
|
---|
63 |
|
---|