Index: trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.cc	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.cc	(revision 1213)
@@ -0,0 +1,163 @@
+/* ======================================================================== *\
+!
+! *
+! * 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    1/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Wolfgang Wittek 1/2002 <mailto:wittek@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+//  MHEffOnTimeTheta                                                       //
+//                                                                          //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+#include "MHEffOnTimeTheta.h"
+
+#include <TF1.h>
+#include <TH2.h>
+#include <TCanvas.h>
+
+#include "MTime.h"
+
+#include "MBinning.h"
+#include "MParList.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MHEffOnTimeTheta);
+
+
+// --------------------------------------------------------------------------
+//
+// Default Constructor. It sets name and title only. Typically you won't
+// need to change this.
+//
+MHEffOnTimeTheta::MHEffOnTimeTheta(const char *name, const char *title)
+    : fHist()
+{
+    //
+    //   set the name and title of this object
+    //
+    fName  = name  ? name  : "MHEffOnTimeTheta";
+    fTitle = title ? title : "1-D histogram of Eff On Time";
+
+    fHist.SetName("EffOn");
+    fHist.SetTitle("Effective On Time Vs. Theta");
+
+    fHist.SetDirectory(NULL);
+
+    fHist.GetXaxis()->SetTitle("t_{eff} [s]");
+    fHist.GetYaxis()->SetTitle("\\Theta [\\circ]");
+}
+
+void MHEffOnTimeTheta::Calc(TH2D *hist)
+{
+    const Int_t nbins = hist->GetNbinsY();
+
+    for (int i=1; i<nbins; i++)
+    {
+        //char txt[100];
+        //sprintf(txt, "Name%d", 100*i);
+        //new TCanvas(txt, "Title");
+
+        TH1D *h = hist->ProjectionX("dTime-Distribution for fixed Time", i, i);
+
+        //hist->Draw();
+        //gPad->SetLogy();
+
+        Double_t Nmdel = h->Integral("width");
+        Double_t mean  = h->GetMean();
+
+        TF1 func("Poisson", "[1] * [0] * exp(-[0] *x)",
+                 mean, hist->GetXaxis()->GetXmax());
+
+        func.SetParameter(0, 100); // [Hz]
+        func.SetParameter(1, Nmdel);
+
+        func.SetParLimits(0, 0, 1000);    // [Hz]
+        func.SetParLimits(1, 0, 2*Nmdel);
+
+        func.SetParName(0, "lambda");
+        func.SetParName(1, "Nmdel");
+
+        h->Fit("Poisson", "RN");
+
+        //func.SetRange(0, 0.1); // Range of Drawing
+        //func.DrawCopy("same");
+
+        //cout << func.GetParameter(0) << " " << func.GetParameter(1) << endl;
+
+        Double_t lambda = func.GetParameter(0);
+        //Double_t a      = func.GetParameter(1);
+
+        //cout << "t_eff = " << h->Integral()/lambda << "  T(last)=" << time.GetTimeLo()*0.0001 << endl;
+
+        fHist.SetBinContent(i, h->Integral()/lambda);
+    }
+}
+
+Bool_t MHEffOnTimeTheta::SetupFill(const MParList *plist)
+{
+   const MBinning* bins = (MBinning*)plist->FindObject("BinningTheta");
+   if (!bins)
+   {
+       *fLog << err << dbginf << "BinningTheta [MBinning] not found... aborting." << endl;
+       return kFALSE;
+   }
+
+   SetBinning(&fHist, bins);
+
+   return kTRUE;
+}
+
+TObject *MHEffOnTimeTheta::DrawClone(Option_t *opt) const
+{
+    TCanvas *c = MakeDefCanvas("EffOnTimeTheta", "t_{eff} vs. \\Theta");
+
+    gROOT->SetSelectedPad(NULL);
+
+    ((TH2*)(&fHist))->DrawCopy(opt);
+
+    c->Modified();
+    c->Update();
+
+    return c;
+}
+
+void MHEffOnTimeTheta::Draw(Option_t *opt)
+{
+    if (!gPad)
+        MakeDefCanvas("EffOnTimeTheta", "t_{eff} vs. \\Theta");
+
+    fHist.Draw(opt);
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+
+Bool_t MHEffOnTimeTheta::Fill(const MParContainer *par)
+{
+    return kTRUE;
+}
+
Index: trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.h	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.h	(revision 1213)
@@ -0,0 +1,38 @@
+#ifndef MARS_MHEffOnTimeTheta
+#define MARS_MHEffOnTimeTheta
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TH1
+#include "TH1.h"
+#endif
+
+class MTime;
+class TH2D;
+class MParList;
+
+class MHEffOnTimeTheta : public MH
+{
+private:
+    TH1D   fHist;
+
+public:
+    MHEffOnTimeTheta(const char *name=NULL, const char *title=NULL);
+
+    virtual Bool_t SetupFill(const MParList *pList);
+    virtual Bool_t Fill(const MParContainer *par);
+
+    const TH1D *GetHist() { return &fHist; }
+    const TH1D *GetHist() const { return &fHist; }
+
+    void Calc(TH2D *hist);
+
+    void Draw(Option_t *option="");
+    TObject *DrawClone(Option_t *option="") const;
+
+    ClassDef(MHEffOnTimeTheta, 1) //Histogram to store a 3-Dim histogram in alpha, Energy and time
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.cc	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.cc	(revision 1213)
@@ -0,0 +1,164 @@
+/* ======================================================================== *\
+!
+! *
+! * 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    1/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!   Author(s): Wolfgang Wittek 1/2002 <mailto:wittek@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+//  MHEffOnTimeTime                                                       //
+//                                                                          //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+#include "MHEffOnTimeTime.h"
+
+#include <TF1.h>
+#include <TH2.h>
+#include <TCanvas.h>
+
+#include "MTime.h"
+
+#include "MBinning.h"
+#include "MParList.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MHEffOnTimeTime);
+
+
+// --------------------------------------------------------------------------
+//
+// Default Constructor. It sets name and title only. Typically you won't
+// need to change this.
+//
+MHEffOnTimeTime::MHEffOnTimeTime(const char *name, const char *title)
+    : fHist()
+{
+    //
+    //   set the name and title of this object
+    //
+    fName  = name  ? name  : "MHEffOnTimeTime";
+    fTitle = title ? title : "1-D histogram of Eff On Time";
+
+    fHist.SetName("EffOn");
+    fHist.SetTitle("Effective On Time Vs. Theta");
+
+
+    fHist.SetDirectory(NULL);
+
+    fHist.GetXaxis()->SetTitle("t_{eff} [s]");
+    fHist.GetYaxis()->SetTitle("t [s]");
+}
+
+TObject *MHEffOnTimeTime::DrawClone(Option_t *opt) const
+{
+    TCanvas *c = MakeDefCanvas("EffOnTimeTheta", "t_{eff} vs. t");
+
+    gROOT->SetSelectedPad(NULL);
+
+    ((TH2*)(&fHist))->DrawCopy(opt);
+
+    c->Modified();
+    c->Update();
+
+    return c;
+}
+
+void MHEffOnTimeTime::Draw(Option_t *opt)
+{
+    if (!gPad)
+        MakeDefCanvas("EffOnTimeTheta", "t_{eff} vs. t");
+
+    fHist.Draw(opt);
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+
+void MHEffOnTimeTime::Calc(TH2D *hist)
+{
+    const Int_t nbins = hist->GetNbinsY();
+
+    for (int i=1; i<nbins; i++)
+    {
+        //char txt[100];
+        //sprintf(txt, "Name%d", 100*i);
+        //new TCanvas(txt, "Title");
+
+        TH1D *h = hist->ProjectionX("dTime-Distribution for fixed Theta", i, i);
+
+        //hist->Draw();
+        //gPad->SetLogy();
+
+        Double_t Nmdel = h->Integral("width");
+        Double_t mean  = h->GetMean();
+
+        TF1 func("Poisson", "[1] * [0] * exp(-[0] *x)",
+                 mean, hist->GetXaxis()->GetXmax());
+
+        func.SetParameter(0, 100); // [Hz]
+        func.SetParameter(1, Nmdel);
+
+        func.SetParLimits(0, 0, 1000);    // [Hz]
+        func.SetParLimits(1, 0, 2*Nmdel);
+
+        func.SetParName(0, "lambda");
+        func.SetParName(1, "Nmdel");
+
+        h->Fit("Poisson", "RN");
+
+        //func.SetRange(0, 0.1); // Range of Drawing
+        //func.DrawCopy("same");
+
+        //cout << func.GetParameter(0) << " " << func.GetParameter(1) << endl;
+
+        Double_t lambda = func.GetParameter(0);
+        //Double_t a      = func.GetParameter(1);
+
+        //cout << "t_eff = " << h->Integral()/lambda << "  T(last)=" << time.GetTimeLo()*0.0001 << endl;
+
+        fHist.SetBinContent(i, h->Integral()/lambda);
+    }
+}
+
+Bool_t MHEffOnTimeTime::SetupFill(const MParList *plist)
+{
+    const MBinning* binstime = (MBinning*)plist->FindObject("BinningTime");
+    if (!binstime)
+    {
+        *fLog << err << dbginf << "BinningTime [MBinning] not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    SetBinning(&fHist, binstime);
+
+    return kTRUE;
+}
+
+Bool_t MHEffOnTimeTime::Fill(const MParContainer *par)
+{
+    return kTRUE;
+}
+
Index: trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.h	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.h	(revision 1213)
@@ -0,0 +1,38 @@
+#ifndef MARS_MHEffOnTimeTime
+#define MARS_MHEffOnTimeTime
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TH1
+#include "TH1.h"
+#endif
+
+class MTime;
+class TH2D;
+class MParList;
+
+class MHEffOnTimeTime : public MH
+{
+private:
+    TH1D   fHist;
+
+public:
+    MHEffOnTimeTime(const char *name=NULL, const char *title=NULL);
+
+    virtual Bool_t SetupFill(const MParList *pList);
+    virtual Bool_t Fill(const MParContainer *par);
+
+    const TH1D *GetHist() { return &fHist; }
+    const TH1D *GetHist() const { return &fHist; }
+
+    void Calc(TH2D *hist);
+
+    void Draw(Option_t *option="");
+    TObject *DrawClone(Option_t *option="") const;
+
+    ClassDef(MHEffOnTimeTime, 1) //Histogram to store a 3-Dim histogram in alpha, Energy and time
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/mhist/MHEnergyTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEnergyTheta.cc	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEnergyTheta.cc	(revision 1213)
@@ -0,0 +1,157 @@
+/* ======================================================================== *\
+!
+! *
+! * 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  1/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+#include "MHEnergyTheta.h" 
+
+#include <TCanvas.h>
+
+#include "MH.h"
+#include "MBinning.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MMcEvt.hxx"
+
+#include "MParList.h"
+
+ClassImp(MHEnergyTheta);
+
+// --------------------------------------------------------------------------
+//
+//  Creates the three necessary histograms:
+//   - selected showers (input)
+//   - all showers (input)
+//   - collection area (result)
+//
+MHEnergyTheta::MHEnergyTheta(const char *name, const char *title)
+{ 
+    //   initialize the histogram for the distribution r vs E
+    //
+    //   we set the energy range from 1 Gev to 10000 GeV (in log 5 orders
+    //   of magnitude) and for each order we take 10 subdivision --> 50 xbins
+    //
+    //   we set the radius range from 0 m to 500 m with 10 m bin --> 50 ybins
+
+  
+    fName  = name  ? name  : "MHEnergyTheta";
+    fTitle = title ? title : "Data to Calculate Collection Area";
+
+    fHist.SetDirectory(NULL);
+
+    fHist.SetXTitle("E [GeV]");
+    fHist.SetYTitle("\\Theta [\\circ]");
+    fHist.SetZTitle("N");
+}
+
+Bool_t MHEnergyTheta::SetupFill(const MParList *plist)
+{
+    MBinning* binsenergy = (MBinning*)plist->FindObject("BinningE");
+    MBinning* binstheta  = (MBinning*)plist->FindObject("BinningTheta");
+    if (!binsenergy || !binstheta)
+    {
+        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    SetBinning(&fHist, binsenergy, binstheta);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Delete the three histograms
+//
+MHEnergyTheta::~MHEnergyTheta()
+{
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill data into the histogram which contains all showers
+//
+Bool_t MHEnergyTheta::Fill(const MParContainer *par)
+{
+    const MMcEvt &mcevt = *(MMcEvt*)par;
+
+    fHist.Fill(mcevt.GetEnergy(), mcevt.GetTheta());
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw the histogram with all showers
+//
+void MHEnergyTheta::Draw(Option_t* option)
+{
+    if (!gPad)
+        MakeDefCanvas(&fHist);
+
+    fHist.DrawCopy(option);
+    gPad->SetLogy();
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Creates a new canvas and draws the histogram into it.
+// Be careful: The histogram belongs to this object and won't get deleted
+// together with the canvas.
+//
+TObject *MHEnergyTheta::DrawClone(Option_t* option) const
+{
+    TCanvas *c = MakeDefCanvas(&fHist);
+
+    //
+    // This is necessary to get the expected bahviour of DrawClone
+    //
+    gROOT->SetSelectedPad(NULL);
+
+    ((TH2D*)&fHist)->DrawCopy(option);
+    gPad->SetLogy();
+
+    c->Modified();
+    c->Update();
+
+    return c;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Calculate the Efficiency (collection area) and set the 'ReadyToSave'
+//  flag
+//
+void MHEnergyTheta::Divide(const TH2D *h1, const TH2D *h2)
+{
+    // Description!
+
+    fHist.Sumw2();
+    fHist.Divide((TH2D*)h1, (TH2D*)h2);
+
+    SetReadyToSave();
+}
Index: trunk/MagicSoft/Mars/mhist/MHEnergyTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEnergyTheta.h	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEnergyTheta.h	(revision 1213)
@@ -0,0 +1,43 @@
+#ifndef MARS_MHEnergyTheta
+#define MARS_MHEnergyTheta
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TH2
+#include "TH2.h"
+#endif
+
+class MTime;
+class MParList;
+
+class MHEnergyTheta : public MH
+{
+private:
+    TH2D fHist; //! 
+
+public:
+
+    MHEnergyTheta(const char *name=NULL, const char *title=NULL);
+    ~MHEnergyTheta();
+
+    Bool_t Fill(const MParContainer *cont);
+
+    void Draw(Option_t *option="");
+    TObject *DrawClone(Option_t *option="") const;
+
+    Bool_t SetupFill(const MParList *plist);
+
+    const TH2D *GetHist() { return &fHist; }
+    const TH2D *GetHist() const { return &fHist; }
+
+    void Divide(const TH2D *h1, const TH2D *h2);
+    void Divide(const MHEnergyTheta *h1, const MHEnergyTheta *h2)
+    {
+        Divide(h1->GetHist(), h2->GetHist());
+    }
+
+    ClassDef(MHEnergyTheta, 1)  // Data Container to calculate Collection Area
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mhist/MHEnergyTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEnergyTime.cc	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEnergyTime.cc	(revision 1213)
@@ -0,0 +1,165 @@
+/* ======================================================================== *\
+!
+! *
+! * 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  1/2002 <mailto:tbretz@uni-sw.gwdg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+#include "MHEnergyTime.h" 
+
+#include <TCanvas.h>
+
+#include "MMcEvt.hxx"
+#include "MTime.h"
+
+#include "MH.h"
+#include "MBinning.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+
+ClassImp(MHEnergyTime);
+
+// --------------------------------------------------------------------------
+//
+//  Creates the three necessary histograms:
+//   - selected showers (input)
+//   - all showers (input)
+//   - collection area (result)
+//
+MHEnergyTime::MHEnergyTime(const char *name, const char *title)
+{ 
+    //   initialize the histogram for the distribution r vs E
+    //
+    //   we set the energy range from 1 Gev to 10000 GeV (in log 5 orders
+    //   of magnitude) and for each order we take 10 subdivision --> 50 xbins
+    //
+    //   we set the radius range from 0 m to 500 m with 10 m bin --> 50 ybins
+
+  
+    fName  = name  ? name  : "MHEnergyTime";
+    fTitle = title ? title : "Data to Calculate Collection Area";
+
+    fHist.SetDirectory(NULL);
+
+    fHist.SetXTitle("E [GeV]");
+    fHist.SetYTitle("t [s]");
+    fHist.SetZTitle("N");
+}
+
+Bool_t MHEnergyTime::SetupFill(const MParList *plist)
+{
+    fTime = (MTime*)plist->FindObject("MTime");
+    if (!fTime)
+    {
+        *fLog << err << dbginf << "MTime not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    const MBinning* binsenergy = (MBinning*)plist->FindObject("BinningE");
+    const MBinning* binstime   = (MBinning*)plist->FindObject("BinningTime");
+    if (!binsenergy || !binstime)
+    {
+        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    SetBinning(&fHist, binsenergy, binstime);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Delete the three histograms
+//
+MHEnergyTime::~MHEnergyTime()
+{
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill data into the histogram which contains all showers
+//
+Bool_t MHEnergyTime::Fill(const MParContainer *par)
+{
+    const MMcEvt &mcevt = *(MMcEvt*)par;
+
+    fHist.Fill(mcevt.GetEnergy(), 0.0001*fTime->GetTimeLo());
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw the histogram with all showers
+//
+void MHEnergyTime::Draw(Option_t* option)
+{
+    if (!gPad)
+        MakeDefCanvas(&fHist);
+
+    fHist.DrawCopy(option);
+    gPad->SetLogy();
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Creates a new canvas and draws the histogram into it.
+// Be careful: The histogram belongs to this object and won't get deleted
+// together with the canvas.
+//
+TObject *MHEnergyTime::DrawClone(Option_t* option) const
+{
+    TCanvas *c = MakeDefCanvas(&fHist);
+
+    //
+    // This is necessary to get the expected bahviour of DrawClone
+    //
+    gROOT->SetSelectedPad(NULL);
+
+    ((TH2D*)&fHist)->DrawCopy(option);
+    gPad->SetLogy();
+
+    c->Modified();
+    c->Update();
+
+    return c;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Calculate the Efficiency (collection area) and set the 'ReadyToSave'
+//  flag
+//
+void MHEnergyTime::Divide(const TH2D *h1, const TH2D *h2)
+{
+    // Description!
+
+    fHist.Sumw2();
+    fHist.Divide((TH2D*)h1, (TH2D*)h2);
+
+    SetReadyToSave();
+}
Index: trunk/MagicSoft/Mars/mhist/MHEnergyTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEnergyTime.h	(revision 1213)
+++ trunk/MagicSoft/Mars/mhist/MHEnergyTime.h	(revision 1213)
@@ -0,0 +1,44 @@
+#ifndef MARS_MHEnergyTime
+#define MARS_MHEnergyTime
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TH2
+#include "TH2.h"
+#endif
+
+class MTime;
+class MParList;
+
+class MHEnergyTime : public MH
+{
+private:
+    MTime *fTime;
+    TH2D fHist; //! 
+
+public:
+
+    MHEnergyTime(const char *name=NULL, const char *title=NULL);
+    ~MHEnergyTime();
+
+    Bool_t Fill(const MParContainer *cont);
+
+    void Draw(Option_t *option="");
+    TObject *DrawClone(Option_t *option="") const;
+
+    Bool_t SetupFill(const MParList *plist);
+
+    const TH2D *GetHist() { return &fHist; }
+    const TH2D *GetHist() const { return &fHist; }
+
+    void Divide(const TH2D *h1, const TH2D *h2);
+    void Divide(const MHEnergyTime *h1, const MHEnergyTime *h2)
+    {
+        Divide(h1->GetHist(), h2->GetHist());
+    }
+
+    ClassDef(MHEnergyTime, 1)  // Data Container to calculate Collection Area
+};
+
+#endif
