Index: trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.cc	(revision 1322)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.cc	(revision 1322)
@@ -0,0 +1,226 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Wolfgang Wittek 4/2002 <mailto:wittek@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+//  MHMcEnergyMigration                                                     //
+//                                                                          //
+//  calculates the migration matrix E-est vs. E-true                        //
+//  for different bins in Theta                                             //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+#include "MHMcEnergyMigration.h"
+
+#include <TCanvas.h>
+
+#include "MMcEvt.hxx"
+
+#include "MEnergyEst.h"
+#include "MBinning.h"
+#include "MHillasSrc.h"
+#include "MParList.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MHMcEnergyMigration);
+
+
+// --------------------------------------------------------------------------
+//
+// Default Constructor. It sets name and title of the histogram.
+//
+MHMcEnergyMigration::MHMcEnergyMigration(const char *name, const char *title)
+    : fHist()
+{
+    //
+    //   set the name and title of this object
+    //
+    fName  = name  ? name  : "MHMcEnergyMigration";
+    fTitle = title ? title : "3-D histogram   E-true E-est Theta";
+
+    fHist.SetDirectory(NULL);
+
+    fHist.SetTitle("3D-plot   E-true E-est Theta");
+    fHist.SetXTitle("E-true [GeV]            ");
+    fHist.SetYTitle("E-est [GeV]            ");
+    fHist.SetZTitle("\\Theta [\\circ]");
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the binnings and prepare the filling of the histograms
+//
+Bool_t MHMcEnergyMigration::SetupFill(const MParList *plist)
+{
+    fEnergy = (MEnergyEst*)plist->FindObject("MEnergyEst");
+    if (!fEnergy)
+    {
+        *fLog << err << dbginf << "MEnergyEst not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
+    if (!fMcEvt)
+    {
+        *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    const MBinning* binsenergy = (MBinning*)plist->FindObject("BinningE");
+    const 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, binsenergy, binstheta);
+
+    fHist.Sumw2();
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw a copy of the histogram
+//
+TObject *MHMcEnergyMigration::DrawClone(Option_t *opt) const
+{
+    TCanvas &c = *MakeDefCanvas("EnergyMigration", "E-est vs. E-true");
+
+    c.Divide(2, 2);
+
+    gROOT->SetSelectedPad(NULL);
+
+    TH1 *h;
+
+    c.cd(1);
+    h = ((TH3*)(&fHist))->Project3D("expro");
+
+    h->SetTitle("Distribution of E-true");
+    h->SetXTitle("E-true [GeV]            ");
+    h->SetYTitle("Counts");
+
+    h->Draw(opt);
+    h->SetBit(kCanDelete);
+    gPad->SetLogx();
+
+
+    c.cd(2);
+    h = ((TH3*)(&fHist))->Project3D("eypro");
+
+    h->SetTitle("Distribution of E-est");
+    h->SetXTitle("E-est [GeV]            ");
+    h->SetYTitle("Counts");
+
+    h->Draw(opt);
+    h->SetBit(kCanDelete);
+    gPad->SetLogx();
+
+    c.cd(3);
+    h = ((TH3*)(&fHist))->Project3D("ezpro");
+
+    h->SetTitle("Distribution of Theta");
+    h->SetXTitle("\\Theta [\\circ]");
+    h->SetYTitle("Counts");
+
+    h->Draw(opt);
+    h->SetBit(kCanDelete);
+
+
+    c.cd(4);
+    ((TH3*)(&fHist))->DrawCopy(opt);
+
+    c.Modified();
+    c.Update();
+
+    return &c;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw the histogram
+//
+void MHMcEnergyMigration::Draw(Option_t *opt)
+{
+    if (!gPad)
+        MakeDefCanvas("EnergyMigration", "E-est vs. E-true");
+
+    gPad->Divide(2,2);
+    
+    TH1 *h;
+
+    gPad->cd(1);
+    h = fHist.Project3D("ex_pro");
+
+    h->SetTitle("Distribution of E-true");
+    h->SetXTitle("E-true [GeV]            ");
+
+    h->Draw(opt);
+    h->SetBit(kCanDelete);
+    gPad->SetLogx();
+
+
+    gPad->cd(2);
+    h = fHist.Project3D("ey_pro");
+
+    h->SetTitle("Distribution of E-est");
+    h->SetXTitle("E-est [GeV]            ");
+    h->Draw(opt);
+    h->SetBit(kCanDelete);
+    gPad->SetLogx();
+
+    gPad->cd(3);
+    h = fHist.Project3D("ez_pro");
+
+    h->SetTitle("Distribution of Theta");
+    h->SetXTitle("\\Theta [\\circ]");
+    h->Draw(opt);
+    h->SetBit(kCanDelete);
+
+
+    gPad->cd(4);
+    fHist.DrawCopy(opt);
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill the histogram
+//
+Bool_t MHMcEnergyMigration::Fill(const MParContainer *par)
+{
+    //    MHillasSrc &hil = *(MHillasSrc*)par;
+    //    fHist.Fill(fMcEvt->GetEnergy(), hil.GetSize());
+
+    // get E-true from fMcEvt and E-est from fEnergy
+    fHist.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), fMcEvt->GetTheta()*kRad2Deg);
+
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.h	(revision 1322)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.h	(revision 1322)
@@ -0,0 +1,46 @@
+#ifndef MARS_MHMcEnergyMigration
+#define MARS_MHMcEnergyMigration
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+
+#ifndef ROOT_TH3
+#include "TH3.h"
+#endif
+
+#ifndef ROOT_TH2
+#include "TH2.h"
+#endif
+
+class MMcEvt;
+class MEnergyEst;
+class MParList;
+
+class MHMcEnergyMigration : public MH
+{
+private:
+    MMcEvt      *fMcEvt;
+    MEnergyEst  *fEnergy;
+    TH3D        fHist;
+
+public:
+    MHMcEnergyMigration(const char *name=NULL, const char *title=NULL);
+
+    virtual Bool_t SetupFill(const MParList *pList);
+    virtual Bool_t Fill(const MParContainer *par);
+
+    const TH3D *GetHist() { return &fHist; }
+    const TH3D *GetHist() const { return &fHist; }
+
+    void Draw(Option_t *option="");
+    TObject *DrawClone(Option_t *option="") const;
+
+    ClassDef(MHMcEnergyMigration, 1) //3D-histogram   E-true E-est Theta
+
+};
+
+#endif
+
+
+
Index: trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc	(revision 1322)
+++ trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc	(revision 1322)
@@ -0,0 +1,134 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Wolfgang Wittek 1/2002 <mailto:wittek@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+//  MHThetabarTheta                                                         //
+//                                                                          //
+//  calculates the average Theta for different bins in Theta                //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+#include "MHThetabarTheta.h"
+
+#include <TCanvas.h>
+
+#include "MMcEvt.hxx"
+
+#include "MBinning.h"
+#include "MParList.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MHThetabarTheta);
+
+// --------------------------------------------------------------------------
+//
+// Default Constructor. It sets name and title of the histogram.
+//
+MHThetabarTheta::MHThetabarTheta(const char *name, const char *title)
+    : fHist()
+{
+    //
+    //   set the name and title of this object
+    //
+    fName  = name  ? name  : "MHThetabarTheta";
+    fTitle = title ? title : "1-D profile histogram Thetabar vs. Theta";
+
+    fHist.SetDirectory(NULL);
+
+    fHist.SetXTitle("\\Theta [s]");
+    fHist.SetYTitle("\\overline{\\Theta} [\\circ]");
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the binnings and prepare the filling of the histogram
+//
+Bool_t MHThetabarTheta::SetupFill(const MParList *plist)
+{
+    fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
+    if (!fMcEvt)
+    {
+        *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    const MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta");
+    if (!binstheta )
+    {
+        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    SetBinning(&fHist, binstheta);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw a copy of the histogram
+//
+TObject *MHThetabarTheta::DrawClone(Option_t *opt) const
+{
+    TCanvas &c = *MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
+
+    gROOT->SetSelectedPad(NULL);
+
+    ((TProfile*)&fHist)->DrawCopy(opt);
+
+    c.Modified();
+    c.Update();
+
+    return &c;
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw the histogram
+//
+void MHThetabarTheta::Draw(Option_t *opt)
+{
+    if (!gPad)
+        MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
+
+    fHist.DrawCopy(opt);
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Fill the histogram
+//
+Bool_t MHThetabarTheta::Fill(const MParContainer *par)
+{
+    fHist.Fill(fMcEvt->GetTheta()*kRad2Deg, fMcEvt->GetTheta()*kRad2Deg);
+
+    return kTRUE;
+}
+
Index: trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h	(revision 1322)
+++ trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h	(revision 1322)
@@ -0,0 +1,51 @@
+#ifndef MARS_MHThetabarTheta
+#define MARS_MHThetabarTheta
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TProfile
+#include "TProfile.h"
+#endif
+
+class MTime;
+class MMcEvt;
+
+class MParList;
+
+class MHThetabarTheta : public MH
+{
+private:
+    MTime  *fTime;   //!
+    MMcEvt *fMcEvt;  //!
+
+    TProfile    fHist;
+
+public:
+    MHThetabarTheta(const char *name=NULL, const char *title=NULL);
+
+    virtual Bool_t SetupFill(const MParList *pList);
+    virtual Bool_t Fill(const MParContainer *par);
+
+    const TProfile *GetHist() { return &fHist; }
+    const TProfile *GetHist() const { return &fHist; }
+
+    void Draw(Option_t *option="");
+    TObject *DrawClone(Option_t *option="") const;
+
+    ClassDef(MHThetabarTheta, 1) //Profile histogram Thetabar vs. time
+
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
