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 | # this script doesn't need variable $doupdate
|
---|
13 | # filling is done by macro and update is always done
|
---|
14 |
|
---|
15 | # get dates
|
---|
16 | if [ "$certaindate" != "" ]
|
---|
17 | then
|
---|
18 | getdates $certaindate
|
---|
19 | else
|
---|
20 | # get all night
|
---|
21 | #getdates "all"
|
---|
22 | # get last 6 nights
|
---|
23 | getdates 6
|
---|
24 | fi
|
---|
25 |
|
---|
26 |
|
---|
27 | printprocesslog "INFO processing the following night(s): "${dates[@]}
|
---|
28 | echo `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
|
---|
29 |
|
---|
30 | cd $mars
|
---|
31 |
|
---|
32 | # do filling of aux data
|
---|
33 | for date in ${dates[@]}
|
---|
34 | do
|
---|
35 | auxdir=$auxdata/$date
|
---|
36 | runnumber=`echo $date | sed -e 's/\///g'`
|
---|
37 |
|
---|
38 | # check if aux files are available from that night
|
---|
39 | if ! [ -d $auxdir ]
|
---|
40 | then
|
---|
41 | printprocesslog "INFO no data available in "$auxdir
|
---|
42 | continue
|
---|
43 | else
|
---|
44 | printprocesslog "INFO processing files in "$auxdir
|
---|
45 | fi
|
---|
46 |
|
---|
47 | ratescanfile=$auxdir/$runnumber.RATE_SCAN_DATA.fits
|
---|
48 | printprocesslog "INFO processing "$ratescanfile
|
---|
49 | echo "INFO processing "$ratescanfile >> $logfile 2>&1
|
---|
50 | if ! [ -e $ratescanfile ]
|
---|
51 | then
|
---|
52 | rawdir=$rawdata/$date
|
---|
53 | # check if raw files are available from that night
|
---|
54 | if ! [ -d $rawdir ]
|
---|
55 | then
|
---|
56 | printprocesslog "INFO "$ratescanfile" not found."
|
---|
57 | else
|
---|
58 | printprocesslog "WARN "$ratescanfile" not found."
|
---|
59 | fi
|
---|
60 | continue
|
---|
61 | # else
|
---|
62 | # ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'`
|
---|
63 | # if [ $ratescannumerrors -gt 0 ]
|
---|
64 | # then
|
---|
65 | # printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
|
---|
66 | # fi
|
---|
67 | fi
|
---|
68 |
|
---|
69 | printprocesslog "INFO run fillratescan.C for night "$runnumber
|
---|
70 | echo "run fillratescan.C for night "$runnumber >> $logfile 2>&1
|
---|
71 | check1=`root -q -b -l fact/processing/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\) | tee $logfile | intgrep`
|
---|
72 | case $check1 in
|
---|
73 | 1) printprocesslog "INFO fillratescan.C was successfully for night "$runumber" (check1=$check1)."
|
---|
74 | ;;
|
---|
75 | 0) printprocesslog "WARN connection to DB failed (check1=$check1)."
|
---|
76 | ;;
|
---|
77 | *) printprocesslog "ERROR fillratescan.C failed for night "$runumber" (check1=$check1)."
|
---|
78 | ;;
|
---|
79 | esac
|
---|
80 |
|
---|
81 |
|
---|
82 | done
|
---|
83 |
|
---|
84 | finish
|
---|
85 |
|
---|
86 |
|
---|