Index: trunk/DataCheck/QuickLook/Step3.sh
===================================================================
--- trunk/DataCheck/QuickLook/Step3.sh	(revision 17587)
+++ trunk/DataCheck/QuickLook/Step3.sh	(revision 17591)
@@ -57,5 +57,4 @@
       continue
    fi
-   #echo "date: "$date
    query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$date2" AND fSourceKey > 0 AND fRunTypeKEY=1 GROUP BY fSourceKey "
    sources=( `sendquery` )
@@ -115,4 +114,27 @@
          esac
 
+         # doing the plots for last month
+         lastmonth=`date +%Y%m%d --date="$date -28 day"`
+         logfile=$outpath"/lightcurve"$source"_"$timebin$timename"_month.log"
+         outfile=$outpath"/lightcurve"$source"_"$timebin$timename"_month.root"
+         #echo $outfile
+         printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" "$timename" night "$date2" last month ("$lastmonth")"
+      
+	 check1=`root -q -b fact/analysis/lightcurve.C+\($source\,$lastmonth\\,$date2\,$timebin\,"\"$tablename"\"\,"\"$outfile\""\,kFALSE\) | tee $logfile | intgrep`
+      
+         case $check1 in
+            0)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" "$timename" night "$date2" last month (check1=$check1)"
+                 #./showplot -b --save-as-png $outfile
+                 if ! ./showplot -b --save-as-png $outfile >/dev/null
+                 then
+                    printprocesslog "WARN showplot -b --save-as-png "$outfile" failed."
+                 fi
+                 ;;
+            1)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" "$timename" night "$date2" last month, but nothing to plot (check1=$check1)"
+                 ;;
+            *)   printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" "$timename" night "$date2" last month (check1=$check1)"
+                 ;;
+         esac
+
          # doing the plots for all nights
          logfile=$outpath"/lightcurve"$source"_"$timebin$timename"_all.log"
@@ -183,4 +205,27 @@
               ;;
          *)   printprocesslog "ERROR lightcurve.C failed for source "$source" timebin 1 night for night "$date2" last week (check1=$check1)"
+              ;;
+      esac
+
+      # doing the plots for last month 
+      lastmonth=`date +%Y%m%d --date="$date -28 day"`
+      logfile=$outpath"/lightcurve"$source"_1night_month.log"
+      outfile=$outpath"/lightcurve"$source"_1night_month.root"
+      #echo $outfile
+      printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin 1 night for night "$date2" last month ("$lastmonth")"
+   
+      check1=`root -q -b fact/analysis/lightcurve.C+\($source\,$lastmonth\\,$date2\,-1\,"\"$tablename"\"\,"\"$outfile\""\,kFALSE\) | tee $logfile | intgrep`
+   
+      case $check1 in
+         0)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin 1 night for night "$date2" last month (check1=$check1)"
+              #./showplot -b --save-as-png $outfile
+              if ! ./showplot -b --save-as-png $outfile >/dev/null
+              then
+                 printprocesslog "WARN showplot -b --save-as-png "$outfile" failed."
+              fi
+              ;;
+         1)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin 1 night for night "$date2" last month, but nothing to plot (check1=$check1)"
+              ;;
+         *)   printprocesslog "ERROR lightcurve.C failed for source "$source" timebin 1 night for night "$date2" last month (check1=$check1)"
               ;;
       esac
