Index: trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C	(revision 9013)
+++ trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C	(revision 9014)
@@ -19,5 +19,5 @@
 !   Author(s): Daniela Dorner, 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2006
+!   Copyright: MAGIC Software Development, 2000-2008
 !
 !
@@ -103,4 +103,14 @@
 using namespace std;
 
+    /*static*/ UInt_t GetId(const TString str)
+    {
+        const Ssiz_t dot = str.First('.');
+
+        const UInt_t run = str.Atoi();
+        const UInt_t sub = dot<0 ? 0 : atoi(str.Data()+dot+1);
+
+        return run*1000+sub;
+    }
+
 
 class Rule : public TObject
@@ -113,9 +123,4 @@
 
 public:
-    Rule(const char *regexp, UInt_t min=0, UInt_t max=(UInt_t)-1) :
-        fRegexp(Form("^%s", regexp)), fMin(min), fMax(max)
-    {
-    }
-
     Rule(TObjArray &arr) :
         fRegexp(arr.GetEntries()>0?Form("^%s", arr[0]->GetName()):""),
@@ -123,9 +128,7 @@
     {
         if (arr.GetEntries()>1)
-            fMin = atoi(arr[1]->GetName());
+            fMin = GetId(arr[1]->GetName());
         if (arr.GetEntries()>2)
-            fMax = atoi(arr[2]->GetName());
-
-        //cout << "Regexp: " << (arr.GetEntries()>0?Form("^%s", arr[0]->GetName()):"") << " " << fMin << " " << fMax << endl;
+            fMax = GetId(arr[2]->GetName());
     }
 
@@ -158,14 +161,4 @@
     UInt_t fMin;
     UInt_t fMax;
-
-    static UInt_t GetId(const TString &str)
-    {
-        const Ssiz_t dot = str.First('.');
-
-        const UInt_t run = str.Atoi();
-        const UInt_t sub = dot<0 ? 0 : atoi(str.Data()+dot+1);
-
-        return run*1000+sub;
-    }
 
     void Init(const TObjArray &arr, Int_t idx=0)
@@ -472,5 +465,5 @@
         const char *fmt2 = "AND fExcludedFDAKEY=1 AND (fRunTypeKEY BETWEEN 2 AND 4) ORDER BY Id";
 
-        const TString query1 = Form("%s fTelescopeNumber=%d AND fSequenceFirst=%d %s",    fmt1, fTelescopeNumber, runstart/1000, fTelescopeNumber, fmt2);
+        const TString query1 = Form("%s fTelescopeNumber=%d AND fSequenceFirst=%d %s",                             fmt1, fTelescopeNumber, runstart/1000, fTelescopeNumber, fmt2);
         const TString query2 = Form("%s fTelescopeNumber=%d AND fRunNumber*1000+fFileNumber BETWEEN %d AND %d %s", fmt1, fTelescopeNumber, runstart, runstop, fmt2);
 
@@ -595,13 +588,12 @@
                 continue;
 
-            if (txt[0]=='['/* && section!=2*/)
+            if (txt[0]=='[')
             {
                 TString sec = txt(regexp);
                 if (!sec.IsNull())
                 {
-                    section = 0;
-
                     // Skip sections with the wrong telescope number
-                    if (!sec(regnum).IsNull() && !sec(regtel).IsNull())
+                    // (If section contains numbers but not the tel num)
+                    if (!sec(regnum).IsNull() && sec(regtel).IsNull())
                         continue;
 
@@ -609,6 +601,7 @@
                     if (sec.BeginsWith("[Transition"))
                         section = 1;
-                    if (sec.BeginsWith("[Regexp]"))
+                    if (sec.BeginsWith("[Regexp"))
                         section = 2;
+
                     continue;
                 }
