Index: trunk/DataCheck/QuickLook/Step1.sh
===================================================================
--- trunk/DataCheck/QuickLook/Step1.sh	(revision 18067)
+++ trunk/DataCheck/QuickLook/Step1.sh	(revision 18068)
@@ -28,12 +28,12 @@
 # create aux directory on daq, if not yet there
 auxpath=/loc_data/aux/$datepath
-makedir $auxpath
+makedir $auxpath >/dev/null
 # create path for info files needed for analysis
 infopath=$anapath/info/$datepath
-makedir $infopath
+makedir $infopath >/dev/null
 echo "" > $infopath/runrow.txt
 # create path for callisto output
 calpath=$anapath/callisto/$datepath
-makedir $calpath
+makedir $calpath >/dev/null
 rawpathnewdaq=/newdaq/raw/$datepath
 rawpath=/loc_data/raw/$datepath
@@ -105,6 +105,6 @@
    finish
 fi
-fileslocal=( `find $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
-callistofiles=( `find $calpath -type f -name $date*-calibration.log | sort` )
+fileslocal=( `find -L $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' 2>/dev/null| sort` )
+callistofiles=( `find $calpath -type f -name $date*-calibration.log 2>/dev/null| sort` )
 # get number of dataruns from DB
 query="SELECT Count(*) FROM RunInfo WHERE fNight="$date" AND fRunTypeKey=1"
@@ -121,7 +121,7 @@
 
 # create raw directory on daq, if not yet there
-makedir $rawpath
-
-echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
+makedir $rawpath >/dev/null
+
+#echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
 printprocesslog "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
 
@@ -134,5 +134,5 @@
    
    numcalibrated=0
-   echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
+   #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    printprocesslog "INFO status beginning of while-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
 
@@ -155,5 +155,5 @@
          then
             nondrs=`basename $file | sed -e 's/[.]drs//g'`
-            nondrsfile=`find $rawpath -name $nondrs.*z`
+            nondrsfile=`find -L $rawpath -name $nondrs.*z`
             tstop=`$factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
          else
@@ -203,4 +203,22 @@
       fi
       
+#      # temporary check
+#      if [ "`echo $file | grep -o drs`" == "drs" ]
+#      then
+#         nondrs=`basename $file | sed -e 's/[.]drs//g'`
+#         nondrsfile=`find -L $rawpath -name $nondrs.*z`
+#         tstop=`$factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
+#      else
+#         tstop=`$factpath/fitsdump -h $file  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
+#      fi
+#      # when stop time is 0, file is not closed
+#      # when an error is returned the tstop is empty
+#      if [ "$tstop" == "0" ] || [ "$tstop" == "" ]
+#      then
+#         printprocesslog "WARN "$file" not yet closed. -> continue (temporary check)"
+#         continue
+#      fi
+#      # end temporary check
+      
       # treat other files (.fits.fz)
       runtype=`$factpath/fitsdump -h $localfile  2>/dev/null | grep RUNTYPE | grep -E -o "['][a-z0-9._-]+[']" | sed -e "s/'//g" -e "s/_/-/g" -e "s/[.]//g"`
@@ -264,5 +282,5 @@
                   calfile=$calpath"/"$date"_"$runnum"_C.root"
                   printprocesslog "INFO starting RunCallisto.sh for drun "$localfile" logfile "$callistolog" drs-calib "$drscalib" drs-time "$drstime" outpath "$outpath" calfile "$calfile
-                  echo "INFO starting RunCallisto.sh for drun "$localfile" logfile "$callistolog" drs-calib "$drscalib" drs-time "$drstime" outpath "$outpath" calfile "$calfile
+                  #echo "INFO starting RunCallisto.sh for drun "$localfile" logfile "$callistolog" drs-calib "$drscalib" drs-time "$drstime" outpath "$outpath" calfile "$calfile
                   `dirname $0`/RunCallisto.sh "drun" $callistolog $localfile $drscalib $drstime $calpath $calfile &
                fi
@@ -283,9 +301,9 @@
                #else
                   # not needed for QLA
+                  #numcalibrated=`echo " $numcalibrated + 1 " | bc -l`
                   #if ! [ -e $callistolog ]
                   #then
                   #   pedfile=$calpath"/"$date"_"$runnum"-pedestal.root"
                   #   # count runs to be calibrated
-                  #   numcalibrated=`echo " $numcalibrated + 1 " | bc -l`
                   #   printprocesslog "INFO starting RunCallisto.sh for prun "$localfile" logfile "$callistolog" drs-calib "$drscalib" pedfile "$pedfile
                   #   echo "INFO starting RunCallisto.sh for prun "$localfile" logfile "$callistolog" drs-calib "$drscalib" pedfile "$pedfile
@@ -298,4 +316,5 @@
             # do lp-treatment -> not needed for QLA
             #lpfile=$calpath"/"$date"_"$runnum"-lightpulser.root"
+            #numcalibrated=`echo " $numcalibrated + 1 " | bc -l`
             #if ! [ -e $callistolog ]
             #then
@@ -303,5 +322,4 @@
             #   then
             #      # count runs to be calibrated
-            #      numcalibrated=`echo " $numcalibrated + 1 " | bc -l`
             #      printprocesslog "INFO starting RunCallisto.sh for crun "$localfile" logfile "$callistolog" drs-calib "$drscalib" drs-time "$drstime" lpfile "$lpfile
             #      echo "INFO starting RunCallisto.sh for crun "$localfile" logfile "$callistolog" drs-calib "$drscalib" drs-time "$drstime" lpfile "$lpfile
@@ -314,10 +332,10 @@
             drstime=$calpath"/"$date"_"$runnum"-drstime.root"
             # starting calibration
+            numcalibrated=`echo " $numcalibrated + 1 " | bc -l`
             if ! [ -e $callistolog ]
             then
                # count runs to be calibrated
-               numcalibrated=`echo " $numcalibrated + 1 " | bc -l`
                printprocesslog "INFO starting RunCallisto.sh for time "$localfile" logfile "$callistolog" drs-ped "$drsped" drstime "$drstime
-               echo "INFO starting RunCallisto.sh for time "$localfile" logfile "$callistolog" drs-ped "$drsped" drstime "$drstime
+               #echo "INFO starting RunCallisto.sh for time "$localfile" logfile "$callistolog" drs-ped "$drsped" drstime "$drstime
                `dirname $0`/RunCallisto.sh "time" $callistolog $localfile $drsped $drstime &
             fi
@@ -342,7 +360,7 @@
    printprocesslog "INFO get new file lists for "$datepath
    files=( `find $rawpathnewdaq -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
-   fileslocal=( `find $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
+   fileslocal=( `find -L $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
    callistofiles=( `find $calpath -type f -name $date*-calibration.log | sort` )
-   echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
+   #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    printprocesslog "INFO status after for-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
 
@@ -355,9 +373,11 @@
       printprocesslog "INFO get new file lists for "$datepath
       files=( `find $rawpathnewdaq -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
-      fileslocal=( `find $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
+      fileslocal=( `find -L $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` )
       callistofiles=( `find $calpath -type f -name $date*-calibration.log | sort` )
    fi
-   echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
+   #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    printprocesslog "INFO status after wait end of while-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
+   sleep 30
+   printprocesslog "INFO sleep 30"
 done
 
