Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8985)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8986)
@@ -19,5 +19,29 @@
                                                  -*-*- END OF LINE -*-*-
 
- 2008/06/10 Thomas Bretz
+ 2008/06/21 Thomas Bretz
+
+   * callisto.cc, star.cc, ganymed.cc, sponde.cc:
+     - set the display name to a more convinient name
+
+   * datacenter/macros/plotdb.C:
+     - some improvement in setting axis titles and titles
+       automatically from the sql column names
+     - moved the Muon cut to a SetCondition call
+     - renamed some functions
+
+   * mbase/MStatusDisplay.h:
+     - overwrote SetTitle with a function allowing to set a title
+       only if no title set so far
+
+   * mjobs/MJCalibrateSignal.cc, mjobs/MJCalibration.cc, 
+     mjobs/MJPedestal.cc:
+     - set a proper display title and set it only if not already set
+
+   * mjobs/MJPedestal.cc:
+     - changed some filter names to more convinient names
+
+
+
+ 2008/06/20 Thomas Bretz
 
    * macros/dohtml.C:
Index: /trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/callisto.cc	(revision 8986)
@@ -360,5 +360,5 @@
     // From now on each 'Exit' means: Terminate the application
     d->SetBit(MStatusDisplay::kExitLoopOnExit);
-    d->SetTitle(kSequence);
+    d->SetTitle(Form("-- Callisto: %s --", kSequence.Data()));
 
     if (kModeC/* || kUseTest*/)
Index: /trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 8985)
+++ /trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 8986)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.45 2008-06-16 14:58:26 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.46 2008-06-21 13:53:33 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -133,9 +133,9 @@
         // Create TGraph objects
         TGraph &gt = res.GetFieldCount()>4 ? *new TGraphErrors : *new TGraph;
-        gt.SetNameTitle(name, Form("%s vs Time", name.Data()));
+        gt.SetNameTitle(Form("%s_time", res.GetFieldName(2)), Form("%s vs %s", res.GetFieldName(2), res.GetFieldName(0)));
         gt.SetMarkerStyle(kFullDotMedium);
 
         TGraph gz;
-        gz.SetNameTitle(name, Form("%s vs <Zd>", name.Data()));
+        gz.SetNameTitle(res.GetFieldName(2), Form("%s vs %s", res.GetFieldName(2), res.GetFieldName(1)));
         gz.SetMarkerStyle(kFullDotMedium);
 
@@ -257,4 +257,25 @@
         cerr << endl;
 
+        // format axis
+        TH1 *h = gt.GetHistogram();
+
+        const Double_t min = fHistMin>fHistMax ? h->GetMinimum()-resolution/2 : fHistMin;
+        const Double_t max = fHistMin>fHistMax ? h->GetMaximum()+resolution/2 : fHistMax;
+
+        // Create histogram
+        const Int_t n = resolution>0 ? TMath::Nint((max-min)/resolution) : 50;
+
+        TH1F hist("Hist", Form("Distribution of %s", fDescription.IsNull() ? name.Data() : fDescription.Data()), n, min, max);
+        hist.SetDirectory(0);
+
+        // Fill data into histogra,
+        for (int i=0; i<gt.GetN(); i++)
+            hist.Fill(gt.GetY()[i]);
+
+        // Format histogram
+        if (fDescription.IsNull())
+            hist.SetXTitle(name);
+        hist.SetYTitle("Counts");
+
         TVirtualPad *pad = gPad;
 
@@ -269,9 +290,6 @@
         gPad->SetBottomMargin(0.08);
 
-        // format axis
-        TH1 *h = gt.GetHistogram();
-
         h->SetXTitle("Time");
-        h->SetYTitle(name);
+        h->SetYTitle(hist.GetXaxis()->GetTitle());
         h->GetXaxis()->SetTimeDisplay(1);
         h->GetYaxis()->SetTitleOffset(0.8);
@@ -312,10 +330,4 @@
             gPad->SetGridx();
 
