Index: trunk/DataCheck/Processing/FillAuxData.sh
===================================================================
--- trunk/DataCheck/Processing/FillAuxData.sh	(revision 18672)
+++ trunk/DataCheck/Processing/FillAuxData.sh	(revision 18682)
@@ -63,5 +63,5 @@
    if [ "$2" = "" ]
    then
-      printprocesslog "WARN couldn't get statistics from file $1 for run "$date" "$file
+      printprocesslog "WARN couldn't get statistics from file $1 for run "$date" "$rawfile
       continue
    fi
@@ -74,5 +74,10 @@
    if [ "$evaluation" = "" ]
    then
-      printprocesslog "WARN empty evaluation of statistic ("$@") for run "$date" "$file
+      if [ $runtypekey -ne 1 ] #|| [ $sourcekey -gt 0 ] #doesn't work as sourcekey can be empty
+      then
+         printprocesslog "DEBUG empty evaluation of statistic ("$@") for run "$date" file "$rawfile
+      else
+         printprocesslog "WARN empty evaluation of statistic ("$@") for run "$date" file "$rawfile
+      fi
    fi
    min=`echo $evaluation | grep -E -o 'Min:\ [-]?[0-9]+[.]?[0-9]*' | sed -e 's/Min:\ //'`
@@ -173,5 +178,5 @@
  
       # get information from rawfile
-      rawfile=`ls $rawdir/$runnumber"_"\`printf %03d $filenum\`.fits*`
+      rawfile=`ls $rawdir/$runnumber"_"\`printf %03d $filenum\`.fits* 2>/dev/null`
       if ! [ -e $rawfile ]
       then 
@@ -180,5 +185,5 @@
       fi
 
-      #runtype=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep RUNTYPE | grep -E -o "['][a-z-]+[']" | sed -e "s/'//g"`
+      runtype=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep RUNTYPE | grep -E -o "['][a-z-]+[']" | sed -e "s/'//g"`
       #mjdrefraw=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep 'MJDREF' | grep -E -o '[0-9]{5}'`
       tstarti=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep 'TSTARTI' | grep -E -o '[0-9]{5}'`
@@ -234,43 +239,45 @@
          fi
       fi
+      # set runtype to 'unknown', if no runtype could be retrieved from file
+      if [ "$runtype" == "" ]
+      then
+         runtype="n/a"
+      fi
+      # on 15.11.2011 the runtypes had different names
+      if [ "$date" == "2011/11/15" ]
+      then
+         if [ "$runtype" == "drs-calib" ]
+         then
+            runtype="drs-gain"
+         fi
+         if [ "$runtype" == "drs-time-calib" ]
+         then
+            runtype="drs-time"
+         fi
+         if [ "$runtype" == "pedestal" ]
+         then
+            runtype="drs-pedestal"
+         fi
+         if [ "$runtype" == "light-pulser" ]
+         then
+            runtype="light-pulser-ext"
+         fi
+         if [ "$runtype" == "pedestal-on" ]
+         then
+            runtype="pedestal"
+         fi
+      fi
+      # get runtype
+      query="SELECT fRunTypeKEY FROM RunType WHERE fRunTypeName='"$runtype"'"
+      result2=( `sendquery` )
+      if [ ${#result2} -eq 0 ]
+      then 
+         printprocesslog "ERROR "$numberfromname": Could not query fRunTypeKey for runtype "$runtype" ."
+         continue
+      fi
+      runtypekey=${result2[0]}
+
       if [ "$doupdate" == "force" ]
       then
-         # set runtype to 'unknown', if no runtype could be retrieved from file
-         if [ "$runtype" == "" ]
-         then
-            runtype="n/a"
-         fi
-         # on 15.11.2011 the runtypes had different names
-         if [ "$date" == "2011/11/15" ]
-         then
-            if [ "$runtype" == "drs-calib" ]
-            then
-               runtype="drs-gain"
-            fi
-            if [ "$runtype" == "drs-time-calib" ]
-            then
-               runtype="drs-time"
-            fi
-            if [ "$runtype" == "pedestal" ]
-            then
-               runtype="drs-pedestal"
-            fi
-            if [ "$runtype" == "light-pulser" ]
-            then
-               runtype="light-pulser-ext"
-            fi
-            if [ "$runtype" == "pedestal-on" ]
-            then
-               runtype="pedestal"
-            fi
-         fi
-         # get runtype
-         query="SELECT fRunTypeKEY FROM RunType WHERE fRunTypeName='"$runtype"'"
-         result2=( `sendquery` )
-         if [ ${#result2} -eq 0 ]
-         then 
-            printprocesslog "ERROR "$numberfromname": Could not query fRunTypeKey for runtype "$runtype" ."
-            continue
-         fi
          # in newest data start time is in DATE-OBS
          # in older data start time is in TSTART
@@ -537,5 +544,5 @@
       then
          query=$query", fRunStart='"$runstart"', fRunStop='"$runstop"'"
-         query=$query", fRunTypeKey="${result2[0]}
+         query=$query", fRunTypeKey="$runtypekey
          if [ "$numevents" != "" ]
          then
