Index: trunk/Mars/datacenter/scripts/insertmc
===================================================================
--- trunk/Mars/datacenter/scripts/insertmc	(revision 9886)
+++ trunk/Mars/datacenter/scripts/insertmc	(revision 9898)
@@ -18,7 +18,7 @@
 #
 #
-#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
-#
-#   Copyright: MAGIC Software Development, 2000-2007
+#   Author(s): Daniela Dorner  08/2010 <mailto:daniela.dorner@unige.ch>
+#
+#   Copyright: MAGIC Software Development, 2000-2010
 #
 #
@@ -95,8 +95,9 @@
 impactmax=80000 # for protons (and irons ?)
 #impactmax=42500 # for gammas
-#impactmax=17500 # for muons
+#impactmax=20000 # for muons
 
 # view cone
-viewconemax=4.5 # for muons and protons and irons
+viewconemax=5.0 # for protons and irons
+#viewconemax=4.5 # for muons 
 #viewconemax=0 # for gammas
 
@@ -273,6 +274,4 @@
          query="INSERT CeresInfo SET fSequenceNumber="$drun", fRunNumber="$drun", fFileNumber="$i", fCeresSetupKEY="$cereskey", fRunTypeKEY=2"
          sendquery2 
-         query="INSERT CeresStatus SET fRunNumber="$drun", fFileNumber="$i", fCeresSetupKEY="$cereskey", fPriority="$drun
-         sendquery2 
       done
 
@@ -281,7 +280,9 @@
       query="INSERT CeresInfo SET fSequenceNumber="$drun", fRunNumber="$crun", fFileNumber=1, fCeresSetupKEY="$cereskey", fRunTypeKEY=4"
       sendquery2 
-      query="INSERT CeresStatus SET fRunNumber="$prun", fFileNumber=1, fCeresSetupKEY="$cereskey", fPriority="$prun
-      sendquery2 
-      query="INSERT CeresStatus SET fRunNumber="$crun", fFileNumber=1, fCeresSetupKEY="$cereskey", fPriority="$crun
+      query="INSERT CeresStatus SET fRunNumber="$drun", fCeresSetupKEY="$cereskey", fPriority="$drun
+      sendquery2 
+      query="INSERT CeresStatus SET fRunNumber="$prun", fCeresSetupKEY="$cereskey", fPriority="$prun
+      sendquery2 
+      query="INSERT CeresStatus SET fRunNumber="$crun", fCeresSetupKEY="$cereskey", fPriority="$crun
       sendquery2 
       query="INSERT Star SET fSequenceNumber="$drun", fCeresSetupKEY="$cereskey
Index: trunk/Mars/datacenter/scripts/runceres
===================================================================
--- trunk/Mars/datacenter/scripts/runceres	(revision 9886)
+++ trunk/Mars/datacenter/scripts/runceres	(revision 9898)
@@ -40,9 +40,8 @@
 gettodo "1"
 run=${primaries[0]}
-file=${primaries[1]}
-cereskey=${primaries[2]}
+cereskey=${primaries[1]}
 
 # lock sequ for cal
-lockfile=$lockpath/lock-$step-$run.$file.$cereskey.txt
+lockfile=$lockpath/lock-$step-$run.$cereskey.txt
 checklock
 
@@ -50,5 +49,5 @@
 
 # run calibration for sequence
-printprocesslog "INFO starting $program for run $run and file $file and ceres-setup $cereskey"
+printprocesslog "INFO starting $program for run $run and ceres-setup $cereskey"
 
 setstatus "start"
@@ -56,23 +55,28 @@
 setupfile=$setuppath/$program/`printf %03d $cereskey`/ceres.rc
 
-query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fFileNumber="$file" AND fCeresSetupKEY="$cereskey
+query="SELECT fRunTypeKEY FROM CeresInfo WHERE fRunNumber="$run" AND fCeresSetupKEY="$cereskey
 runkey=`sendquery`
 
 case $runkey in 
-   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`
+   2) printprocesslog "INFO run $run is a data run (key="$runkey")"
+      printprocesslog "INFO getting file numbers for run "$run
+      query="SELECT CONCAT('"$mcpath"/corsika/', RIGHT(LPAD(CeresInfo.fRunNumber, 8, '0'), 4),"
+      query=$query" '"$mcpath"/corsika/', LEFT(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 `"."`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"
+      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 and file $file is a pedestal run (key="$runkey")"
+   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 `"."`printf %06d $file | cut -c 4-6`
+      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
@@ -80,9 +84,9 @@
       check1=$?
       ;;
-   4) printprocesslog "INFO run $run and file $file is a calibration run (key="$runkey")"
+   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 `"."`printf %06d $file | cut -c 4-6`
+      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
@@ -96,7 +100,7 @@
 
 case $check1 in
-   0)   printprocesslog "INFO $program finished successfully for run $run file $file cereskey $cereskey runtype $runkey (check1=$check1)"
+   0)   printprocesslog "INFO $program finished successfully for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
         ;;
-   *)   printprocesslog "ERROR $program failed for run $run file $file cereskey $cereskey runtype $runkey (check1=$check1)"
+   *)   printprocesslog "ERROR $program failed for run $run, cereskey $cereskey, runtype $runkey (check1=$check1)"
         check=$check1
         ;;