-        const Double_t min = fHistMin>fHistMax ? h->GetMinimum()-resolution/2 : fHistMin;
-        const Double_t max = fHistMin>fHistMax ? h->GetMaximum()+resolution/2 : fHistMax;
-
-        // Use this to save the pad with the time development to a file
-        //gPad->SaveAs(Form("plotdb-%s.eps", title.Data()));
-
         // Go back to first (upper) pad, format it and divide it again
         pad->cd(1);
@@ -333,19 +345,4 @@
         gPad->SetGridy();
 
-        // Create histogram
-        const Int_t n = resolution>0 ? TMath::Nint((max-min)/resolution) : 50;
-
-        TH1F hist("Hist", Form("Distribution of %s", fDescription.IsNull() ? name.Data() : fDescription.Data()), n, min, max);
-        hist.SetDirectory(0);
-
-        // Fill data into histogra,
-        for (int i=0; i<gt.GetN(); i++)
-            hist.Fill(gt.GetY()[i]);
-
-        // Format histogram
-        if (fDescription.IsNull())
-            hist.SetXTitle(name);
-        hist.SetYTitle("Counts");
-
         // plot histogram
         hist.DrawCopy("");
@@ -357,12 +354,8 @@
         gPad->SetGridy();
 
-        // format graph
-        TH1 *h2 = gz.GetHistogram();
-
-        h2->SetXTitle("Zd");
-        h2->SetYTitle(name);
-
         // draw graph
         gROOT->SetSelectedPad(0);
+        gz.GetXaxis()->SetTitle(res.GetFieldName(1));
+        gz.GetYaxis()->SetTitle(hist.GetXaxis()->GetTitle());
         gz.DrawClone("AP");
 
@@ -399,8 +392,11 @@
     void SetCondition(const char *cond="") { fCondition = cond; }
     void SetDescription(const char *d, const char *t=0) { fDescription = d; fNameTab = t; }
+    void SetTabName(const char *t) { fNameTab = t; }
     void SetGroupBy(GroupBy_t b=kGroupByWeek) { fGroupBy=b; }
     void SetPrimaryDate(const char *ts) { fPrimaryDate=ts; }
     void SetPrimaryNumber(const char *ts) { fPrimaryNumber=ts; }
     void SetSecondary(const char *ts) { fSecondary=ts; }
+
+    MStatusDisplay *GetDisplay() { return fDisplay; }
 
     Bool_t Plot(const char *value, Float_t min=0, Float_t max=-1, Float_t resolution=0)
@@ -473,4 +469,5 @@
 
         TString where(fCondition);
+        /*
         if (!fDataSet && !interval && tablev=="Star")
         {
@@ -479,5 +476,5 @@
             where += "Star.fMuonNumber>300 ";
         }
-
+        */
         if (interval)
         {
@@ -496,4 +493,5 @@
             query += "WHERE ";
             query += where;
+            query += " ";
         }
 
@@ -504,5 +502,4 @@
         }
         query += Form("ORDER BY %s ", valued.Data()+1);
-
 
         // ------------------------------
@@ -526,5 +523,5 @@
 };
 
