Index: trunk/DataCheck/Processing/FillRatescans.sh
===================================================================
--- trunk/DataCheck/Processing/FillRatescans.sh	(revision 15067)
+++ trunk/DataCheck/Processing/FillRatescans.sh	(revision 15067)
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+source `dirname $0`/../Sourcefile.sh
+printprocesslog "INFO starting "$0
+
+# setup to use ftools
+source $HEADAS/headas-init.sh
+
+logfile=$runlogpath"/FillTemp-"$datetime".log"
+date >> $logfile
+
+# get last 3, 6 or 9 nights
+dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
+#        `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
+#        `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
+        )
+#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
+
+#dates=( "2013/01/31" )
+
+printprocesslog "INFO processing the following night(s): "${dates[@]}
+echo  `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
+
+echo ${dates[@]}
+
+cd $mars
+
+# do filling of aux data 
+for date in ${dates[@]}
+do 
+   auxdir=$auxdata/$date
+   runnumber=`echo $date | sed -e 's/\///g'`
+   
+   # check if aux files are available from that night
+   if ! [ -d $auxdir ]
+   then
+      printprocesslog "INFO no data available in "$auxdir
+      continue
+   else
+      printprocesslog "INFO processing files in "$auxdir
+   fi
+   
+   ratescanfile=$auxdir/$runnumber.RATE_SCAN_DATA.fits
+   if ! [ -e $ratescanfile ]
+   then 
+      printprocesslog "WARN "$ratescanfile" not found."
+      continue
+   else
+      ratescannumerrors=`fverify $ratescanfile 2>/dev/null | grep -o '[0-9][ ]error(s)'  | grep -E -o '[0-9]'`
+      if [ $ratescannumerrors -gt 0 ]
+      then 
+         printprocesslog "WARN for $ratescanfile fverify returned "$ratescannumerrors" error(s)."
+      fi
+   fi
+
+   echo "run fillratescan.C for night "$runnumber
+   root -q -b -l fact/fillratescan.C\("\"$ratescanfile"\"\,kFALSE\)
+
+done
+
+finish
+
+
