Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3393)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3394)
@@ -18,4 +18,24 @@
      - added getter function fAidx
      - increased class version to 3
+
+   * macros/sectorvstime.C:
+     - added example of how to plot the evolution of a sector vs time
+
+   * mhist/MHVsTime.[h,cc], mhist/MHPixVsTime.[h,cc]:
+     - moved to mhvstime
+
+   * mhvstime/MHSectorVsTime.[h,cc]:
+     - added
+
+   * Makefile:
+     - added mhvstime
+
+   * mhvstime/Makefile, mhvstime/HVsTimeLinkDef.h, 
+     mhvstime/HVsTimeIncl.h:
+     - added
+
+   * mhist/Makefile, mhist/HistLinkDef.h, 
+     - removed MHVsTime
+     - removed MHPixVsTime
 
 
Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 3393)
+++ trunk/MagicSoft/Mars/Makefile	(revision 3394)
@@ -43,4 +43,5 @@
           mdata \
           mhbase \
+          mhvstime \
           mhist \
           manalysis \
Index: trunk/MagicSoft/Mars/macros/dohtml.C
===================================================================
--- trunk/MagicSoft/Mars/macros/dohtml.C	(revision 3393)
+++ trunk/MagicSoft/Mars/macros/dohtml.C	(revision 3394)
@@ -55,4 +55,5 @@
     sourcedir += "mhist:";
     sourcedir += "mhistmc:";
+    sourcedir += "mhvstime:";
     sourcedir += "mimage:";
     sourcedir += "mmain:";
Index: trunk/MagicSoft/Mars/macros/rootlogon.C
===================================================================
--- trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 3393)
+++ trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 3394)
@@ -112,4 +112,5 @@
     gInterpreter->AddIncludePath(dir+"mhist");
     gInterpreter->AddIncludePath(dir+"mhistmc");
+    gInterpreter->AddIncludePath(dir+"mhvstime");
     gInterpreter->AddIncludePath(dir+"mimage");
     gInterpreter->AddIncludePath(dir+"mmain");
Index: trunk/MagicSoft/Mars/mhist/HistLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 3393)
+++ trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 3394)
@@ -4,6 +4,4 @@
 #pragma link off all classes;
 #pragma link off all functions;
-
-#pragma link C++ class MHVsTime+;
 
 #pragma link C++ class MHFadcCam+;
@@ -15,4 +13,5 @@
 
 #pragma link C++ class MHBlindPixels+;
+#pragma link C++ class MHHeaders+;
 
 #pragma link C++ class MHStarMap+;
@@ -40,5 +39,4 @@
 
 #pragma link C++ class MHCamera+;
-#pragma link C++ class MHPixVsTime+;
 
 #endif
