Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2191)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2206)
@@ -360,5 +360,5 @@
 // with the same type as the given object name.
 //
-Bool_t MFillH::PreProcess(MParList *pList)
+Int_t MFillH::PreProcess(MParList *pList)
 {
     if (fIndex)
@@ -467,5 +467,5 @@
 // Fills the data from the parameter conatiner into the histogram container
 //
-Bool_t MFillH::Process()
+Int_t MFillH::Process()
 {
     if (fIndex)
@@ -485,5 +485,5 @@
 // has been filled into the histogram.
 //
-Bool_t MFillH::PostProcess()
+Int_t MFillH::PostProcess()
 {
     //
Index: trunk/MagicSoft/Mars/mhist/MFillH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 2191)
+++ trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 2206)
@@ -59,7 +59,7 @@
     void SetWeight(const char *name) { fWeightName = name; }
 
-    Bool_t PreProcess(MParList *pList);
-    Bool_t Process();
-    Bool_t PostProcess();
+    Int_t PreProcess(MParList *pList);
+    Int_t Process();
+    Int_t PostProcess();
 
     ClassDef(MFillH, 2) // Task to fill a histogram with data from a parameter container
Index: trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc	(revision 2191)
+++ trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc	(revision 2206)
@@ -36,5 +36,5 @@
 
 #include "MParList.h"
-#include "MCerPhotEvt.h"
+#include "MCamEvent.h"
 #include "MCamDisplay.h"
 
@@ -48,26 +48,9 @@
 // --------------------------------------------------------------------------
 //
-// Reset all pixels to 0 and reset fEntries to 0.
-//
-void MHCerPhotEvt::Clear(const Option_t *)
-{
-    fSum.Reset();
-//    fSum.InitSize(577);
-    for (int i=0; i<577; i++)
-    {
-        fSum.AddPixel(i, 0, 0);
-        fSum[i].SetPixelUnused();
-    }
-    fSum.FixSize();
-    fEntries = 0;
-}
-
-// --------------------------------------------------------------------------
-//
 // Initialize the name and title of the task.
 // Resets the sum histogram
 //
 MHCerPhotEvt::MHCerPhotEvt(const char *name, const char *title)
-    : fCam(NULL), fEvt(NULL), fDispl(NULL)
+    : fSum(NULL), fEvt(NULL)
 {
     //
@@ -76,6 +59,4 @@
     fName  = name  ? name  : "MHCerPhotEvt";
     fTitle = title ? title : "Average of MCerPhotEvts";
-
-    Clear();
 }
 
@@ -86,6 +67,6 @@
 MHCerPhotEvt::~MHCerPhotEvt()
 {
-    if (fDispl)
-        delete fDispl;
+    if (fSum)
+        delete fSum;
 }
 
@@ -99,13 +80,15 @@
 Bool_t MHCerPhotEvt::SetupFill(const MParList *plist)
 {
-    fEvt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
+    fEvt = (MCamEvent*)plist->FindObject(fNameEvt, "MCamEvent");
     if (!fEvt)
         *fLog << warn << GetDescriptor() << ": No MCerPhotEvt available..." << endl;
 
-    fCam = (MGeomCam*)plist->FindObject("MGeomCam");
-    if (!fCam)
+    MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam");
+    if (!cam)
         *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl;
 
-    Clear();
+    if (fSum)
+        delete (fSum);
+    fSum = new MCamDisplay(*cam, fNameEvt+";avg", fNameEvt+" Avarage");
 
     return kTRUE;
@@ -118,5 +101,5 @@
 Bool_t MHCerPhotEvt::Fill(const MParContainer *par, const Stat_t w)
 {
-    const MCerPhotEvt *evt = par ? (MCerPhotEvt*)par : fEvt;
+    const MCamEvent *evt = par ? dynamic_cast<const MCamEvent*>(par) : fEvt;
     if (!evt)
     {
@@ -124,18 +107,5 @@
         return kFALSE;
     }
-
-    const UInt_t n = evt->GetNumPixels();
-
-    for (UInt_t idx=0; idx<n; idx++)
-    {
-        Float_t val;
-        if (!evt->GetPixelContent(val, idx))
-            continue;
-
-        fSum[idx].SetPixelUsed();
-        fSum[idx].AddNumPhotons(val);
-    }
-
-    fEntries++;
+    fSum->AddCamContent(*evt);
 
     return kTRUE;
@@ -148,11 +118,9 @@
 Bool_t MHCerPhotEvt::Finalize()
 {
-    if (fEntries<1)
-        *fLog << warn << "WARNING - " << GetDescriptor() << " doesn't contain entries." << endl;
-    else
-        fSum.Scale(fEntries);
+    if (fSum->GetEntries()>0)
+        fSum->Scale(1./fSum->GetEntries());
     return kTRUE;
 }
-
+/*
 // --------------------------------------------------------------------------
 //
@@ -161,5 +129,5 @@
 void MHCerPhotEvt::Draw(Option_t *)
 {
-    if (!fCam)
+    if (!fSum)
     {
         *fLog << warn << "WARNING - Cannot draw " << GetDescriptor() << ": No Camera Geometry available." << endl;
@@ -169,4 +137,6 @@
     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 750, 600);
     pad->SetBorderMode(0);
+    //pad->Divide(1,1);
+    //gPad->SetBorderMode(0);
 
     AppendPad("");
@@ -179,14 +149,13 @@
 void MHCerPhotEvt::Paint(Option_t *option)
 {
-    if (!fCam)
-    {
-        *fLog << warn << "WARNING - Cannot paint " << GetDescriptor() << ": No Camera Geometry available." << endl;
+    if (!fSum)
         return;
-    }
 
-    if (!fDispl)
-        fDispl = new MCamDisplay(fCam);
+    fSum->Paint();
+}
+*/
 
-    fDispl->Fill(fSum);
-    fDispl->Paint();
+TH1 *MHCerPhotEvt::GetHistByName(const TString name)
+{
+    return fSum;
 }
Index: trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.h	(revision 2191)
+++ trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.h	(revision 2206)
@@ -6,19 +6,18 @@
 #endif
 
-#ifndef MARS_MCerPhotEvt
-#include "MCerPhotEvt.h"
-#endif
-
-class TH1D;
 class MCamDisplay;
+class MCamEvent;
 
 class MHCerPhotEvt : public MH
 {
 private:
-    MCerPhotEvt  fSum;      // storing the sum
-    Int_t        fEntries;  // number of entries in the histogram
-    MGeomCam    *fCam;      // the present geometry
-    MCerPhotEvt *fEvt;      //! the current event
-    MCamDisplay *fDispl;    //! the camera display
+    MCamDisplay *fSum;      // storing the sum
+    MCamEvent   *fEvt;      //! the current event
+
+    TString fNameEvt;
+
+    Bool_t SetupFill(const MParList *pList);
+    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
+    Bool_t Finalize();
 
 public:
@@ -26,16 +25,7 @@
     ~MHCerPhotEvt();
 
-    void Clear(const Option_t *o="");
+    void SetNameEvt(const TString name) { fNameEvt = name; }
 
-    Bool_t SetupFill(const MParList *pList);
-    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
-    Bool_t Finalize();
-
-    TH1 *GetHistByName(const TString name) { return NULL; }
-
-    const MCerPhotEvt &GetSum() const { return fSum; }
-
-    void Draw(Option_t *opt="");
-    void Paint(Option_t *option="");
+    TH1 *GetHistByName(const TString name="");
 
     ClassDef(MHCerPhotEvt, 1) // Histogram to sum camera events