-void plotall(MPlot &plot)
+void plotalldb(MPlot &plot)
 {
     //plot.SetGroupBy(MPlot::kGroupByNight);
@@ -532,5 +529,5 @@
     plot.SetPrimaryDate("Sequences.fRunStart");
     plot.SetPrimaryNumber("Sequences.fSequenceFirst");
-    plot.SetSecondary("(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2");
+    plot.SetSecondary("(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2 as '<Zd>'");
 
     //inner camera
@@ -592,6 +589,8 @@
     //plot.Plot("Calibration.fPulsePosVar", 0, 0.03, 0.001);
 
+
     //from star*.root
     //muon
+    plot.SetCondition("Star.fMuonNumber>300");
     plot.SetDescription("Point Spred Function;PSF [mm]");
     plot.Plot("Star.fPSF",                     0,  30, 0.5);
@@ -600,4 +599,6 @@
     plot.SetDescription("Muon Rate after Muon Cuts;R [Hz]");
     plot.Plot("Star.fMuonRate",                0, 2.0, 0.05);
+    plot.SetCondition();
+
     //quality
     plot.SetDescription("Datarate [Hz]", "Rate");
@@ -656,5 +657,5 @@
     plot.SetDescription("RMS Arrival Time outer Camera;\\sigma_{T,O} [sl]", "RmsArrTmO");
     plot.Plot("Calibration.fArrTimeRmsOuter",  0, 4.5, 0.01);
-    plot.SetDescription("Number of unsuitable pixels outer Camera;N{O}", "UnsuitO");
+    plot.SetDescription("Number of unsuitable pixels outer Camera;N_{O}", "UnsuitO");
     plot.Plot("Calibration.fUnsuitableOuter",  0, 25, 1);
     //from signal*.root
@@ -690,5 +691,5 @@
     plot.SetDisplay(d);
     plot.SetRequestRange(from, to);
-    plotall(plot);
+    plotalldb(plot);
     d->SaveAsRoot("plotdb.root");
     d->SaveAsPS("plotdb.ps");
@@ -722,5 +723,5 @@
     plot.SetDisplay(d);
     plot.SetRequestRange("", "");
-    plotall(plot);
+    plotalldb(plot);
     d->SaveAsRoot("plotdb.root");
     d->SaveAsPS("plotdb.ps");
@@ -754,5 +755,5 @@
     plot.SetDisplay(d);
     plot.SetRequestPeriod(period);
-    plotall(plot);
+    plotalldb(plot);
     d->SaveAsRoot("plotdb.root");
     d->SaveAsPS("plotdb.ps");
Index: /trunk/MagicSoft/Mars/ganymed.cc
===================================================================
--- /trunk/MagicSoft/Mars/ganymed.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/ganymed.cc	(revision 8986)
@@ -267,5 +267,5 @@
     // From now on each 'Exit' means: Terminate the application
     d->SetBit(MStatusDisplay::kExitLoopOnExit);
-    d->SetTitle(kSequences);
+    d->SetTitle(Form("-- Ganymed: %s --", kSequences.Data()));
 
     //
Index: /trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 8985)
+++ /trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 8986)
@@ -172,7 +172,12 @@
      // Name and title handling
      virtual void SetName(const char *name) { fName = name; }
-     virtual void SetTitle(const char *title="") { fTitle = title; }
+     virtual void SetTitle(const char *title="") { SetTitle(title, kTRUE); }
      virtual const char *GetName() const { return fName.Data(); }
      virtual const char *GetTitle() const { return fTitle.Data(); }
+
+     virtual void SetTitle(const char *title, Bool_t replace)
+     {
+         if (fTitle.IsNull() || replace) fTitle = title;
+     }
 
      // Getter / display access
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8986)
@@ -159,5 +159,12 @@
 
     if (fDisplay)
+    {
+        TString title = "--  Calibrate Signal: ";
+        title += fSequence.GetSequence();
+        title += "  --";
+        fDisplay->SetTitle(title, kFALSE);
+
         cont.Add(fDisplay);
+    }
 
     const TString name(Form("signal%08d.root", fSequence.GetSequence()));
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8986)
@@ -317,9 +317,8 @@
     // Update display
     //
-    TString title = fDisplay->GetTitle();
-    title += "--  Calibration ";
-    title += Form("calib%08d", fSequence.GetSequence());
+    TString title = "--  Calibration: ";
+    title += fSequence.GetSequence();
     title += "  --";
-    fDisplay->SetTitle(title);
+    fDisplay->SetTitle(title, kFALSE);
 
     //
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8986)
@@ -202,14 +202,13 @@
     // Update display
     //
-    TString title = fDisplay->GetTitle();
-    title += "--  Pedestal ";
-    title += fSequence.GetFileName();
+    TString title = "--  Pedestal: ";
+    title += fSequence.GetSequence();
     title += "  --";
-    fDisplay->SetTitle(title);
+    fDisplay->SetTitle(title, kFALSE);
 
     //
     // Get container from list
     //