Index: trunk/MagicSoft/Mars/mhist/MHPixVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHPixVsTime.cc	(revision 3393)
+++ 	(revision )
@@ -1,216 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * 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, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MHPixVsTime
-//
-// A histogram to store the sum of camera events. This can be photons,
-// currents or enything else derived from MPixVsTime
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MHPixVsTime.h"
-
-#include <TCanvas.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-#include "MCamEvent.h"
-
-#include "MGeomCam.h"
-
-#include "MRawEvtHeader.h"
-#include "MTime.h"
-
-ClassImp(MHPixVsTime);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Initialize the name and title of the task.
-// Resets the sum histogram
-//
-MHPixVsTime::MHPixVsTime(Int_t idx, const char *name, const char *title)
-    : fIndex(idx), fEvt(NULL), fType(0)
-{
-    //
-    //   set the name and title of this object
-    //
-    fName  = name  ? name  : "MHPixVsTime";
-    fTitle = title ? title : "Average of MPixVsTimes";
-
-    TString t("Pixel Index #");
-    t += idx;
-    t += " vs Time";
-
-    fGraph = new TGraph;
-    fGraph->SetName("MCamEvent");
-    fGraph->SetTitle(t);
-}
-
-// --------------------------------------------------------------------------
-//
-// Delete the corresponding camera display if available
-//
-MHPixVsTime::~MHPixVsTime()
-{
-  if(fGraph)
-    delete fGraph;
-}
-
-// --------------------------------------------------------------------------
-//
-// Get the event (MPixVsTime) the histogram might be filled with. If
-// it is not given, it is assumed, that it is filled with the argument
-// of the Fill function.
-// Looks for the camera geometry MGeomCam and resets the sum histogram.
-//
-Bool_t MHPixVsTime::SetupFill(const MParList *plist)
-{
-    fEvt = (MCamEvent*)plist->FindObject(fNameEvt, "MCamEvent");
-    if (!fEvt)
-    {
-        if (!fNameEvt.IsNull())
-        {
-            *fLog << err << GetDescriptor() << ": No " << fNameEvt <<" [MCamEvent] available..." << endl;
-            return kFALSE;
-        }
-        *fLog << warn << GetDescriptor() << ": No MCamEvent available..." << endl;
-    }
-
-    fCam = (MGeomCam*)plist->FindObject("MGeomCam");
-    if (!fCam)
-    {
-        *fLog << err << "MGeomCam not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    if (!fNameTime.IsNull())
-    {
-        fTime = (MTime*)plist->FindObject(fNameTime, "MTime");
-        if (!fTime)
-        {
-            *fLog << err << fNameTime << " [MTime] not found... abort." << endl;
-            return kFALSE;
-        }
-    }
-    else
-    {
-        fHeader = (MRawEvtHeader*)plist->FindObject("MRawEvtHeader");
-        if (!fHeader)
-        {
-            *fLog << err << "MRawEvtHeader not found... abort." << endl;
-            return kFALSE;
-        }
-    }
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Fill the histograms with data from a MPixVsTime-Container.
-//
-Bool_t MHPixVsTime::Fill(const MParContainer *par, const Stat_t w)
-{
-    const MCamEvent *evt = par ? dynamic_cast<const MCamEvent*>(par) : fEvt;
-    if (!evt)
-    {
-        *fLog << err << dbginf << "No MCamEvent found..." << endl;
-        return kFALSE;
-    }
-
-    Double_t val = 0;
-    evt->GetPixelContent(val, fIndex, *fCam, fType);
-    if (TMath::IsNaN(val))
-        return kCONTINUE;
-
-    Double_t t = 0;
-    if (!fNameTime.IsNull())
-        t = fTime->GetAxisTime();
-    else
-        t = fHeader ? fHeader->GetDAQEvtNumber() : fGraph->GetN();
-
-    fGraph->SetPoint(fGraph->GetN(), t, val);
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Scale the sum container with the number of entries
-//
-Bool_t MHPixVsTime::Finalize()
-{
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Return fSum.
-//
-TH1 *MHPixVsTime::GetHistByName(const TString name)
-{
-    return fGraph->GetHistogram();
-}
-
-void MHPixVsTime::Draw(Option_t *opt)
-{
-
-    if (fGraph->GetN()==0)
-        return;
-
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
-    pad->SetBorderMode(0);
-
-    AppendPad("");
-
-    TString str(opt);
-
-    fGraph->GetHistogram()->SetXTitle("Time");
-    fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
-    fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
-    fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
-
-    fGraph->GetHistogram()->SetYTitle("");
-
-    if (!str.Contains("A"))
-        str += "A";
-    if (!str.Contains("P"))
-        str += "P";
-
-    if (str.Contains("same", TString::kIgnoreCase))
-    {
-        str.ReplaceAll("same", "");
-        str.ReplaceAll("A", "");
-    }
-
-    fGraph->Draw(str);
-
-    pad->Modified();
-    pad->Update();
-
-}
Index: trunk/MagicSoft/Mars/mhist/MHPixVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHPixVsTime.h	(revision 3393)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#ifndef MARS_MHPixVsTime
-#define MARS_MHPixVsTime
-
-#ifndef MARS_MH
-#include "MH.h"
-#endif
-
-#ifndef ROOT_TGraph
-#include <TGraph.h>
-#endif
-
-class MHCamera;
-class MCamEvent;
-class MGeomCam;
-
-class MRawEvtHeader;
-class MTime;
-
-class MHPixVsTime : public MH
-{
-private:
-    TGraph     *fGraph;
-    Int_t      fIndex;
-
-    MCamEvent *fEvt; //! the current event
-    MGeomCam  *fCam; //! the camera geometry
-
-    MRawEvtHeader *fHeader; //!
-    MTime         *fTime;   //!
-
-    TString fNameEvt;
-    TString fNameTime;
-
-    Int_t fType;
-    Int_t fTypeErr;
-
-    Bool_t SetupFill(const MParList *pList);
-    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
-    Bool_t Finalize();
-
-public:
-    MHPixVsTime(Int_t idx=0, const char *name=NULL, const char *title=NULL);
-    ~MHPixVsTime();
-
-    void SetNameEvt(const TString name) { fNameEvt = name; }
-    void SetNameTime(const TString name) { fNameTime = name; }
-    void SetType(Int_t type, Int_t e=-1) { fType = type; fTypeErr=e; }
-
-    TH1 *GetHistByName(const TString name="");
-    TGraph *GetGraph() { return fGraph; }
-
-    void Draw(Option_t *o=NULL);
-
-    ClassDef(MHPixVsTime, 1) // Histogram to sum camera events
-};
-
-#endif
-
-
-
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 3393)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * 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"
-#include "MRawEvtHeader.h"
-
-ClassImp(MHVsTime);
-
-using namespace std;
-
-static const TString gsDefName  = "MHVsTime";
-static const TString gsDefTitle = "Container for a graph vs time/evtnumber";
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MHVsTime::MHVsTime(const char *rule)
-    : fGraph(NULL), fData(NULL), fScale(1), fUseEventNumber(0)
-{  
-    fName  = gsDefName;
-    fTitle = gsDefTitle;
-
-    if (!rule)
-        return;
-
-    fGraph = new TGraph;
-    fData = new MDataChain(rule);
-}
-
-// --------------------------------------------------------------------------
-//
-// Deletes the histogram
-//
-MHVsTime::~MHVsTime()
-{
-    if (fGraph)
-        delete fGraph;
-
-    if (fData)
-        delete fData;
-}
-
-// --------------------------------------------------------------------------
-//
-// Return the data members used by the data chain to be used in
-// MTask::AddBranchToList
-//
-TString MHVsTime::GetDataMember() const
-{
-    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) 
-    //fGraph->Reset();
-
-    if (fData && !fData->PreProcess(plist))
-        return kFALSE;
-
-    if (fGraph)
-    {
-        delete fGraph;
-        fGraph = new TGraph;
-    }
-
-    TString title(fData ? GetRule() : (TString)"Histogram");
-    title += " vs ";
-    title += fUseEventNumber ? "Event Number" : "Time";
-
-    fGraph->SetNameTitle(fName, title);
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Set the name of the histogram ant the MHVsTime container
-//
-void MHVsTime::SetName(const char *name)
-{
-    fGraph->SetName(name);
-    MParContainer::SetName(name);
-}
-
-// --------------------------------------------------------------------------
-//
-// Set the title of the histogram ant the MHVsTime container
-//
-void MHVsTime::SetTitle(const char *title)
-{
-    fGraph->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)
-{
-    Double_t t = 0;
-    if (fUseEventNumber)
-    {
-        const MRawEvtHeader *h = dynamic_cast<const MRawEvtHeader*>(par);
-        t = h ? h->GetDAQEvtNumber() : fGraph->GetN();
-    }
-    else
-    {
-        const MTime *tm = dynamic_cast<const MTime*>(par);
-        if (!tm)
-        {
-            *fLog << err << dbginf << "No MTime found..." << endl;
-            return kFALSE;
-        }
-        t = tm->GetAxisTime();
-    }
-
-    const Double_t v = fData->GetValue()*fScale;
-
-    fGraph->SetPoint(fGraph->GetN(), 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 (fGraph->GetN()==0)
-        return;
-
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
-    pad->SetBorderMode(0);
-
-    AppendPad("");
-
-    TString str(opt);
-
-    if (fUseEventNumber)
-        fGraph->GetHistogram()->SetXTitle("Event Number");
-    else
-    {
-        fGraph->GetHistogram()->SetXTitle("Time");
-        fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
-        fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
-        fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
-    }
-    fGraph->GetHistogram()->SetYTitle(GetRule());
-
-    if (!str.Contains("A"))
-        str += "A";
-    if (!str.Contains("P"))
-        str += "P";
-
-    if (str.Contains("same", TString::kIgnoreCase))
-    {
-        str.ReplaceAll("same", "");
-        str.ReplaceAll("A", "");
-    }
-
-    fGraph->Draw(str);
-    if (fGraph->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);
-    if (fUseEventNumber)
-        h->SetUseEventNumber();
-    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 fGraph->GetN();
-}
-/*
-TH1 *MHVsTime::GetHist()
-{
-    return fGraph ? fGraph->GetHistogram() : 0;
-}
-
-const TH1 *MHVsTime::GetHist() const
-{
-    return fGraph ? fGraph->GetHistogram() : 0;
-}
-
-TH1 *MHVsTime::GetHistByName(const TString name)
-{
-    return GetHist();
-}
-*/
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 3393)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#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     *fGraph;  // Histogram to fill
-    MDataChain *fData;  // Object from which the data is filled
-    Double_t    fScale; // Scale for axis (eg unit)
-
-    enum {
-        kIsLogy = BIT(18),
-        kUseEventNumber = BIT(20)
-    };
-
-    Bool_t fUseEventNumber;
-
-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="");
-*/
-    const TGraph *GetGraph() const { return fGraph; }
-    TGraph *GetGraph() { return fGraph; }
-
-    void SetUseEventNumber(Bool_t use = kTRUE) { fUseEventNumber = use; }
-
-    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 3393)
+++ trunk/MagicSoft/Mars/mhist/Makefile	(revision 3394)
@@ -30,8 +30,6 @@
 .SUFFIXES: .c .cc .cxx .h .hxx .o 
 
-SRCFILES = MHVsTime.cc \
-           MHEvent.cc \
+SRCFILES = MHEvent.cc \
            MHCamEvent.cc \
-           MHPixVsTime.cc \
            MHFadcPix.cc \
            MHFadcCam.cc \
@@ -51,4 +49,5 @@
            MHGamma.cc \
            MHFlux.cc \
+           MHHeaders.cc \
 	   MHSigmaPixel.cc \
 	   MHSigmabarTheta.cc \
Index: trunk/MagicSoft/Mars/mhvstime/HVsTimeIncl.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/HVsTimeIncl.h	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/HVsTimeIncl.h	(revision 3394)
@@ -0,0 +1,6 @@
+#ifndef __CINT__
+
+#include <TF1.h>
+#include <TArrayI.h>
+
+#endif // __CINT__
Index: trunk/MagicSoft/Mars/mhvstime/HVsTimeLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/HVsTimeLinkDef.h	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/HVsTimeLinkDef.h	(revision 3394)
@@ -0,0 +1,11 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class MHVsTime+;
+#pragma link C++ class MHPixVsTime+;
+#pragma link C++ class MHSectorVsTime+;
+
+#endif
Index: trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc	(revision 3394)
@@ -0,0 +1,217 @@
+/* ======================================================================== *\
+!
+! *
+! * 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, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MHPixVsTime
+//
+// Display the pixel content versus time or event number
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MHPixVsTime.h"
+
+#include <TCanvas.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+#include "MCamEvent.h"
+
+#include "MGeomCam.h"
+
+#include "MRawEvtHeader.h"
+#include "MTime.h"
+
+ClassImp(MHPixVsTime);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Initialize the name and title of the task.
+//
+MHPixVsTime::MHPixVsTime(Int_t idx, const char *name, const char *title)
+    : fIndex(idx), fEvt(NULL), fType(0)
+{
+    //
+    //   set the name and title of this object
+    //
+    fName  = name  ? name  : "MHPixVsTime";
+    fTitle = title ? title : "Average of MPixVsTimes";
+
+    TString t("Pixel Index #");
+    t += idx;
+    t += " vs Time";
+
+    fGraph = new TGraphErrors;
+    fGraph->SetName("MCamEvent");
+    fGraph->SetTitle(t);
+}
+
+// --------------------------------------------------------------------------
+//
+// Delete the corresponding camera display if available
+//
+MHPixVsTime::~MHPixVsTime()
+{
+  if(fGraph)
+    delete fGraph;
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the event (MPixVsTime) the histogram might be filled with. If
+// it is not given, it is assumed, that it is filled with the argument
+// of the Fill function.
+// Looks for the camera geometry MGeomCam and resets the sum histogram.
+//
+Bool_t MHPixVsTime::SetupFill(const MParList *plist)
+{
+    fEvt = (MCamEvent*)plist->FindObject(fNameEvt, "MCamEvent");
+    if (!fEvt)
+    {
+        if (!fNameEvt.IsNull())
+        {
+            *fLog << err << GetDescriptor() << ": No " << fNameEvt <<" [MCamEvent] available..." << endl;
+            return kFALSE;
+        }
+        *fLog << warn << GetDescriptor() << ": No MCamEvent available..." << endl;
+    }
+
+    fCam = (MGeomCam*)plist->FindObject("MGeomCam");
+    if (!fCam)
+    {
+        *fLog << err << "MGeomCam not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    if (!fNameTime.IsNull())
+    {
+        fTime = (MTime*)plist->FindObject(fNameTime, "MTime");
+        if (!fTime)
+        {
+            *fLog << err << fNameTime << " [MTime] not found... abort." << endl;
+            return kFALSE;
+        }
+    }
+    else
+    {
+        fHeader = (MRawEvtHeader*)plist->FindObject("MRawEvtHeader");
+        if (!fHeader)
+            *fLog << warn << "MRawEvtHeader not found... using counter." << endl;
+    }
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill the histograms with data from a MPixVsTime-Container.
+//
+Bool_t MHPixVsTime::Fill(const MParContainer *par, const Stat_t w)
+{
+    const MCamEvent *evt = par ? dynamic_cast<const MCamEvent*>(par) : fEvt;
+    if (!evt)
+    {
+        *fLog << err << dbginf << "No MCamEvent found..." << endl;
+        return kFALSE;
+    }
+
+    Double_t val = 0;
+    Double_t rms = 0;
+    evt->GetPixelContent(val, fIndex, *fCam, fType);
+    if (TMath::IsNaN(val))
+        return kCONTINUE;
+
+    Double_t t = 0;
+    if (!fNameTime.IsNull())
+        t = fTime->GetAxisTime();
+    else
+        t = fHeader ? fHeader->GetDAQEvtNumber() : fGraph->GetN();
+
+    fGraph->SetPoint(fGraph->GetN(), t, val);
+
+    if (fTypeErr>=0)
+    {
+        evt->GetPixelContent(rms, fIndex, *fCam, fType);
+        if (TMath::IsNaN(rms))
+            return kCONTINUE;
+    }
+
+    fGraph->SetPointError(fGraph->GetN()-1, 0, rms);
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return histogram of TGraph
+//
+TH1 *MHPixVsTime::GetHistByName(const TString name)
+{
+    return fGraph->GetHistogram();
+}
+
+void MHPixVsTime::Draw(Option_t *opt)
+{
+
+    if (fGraph->GetN()==0)
+        return;
+
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
+    TString str(opt);
+
+    TH1 *h = fGraph->GetHistogram();
+
+    h->SetXTitle("Time");
+    h->SetYTitle("");
+    if (!fNameTime.IsNull())
+    {
+        TAxis *axe = h->GetXaxis();
+        axe->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
+        axe->SetTimeDisplay(1);
+        axe->SetLabelSize(0.033);
+    }
+
+
+    if (!str.Contains("A"))
+        str += "A";
+    if (!str.Contains("P"))
+        str += "P";
+
+    if (str.Contains("same", TString::kIgnoreCase))
+    {
+        str.ReplaceAll("same", "");
+        str.ReplaceAll("A", "");
+    }
+
+    fGraph->Draw(str);
+
+    pad->Modified();
+    pad->Update();
+}
Index: trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.h	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.h	(revision 3394)
@@ -0,0 +1,59 @@
+#ifndef MARS_MHPixVsTime
+#define MARS_MHPixVsTime
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+
+#ifndef ROOT_TGraphErrors
+#include <TGraphErrors.h>
+#endif
+
+class MHCamera;
+class MCamEvent;
+class MGeomCam;
+
+class MRawEvtHeader;
+class MTime;
+
+class MHPixVsTime : public MH
+{
+private:
+    TGraphErrors *fGraph;
+    Int_t fIndex;
+
+    MCamEvent *fEvt; //! the current event
+    MGeomCam  *fCam; //! the camera geometry
+
+    MRawEvtHeader *fHeader; //!
+    MTime         *fTime;   //!
+
+    TString fNameEvt;
+    TString fNameTime;
+
+    Int_t fType;
+    Int_t fTypeErr;
+
+    Bool_t SetupFill(const MParList *pList);
+    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
+
+public:
+    MHPixVsTime(Int_t idx=0, const char *name=NULL, const char *title=NULL);
+    ~MHPixVsTime();
+
+    void SetNameEvt(const TString name) { fNameEvt = name; }
+    void SetNameTime(const TString name) { fNameTime = name; }
+    void SetType(Int_t type, Int_t e=-1) { fType = type; fTypeErr=e; }
+
+    TH1 *GetHistByName(const TString name="");
+    TGraph *GetGraph() { return fGraph; }
+
+    void Draw(Option_t *o=NULL);
+
+    ClassDef(MHPixVsTime, 1) // Histogram to sum camera events
+};
+
+#endif
+
+
+
Index: trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc	(revision 3394)
@@ -0,0 +1,280 @@
+/* ======================================================================== *\
+!
+! *
+! * 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, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MHSectorVsTime
+//
+// Display the mean and its variance vs time of the whole camera or a
+// single sector
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MHSectorVsTime.h"
+
+#include <TCanvas.h>
+#include <TGraphErrors.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+#include "MCamEvent.h"
+
+#include "MGeomCam.h"
+
+#include "MRawEvtHeader.h"
+#include "MTime.h"
+
+ClassImp(MHSectorVsTime);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Initialize the name and title of the task. If fErrType>=0 the variance is
+// taken into account.
+//
+MHSectorVsTime::MHSectorVsTime(const char *name, const char *title)
+    : fGraph(0), fEvt(NULL), fType(0), fTypeErr(-1)
+{
+    //
+    //   set the name and title of this object
+    //
+    fName  = name  ? name  : "MHSectorVsTime";
+    fTitle = title ? title : "Sector mean vs time";
+}
+
+// --------------------------------------------------------------------------
+//
+// Delete the fGraph
+//
+MHSectorVsTime::~MHSectorVsTime()
+{
+    if (fGraph)
+        delete fGraph;
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the event (MPixVsTime) the histogram might be filled with. If
+// it is not given, it is assumed, that it is filled with the argument
+// of the Fill function.
+// Looks for the camera geometry MGeomCam and resets the sum histogram.
+// Create and/or initialize fGraph
+//
+Bool_t MHSectorVsTime::SetupFill(const MParList *plist)
+{
+    fEvt = dynamic_cast<MCamEvent*>(plist->FindObject(fNameEvt, "MCamEvent"));
+    if (!fEvt)
+    {
+        if (!fNameEvt.IsNull())
+        {
+            *fLog << err << GetDescriptor() << ": No " << fNameEvt <<" [MCamEvent] available..." << endl;
+            return kFALSE;
+        }
+        *fLog << warn << GetDescriptor() << ": No MCamEvent available..." << endl;
+    }
+
+    fCam = (MGeomCam*)plist->FindObject("MGeomCam");
+    if (!fCam)
+    {
+        *fLog << err << "MGeomCam not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fHCamera.SetGeometry(*fCam);
+
+    if (!fNameTime.IsNull())
+    {
+        fTime = (MTime*)plist->FindObject(fNameTime, "MTime");
+        if (!fTime)
+        {
+            *fLog << err << fNameTime << " [MTime] not found... abort." << endl;
+            return kFALSE;
+        }
+    }
+    else
+    {
+        fHeader = (MRawEvtHeader*)plist->FindObject("MRawEvtHeader");
+        if (!fHeader)
+            *fLog << warn << "MRawEvtHeader not found... using counter." << endl;
+    }
+
+    if (fGraph)
+        delete fGraph;
+
+    fGraph = fTypeErr<0 ? new TGraph : new TGraphErrors;
+    fGraph->SetName(fEvt ? dynamic_cast<TObject*>(fEvt)->GetName() : "MCamEvent");
+    fGraph->SetTitle("Camera");
+
+    fMin =  FLT_MAX;
+    fMax = -FLT_MAX;
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill the histograms with data from a MCamEvent
+//
+Bool_t MHSectorVsTime::Fill(const MParContainer *par, const Stat_t w)
+{
+    const MCamEvent *evt = par ? dynamic_cast<const MCamEvent*>(par) : fEvt;
+    if (!evt)
+    {
+        *fLog << err << dbginf << "No MCamEvent found..." << endl;
+        return kFALSE;
+    }
+
+    Double_t t = 0;
+    if (!fNameTime.IsNull())
+        t = fTime->GetAxisTime();
+    else
+        t = fHeader ? fHeader->GetDAQEvtNumber() : fGraph->GetN();
+
+
+    fHCamera.SetCamContent(*evt, fType);
+
+    const Double_t val0 = fHCamera.GetMeanSectors(fSectors, fAreaIndex);
+
+    if (TMath::IsNaN(val0)/* || TMath::IsNaN(rms0)*/)
+        return kCONTINUE;
+
+    fGraph->SetPoint(fGraph->GetN(), t, val0);
+
+    if (fTypeErr>=0)
+    {
+        const Double_t rms0 = fHCamera.GetRmsSectors(fSectors, fAreaIndex);
+        if (TMath::IsNaN(rms0))
+            return kCONTINUE;
+        ((TGraphErrors*)fGraph)->SetPointError(fGraph->GetN()-1, 0, rms0);
+    }
+
+    fMin = TMath::Min(fMin, val0);
+    fMax = TMath::Max(fMax, val0);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set Minimum and Maximum;
+//
+Bool_t MHSectorVsTime::Finalize()
+{
+    const Double_t add = (fMax-fMin)*0.15;
+
+    fGraph->SetMinimum(fMin-add);
+    fGraph->SetMaximum(fMax+add);
+
+    *fLog << dbg << "Min=" << fMin << " " << fMin-add << endl;
+    *fLog << dbg << "Max=" << fMax << " " << fMax+add << endl;
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return fHistogram from TGraph
+//
+TH1 *MHSectorVsTime::GetHistByName(const TString name)
+{
+    return fGraph->GetHistogram();
+}
+
+void MHSectorVsTime::Draw(Option_t *opt)
+{
+    /*
+    if (fGraph->GetN()==0)
+        return;
+        */
+
+    if (fGraph->GetN()==0)
+        return;
+
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
+    TString str(opt);
+    /*
+    fGraph->GetHistogram()->SetXTitle("Time");
+    fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
+    fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
+    fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
+
+    fGraph->GetHistogram()->SetYTitle("");
+     */
+    if (!str.Contains("A"))
+        str += "A";
+    if (!str.Contains("L"))
+        str += "L";
+
+    if (str.Contains("same", TString::kIgnoreCase))
+    {
+        str.ReplaceAll("same", "");
+        str.ReplaceAll("A", "");
+    }
+
+    TH1 *h = fGraph->GetHistogram();
+
+    h->SetXTitle("Time");
+    h->SetYTitle("");
+
+    if (!fNameTime.IsNull())
+    {
+        TAxis *axe = h->GetXaxis();
+        axe->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
+        axe->SetTimeDisplay(1);
+        axe->SetLabelSize(0.025);
+    }
+
+    *fLog << dbg << "Draw: " << str << endl;
+    fGraph->Draw(str);
+/*
+    str.ReplaceAll("same", "");
+    str.ReplaceAll("A", "");
+
+    Int_t i=-1;
+    Int_t col=kRed;
+    while ((g=(TGraphErrors*)Next()))
+    {
+        i++;
+        *fLog << dbg << "Check" << i << ": " << str << endl;
+
+        while ((fMinSector>=0 && i<fMinSector) || (fMaxSector>=0 && i>fMaxSector))
+            i++;
+
+        h = g->GetHistogram();
+        g->SetLineColor(col++);
+
+        *fLog << dbg << "Draw" << i << ": " << g->GetTitle() << endl;
+        g->Draw(str);
+
+    }
+
+    pad->Modified();
+    pad->Update();*/
+}
Index: trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h	(revision 3394)
@@ -0,0 +1,70 @@
+#ifndef MARS_MHSectorVsTime
+#define MARS_MHSectorVsTime
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+
+#ifndef MARS_MHCamera
+#include "MHCamera.h"
+#endif
+
+class MHCamera;
+class MCamEvent;
+class MGeomCam;
+
+class MRawEvtHeader;
+class MTime;
+class TGraph;
+
+class MHSectorVsTime : public MH
+{
+private:
+    TGraph *fGraph;
+
+    MCamEvent *fEvt;        //! the current event
+    MGeomCam  *fCam;        //! the camera geometry
+
+    MRawEvtHeader *fHeader; //!
+    MTime         *fTime;   //!
+
+    MHCamera fHCamera;      //!
+
+    Double_t fMin;          //!
+    Double_t fMax;          //!
+
+    TString fNameEvt;
+    TString fNameTime;
+
+    Int_t fType;
+    Int_t fTypeErr;
+
+    TArrayI fSectors;
+    TArrayI fAreaIndex;
+
+    Bool_t SetupFill(const MParList *pList);
+    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
+    Bool_t Finalize();
+
+public:
+    MHSectorVsTime(const char *name=NULL, const char *title=NULL);
+    ~MHSectorVsTime();
+
+    void SetNameEvt(const TString name)  { fNameEvt = name; }
+    void SetNameTime(const TString name) { fNameTime = name; }
+    void SetType(Int_t type, Int_t e=-1) { fType = type; fTypeErr=e; }
+    void SetSectors(const TArrayI &s)    { fSectors=s; }
+    void SetAreaIndex(const TArrayI &a)  { fAreaIndex=a; }
+
+    TH1 *GetHistByName(const TString name="");
+    //TGraph *GetGraph() { return fGraph; }
+
+    void Draw(Option_t *o=NULL);
+
+    ClassDef(MHSectorVsTime, 1) // Histogram to sum camera events
+};
+
+#endif
+
+
+
Index: trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc	(revision 3394)
@@ -0,0 +1,277 @@
+/* ======================================================================== *\
+!
+! *
+! * 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"
+#include "MRawEvtHeader.h"
+
+ClassImp(MHVsTime);
+
+using namespace std;
+
+static const TString gsDefName  = "MHVsTime";
+static const TString gsDefTitle = "Container for a graph vs time/evtnumber";
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MHVsTime::MHVsTime(const char *rule)
+    : fGraph(NULL), fData(NULL), fScale(1), fUseEventNumber(0)
+{  
+    fName  = gsDefName;
+    fTitle = gsDefTitle;
+
+    if (!rule)
+        return;
+
+    fGraph = new TGraph;
+    fData = new MDataChain(rule);
+}
+
+// --------------------------------------------------------------------------
+//
+// Deletes the histogram
+//
+MHVsTime::~MHVsTime()
+{
+    if (fGraph)
+        delete fGraph;
+
+    if (fData)
+        delete fData;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the data members used by the data chain to be used in
+// MTask::AddBranchToList
+//
+TString MHVsTime::GetDataMember() const
+{
+    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) 
+    //fGraph->Reset();
+
+    if (fData && !fData->PreProcess(plist))
+        return kFALSE;
+
+    if (fGraph)
+    {
+        delete fGraph;
+        fGraph = new TGraph;
+    }
+
+    TString title(fData ? GetRule() : (TString)"Histogram");
+    title += " vs ";
+    title += fUseEventNumber ? "Event Number" : "Time";
+
+    fGraph->SetNameTitle(fName, title);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the name of the histogram ant the MHVsTime container
+//
+void MHVsTime::SetName(const char *name)
+{
+    fGraph->SetName(name);
+    MParContainer::SetName(name);
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the title of the histogram ant the MHVsTime container
+//
+void MHVsTime::SetTitle(const char *title)
+{
+    fGraph->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)
+{
+    Double_t t = 0;
+    if (fUseEventNumber)
+    {
+        const MRawEvtHeader *h = dynamic_cast<const MRawEvtHeader*>(par);
+        t = h ? h->GetDAQEvtNumber() : fGraph->GetN();
+    }
+    else
+    {
+        const MTime *tm = dynamic_cast<const MTime*>(par);
+        if (!tm)
+        {
+            *fLog << err << dbginf << "No MTime found..." << endl;
+            return kFALSE;
+        }
+        t = tm->GetAxisTime();
+    }
+
+    const Double_t v = fData->GetValue()*fScale;
+
+    fGraph->SetPoint(fGraph->GetN(), 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 (fGraph->GetN()==0)
+        return;
+
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
+    TString str(opt);
+
+    if (fUseEventNumber)
+        fGraph->GetHistogram()->SetXTitle("Event Number");
+    else
+    {
+        fGraph->GetHistogram()->SetXTitle("Time");
+        fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
+        fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
+        fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
+    }
+    fGraph->GetHistogram()->SetYTitle(GetRule());
+
+    if (!str.Contains("A"))
+        str += "A";
+    if (!str.Contains("P"))
+        str += "P";
+
+    if (str.Contains("same", TString::kIgnoreCase))
+    {
+        str.ReplaceAll("same", "");
+        str.ReplaceAll("A", "");
+    }
+
+    fGraph->Draw(str);
+    if (fGraph->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);
+    if (fUseEventNumber)
+        h->SetUseEventNumber();
+    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 fGraph->GetN();
+}
+/*
+TH1 *MHVsTime::GetHist()
+{
+    return fGraph ? fGraph->GetHistogram() : 0;
+}
+
+const TH1 *MHVsTime::GetHist() const
+{
+    return fGraph ? fGraph->GetHistogram() : 0;
+}
+
+TH1 *MHVsTime::GetHistByName(const TString name)
+{
+    return GetHist();
+}
+*/
Index: trunk/MagicSoft/Mars/mhvstime/MHVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHVsTime.h	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/MHVsTime.h	(revision 3394)
@@ -0,0 +1,60 @@
+#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     *fGraph;  // Histogram to fill
+    MDataChain *fData;  // Object from which the data is filled
+    Double_t    fScale; // Scale for axis (eg unit)
+
+    enum {
+        kIsLogy = BIT(18),
+        kUseEventNumber = BIT(20)
+    };
+
+    Bool_t fUseEventNumber;
+
+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="");
+*/
+    const TGraph *GetGraph() const { return fGraph; }
+    TGraph *GetGraph() { return fGraph; }
+
+    void SetUseEventNumber(Bool_t use = kTRUE) { fUseEventNumber = use; }
+
+    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/mhvstime/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/Makefile	(revision 3394)
+++ trunk/MagicSoft/Mars/mhvstime/Makefile	(revision 3394)
@@ -0,0 +1,53 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+#
+# Handling name of the Root Dictionary Files
+#
+CINT  = HVsTime
+
+#
+# Library name to creatre
+#
+LIB   = mhvstime.a
+
+#
+#  connect the include files defined in the config.mk file
+#
+INCLUDES = -I. -I../mbase -I../mhbase -I../mgeom -I../mhist \
+	   -I../mgui -I../mraw
+# mhist (MHCamera)
+# mgui  (MCamEvent)
+# mraw  (MRawEvtHeader)
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .o 
+
+SRCFILES = MHVsTime.cc \
+           MHPixVsTime.cc \
+           MHSectorVsTime.cc
+           
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES:.cc=.h)
+OBJS    = $(SRCFILES:.cc=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+#clean:	rmcint rmobjs rmcore rmlib
+
+mrproper:	clean rmbak
+
+# @endcode
