Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 2178)
@@ -32,4 +32,6 @@
 //   the array fWeight (default: all slices added up with weight 1).
 //
+//   The weights are rescaled, such that sum(weigths)=num slices
+//
 //  Input Containers:
 //   MRawRunHeader, MRawEvtData, MPedestalCam
@@ -112,7 +114,11 @@
 
     // Calculate quadratic sum of weights:
-    fSumQuadWeights = 0.;
-    for (Int_t i = 0; i < fWeight.GetSize(); i++)
+    fSumWeights = 0;
+    fSumQuadWeights = 0;
+    for (Int_t i=0; i<fWeight.GetSize(); i++)
+    {
+        fSumWeights += fWeight[i];
         fSumQuadWeights += fWeight[i]*fWeight[i];
+    }
 
     fSumQuadWeights = sqrt(fSumQuadWeights);
@@ -169,6 +175,4 @@
 
     MRawEvtPixelIter pixel(fRawEvt);
-
-    TArrayF binsignal(fWeight.GetSize());
 
     while (pixel.Next())
@@ -194,18 +198,13 @@
         // Calculate pixel signal unless it has all FADC slices empty:
         //
-        const Byte_t *ptr = pixel.GetHiGainSamples();
-
-	Float_t nphot = 0;
-        Float_t nphoterr = 0;
-
-        if (pixel.GetSumHiGainSamples()>0)
-        {
-            for (Int_t i=0; i<fWeight.GetSize(); i++)
-            {
-                binsignal[i] =  ptr[i] - mean;
-                nphot       +=  binsignal[i] * fWeight[i];
-            }
-            nphoterr = ped.GetSigma() * fSumQuadWeights;
-        }
+        Byte_t *ptr = pixel.GetHiGainSamples();
+
+        Float_t nphot = 0;
+        for(Int_t i=0; i<fWeight.GetSize(); i++)
+            nphot += ptr[i]*fWeight[i];
+
+        nphot -= mean*fSumWeights;
+
+        const Float_t nphoterr = ped.GetSigma()* fSumQuadWeights;
 
         fCerPhotEvt->AddPixel(pixid, nphot, nphoterr);
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h	(revision 2178)
@@ -33,4 +33,5 @@
 
     TArrayF         fWeight;  // Weights for adding up the ADC slices
+    Float_t         fSumWeights;
     Float_t         fSumQuadWeights;
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 2178)
@@ -384,2 +384,25 @@
     fNumPixels=fPixels->GetEntriesFast();
 }
+
+Bool_t MCerPhotEvt::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio, Int_t type) const
+{
+    MCerPhotPix *pix = GetPixById(idx);
+    if (!pix || !pix->IsPixelUsed())
+        return kFALSE;
+
+    switch (type)
+    {
+    case 1:
+        val = pix->GetErrorPhot()*TMath::Sqrt(ratio);
+        return kTRUE;
+    case 2:
+        if (pix->GetErrorPhot()<=0)
+            return kFALSE;
+        val = pix->GetNumPhotons()*TMath::Sqrt(ratio)/pix->GetErrorPhot();
+        return kTRUE;
+    default:
+        val = pix->GetNumPhotons()*ratio;
+        return kTRUE;
+    }
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 2178)
@@ -4,4 +4,7 @@
 #ifndef ROOT_TClonesArray
 #include <TClonesArray.h>
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
 #endif
 #ifndef MARS_MCerPhotPix
@@ -12,5 +15,5 @@
 class MCerPhotPix;
 
-class MCerPhotEvt : public MParContainer
+class MCerPhotEvt : public MCamEvent
 {
 private:
@@ -61,4 +64,9 @@
     void Clear(Option_t *opt=NULL) { Reset(); }
 
+    Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const;
+    void DrawPixelContent(Int_t num) const
+    {
+    }
+
     ClassDef(MCerPhotEvt, 1)    // class for an event containing cerenkov photons
 };
Index: trunk/MagicSoft/Mars/manalysis/MCurrents.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCurrents.h	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MCurrents.h	(revision 2178)
@@ -2,6 +2,6 @@
 #define MARS_MCurrents
 
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
 #endif
 
@@ -10,5 +10,6 @@
 #endif
 
-class MCurrents : public MParContainer
+#include <iostream.h>
+class MCurrents : public MCamEvent
 {
 private:
@@ -37,4 +38,13 @@
     void Print(Option_t *opt=NULL) const;
 
+    Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const
+    {
+        val = (*this)[idx];
+        return val>0;
+    }
+    void DrawPixelContent(Int_t num) const
+    {
+    }
+
     ClassDef(MCurrents, 1) // Storage Container for the Currents (PRELIMINARY)
 };
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 2178)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Oscar Blanch  11/2001 < mailto:blanch@ifae.es>
+!   Author(s): Oscar Blanch, 11/2001 <mailto:blanch@ifae.es>
 !
 !   Copyright: MAGIC Software Development, 2000-2001
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 2178)
@@ -181,2 +181,8 @@
     return maxval;
 }
+
+Bool_t MPedestalCam::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const
+{
+    val = (*this)[idx].GetMean()*ratio;
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 2175)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 2178)
@@ -2,6 +2,6 @@
 #define MARS_MPedestalCam
 
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
 #endif
 
@@ -11,5 +11,5 @@
 class MPedestalPix;
 
-class MPedestalCam : public MParContainer
+class MPedestalCam : public MCamEvent
 {
 private:
@@ -35,4 +35,9 @@
     void Print(Option_t *o="") const;
 
+    Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const;
+    void DrawPixelContent(Int_t num) const
+    {
+    }
+
     ClassDef(MPedestalCam, 1)	// Storage Container for all pedestal information of the camera
 };
