Index: trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 7493)
+++ trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 7494)
@@ -52,9 +52,10 @@
 //
 // To draw sequences belonging to a DataSet in colors for highliting
-// change the defintition of "MDataSet ds;" in the code to something
-// like "MDataSet ds("dataset.txt");" to load your favourite dataset.
+// change the defintition of 'const char *dataset=0;' in the code to something
+// like 'const char *dataset="dataset.txt";' to load your favourite dataset.
 //
 /////////////////////////////////////////////////////////////////////////////
 #include <iostream>
+#include <iomanip>
 
 #include <TH1.h>
@@ -77,7 +78,7 @@
 
 // Replace this line
-MDataSet ds;
+const char *dataset=0;
 //  by
-// MDataSet ds("/magic/datasets/00000/dataset00000003.txt");
+// const char *dataset = "/magic/datasets/00000/dataset00000003.txt";
 //  to mark the sequences of your favourite dataset.
 
@@ -86,4 +87,6 @@
 private:
     MSQLServer &fServer;
+
+    MDataSet *fDataSet;
 
     TString fRequestFrom;
@@ -162,14 +165,17 @@
             Float_t zenith = atof(zd);
 
-            if (ds.HasOnSequence(seq))
+            if (fDataSet)
             {
-                gt1.SetPoint(gt1.GetN(), t.GetAxisTime(), value);
-                gz1.SetPoint(gz1.GetN(), zenith, value);
-            }
-
-            if (ds.HasOffSequence(seq))
-            {
-                gt0.SetPoint(gt0.GetN(), t.GetAxisTime(), value);
-                gz0.SetPoint(gz0.GetN(), zenith, value);
+                if (fDataSet->HasOnSequence(seq))
+                {
+                    gt1.SetPoint(gt1.GetN(), t.GetAxisTime(), value);
+                    gz1.SetPoint(gz1.GetN(), zenith, value);
+                }
+
+                if (fDataSet->HasOffSequence(seq))
+                {
+                    gt0.SetPoint(gt0.GetN(), t.GetAxisTime(), value);
+                    gz0.SetPoint(gz0.GetN(), zenith, value);
+                }
             }
 
@@ -292,7 +298,22 @@
 
 public:
-    MPlot(MSQLServer &server) : fServer(server), fRequestPeriod(-1),
-        fPlotMin(0), fPlotMax(-1), fHistMin(0), fHistMax(-1)
-    {
+    MPlot(MSQLServer &server) : fDataSet(NULL), fServer(server),
+        fRequestPeriod(-1), fPlotMin(0), fPlotMax(-1), fHistMin(0), fHistMax(-1)
+    {
+    }
+    ~MPlot()
+    {
+        if (fDataSet)
+            delete fDataSet;
+    }
+    void SetDataSet(const TString filename)
+    {
+        if (fDataSet)
+        {
+            delete fDataSet;
+            fDataSet = NULL;
+        }
+        if (!filename.IsNull())
+            fDataSet = new MDataSet(filename);
     }
     void SetPlotRange(Float_t min, Float_t max, Int_t n=5)
@@ -433,4 +454,5 @@
 
     MPlot plot(serv);
+    plot.SetDataSet(dataset);
     plot.SetDisplay(d);
     plot.SetRequestRange(from, to);
@@ -464,4 +486,5 @@
 
     MPlot plot(serv);
+    plot.SetDataSet(dataset);
     plot.SetDisplay(d);
     plot.SetRequestPeriod(period);
