Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2992)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2993)
@@ -63,4 +63,10 @@
 
    * mjobs/*:
+     - added
+
+   * mbase/Makefile, mbase/BaseLinkDef.h:
+     - added MRunIter
+
+   * mbase/MRunIter.[h,cc]:
      - added
 
Index: trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 2992)
+++ trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 2993)
@@ -24,6 +24,8 @@
 // Basic Tools
 #pragma link C++ class MIter+;
+#pragma link C++ class MDirIter+;
+#pragma link C++ class MRunIter+;
+
 #pragma link C++ class MAstro+;
-#pragma link C++ class MDirIter+;
 
 // Mars core
Index: trunk/MagicSoft/Mars/mbase/MRunIter.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MRunIter.h	(revision 2993)
+++ trunk/MagicSoft/Mars/mbase/MRunIter.h	(revision 2993)
@@ -0,0 +1,82 @@
+#ifndef MARS_MRunIter
+#define MARS_MRunIter
+
+#ifndef MARS_MDirIter
+#include "MDirIter.h"
+#endif
+
+#ifndef ROOT_TArrayI
+#include <TArrayI.h>
+#endif
+
+class MRunIter : public MDirIter
+{
+private:
+    TString fPath;
+    TArrayI fRuns;
+
+    void AddRunNumber(UInt_t run)
+    {
+        fRuns.Set(fRuns.GetSize()+1);
+        fRuns[fRuns.GetSize()-1] = run;
+
+        Sort();
+
+    }
+
+    void Sort()
+    {
+        const int n = GetNumRuns();
+
+        TArrayI idx(n);
+        TMath::Sort(n, fRuns.GetArray(), idx.GetArray(), kFALSE);
+
+        for (int i=0; i<n; i++)
+            idx[i] = fRuns[idx[i]];
+
+        fRuns = idx;
+    }
+
+public:
+    MRunIter(const char *path=0) : fPath(path) { }
+
+    Int_t AddRun(UInt_t run, const char *path=0);
+    Int_t AddRuns(UInt_t from, UInt_t to, const char *path=0)
+    {
+        Int_t n = 0;
+
+        for (UInt_t i=from; i<=to; i++)
+            AddRun(i, path);
+
+        return n;
+    }
+
+    UInt_t GetNumRuns() const { return fRuns.GetSize(); }
+    const TArrayI &GetRuns() const { return fRuns; }
+
+    TString GetRunsAsString() const {
+        TString txt;
+        for (int i=0; i<fRuns.GetSize(); i++)
+        {
+            txt += "#";
+            txt += fRuns[i];
+            if (i!=fRuns.GetSize()-1)
+                txt += " ";
+        }
+        return txt;
+    }
+    TString GetRunsAsFileName() const {
+        TString txt;
+        for (int i=0; i<fRuns.GetSize(); i++)
+        {
+            txt += fRuns[i];
+            if (i!=fRuns.GetSize()-1)
+                txt += "_";
+        }
+        return txt;
+    }
+
+    ClassDef(MRunIter, 1) // Iterator for runs
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbase/Makefile	(revision 2992)
+++ trunk/MagicSoft/Mars/mbase/Makefile	(revision 2993)
@@ -53,6 +53,7 @@
            MGMenu.cc \
            MIter.cc \
+           MDirIter.cc \
+           MRunIter.cc \
            MReadSocket.cc \
-           MDirIter.cc \
            MGGroupFrame.cc \
            MGList.cc \
