Index: trunk/MagicSoft/Mars/datacenter/scripts/mcsequences
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/mcsequences	(revision 8759)
+++ trunk/MagicSoft/Mars/datacenter/scripts/mcsequences	(revision 8761)
@@ -70,33 +70,43 @@
       calrun=`echo $calfile | cut -d_ -f2`
       pedrun=`echo $pedfile | cut -d_ -f2`
-      datruns=`find $dir -lname *$epoch*.root | grep "_D_" | cut -d_ -f2 | tr "\n" " "`
-      # workaround due to 5digit runnumber for data with runnumber < 35487
-      firstrun=`echo $datruns | cut -c 0-8`
-      #   firstrun=`echo $datruns | cut -c 0-5 | sed -e 's/^0//g' -e 's/^0//g' -e 's/^0//g' -e 's/^0//g'`
-      date=`echo $dir | cut -c 28-37 | sed -e 's/\//-/g'`
-      # for tests
-#      date=`echo $dir | cut -c 57-66 | sed -e 's/\//-/g'`
       
-      # workaround due to 5digit runnumber for data with runnumber < 35487
-      no=`echo $firstrun | cut -c 0-4`
-      #   no=`printf %08d $firstrun | cut -c 0-4`
-      #   no2=`printf %08d $firstrun`
-      sequpath=$mcsequpath/$no
-      makedir $sequpath >> $scriptlog 2>&1
-      sequfile=$sequpath/sequence$firstrun.txt
-      #   sequfile=$sequpath/sequence$no2.txt
-      echo "writing sequfile "$sequfile >> $scriptlog 2>&1
-      printprocesslog "INFO writing sequencefile $sequfile"
+      modes=("Gamma" "GammaW1" "GammaW2" "GammaFW" "GammaDiff" "GammaHE" "GammaHEW1" "GammaHEW2" "GammaHEFW" "GammaHEDiff" "ProtonDiff" "ProtonHEDiff" "MuonDiff" "MuonHEDiff")
+      for mode in ${modes[@]}
+      do
+         datruns=`find $dir -lname *$epoch*.root | grep $mode | grep "_D_" | cut -d_ -f2 | tr "\n" " "`
+      	 if [ "$datruns" != "" ]
+         then
+            # workaround due to 5digit runnumber for data with runnumber < 35487
+      	    firstrun=`echo $datruns | cut -c 0-8`
+      	    #   firstrun=`echo $datruns | cut -c 0-5 | sed -e 's/^0//g' -e 's/^0//g' -e 's/^0//g' -e 's/^0//g'`
+      	    date=`echo $dir | cut -c 28-37 | sed -e 's/\//-/g'`
+#      	    date=`echo $dir | cut -c 57-66 | sed -e 's/\//-/g'`
+      	    # for tests
+	    #      date=`echo $dir | cut -c 57-66 | sed -e 's/\//-/g'`
       
-      echo "Sequence:        $firstrun" >| $sequfile
-      echo "Night:           $date" >> $sequfile
-      echo "Epoch:           $epoch" >> $sequfile
-      echo "" >> $sequfile
-      echo "CalRuns:         $calrun" >> $sequfile
-      echo "PedRuns:         $pedrun" >> $sequfile
-      echo "DatRuns:         $datruns" >> $sequfile
-      echo "" >> $sequfile
-      echo "MonteCarlo: Yes" >> $sequfile
-      echo "" >> $sequfile
+      	    # workaround due to 5digit runnumber for data with runnumber < 35487
+      	    no=`echo $firstrun | cut -c 0-4`
+      	    #   no=`printf %08d $firstrun | cut -c 0-4`
+      	    #   no2=`printf %08d $firstrun`
+      	    sequpath=$mcsequpath/$no
+      	    makedir $sequpath >> $scriptlog 2>&1
+      	    sequfile=$sequpath/sequence$firstrun.txt
+      	    #   sequfile=$sequpath/sequence$no2.txt
+      	    echo "writing sequfile "$sequfile >> $scriptlog 2>&1
+      	    printprocesslog "INFO writing sequencefile $sequfile"
+      
+      	    echo "Sequence:        $firstrun" >| $sequfile
+      	    echo "Night:           $date" >> $sequfile
+      	    echo "Epoch:           $epoch" >> $sequfile
+      	    echo "Mode:            $mode" >> $sequfile
+      	    echo "" >> $sequfile
+      	    echo "CalRuns:         $calrun" >> $sequfile
+      	    echo "PedRuns:         $pedrun" >> $sequfile
+      	    echo "DatRuns:         $datruns" >> $sequfile
+      	    echo "" >> $sequfile
+      	    echo "MonteCarlo: Yes" >> $sequfile
+      	    echo "" >> $sequfile
+         fi
+      done
    done
 done
