Index: trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7037)
+++ trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets	(revision 7037)
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# ========================================================================
+#
+# *
+# * This file is part of MARS, the MAGIC Analysis and Reconstruction
+# * Software. It is distributed to you in the hope that it can be a useful
+# * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+# * It is distributed WITHOUT ANY WARRANTY.
+# *
+# * Permission to use, copy, modify and distribute this software and its
+# * documentation for any purpose is hereby granted without fee,
+# * provided that the above copyright notice appear in all copies and
+# * that both that copyright notice and this permission notice appear
+# * in supporting documentation. It is provided "as is" without express
+# * or implied warranty.
+# *
+#
+#
+#   Author(s): Daniela Dorner  08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
+#
+#   Copyright: MAGIC Software Development, 2000-2004
+#
+#
+# ========================================================================
+#
+#
+
+source /home/operator/Mars.cvs/datacenter/scripts/sourcefile
+
+set -C
+
+#cd $mars
+
+macrospath=/home/operator/Mars.cvs/datacenter/macros
+cd /home/operator/Mars.cvs
+
+
+datasetfiles=(`ls /magic/datasets/*/*`)
+echo "datasetfiles: "${datasetfiles[@]} 
+echo ""
+
+for datasetfile in ${datasetfiles[@]}
+do 
+   no=`echo $datasetfile | cut -d/ -f5 | cut -c8-99 | cut -d. -f1`
+   no2=`grep 'AnalysisNumber:' $datasetfile | sed -e 's/AnalysisNumber://g' | sed -e 's/ //g'`
+   no3=`printf %08d $no2`
+   if [ "$no" = "$no3" ]
+   then 
+      echo "number in filename and in file are the same -> continue"
+   else
+      echo "number in filename and in file are not the same "
+      echo " -> continue with next dataset"
+      continue
+   fi
+   source=`grep 'SourceName:' $datasetfile | sed -e 's/SourceName://g' | sed -e 's/ //g' | sed -e 's/#//g'`
+   mode=`grep 'WobbleMode:' $datasetfile`
+   mode2=`echo $mode | grep ^\#`
+   if [ "$mode2" = "" ]
+   then 
+      wobble="Y"
+   else
+      wobble="N"
+   fi
+   echo "file: "$datasetfile
+   echo "  datasetno:  "$no2
+   echo "  sourcename: "$source
+   echo "  wobble:     "$wobble
+   echo " "
+#   check0=`root -q -b $macrospath/insertdataset.C+\("\"$no\""\,"\"$source\""\,"\"$type\""\) | tee $insertdatasetlog | grep int | sed -e 's/(int)//'`
+   check0=`root -q -b $macrospath/insertdataset.C+\("\"$no2\""\,"\"$source\""\,"\"$wobble\"",kFALSE\) | grep int | sed -e 's/(int)//'`
+   case $check0 in 
+      1)   echo "check0=$check0 -> everthing ok ";;
+      *)   echo "check0=$check0 -> ERROR ";;
+   esac
+done
+
+
