Index: trunk/Mars/fact/processing/buildseqentries.C
===================================================================
--- trunk/Mars/fact/processing/buildseqentries.C	(revision 18246)
+++ trunk/Mars/fact/processing/buildseqentries.C	(revision 18308)
@@ -136,4 +136,5 @@
         if (arr.GetEntries()>2)
             fMax = GetId(arr[2]->GetName());
+        cout << "----> " << fMin << " " << fMax << endl;
     }
 
@@ -217,4 +218,5 @@
         if (run>0)
         {
+            cout << " - - > " << run << endl;
             if (run<fMin || run>fMax)
                 return kFALSE;
@@ -915,5 +917,5 @@
     }
 
-    TString PrepareString(TSQLResult &res, TArrayL &runs)
+    TString PrepareString(TSQLResult &res, TArrayL &runs, TArrayL &nights)
     {
         // Number of result rows
@@ -921,4 +923,5 @@
 
         runs.Set(rows);       // initialize size of array for run numbers
+        nights.Set(rows);       // initialize size of array for nights
 
         TArrayD start(rows);  // instantiate array for start times
@@ -932,4 +935,5 @@
         {
             runs[idx] = atol((*row)[0]);          // run number
+            nights[idx] = atol((*row)[4]);          // night
 
             const TString tstart = ((*row)[2]);   // start time
@@ -1021,5 +1025,5 @@
         /*const*/
         TString query =
-            "SELECT fRunID, fRunTypeKEY, fRunStart, fRunStop"
+            "SELECT fRunID, fRunTypeKEY, fRunStart, fRunStop, fNight*1000 "
             " FROM RunInfo WHERE fExcludedFDAKEY=1 AND ";
         query += Form("fRunID BETWEEN %ld AND %ld AND "
@@ -1038,5 +1042,6 @@
         // and an array with the corresponding run-numbers
         TArrayL runs;
-        const TString str = PrepareString(*res, runs);
+        TArrayL nights;
+        const TString str = PrepareString(*res, runs, nights);
 
         delete res;
@@ -1071,5 +1076,5 @@
             {
                 // Check if regular expressions matchs
-                const Ssiz_t len = obj->Match(str, pos, runs[pos]);
+                const Ssiz_t len = obj->Match(str, pos, nights[pos]);
                 if (len>0)
                 {
