Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9592)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9593)
@@ -19,4 +19,18 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2010/06/24 Daniela Dorner
+
+   * datacenter/scripts/runceres:
+     - added (script to run telescope simulation of file basis)
+
+   * datacenter/scripts/sourcefile, resources/steps_fact.rc:
+     - bugfixes: changed joins to get correct queries for all cases
+
+   * datacenter/scripts/setup.wue.fact.mc:
+     - changed path for setup files
+     - added runceres to jobmanager settings
+
+
+
  2010/06/22 Daniela Dorner
 
Index: /trunk/MagicSoft/Mars/datacenter/scripts/setup.wue.fact.mc
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/scripts/setup.wue.fact.mc	(revision 9592)
+++ /trunk/MagicSoft/Mars/datacenter/scripts/setup.wue.fact.mc	(revision 9593)
@@ -43,5 +43,5 @@
 logpath=/magic/datacenter/fact/autologs
 lockpath=/magic/datacenter/fact/locks
-setuppath=/magic/datacenter/fact/setup
+setuppath=/magic/simulated/setup
 
 ## paths of data
@@ -73,7 +73,7 @@
 
 #addresses to which the errors are sent
-erradrs="daniela.dorner@unige.ch" 
+erradrs="dorner@astro.uni-wuerzburg.de" 
 #addresses to which the changes are sent
-adrs="daniela.dorner@unige.ch" 
+adrs="dorner@astro.uni-wuerzburg.de" 
 
 
@@ -97,20 +97,20 @@
 pnototalwe=(     42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 )
 
-pnocorsika=(     30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 )
-pnoceres=(       12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 )
-pnocprun=(       12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 )
-pnocallisto=(    32 32 32 32 32 20 20 18 18 12 12 12 12 12 12 12 12 12 12 18 18 20 20 32 )
+pnocorsika=(     20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 )
+pnoceres=(       15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 )
+pnocprun=(       15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 )
+pnocallisto=(    32 32 32 32 32 20 20 18 18 15 15 15 15 15 15 15 15 15 15 18 18 20 20 32 )
 pnostar=(        10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 )
 
-pnocorsikawe=(   30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 )
-pnocereswe=(     12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 )
-pnocprunwe=(     12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 )
+pnocorsikawe=(   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 )
+pnocereswe=(     15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 )
+pnocprunwe=(     15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 )
 pnocallistowe=(  32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 )
 pnostarwe=(      10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 )
 
 # set variables for jobmanager 
-scripts=( "runcorsika" ) 
-scriptscolname=( "Corsika" ) 
-pnosweek=( ${pnocorsika[@]} ) 
-pnoswe=( ${pnocorsikawe[@]} ) 
+scripts=( "runcorsika" "runceres" ) 
+scriptscolname=( "Corsika" "Ceres" ) 
+pnosweek=( ${pnocorsika[@]} ${pnoceres[@]} ) 
+pnoswe=( ${pnocorsikawe[@]} ${pnocereswe[@]} ) 
 
Index: /trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 9592)
+++ /trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 9593)
@@ -500,24 +500,37 @@
    query=" UPDATE "$step"Status "
    # add joins to the influenced tables
+   stepspecialjoin=""
    for influence in $influences
    do
-      # make sure that the right join is done 
-      #   in case the is a 'Join' given for the 
-      #   influenced step, this is added
-      # otherwise it is checked whether the executed step
-      #   itself needs a 'Join' (i.e. has different primaries)
-      #   if yes, the tables are joined with the primaries of the influenced step
-      #   else with the primaries of the executed step itself
-      stdjoin=`getjoin $influence`
-      if ! [ "$stdjoin" = "" ]
+      inflprims=( `getprimary $influence` )
+      # make sure that the correct joins are used
+      # in case the primaries of the step and the influence are 
+      #   the same, the tables are join with these primaries
+      # otherwise they are joined with the primaries of the influence
+      if [ "`echo ${inflprims[@]}`" == "`echo ${prims[@]}`" ]
       then 
-         query=$query" "$stdjoin" "
-      else
-         stdjoin2=`getjoin $step`
-         if [ "$stdjoin2" == "" ]
+         query=$query" LEFT JOIN "$influence"Status USING (${prims[@]}) "
+      else 
+         prims2=`getprimary $step | sed -e "s/\ //g"`
+         primstest=`echo ${inflprims[@]} | sed -e "s/\ //g" | sed -e "s/$prims2//g"`
+         if [ "$primstest" == "`echo ${inflprims[@]} | sed -e "s/\ //g"`" ]
          then
-            query=$query" LEFT JOIN "$influence"Status USING("`getprimary $influence`") "
+            if [ "$stepspecialjoin" == "" ]
+            then
+               stepspecialjoin=`getspecialjoin $step`
+               query=$query" "$stepspecialjoin" "
+            fi
+            query=$query" LEFT JOIN "$influence"Status USING (${inflprims[@]}) "
          else
-            query=$query" LEFT JOIN "$influence"Status USING("`getprimary $step`") "
+            infljoin=`getjoin $influence`
+            if [ "$infljoin" = "" ]
+            then
+               query=$query" LEFT JOIN "$influence"Status USING (${prims[@]}) "
+            else
+               query=$query" "$infljoin
+               # warning: this is a workaround
+               #  it has to be checked whether it works for all steps
+               stepspecialjoin="not empty"
+            fi
          fi
       fi
@@ -543,8 +556,8 @@
       s=0
    fi
-   query=$query" "`echo ${prims[0]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}]}'"
+   query=$query" "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}]}'"
    for (( j=1 ; j < ${#prims[@]} ; j++ ))
    do
-      query=$query" AND "`echo ${prims[$j]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}+$j]}' "
+      query=$query" AND "$step"Status."`echo ${prims[$j]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}+$j]}' "
    done   
    # print query
Index: /trunk/MagicSoft/Mars/resources/steps_fact.rc
===================================================================
--- /trunk/MagicSoft/Mars/resources/steps_fact.rc	(revision 9592)
+++ /trunk/MagicSoft/Mars/resources/steps_fact.rc	(revision 9593)
@@ -2,7 +2,8 @@
 Corsika.Primaries: fRunNumber, fFileNumber
 Corsika.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)
+Corsika.Join: LEFT JOIN CorsikaStatus USING(fRunNumber, fFileNumber)
 
 Ceres.Primaries: fRunNumber, fFileNumber, fCeresSetupKEY
-Ceres.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber)
+Ceres.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber, fCeresSetupKEY)
 Ceres.Join: LEFT JOIN CeresStatus USING(fRunNumber, fFileNumber) LEFT JOIN CeresInfo USING(fRunNumber, fFileNumber, fCeresSetupKEY)
 Ceres.Needs: Corsika
