Index: trunk/DataCheck/Processing/FillAuxThresholds.sh
===================================================================
--- trunk/DataCheck/Processing/FillAuxThresholds.sh	(revision 17095)
+++ trunk/DataCheck/Processing/FillAuxThresholds.sh	(revision 17096)
@@ -1,7 +1,11 @@
 #!/bin/bash
 
-# option 
-doupdate="yes" # update all entries (needed when new fields have been added)
-doupdate="no" # fill only entries which are not yet existing (default)
+# option whether to fill all row or only those where information is missing
+# $doupdate might be given as environment variable
+if [ "$doupdate" = "" ]
+then
+   doupdate="yes" # update all entries (needed when new fields have been added)
+   doupdate="no" # fill only entries which are not yet existing (default)
+fi
 
 source `dirname $0`/../Sourcefile.sh
@@ -22,18 +26,19 @@
 
 
-# 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=( `find -L $rawdata -mindepth 3 -type d | sort -r | sed "s/\${rawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /fact/raw
-
-#dates=( "2013/01/31" )
+# get dates
+if [ "$certaindate" != "" ]
+then
+   getdates $certaindate
+else
+   # get all night
+   #getdates "all"
+   # get last 6 nights
+   getdates 6
+fi
 
 printprocesslog "INFO processing the following night(s): "${dates[@]}
 echo  `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
 
-echo ${dates[@]}
+#echo ${dates[@]}
 
 cd $mars
@@ -45,6 +50,4 @@
    runnumber=`echo $date | sed -e 's/\///g'`
 
-   echo $auxdir
-   
    # check if aux files are available from that night
    if ! [ -d $auxdir ]
@@ -57,5 +60,6 @@
    
    thresholdfile=$auxdir/$runnumber.RATE_CONTROL_THRESHOLD.fits
-   ls $thresholdfile
+   printprocesslog "INFO processing "$thresholdfile
+   echo "INFO processing "$thresholdfile >> $logfile 2>&1
    if ! [ -e $thresholdfile ]
    then 
@@ -71,5 +75,5 @@
 
    thresholdfile2=$auxdir/$runnumber.FTM_CONTROL_STATIC_DATA.fits
-   ls $thresholdfile2
+   #ls $thresholdfile2
    if ! [ -e $thresholdfile2 ]
    then 
@@ -150,7 +154,7 @@
       if [ -e $threshcurrentsfile ] && [ $threshnumerrors -eq 0 ]
       then 
-         thresholds1=( `root -q -b -l fact/threshold.C\("\"$thresholdfile2\""\,$tstart\,$tstop\) | grep "result" | grep -E -o '[0-9]+[.]?[0-9]*'` )
+         thresholds1=( `root -q -b -l fact/processing/threshold.C\("\"$thresholdfile2\""\,$tstart\,$tstop\) | grep "result" | grep -E -o '[0-9]+[.]?[0-9]*'` )
          #root -q -b -l fact/threshold.C\("\"$thresholdfile2\""\,$tstart\,$tstop\) | grep "result"
-         echo ${thresholds1[@]}
+         #echo ${thresholds1[@]}
          if [ "${thresholds1[0]}" == "" ]
          then 
@@ -187,7 +191,7 @@
       if [ -e $threshcurrentsfile2 ] && [ $threshnumerrors2 -eq 0 ]
       then 
-         thresholds2=( `root -q -b -l fact/lastth.C\("\"$thresholdfile\""\,$tstart\) | grep "result" | grep -E -o '[0-9]+[.]?[0-9]*'` )
+         thresholds2=( `root -q -b -l fact/processing/lastth.C\("\"$thresholdfile\""\,$tstart\) | grep "result" | grep -E -o '[0-9]+[.]?[0-9]*'` )
          #root -q -b -l fact/lastth.C\("\"$thresholdfile\""\,$tstart\) | grep "result"
-         echo ${thresholds2[@]}
+         #echo ${thresholds2[@]}
          if [ "${thresholds2[0]}" == "" ]
          then 
@@ -210,5 +214,5 @@
       query=$query" WHERE fNight="$runnumber" AND fRunID="$filenum
       
-      echo $query
+      #echo $query
       # send query to DB
       sendquery >/dev/null
