Index: trunk/DataCheck/QuickLook/Step2a.sh
===================================================================
--- trunk/DataCheck/QuickLook/Step2a.sh	(revision 17077)
+++ trunk/DataCheck/QuickLook/Step2a.sh	(revision 17078)
@@ -4,42 +4,42 @@
 printprocesslog "INFO starting $0"
 
-if [ "$1" = "" ]
-then 
-   hour=`date +%k`
-   # get date (before 18h there is no new data to be processed)
-   if [ $hour -le 7 ] || [ $hour -ge 19 ]
-   then
-      datepaths=( `date --date="-19HOUR" +%Y/%m/%d` )
+# get dates
+if [ "$certaindate" != "" ]
+then
+   getdates $certaindate
+else
+   if [ "$1" = "" ]
+   then 
+      # get all night
+      #getdates "all"
+      # get last 6 nights
+      getdates 6
    else
-      datepaths=( `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"` \
-              )
+      getdates $1
    fi
-   #datepaths=( `find -L $datapath/star -mindepth 3 -type d | sort -r | sed "s/\${datapath_for_sed}\/star//g" | sed -e 's/^\///'` ) #all available dates in star-directory
-else
-   datepaths=( $1 )
 fi
 
-for datepath in ${datepaths[@]}
+
+
+for date in ${dates[@]}
 do 
-   printprocesslog "INFO processing "$datepath
-   #echo "INFO processing "$datepath
-   night=`echo $datepath | sed -e 's/\///g'`
+   printprocesslog "INFO processing "$date
+   #echo "INFO processing "$date
+   night=`echo $date | sed -e 's/\///g'`
    
    numganymeds=0
    
    # getting all image files for this night
-   printprocesslog "INFO get file list for night "$datepath
-   files=( `find $anapath/star/$datepath -type f -name '*_I.root' 2>/dev/null | sort` )
+   printprocesslog "INFO get file list for night "$date
+   files=( `find $anapath/star/$date -type f -name '*_I.root' 2>/dev/null | sort` )
    if [ ${#files[@]} -eq 0 ]
    then
-      printprocesslog "INFO no image files available for night "$datepath
+      printprocesslog "INFO no image files available for night "$date
       continue
    fi
    # write data set file
-   #dspath=$anapath/$source/datasets`printf %03d $min`min/$datepath
-   #dspath=$anapath/$source/datasets_run/$datepath
-   dspath=$anapath/datasets_run/$datepath
+   #dspath=$anapath/$source/datasets`printf %03d $min`min/$date
+   #dspath=$anapath/$source/datasets_run/$date
+   dspath=$anapath/datasets_run/$date
    makedir $dspath
 
@@ -76,6 +76,6 @@
          night=`basename ${files[$i-1]} | cut -d_ -f1`
          runid=`basename ${files[$i-1]} | cut -d_ -f2 | cut -d. -f1`
-         drivefile=$auxdata"/"$datepath"/"`basename ${files[$i-1]} | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
-         rawfilepath=$rawdata"/"$datepath"/"
+         drivefile=$auxdata"/"$date"/"`basename ${files[$i-1]} | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
+         rawfilepath=$rawdata"/"$date"/"
          rawfilename=`basename ${files[$i-1]} | sed -e 's/_I.root/.fits/'`
          rawfile=`find $rawfilepath -name $rawfilename* 2>/dev/null`
