Index: trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 7100)
+++ trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 7101)
@@ -103,4 +103,8 @@
         }
 
+        TGraph g2;
+        g2.SetNameTitle(name, Form("%s vs ZdMin", name.Data()));
+        g2.SetMarkerStyle(kFullDotMedium);
+
         Int_t first = -1;
         Int_t last  = -1;
@@ -109,6 +113,7 @@
         {
             const char *date = (*row)[0];
-            const char *val  = (*row)[1];
-            if (!date || !val)
+            const char *zd   = (*row)[1];
+            const char *val  = (*row)[2];
+            if (!date || !val || !zd)
                 continue;
 
@@ -125,5 +130,7 @@
 
             Float_t value = atof(val);
+            Float_t zenith = atof(zd);
             g.SetPoint(g.GetN(), t.GetAxisTime(), value);
+            g2.SetPoint(g2.GetN(), zenith, value);
         }
 
@@ -176,4 +183,9 @@
         pad->cd(1);
         gPad->SetBorderMode(0);
+        gPad->Divide(2,1);
+
+        TVirtualPad *pad2 = gPad;
+        pad2->cd(1);
+        gPad->SetBorderMode(0);
         gPad->SetGridx();
         gPad->SetGridy();
@@ -192,4 +204,16 @@
 
         hist.DrawCopy("");
+
+        pad2->cd(2);
+        gPad->SetBorderMode(0);
+        gPad->SetGridy();
+
+        TH1 *h2 = g2.GetHistogram();
+
+        h2->SetXTitle("Zd");
+        h2->SetYTitle(name);
+
+        g2.DrawClone("AP");
+
     }
 
@@ -212,4 +236,5 @@
     {
         TString named  = "Sequences.fRunStart";
+        TString named2 = "Sequences.fZenithDistanceMin";
         TString namev  = value;
         TString join   = "fSequenceFirst";
@@ -221,6 +246,9 @@
         TString valued = named(named.First('.')+1, named.Length());
 
+        TString tabled2 = named2(0, named2.First('.'));
+        TString valued2 = named2(named2.First('.')+1, named2.Length());
+
         TString query;
-        query  = Form("select %s, %s ",        valued.Data(), valuev.Data());
+        query  = Form("select %s, %s, %s ",        valued.Data(), valued2.Data(), valuev.Data());
         query += Form("from %s left join %s ", tabled.Data(), tablev.Data());
         query += Form("on %s.%s=%s.%s ",       tabled.Data(), join.Data(), tablev.Data(), join.Data());
@@ -231,4 +259,6 @@
 
         query += "order by fRunStart";
+
+        cout << "q: " << query << endl;
 
         TSQLResult *res = fServer.Query(query);
@@ -255,5 +285,5 @@
     //from calib*.root
     plot.SetDescription("Conversion Factor inner Camera;C_{I} [phe/fadc cnts]", "ConvI");
-    plot.Plot("Calibration.fConvFactorInner",  0, 0.5, 0.01);
+    plot.Plot("Calibration.fConvFactorInner",  0, 0.5, 0.001);
     plot.SetDescription("Mean Arrival Time inner Camera;T_{I} [sl]", "ArrTmI");
     plot.Plot("Calibration.fArrTimeMeanInner", 0, 9.0, 0.1);
Index: trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C	(revision 7101)
+++ trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C	(revision 7101)
@@ -0,0 +1,124 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Daniela Dorner, 05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2005
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// ResetColumn.C
+// =============
+//
+// This macro is used to reset values in the DB.
+//
+// If a step in the automatic analysis chain has to be repeated, the value
+// for this step in the DB has to be reset. This can be done with this macro.
+//
+// As arguments you have to give the column, the table and the from which
+// to which Date/Sequence/Run you want to reset the value.
+//
+// The last argument is the 'dummy-mode'. If it is kTRUE dummy-mode is
+// switched on and nothing will be written into the database. This is usefull
+// for tests (i.e. if you want to see if the query is correct).
+//
+// usage:
+//   .x resetcolumn.C("fStar","SequenceProcessStatus","45114","49329",kTRUE)
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+
+#include <TEnv.h>
+#include <TObjString.h>
+#include <TList.h>
+
+#include <MSQLServer.h>
+#include <TSQLRow.h>
+#include <TSQLResult.h>
+
+using namespace std;
+
+
+int resetcolumn(TString column, TString table, TString from, TString to, Bool_t dummy=kTRUE)
+{
+    TEnv env("sql.rc");
+
+    MSQLServer serv(env);
+    if (!serv.IsConnected())
+    {
+        cout << "ERROR - Connection to database failed." << endl;
+        return 0;
+    }
+    cout << "resetcolumn" << endl;
+    cout << "-----------" << endl;
+    cout << endl;
+    cout << "Connected to " << serv.GetName() << endl;
+    cout << endl;
+
+    TEnv rc("steps.rc");
+    TString influences  = rc.GetValue(table+"."+column+".Influences", "");
+
+    cout << "resetting column " << column << flush;
+    cout << " and the columns it influences(" << influences << ") from " << flush;
+    cout << from << " to " << to << "..." << endl;
+
+    TList l;
+    while (!influences.IsNull())
+    {
+        influences = influences.Strip(TString::kBoth);
+
+        Int_t idx = influences.First(' ');
+        if (idx<0)
+            idx = influences.Length();
+
+        TString influence = influences(0, idx);
+        influences.Remove(0, idx);
+        l.Add(new TObjString(influence));
+    }
+
+    TString query(Form("Update MyMagic.%s SET %s=NULL ", table.Data(), column.Data()));
+
+    TIter Next(&l);
+    TObject *o=0;
+    while ((o=Next()))
+        query+=Form(", %s=NULL ", o->GetName());
+
+    query+=Form(" WHERE %s between '%s' and '%s'", rc.GetValue(table+".Primary", ""), from.Data(), to.Data());
+
+    if (dummy)
+    {
+        cout << "query: " << query << endl;
+        return 1;
+    }
+
+/*
+    TSQLResult *res = serv.Query(query);
+    if (!res)
+        return 0;
+
+    delete res;
+*/
+    return 1;
+}
+
+