-    MGeomCam           &geomcam   = *(MGeomCam*)plist.FindObject("MGeomCam");
+    const MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam");
     //    MCalibrationPedCam &calpedcam = *(MCalibrationPedCam*)plist.FindObject("MCalibrationPedCam");
 
@@ -276,5 +275,5 @@
       }
     */
-    
+
     if (fExtractionType!=kFundamental/*fExtractorResolution*/)
       {
@@ -326,5 +325,5 @@
         return;
       }
-    
+
 /*
     if (fIsUseHists)
@@ -362,5 +361,5 @@
         TCanvas &c3 = fDisplay->AddTab(fExtractionType!=kFundamental/*fExtractorResolution*/ ? "PedExtrd" : "Ped");
         c3.Divide(2,3);
-        
+
         c3.cd(1);
         gPad->SetBorderMode(0);
@@ -390,5 +389,5 @@
         obj1->SetPrettyPalette();
         obj1->Draw();
-        
+
         c3.cd(5);
         gPad->SetBorderMode(0);
@@ -404,5 +403,5 @@
         FixDataCheckHist(obj2);
         obj2->SetStats(1);
-        
+
         c3.cd(2);
         gPad->SetBorderMode(0);
@@ -422,5 +421,5 @@
         //
         DisplayReferenceLines(obj3,1);
-        
+
         c3.cd(4);
         gPad->SetBorderMode(0);
@@ -430,5 +429,5 @@
         c3.cd(6);
         gPad->SetBorderMode(0);
-        
+
         if (geomcam.InheritsFrom("MGeomCamMagic"))
           {
@@ -512,8 +511,8 @@
           }
       }
-    
+
     if (fExtractionType!=kFundamental/*fExtractorResolution*/)
       {
-            
+
           TCanvas &c3 = fDisplay->AddTab(fExtractionType==kWithExtractor?"PedExtrd":"PedRndm");
           c3.Divide(2,3);
@@ -530,5 +529,4 @@
       }
 }
-
 
 void  MJPedestal::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
@@ -1099,5 +1097,5 @@
     // The selection is done with the trigger bits before prescaling
     MTriggerPatternDecode decode;
-    MFTriggerPattern fcalib("CalibFilter");
+    MFTriggerPattern fcalib("SelectCosmics");
     fcalib.SetDefault(kTRUE);
     fcalib.DenyAll();
@@ -1116,4 +1114,5 @@
     tlist.AddToList(&pedsub);
 
+    // FIXME: MUX Monte Carlos?!??
     if (fIsPulsePosCheck)
     {
@@ -1135,9 +1134,10 @@
     //------------------------------
     // Require that before the Prescaling we had only a pedestal trigger
-    MFTriggerPattern ftp2("PedestalFilter");
+    MFTriggerPattern ftp2("SelectPedestals");
     ftp2.SetDefault(kTRUE);
     ftp2.DenyAll();
     ftp2.RequirePedestal();
 
+    // FIXME: WHAT D WE DO IN CASE OF MUX MCs????
     if (!fSequence.IsMonteCarlo() && (!fExtractor || !fExtractor->HasLoGain()))
     {
Index: /trunk/MagicSoft/Mars/sponde.cc
===================================================================
--- /trunk/MagicSoft/Mars/sponde.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/sponde.cc	(revision 8986)
@@ -231,5 +231,5 @@
     // From now on each 'Exit' means: Terminate the application
     d->SetBit(MStatusDisplay::kExitLoopOnExit);
-    d->SetTitle(kDataset);
+    d->SetTitle(Form("-- Sponde: %s --", kDataset.Data()));
 
     //
Index: /trunk/MagicSoft/Mars/star.cc
===================================================================
--- /trunk/MagicSoft/Mars/star.cc	(revision 8985)
+++ /trunk/MagicSoft/Mars/star.cc	(revision 8986)
@@ -230,5 +230,5 @@
     // From now on each 'Exit' means: Terminate the application
     d->SetBit(MStatusDisplay::kExitLoopOnExit);
-    d->SetTitle(kSequence);
+    d->SetTitle(Form("-- Star: %s --", kSequence.Data()));
 
     if (kDebugMem)
