Index: trunk/MagicSoft/Mars/mhist/HistLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 2551)
+++ trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 2556)
@@ -10,4 +10,5 @@
 #pragma link C++ class MHArray+;
 #pragma link C++ class MH3+;
+#pragma link C++ class MHVsTime+;
 
 #pragma link C++ class MBinning+;
Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2551)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2556)
@@ -154,4 +154,7 @@
     fParContainerName = par;
 
+    AddToBranchList(Form("%s.*", (const char*)ExtractName(hist)));
+    AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
+
     if (title)
         return;
@@ -196,4 +199,7 @@
     fParContainerName = par->GetName();
 
+    AddToBranchList(Form("%s.*", (const char*)ExtractName(hist)));
+    AddToBranchList(Form("%s.*", par->GetName()));
+
     if (!title)
         fTitle = "Fill " + fHName + " from " + par->GetDescriptor();
@@ -218,4 +224,5 @@
 
     AddToBranchList(fH->GetDataMember());
+    AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
 
     if (title)
@@ -248,4 +255,5 @@
 
     AddToBranchList(fH->GetDataMember());
+    AddToBranchList(Form("%s.*", par->GetName()));
 
     if (!title)
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2556)
@@ -0,0 +1,247 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MHVsTime
+//
+// Preliminary: the docu may be wrong!
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MHVsTime.h"
+
+#include <ctype.h>   // tolower
+#include <fstream>
+
+#include <TPad.h>
+#include <TStyle.h>
+#include <TCanvas.h>
+
+#include <TGraph.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MTime.h"
+#include "MParList.h"
+#include "MDataChain.h"
+
+ClassImp(MHVsTime);
+
+using namespace std;
+
+static const TString gsDefName  = "MHVsTime";
+static const TString gsDefTitle = "Container for a graph vs time";
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MHVsTime::MHVsTime(const char *rule)
+    : fHist(NULL), fData(NULL), fScale(1)
+{  
+    fName  = gsDefName;
+    fTitle = gsDefTitle;
+
+    if (!rule)
+        return;
+
+    fHist = new TGraph;
+    fData = new MDataChain(rule);
+}
+
+// --------------------------------------------------------------------------
+//
+// Deletes the histogram
+//
+MHVsTime::~MHVsTime()
+{
+    if (fHist)
+        delete fHist;
+
+    if (fData)
+        delete fData;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the data members used by the data chain to be used in
+// MTask::AddBranchToList
+//
+TString MHVsTime::GetDataMember() const
+{
+    *fLog << dbg << fData->GetDataMember() << endl;
+    return fData ? fData->GetDataMember() : (TString)"";
+}
+
+// --------------------------------------------------------------------------
+//
+// Setup the Binning for the histograms automatically if the correct
+// instances of MBinning are found in the parameter list
+// For a more detailed description see class description above.
+//
+Bool_t MHVsTime::SetupFill(const MParList *plist)
+{
+    // reset histogram (necessary if the same eventloop is run more than once) 
+    //fHist->Reset();
+
+    if (fData && !fData->PreProcess(plist))
+        return kFALSE;
+
+    if (fHist)
+    {
+        delete fHist;
+        fHist = new TGraph;
+    }
+
+    TString title(fData ? GetRule() : (TString)"Histogram");
+    title += " vs Time";
+
+    fHist->SetNameTitle(fName, title);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the name of the histogram ant the MHVsTime container
+//
+void MHVsTime::SetName(const char *name)
+{
+    fHist->SetName(name);
+    MParContainer::SetName(name);
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the title of the histogram ant the MHVsTime container
+//
+void MHVsTime::SetTitle(const char *title)
+{
+    fHist->SetTitle(title);
+    MParContainer::SetTitle(title);
+}
+
+// --------------------------------------------------------------------------
+//
+// Fills the one, two or three data members into our histogram
+//
+Bool_t MHVsTime::Fill(const MParContainer *par, const Stat_t w)
+{
+    const MTime *t = dynamic_cast<const MTime*>(par);
+    if (!t)
+    {
+        *fLog << err << dbginf << "No MTime found..." << endl;
+        return kFALSE;
+    }
+
+    const Double_t v = fData->GetValue()*fScale;
+    const Double_t T = (*t);///3600;
+
+    fHist->SetPoint(fHist->GetN(), T>12*3600?T-24*3600:T, v);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Creates a new canvas and draws the histogram into it.
+//
+// Possible options are:
+//   PROFX: Draw a x-profile into the histogram (for 2D histograms only)
+//   PROFY: Draw a y-profile into the histogram (for 2D histograms only)
+//   ONLY:  Draw the profile histogram only (for 2D histograms only)
+//
+// If the kIsLog?-Bit is set the axis is displayed lkogarithmically.
+// eg this is set when applying a logarithmic MBinning
+//
+// Be careful: The histogram belongs to this object and won't get deleted
+// together with the canvas.
+//
+void MHVsTime::Draw(Option_t *opt)
+{
+    if (fHist->GetN()==0)
+        return;
+
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
+    TString str(opt);
+
+    fHist->GetHistogram()->SetXTitle("Time");
+    fHist->GetHistogram()->SetYTitle(GetRule());
+    fHist->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
+    fHist->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
+    fHist->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
+    fHist->Draw("AP");
+    if (fHist->TestBit(kIsLogy))
+        pad->SetLogy();
+
+    pad->Modified();
+    pad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Used to rebuild a MHVsTime object of the same type (data members,
+// dimension, ...)
+//
+MParContainer *MHVsTime::New() const
+{
+    MHVsTime *h=new MHVsTime(fData ? (const char*)GetRule() : NULL);
+    h->SetScale(fScale);
+    return h;
+}
+
+TString MHVsTime::GetRule() const
+{
+    return fData ? fData->GetRule() : (TString)"";
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the total number of bins in a histogram (excluding under- and
+// overflow bins)
+//
+Int_t MHVsTime::GetNbins() const
+{
+    return fHist->GetN();
+}
+
+TH1 *MHVsTime::GetHist()
+{
+    return fHist ? fHist->GetHistogram() : 0;
+}
+
+const TH1 *MHVsTime::GetHist() const
+{
+    return fHist ? fHist->GetHistogram() : 0;
+}
+
+TH1 *MHVsTime::GetHistByName(const TString name)
+{
+    return GetHist();
+}
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 2556)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 2556)
@@ -0,0 +1,51 @@
+#ifndef MARS_MHVsTime
+#define MARS_MHVsTime
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+
+class TGraph;
+class MDataChain;
+
+class MHVsTime : public MH
+{
+protected:
+    // Could be const but root < 3.02/06 doesn't like this...
+    TGraph     *fHist;  // Histogram to fill
+    MDataChain *fData;  // Object from which the data is filled
+    Double_t    fScale; // Scale for axis (eg unit)
+
+    enum {
+        kIsLogy = BIT(18)
+    };
+
+public:
+    MHVsTime(const char *rule=NULL);
+    ~MHVsTime();
+
+    void SetScale(Double_t scale) { fScale = scale; }
+
+    Int_t GetNbins() const;
+
+    void SetName(const char *name);
+    void SetTitle(const char *title);
+
+    Bool_t SetupFill(const MParList *pList);
+    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
+
+    TString GetDataMember() const;
+    TString GetRule() const;
+
+    const TH1 *GetHist() const;
+    TH1 *GetHist();
+    TH1 *GetHistByName(const TString name="");
+
+    void Draw(Option_t *opt=NULL);
+
+    MParContainer *New() const;
+
+    ClassDef(MHVsTime, 1) // Generalized 1/2/3D-histogram for Mars variables
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mhist/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhist/Makefile	(revision 2551)
+++ trunk/MagicSoft/Mars/mhist/Makefile	(revision 2556)
@@ -33,4 +33,5 @@
            MBinning.cc \
            MH.cc \
+           MHVsTime.cc \
            MHArray.cc \
            MWeight.cc \
