Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto_mc
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto_mc	(revision 9605)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto_mc	(revision 9610)
@@ -60,5 +60,5 @@
 setstatus "start"
 
-command="./callisto -b -q -v4 -f --out=$outpath --log=$log.log --html=$log.html --config=$callistorc $sequfile"
+command="./callisto -b -q -v4 -f --out=$outpath --ind=$inpath --log=$log.log --html=$log.html --config=$callistorc $sequfile"
 printprocesslog "INFO executing "$command
 $command
Index: trunk/MagicSoft/Mars/datacenter/scripts/runceres
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runceres	(revision 9605)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runceres	(revision 9610)
@@ -54,7 +54,4 @@
 setstatus "start"
 
-outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
-makedir $outpath
-log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
 setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
 
@@ -65,4 +62,7 @@
    2) printprocesslog "INFO run $run and file $file is a data run (key="$runkey")"
       inputfile=$mcpath/corsika/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`/cer000`printf %06d $file | cut -c 4-6`
+      outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $run | cut -c 1-4`/`printf %08d $run | cut -c 5-8`
+      makedir $outpath
+      log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
       command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run $inputfile"
       printprocesslog "INFO executing "$command
@@ -71,4 +71,8 @@
       ;;
    3) printprocesslog "INFO run $run and file $file is a pedestal run (key="$runkey")"
+      drun=`echo "$run + 2 " | bc -l`
+      $outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
+      makedir $outpath
+      log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
       command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
       printprocesslog "INFO executing "$command
@@ -77,4 +81,8 @@
       ;;
    4) printprocesslog "INFO run $run and file $file is a calibration run (key="$runkey")"
+      drun=`echo "$run + 1 " | bc -l`
+      $outpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $drun | cut -c 1-4`/`printf %08d $drun | cut -c 5-8`
+      makedir $outpath
+      log=$outpath/ceres`printf %08d $run `"."`printf %06d $file | cut -c 4-6`
       command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
       printprocesslog "INFO executing "$command
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 9605)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 9610)
@@ -274,10 +274,19 @@
 function subquerypart()
 {
-   query=$query" SELECT COUNT(*) FROM "$need"Status "
-   query=$query" "`getjoin $need "SpecialInfluence"`" "
-   query=$query" WHERE "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`
+   query=$query" SELECT COUNT(*) FROM "$need"Status "`getjoin $need "SpecialInfluence"`
+   needinfluences=`grep $need $steps | grep "Needs" | grep -v "$need[.]Needs" | cut -d'.' -f1`
+   for needinfl in $needinfluences
+   do
+      needinfljoin=`getjoin $needinfl "Influence"`
+      if ! [ "$needinfljoin" = "" ]
+      then
+         query=$query" LEFT JOIN "$needinfl"Status USING ("$needinfljoin") "
+      fi
+      query=$query" "`getjoin $needinfl "SpecialInfluence"`" "
+   done
+   query=$query" WHERE "`echo ${prims[0]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`
    for (( j=1 ; j < ${#prims[@]} ; j++ ))
    do
-      query=$query" AND "$step"Status."`echo ${prims[$j]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[$j]} | sed -e 's/,//g'`
+      query=$query" AND "`echo ${prims[$j]} | sed -e 's/,//g'`"="$step"Status."`echo ${prims[$j]} | sed -e 's/,//g'`
    done
 }
@@ -309,4 +318,5 @@
    counter=0
    specialneedjoin=
+   specialinfljoin=
    for need in $needs
    do
@@ -316,4 +326,5 @@
       fi
       specialneedjoin=$specialneedjoin" "`getjoin $need "SpecialNeed"`
+      specialinfljoin=$specialinfljoin" "`getjoin $need "SpecialInfluence"`
       if [ "$specialneedjoin" = " " ]
       then 
@@ -323,4 +334,5 @@
          query=$query" ISNULL("$need"Status.fReturnCode) "
          specialneedjoin=
+         specialinfljoin=
       else 
          # special query to check steps which 
@@ -334,7 +346,7 @@
          query=$query" ) = ( "
          subquerypart
-         query=$query" AND NOT ISNULL(fStartTime) "
-         query=$query" AND NOT ISNULL(fStopTime) "
-         query=$query" AND ISNULL(fReturnCode)) "
+         query=$query" AND NOT ISNULL("$need"Status.fStartTime) "
+         query=$query" AND NOT ISNULL("$need"Status.fStopTime) "
+         query=$query" AND ISNULL("$need"Status.fReturnCode)) "
       fi
       counter=`echo $counter + 1 | bc -l`
@@ -504,5 +516,10 @@
          query=$query" LEFT JOIN "$influence"Status USING (${inflprims[@]}) "
       else 
-         query=$query" "$infljoin
+         query=$query" LEFT JOIN "$influence"Status USING ("$infljoin") "
+      fi
+      specialinfljoin2=`getjoin $influence "SpecialInfluence"`
+      if ! [ "$specialinfljoin2" = "" ]
+      then
+         query=$query" "$specialinfljoin2
       fi
    done
