Index: trunk/DataCheck/Processing/RunCeres.sh
===================================================================
--- trunk/DataCheck/Processing/RunCeres.sh	(revision 13399)
+++ trunk/DataCheck/Processing/RunCeres.sh	(revision 13399)
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+#
+# This script is launching ceres for corsika runs. 
+# 
+# The ceres.rc and other setup files are stored in the setup directory.
+#
+
+source `dirname $0`/../Sourcefile.sh
+printprocesslog "INFO starting $0"
+program=ceres
+step=Ceres
+
+set -C
+
+# get run # 
+numchanged=0
+while (( 0 < 21 ))
+do 
+   if ! [ $numchanged -eq 1 ]
+   then 
+      if ! [ "$run" = "" ] && ! [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO $program for run $run cereskey $cereskey is already running => request new number "
+      fi
+      gettodo "1" 
+      run=${primaries[0]}
+      cereskey=${primaries[1]}
+      if [ "$run" = "" ] || [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO nothing to do for $program "
+      fi
+   else
+      printprocesslog "INFO starting $program for run $run cereskey $cereskey"
+      break
+   fi
+   setstatus "start"
+done
+
+cd $mars
+
+# run ceres for run
+
+setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
+
+query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey" GROUP BY fRunNumber"
+runkey=`sendquery`
+
+case $runkey in 
+   2) printprocesslog "INFO run $run is a data run (key="$runkey")"
+      printprocesslog "INFO getting file numbers for run "$run
+      query="SELECT CONCAT('"$mcpath"/corsika/', LEFT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4),"
+      query=$query" '/', RIGHT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4), '/cer000', "
+      query=$query" RIGHT(LPAD(CeresInfo.fFileNumber, 6, '0'), 3)) from CeresInfo "
+      query=$query" WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey
+      inputfiles=`sendquery`
+      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 `
+      command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run $inputfiles"
+      printprocesslog "INFO executing "$command
+      $command
+      check1=$?
+      ;;
+   3) printprocesslog "INFO run $run 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 `
+      command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run pedestal"
+      printprocesslog "INFO executing "$command
+      $command
+      check1=$?
+      ;;
+   4) printprocesslog "INFO run $run 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 `
+      command="./ceres -b -q -f --config=$setupfile --out=$outpath --log=$log.log --html=$log.html --run-number=$run calibration"
+      printprocesslog "INFO executing "$command
+      $command
+      check1=$?
+      ;;
+   *) printprocesslog "WARN not valid fRunTypeKEY ("$runkey") was queried from the DB."
+      check="no"
+      ;;
+esac
+
+case $check1 in
+   0)   printprocesslog "INFO $program finished successfully for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
+        ;;
+   *)   printprocesslog "ERROR $program failed for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
+        check=$check1
+        ;;
+esac
+
+setstatus "stop"
+
+finish
+
Index: trunk/DataCheck/Processing/RunMCCallisto.sh
===================================================================
--- trunk/DataCheck/Processing/RunMCCallisto.sh	(revision 13399)
+++ trunk/DataCheck/Processing/RunMCCallisto.sh	(revision 13399)
@@ -0,0 +1,65 @@
+#!/bin/bash
+#
+# This script is launching the calibration of mc sequences. 
+# 
+
+source `dirname $0`/../Sourcefile.sh
+printprocesslog "INFO starting $0"
+program=callisto
+step=Callisto
+
+set -C
+
+# get sequence # 
+numchanged=0
+while (( 0 < 21 ))
+do 
+   if ! [ $numchanged -eq 1 ]
+   then 
+      if ! [ "$sequence" = "" ] && ! [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO $program for sequence $sequence cereskey $cereskey is already running => request new number "
+      fi
+      gettodo "1" 
+      sequence=${primaries[0]}
+      cereskey=${primaries[1]}
+      if [ "$sequence" = "" ] || [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO nothing to do for $program "
+      fi
+   else
+      printprocesslog "INFO starting $program for sequence $sequence cereskey $cereskey"
+      break
+   fi
+   setstatus "start"
+done
+
+cd $mars
+
+# run calibration for sequence
+
+# define files and paths
+sequfile="$mcsequpath/`printf %08d $sequence | cut -c 1-4`/sequence`printf %08d $sequence`.txt"
+outpath=$mcpath/$program/`printf %03d $cereskey`/`printf %08d $sequence | cut -c 1-4`/`printf %08d $sequence | cut -c 5-8`
+makedir $outpath
+log=$outpath/$program`printf %08d $sequence`
+callistorc=$setuppath/$program/`printf %03d $cereskey`/callisto.rc
+inpath=$mcpath/ceres/`printf %03d $cereskey`/`printf %08d $sequence | cut -c 1-4`/`printf %08d $sequence | cut -c 5-8`
+
+command="./callisto -b -q -v4 -f --out=$outpath --ind=$inpath --log=$log.log --html=$log.html --config=$callistorc $sequfile"
+printprocesslog "INFO executing "$command
+$command
+check1=$?
+
+case $check1 in
+   0)  printprocesslog "INFO $program finished successfully for sequence $sequence cereskey $cereskey (return code $check1)"
+       ;;
+   *)  printprocesslog "ERROR $program failed for sequence $sequence cereskey $cereskey (return code $check1)"
+       check=$check1
+       ;;
+esac
+
+setstatus "stop"
+
+finish
+
Index: trunk/DataCheck/Processing/RunMCStar.sh
===================================================================
--- trunk/DataCheck/Processing/RunMCStar.sh	(revision 13399)
+++ trunk/DataCheck/Processing/RunMCStar.sh	(revision 13399)
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# This script is launching star for mc sequences. 
+# 
+
+source `dirname $0`/../Sourcefile.sh
+printprocesslog "INFO starting $0"
+program=star
+step=Star
+
+set -C
+
+# get sequence # 
+numchanged=0
+while (( 0 < 21 ))
+do 
+   if ! [ $numchanged -eq 1 ]
+   then 
+      if ! [ "$sequence" = "" ] && ! [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO $program for sequence $sequence cereskey $cereskey is already running => request new number "
+      fi
+      gettodo "1" 
+      sequence=${primaries[0]}
+      cereskey=${primaries[1]}
+      if [ "$sequence" = "" ] || [ "$cereskey" = "" ]
+      then
+         printprocesslog "INFO nothing to do for $program "
+      fi
+   else
+      printprocesslog "INFO starting $program for sequence $sequence cereskey $cereskey"
+      break
+   fi
+   setstatus "start"
+done
+
+cd $mars
+
+# run calibration for sequence
+
+# define files and paths
+sequfile="$mcsequpath/`printf %08d $sequence | cut -c 1-4`/sequence`printf %08d $sequence`.txt"
+outpath=$mcpath/$program/`printf %03d $cereskey`/`printf %08d $sequence | cut -c 1-4`/`printf %08d $sequence | cut -c 5-8`
+makedir $outpath
+log=$outpath/$program`printf %08d $sequence`
+inpath=$mcpath/callisto/`printf %03d $cereskey`/`printf %08d $sequence | cut -c 1-4`/`printf %08d $sequence | cut -c 5-8`
+
+command="./star -b -q -v4 -f --ind=$inpath --out=$outpath --log=$log.log --html=$log.html $sequfile"
+printprocesslog "INFO executing "$command
+$command
+check1=$?
+
+case $check1 in
+   0)  printprocesslog "INFO $program finished successfully for sequence $sequence cereskey $cereskey (return code $check1)"
+       ;;
+   *)  printprocesslog "ERROR $program failed for sequence $sequence cereskey $cereskey (return code $check1)"
+       check=$check1
+       ;;
+esac
+
+setstatus "stop"
+
+finish
+
Index: trunk/DataCheck/Setup/setup.fact.wue
===================================================================
--- trunk/DataCheck/Setup/setup.fact.wue	(revision 13399)
+++ trunk/DataCheck/Setup/setup.fact.wue	(revision 13399)
@@ -0,0 +1,95 @@
+#!/bin/bash
+#
+# This a resource file for the scripts, in which paths, variables 
+# and setups are defined
+#
+# This setup file is for the machines on the FACT cluster at ISDC
+#
+
+# setup to use ftools
+export HEADAS=/opt/heasoft-6.12/x86_64-unknown-linux-gnu
+export HEADASPROMPT=/dev/null
+
+# setup to use ROOT
+rootsys=/opt/root_v5.32.02
+if ! export | grep ROOTSYS | grep $rootsys  >|/dev/null
+then
+   export ROOTSYS=$rootsys
+   export PATH=$PATH:$ROOTSYS/bin
+   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
+fi
+
+# software versions
+export factpath=/opt/FACT++
+export mars=~/FACT.processing/Mars.von.Thomas.2012.03.07
+
+# site
+processingsite=isdc
+sitekey=4 
+storagesite=isdc
+
+# queuing system
+queuesys=sge
+sgepath=/usr/bin
+
+# logging and setup
+logpath=/fact_tmp/datacenter/autologs
+lockpath=fact_tmp/datacenter/locks
+
+# data paths 
+datapath=/fact_tmp/data
+seqpath=/fact_tmp/sequences
+auxdata=/fact_tmp/aux
+rawdata=/fact_tmp/raw
+rawdata_for_sed=$(printf "%s\n" "$rawdata" | sed 's/[][\.*^$(){}?+|/]/\\&/g')
+
+## paths and setup for mc
+mcpath=/magic/simulated
+mcsequpath=$mcpath/sequences
+corsikapath=/opt/MagicSoft/Simulation/Corsika/Mmcs6500
+export FLUPRO=$corsikapath'/fluka2011_2'
+
+# get paths for mars, macros and scripts
+#   in case the variable is not yet set
+if [ "$mars" == "" ]
+then 
+  mars=`dirname $0 | sed -e 's/\/datacenter\/scripts//'`
+fi
+macrospath=$mars/datacenter/macros
+scriptspath=`dirname $0`
+
+# rcfiles
+# dependencies of steps
+steps=$scriptspath/../Setup/steps_fact_isdc.rc
+# file with db information
+sqlrc=$mars/sqlmc.rc
+
+
+#addresses to which the errors are sent
+erradrs="daniela.dorner@unige.ch" 
+#addresses to which the changes are sent
+adrs="daniela.dorner@unige.ch" 
+
+
+#
+#setup for jobmanager
+#
+sleeptime=150 #600 #30
+sleeptimelimit=360 #360
+errorsleeptimedefault=60 #60
+
+algorithm=2
+
+#hour:            0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+pnototal=(       32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 )
+pnototalwe=(     32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 )
+
+# set variables for jobmanager 
+scripts=( "RunCeres.sh" "RunMCCallisto.sh" "RunMCStar.sh" ) 
+scriptscolname=( "Ceres" "Callisto" "Star" ) 
+ratio=( 0.6 0.2 0.2 )
+maxjobs=( 10 10 10 )
+
+
+# further wishlist: adapt ratio automatically
+
Index: trunk/DataCheck/Setup/steps_fact_wue.rc
===================================================================
--- trunk/DataCheck/Setup/steps_fact_wue.rc	(revision 13399)
+++ trunk/DataCheck/Setup/steps_fact_wue.rc	(revision 13399)
@@ -0,0 +1,20 @@
+
+Corsika.MainTable: Ceres
+Corsika.Primaries: fRunNumber, fFileNumber
+
+Ceres.MainTable: Ceres
+Ceres.Primaries: fRunNumber, fCeresSetupKEY
+Ceres.Needs: Corsika 
+Ceres.SpecialJoin: LEFT JOIN CeresInfo USING(fRunNumber, fCeresSetupKEY)
+
+SequenceFile.MainTable: Ceres
+SequenceFile.Primaries: fSequenceNumber
+
+Callisto.MainTable: Ceres
+Callisto.Primaries: fSequenceNumber, fCeresSetupKEY
+Callisto.Needs: SequenceFile Ceres Corsika 
+
+Star.MainTable: Ceres
+Star.Primaries: fSequenceNumber, fCeresSetupKEY
+Star.Needs: Callisto SequenceFile Ceres Corsika 
+
