Index: /trunk/MagicSoft/Mars/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/Makefile	(revision 6854)
+++ /trunk/MagicSoft/Mars/Makefile	(revision 6855)
@@ -20,5 +20,5 @@
 #
 #PROGRAMS = readraw merpp mars test mona status
-PROGRAMS = readdaq merpp readraw sinope callisto star ganymed showlog showplot mars mona
+PROGRAMS = readdaq merpp readraw sinope callisto star ganymed showlog showplot mars
 SOLIB    = libmars.so
 CINT     = M
Index: /trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 6855)
@@ -4,11 +4,4 @@
 #pragma link off all classes;
 #pragma link off all functions;
-
-#pragma link C++ class MCerPhotPix+;
-#pragma link C++ class MCerPhotEvt+;
-#pragma link C++ class MCerPhotEvtIter+;
-#pragma link C++ class MCerPhotAnal+;
-#pragma link C++ class MCerPhotAnal2+;
-#pragma link C++ class MCerPhotCalc+;
 
 #pragma link C++ class MCameraData+;
@@ -27,9 +20,5 @@
 
 #pragma link C++ class MMatrixLoop+;
-/*
-#pragma link C++ class MSigmabar+;
-#pragma link C++ class MSigmabarCalc+;
-#pragma link C++ class MSigmabarParam+;
-*/
+
 #pragma link C++ class MEventRate+;
 #pragma link C++ class MEventRateCalc+;
@@ -38,5 +27,4 @@
 #pragma link C++ class MParameterD+;
 #pragma link C++ class MParameterDerr+;
-//#pragma link C++ class MParameters+;
 
 #pragma link C++ class MMcTriggerLvl2+;
@@ -49,7 +37,5 @@
 #pragma link C++ class MFiltercutsCalc+;
 
-//#pragma link C++ class MPad+;
 #pragma link C++ class MMcCalibrationUpdate+;
-//#pragma link C++ class MMakePadHistograms+;
 
 #endif
Index: /trunk/MagicSoft/Mars/manalysis/MCameraData.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCameraData.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/manalysis/MCameraData.cc	(revision 6855)
@@ -45,9 +45,8 @@
 #include "MPedPhotPix.h"
 
-#include "MCerPhotEvt.h"
-#include "MCerPhotPix.h"
+#include "MSignalCam.h"
+#include "MSignalPix.h"
 
 #include "MSigmabar.h"
-#include "MArrivalTime.h"
 
 ClassImp(MCameraData);
@@ -57,5 +56,5 @@
 // --------------------------------------------------------------------------
 //
-// Creates a MCerPhotPix object for each pixel in the event
+// Creates a MSignalPix object for each pixel in the event
 //
 MCameraData::MCameraData(const char *name, const char *title)
@@ -99,5 +98,5 @@
 // FIXME: Should the check noise<=0 be replaced by MBadPixels?
 //
-void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MPedPhotCam &cam,
+void MCameraData::CalcCleaningLevel(const MSignalCam &evt, const MPedPhotCam &cam,
                                     const MGeomCam &geom)
 {
@@ -114,9 +113,8 @@
 
     // calculate cleaning levels
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &pix = evt[i];
-
-        const Int_t idx = pix.GetPixId();
+    for (Int_t idx=0; idx<entries; idx++)
+    {
+        const MSignalPix &pix = evt[idx];
+
         const Float_t noise = cam[idx].GetRms();
 
@@ -145,5 +143,5 @@
 // FIXME: Should the check noise<=0 be replaced by MBadPixels?
 //
-void MCameraData::CalcCleaningLevel2(const MCerPhotEvt &evt, const MPedPhotCam &cam,
+void MCameraData::CalcCleaningLevel2(const MSignalCam &evt, const MPedPhotCam &cam,
                                      const MGeomCam &geom)
 {
@@ -164,9 +162,8 @@
     // calculate cleaning levels
     const Int_t entries = evt.GetNumPixels();
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &pix = evt[i];
-
-        const Int_t   idx   = pix.GetPixId();
+    for (Int_t idx=0; idx<entries; idx++)
+    {
+        const MSignalPix &pix = evt[idx];
+
         const Float_t noise = cam[idx].GetRms();
 
@@ -189,5 +186,5 @@
 
 
-void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MSigmabar &sgb,
+void MCameraData::CalcCleaningLevel(const MSignalCam &evt, const MSigmabar &sgb,
                                     const MGeomCam &geom)
 {
@@ -195,5 +192,5 @@
 }
 
-void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, Double_t noise,
+void MCameraData::CalcCleaningLevel(const MSignalCam &evt, Double_t noise,
                                     const MGeomCam &geom)
 {
@@ -213,9 +210,7 @@
     // calculate cleaning levels
     const Int_t entries = evt.GetNumPixels();
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &pix = evt[i];
-
-        const Int_t idx = pix.GetPixId();
+    for (Int_t idx=0; idx<entries; idx++)
+    {
+        const MSignalPix &pix = evt[idx];
 
         //
@@ -237,5 +232,5 @@
 // FIXME: Should the check noise<=0 be replaced by MBadPixels?
 //
-void MCameraData::CalcCleaningLevelDemocratic(const MCerPhotEvt &evt, const MPedPhotCam &cam,
+void MCameraData::CalcCleaningLevelDemocratic(const MSignalCam &evt, const MPedPhotCam &cam,
                                               const MGeomCam &geom)
 {
@@ -256,9 +251,8 @@
     // calculate cleaning levels
     const Int_t entries = evt.GetNumPixels();
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &pix = evt[i];
-
-        const Int_t idx     = pix.GetPixId();
+    for (Int_t idx=0; idx<entries; idx++)
+    {
+        const MSignalPix &pix = evt[idx];
+
         const Float_t noise = cam[idx].GetRms();
 
@@ -286,6 +280,6 @@
 // FIXME: Should the check noise<=0 be replaced by MBadPixels?
 //
-void MCameraData::CalcCleaningProbability(const MCerPhotEvt &evt, const MPedPhotCam &pcam,
-                                          const MGeomCam &geom,   const MArrivalTime *tcam)
+void MCameraData::CalcCleaningProbability(const MSignalCam &evt, const MPedPhotCam &pcam,
+                                          const MGeomCam &geom)
 {
     const Int_t n = geom.GetNumPixels();
@@ -307,28 +301,22 @@
     // Find pixel with max signal
     Int_t maxidx = 0;
-    if (tcam)
-    {
-        // Find pixel enty with maximum signal
-        for (Int_t i=0; i<entries; i++)
-        {
-            const Double_t s0 = evt[i].GetNumPhotons()      * geom.GetPixRatio(i);
-            const Double_t s1 = evt[maxidx].GetNumPhotons() * geom.GetPixRatio(maxidx);
-            if (s0>s1)
-                maxidx = i;
-        }
-
-        // Get software index of pixel
-        maxidx = evt[maxidx].GetPixId();
-    }
-
-    const Double_t timemean = tcam ? (*tcam)[maxidx] : 0;
+
+    // Find pixel entry with maximum signal
+    for (Int_t i=0; i<entries; i++)
+    {
+        const Double_t s0 = evt[i].GetNumPhotons()      * geom.GetPixRatio(i);
+        const Double_t s1 = evt[maxidx].GetNumPhotons() * geom.GetPixRatio(maxidx);
+        if (s0>s1)
+            maxidx = i;
+    }
+
+    const Double_t timemean = evt[maxidx].GetArrivalTime();
     const Double_t timerms  = 0.75; //[slices] rms time spread around highest pixel
 
     // calculate cleaning levels
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &spix = evt[i];
-
-        const Int_t   idx = spix.GetPixId();
+    for (Int_t idx=0; idx<entries; idx++)
+    {
+        const MSignalPix &spix = evt[idx];
+
         const Float_t rms = pcam[idx].GetRms();
         if (rms<=0) // fData[idx]=0, fValidity[idx]=0
@@ -342,5 +330,5 @@
 
         const Double_t signal  = spix.GetNumPhotons() * geom.GetPixRatio(idx) * ratio / rms;
-        const Double_t time    = tcam ? (*tcam)[idx] : 1;
+        const Double_t time    = evt[idx].GetArrivalTime();
 
         // if signal<0 the probability is equal 0
@@ -377,5 +365,5 @@
 // The level is the absolute number of photons times the area-ratio.
 //
-void MCameraData::CalcCleaningAbsolute(const MCerPhotEvt &evt, const MGeomCam &geom)
+void MCameraData::CalcCleaningAbsolute(const MSignalCam &evt, const MGeomCam &geom)
 {
     const Int_t n = geom.GetNumPixels();
@@ -391,9 +379,7 @@
 
     // calculate cleaning levels
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &spix = evt[i];
-
-        const Int_t idx = spix.GetPixId();
+    for (Int_t idx=0; idx<entries; idx++)
+    {
+        const MSignalPix &spix = evt[idx];
 
         // Set probability
Index: /trunk/MagicSoft/Mars/manalysis/MCameraData.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCameraData.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/manalysis/MCameraData.h	(revision 6855)
@@ -17,7 +17,6 @@
 class MGeomCam;
 class MSigmabar;
-class MCerPhotEvt;
+class MSignalCam;
 class MPedPhotCam;
-class MArrivalTime;
 
 class MCameraData : public MParContainer, public MCamEvent
@@ -33,17 +32,17 @@
     UInt_t GetNumPixels() const { return fData.GetSize(); }
 
-    void CalcCleaningLevel(const MCerPhotEvt &evt, const MPedPhotCam &fCam,
+    void CalcCleaningLevel(const MSignalCam &evt, const MPedPhotCam &fCam,
                            const MGeomCam &geom);
-    void CalcCleaningLevel(const MCerPhotEvt &evt, const MSigmabar &sgb,
+    void CalcCleaningLevel(const MSignalCam &evt, const MSigmabar &sgb,
                            const MGeomCam &geom);
-    void CalcCleaningLevel(const MCerPhotEvt &evt, Double_t noise,
+    void CalcCleaningLevel(const MSignalCam &evt, Double_t noise,
                            const MGeomCam &geom);
-    void CalcCleaningLevel2(const MCerPhotEvt &evt, const MPedPhotCam &fCam,
+    void CalcCleaningLevel2(const MSignalCam &evt, const MPedPhotCam &fCam,
                             const MGeomCam &geom);
-    void CalcCleaningLevelDemocratic(const MCerPhotEvt &evt, const MPedPhotCam &cam,
+    void CalcCleaningLevelDemocratic(const MSignalCam &evt, const MPedPhotCam &cam,
                                      const MGeomCam &geom);
-    void CalcCleaningProbability(const MCerPhotEvt &evt, const MPedPhotCam &pcam,
-                                 const MGeomCam &geom,   const MArrivalTime *tcam);
-    void CalcCleaningAbsolute(const MCerPhotEvt &evt, const MGeomCam &geom);
+    void CalcCleaningProbability(const MSignalCam &evt, const MPedPhotCam &pcam,
+                                 const MGeomCam &geom);
+    void CalcCleaningAbsolute(const MSignalCam &evt, const MGeomCam &geom);
 
     const TArrayD &GetData() const { return fData; }
Index: unk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.cc	(revision 6854)
+++ 	(revision )
@@ -1,219 +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/2000 <mailto:tbretz@uni-sw.gwdg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-//   MCerPhotAnal                                                           //
-//                                                                          //
-//   This is a task which calculates the number of photons from the FADC    //
-//   time slices. At the moment it integrates simply the FADC values.       //
-//                                                                          //
-//  Input Containers:                                                       //
-//   MRawEvtData, MPedesdtalCam                                             //
-//                                                                          //
-//  Output Containers:                                                      //
-//   MCerPhotEvt                                                            //
-//                                                                          //
-//////////////////////////////////////////////////////////////////////////////
-
-#include "MCerPhotAnal.h"
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MRawRunHeader.h"
-#include "MRawEvtData.h"       // MRawEvtData::GetNumPixels
-#include "MCerPhotEvt.h"
-#include "MPedestalPix.h"
-#include "MPedestalCam.h"
-#include "MRawEvtPixelIter.h"
-
-ClassImp(MCerPhotAnal);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MCerPhotAnal::MCerPhotAnal(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MCerPhotAnal";
-    fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
-
-    AddToBranchList("MRawEvtData.fHiGainPixId");
-    AddToBranchList("MRawEvtData.fLoGainPixId");
-    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
-    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
-
-}
-
-// --------------------------------------------------------------------------
-//
-// The PreProcess searches for the following input containers:
-//  - MRawRunHeader
-//  - MRawEvtData
-//  - MPedestalCam
-//
-// The following output containers are also searched and created if
-// they were not found:
-//  - MCerPhotEvt
-//
-Int_t MCerPhotAnal::PreProcess(MParList *pList)
-{
-    fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!fRunHeader)
-    {
-        *fLog << dbginf << "MRawRunHeader not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
-    if (!fRawEvt)
-    {
-        *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
-    if (!fCerPhotEvt)
-        return kFALSE;
-
-    return kTRUE;
-}
-
-Bool_t MCerPhotAnal::ReInit(MParList *pList)
-{
-    fPedestals = NULL;
-
-    // This must be done in ReInit because in PreProcess the
-    // headers are not available
-    const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!runheader)
-        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
-    else
-        if (runheader->IsMonteCarloRun())
-            return kTRUE;
-
-    fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
-    if (runheader && !fPedestals)
-        return kFALSE;
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Calculate the integral of the FADC time slices and store them as a new
-// pixel in the MCerPhotEvt container.
-//
-Int_t MCerPhotAnal::Process()
-{
-    //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
-
-    MRawEvtPixelIter pixel(fRawEvt);
-
-    while (pixel.Next())
-    {
-	Byte_t *ptr = pixel.GetHiGainSamples();
-	const Byte_t *end = ptr + fRawEvt->GetNumHiGainSamples();
-	const Byte_t *limit = end - 5;
-	
-	Int_t sum=0;
-	Int_t sumpeak=0;
-	Int_t sumlocal =0;
-	Int_t slice=0;
-	Int_t slicelocal=0;
-
-	do
-        {
-            sumlocal = 0;
-            for (Int_t i = 0; i<5;i++)
-                sumlocal += *(ptr+i);
-
-            if (sumpeak < sumlocal)
-            {
-                slice=slicelocal;
-                sumpeak = sumlocal;
-            }
-
-            slicelocal++;
-	    sum += *ptr;
-        } while (++ptr != limit);
-
-        do sum += *ptr;
-        while (++ptr != end);
-
-        Float_t pedes = (Float_t)(sum-sumpeak)/(fRawEvt->GetNumHiGainSamples()-5);
-        Float_t nphot = (Float_t)sumpeak - 5.0*pedes;
-
-        Float_t sigmaped=0;
-
-        slicelocal=0;
-        sumlocal = 0;
-
-	ptr = pixel.GetHiGainSamples();
-        do
-        {
-            if (slicelocal==slice)
-                ptr += 4;
-            else
-            {
-                sumlocal = *ptr;
-
-                const Float_t d = (Float_t)sumlocal-pedes;
-                sigmaped += d*d;
-            }
-            slicelocal++;
-	}
-        while (++ptr != end);
-
-	sigmaped /= (fRawEvt->GetNumHiGainSamples()-5);
-	sigmaped = sqrt((float)sumlocal);
-
-	const UInt_t pixid = pixel.GetPixelId();
-
-        fCerPhotEvt->AddPixel(pixid, nphot, sigmaped/2.236);
-
-        if (fPedestals)
-            (*fPedestals)[pixid].Set(pedes, sigmaped);
-
-        /*
-         ped.SetPedestalRms(sigmaped/sqrt(fRawEvt->GetNumHiGainSamples()-5.),
-                            sigmaped/sqrt(2.*(fRawEvt->GetNumHiGainSamples()-5)));
-                            */
-        // FIXME! Handling of Lo Gains is missing!
-    }
-
-    fCerPhotEvt->FixSize();
-    fCerPhotEvt->SetReadyToSave();
-
-    if (fPedestals)
-        fPedestals->SetReadyToSave();
-
-    return kTRUE;
-}
-
Index: unk/MagicSoft/Mars/manalysis/MCerPhotAnal.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotAnal.h	(revision 6854)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#ifndef MARS_MCerPhotAnal
-#define MARS_MCerPhotAnal
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCerPhotAnal                                                            //
-//                                                                         //
-// Integrates the time slices of one pixel and substracts the pedestal     //
-// (offset) value                                                          //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MRawEvtData;
-class MPedestalCam;
-class MCerPhotEvt;
-class MRawRunHeader;
-
-class MCerPhotAnal : public MTask
-{
-    MPedestalCam  *fPedestals;  // Pedestals of all pixels in the camera
-    MRawEvtData   *fRawEvt;     // raw event data (time slices)
-    MCerPhotEvt   *fCerPhotEvt; // Cerenkov Photon Event used for calculation
-    MRawRunHeader *fRunHeader;  // RunHeader information
-
-    Int_t  PreProcess(MParList *pList);
-    Bool_t ReInit(MParList *pList);
-    Int_t  Process();
- 
-public:
-    MCerPhotAnal(const char *name=NULL, const char *title=NULL);
-
-    ClassDef(MCerPhotAnal, 0)   // Task to calculate cerenkov photons from raw data
-};
-
-#endif
Index: unk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc	(revision 6854)
+++ 	(revision )
@@ -1,293 +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/2000 <mailto:tbretz@uni-sw.gwdg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//   MCerPhotAnal2
-//
-//   This is a task which calculates the number of photons from the FADC
-//   time slices. At the moment it integrates simply the FADC values.
-//
-//  Input Containers:
-//   MRawEvtData, MPedestalCam
-//
-//  Output Containers:
-//   MCerPhotEvt
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include "MCerPhotAnal2.h"
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MRawRunHeader.h"
-#include "MRawEvtData.h"       // MRawEvtData::GetNumPixels
-#include "MCerPhotEvt.h"
-#include "MPedestalPix.h"
-#include "MPedestalCam.h"
-#include "MRawEvtPixelIter.h"
-
-ClassImp(MCerPhotAnal2);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor. b is the number of slices before the maximum slice,
-// a the number of slices behind the maximum slice which is taken as signal.
-//
-MCerPhotAnal2::MCerPhotAnal2(Byte_t b, Byte_t a, const char *name, const char *title)
-    : fBefore(b), fAfter(a)
-{
-    fName  = name  ? name  : "MCerPhotAnal2";
-    fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
-
-    AddToBranchList("MRawEvtData.fHiGainPixId");
-    AddToBranchList("MRawEvtData.fLoGainPixId");
-    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
-    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
-}
-
-// --------------------------------------------------------------------------
-//
-// The PreProcess searches for the following input containers:
-//  - MRawRunHeader
-//  - MRawEvtData
-//  - MPestalCam
-//
-// The following output containers are also searched and created if
-// they were not found:
-//  - MCerPhotEvt
-//
-Int_t MCerPhotAnal2::PreProcess(MParList *pList)
-{
-    fSkip = 0;
-
-    fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!fRunHeader)
-    {
-        *fLog << dbginf << "MRawRunHeader not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
-    if (!fRawEvt)
-    {
-        *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
-    if (!fCerPhotEvt)
-        return kFALSE;
-
-    return kTRUE;
-}
-
-Bool_t MCerPhotAnal2::ReInit(MParList *pList)
-{
-    fPedestals=NULL;
-
-    // This must be done in ReInit because in PreProcess the
-    // headers are not available
-    const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!runheader)
-        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
-    else
-    {
-        if (runheader->IsMonteCarloRun())
-            return kTRUE;
-    }
-
-    fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
-    if (runheader && !fPedestals)
-        return kFALSE;
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Calculate the integral of the FADC time slices and store them as a new
-// pixel in the MCerPhotEvt container.
-//
-Int_t MCerPhotAnal2::Process()
-{
-    MRawEvtPixelIter pixel(fRawEvt);
-
-    while (pixel.Next())
-    {
-        Byte_t *ptr   = pixel.GetHiGainSamples();
-        Byte_t *max   = ptr+pixel.GetIdxMaxHiGainSample();
-	Byte_t *end   = ptr+fRawEvt->GetNumHiGainSamples();
-        Byte_t *first = max-fBefore;
-        Byte_t *last  = max+fAfter;
-
-        ULong_t sumb  = 0;   // sum background
-        ULong_t sqb   = 0;   // sum sqares background
-        ULong_t sumsb = 0;   // sum signal+background
-        ULong_t sqsb  = 0;   // sum sqares signal+background
-
-        Int_t sat  = 0; // saturates?
-        Int_t ishi = 0; // has a high content?
-        Int_t nb   = 0;
-        Int_t nsb  = 0;
-
-        if (*max==255)
-            sat++;
-
-        if (*max>80)
-            ishi++;
-
-        while (ptr<end)
-        {
-            if (ptr<first || ptr>last)
-            {
-                sumb += *ptr;
-                sqb  += *ptr* *ptr;
-                nb++;
-            }
-            else
-            {
-                sumsb += *ptr;
-                sqsb  += *ptr* *ptr;
-                nsb++;
-            }
-            ptr++;
-        }
-
-        if (sat==0 && ishi)
-        {
-            // Area: x9
-            ptr = pixel.GetLoGainSamples();
-            end = ptr+fRawEvt->GetNumLoGainSamples();
-
-            sumb = 0;   // sum background
-            sqb  = 0;   // sum sqares background
-            nb   = 0;
-
-            while (ptr<end)
-            {
-                // Background already calced from hi-gains!
-                sumb += *ptr;
-                sqb  += *ptr* *ptr;
-                nb++;
-                ptr++;
-            }
-        }
-
-        if (sat>1 && !ishi)
-        {
-            // Area: x9
-            ptr = pixel.GetLoGainSamples();
-            max = ptr+pixel.GetIdxMaxLoGainSample();
-
-            if (*max>250)
-            {
-                fSkip++;
-                return kCONTINUE;
-            }
-
-            end   = ptr+fRawEvt->GetNumLoGainSamples();
-            first = max-fBefore;
-            last  = max+fAfter;
-
-            sumsb = 0;   // sum signal+background
-            sqsb  = 0;   // sum sqares signal+background
-            //sumb  = 0;   // sum background
-            //sqb   = 0;   // sum sqares background
-
-            //nb = 0;
-            nsb = 0;
-            while (ptr<end)
-            {
-                if (ptr<first || ptr>last)
-                {
-                    /*
-                     // Background already calced from hi-gains!
-                    sumb += ptr[i];
-                    sqb  += ptr[i]*ptr[i];
-                    nb++;*/
-                }
-                else
-                {
-                    sumsb += *ptr;
-                    sqsb  += *ptr* *ptr;
-                    nsb++;
-                }
-                ptr++;
-            }
-        }
-
-        Float_t b  = (float)sumb/nb;       // background
-        Float_t sb = (float)sumsb/nsb;     // signal+background
-
-        Float_t msb  = (float)sqb/nb;      // mean square background
-        //Float_t mssb = (float)sqsb/nsb;    // mean square signal+background
-
-        Float_t sigb  = sqrt(msb-b*b);     // sigma background
-        //Float_t sigsb = sqrt(mssb-sb*sb);  // sigma signal+background
-
-        Float_t s   = sb-b;                // signal
-        Float_t sqs = sqsb-nsb*b;          // sum sqaures signal
-
-        Float_t mss  = (float)sqs/nsb;     // mean quare signal
-        //Float_t sigs = sqrt(mss-s*s);      // sigma signal
-
-        if (sat>1)
-            s*=10; // tgb has measured 9, but Florian said it's 10.
-
-        Int_t idx = pixel.GetPixelId();
-//        fCerPhotEvt->AddPixel(idx, s, sigs);
-
-        // Preliminary: Do not overwrite pedestals calculated by
-        // MMcPedestalCopy and MMcPedestalNSBAdd
-        if (fPedestals)
-            (*fPedestals)[idx].Set(b, sigb);
-    }
-
-//    fCerPhotEvt->FixSize();
-//    fCerPhotEvt->SetReadyToSave();
-
-    if (fPedestals)
-        fPedestals->SetReadyToSave();
-
-    return kTRUE;
-}
-
-Int_t MCerPhotAnal2::PostProcess()
-{
-    if (GetNumExecutions()==0 || fSkip==0)
-        return kTRUE;
-
-    *fLog << inf << endl;
-    *fLog << GetDescriptor() << " execution statistics:" << endl;
-    *fLog << dec << setfill(' ');
-    *fLog << " " << setw(7) << fSkip << " (" << setw(3) << (int)(fSkip*100/GetNumExecutions()) << "%) Evts skipped due to: lo gain saturated." << endl;
-
-    return kTRUE;
-}
Index: unk/MagicSoft/Mars/manalysis/MCerPhotAnal2.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.h	(revision 6854)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#ifndef MARS_MCerPhotAnal2
-#define MARS_MCerPhotAnal2
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCerPhotAnal2                                                            //
-//                                                                         //
-// Integrates the time slices of one pixel and substracts the pedestal     //
-// (offset) value                                                          //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MRawEvtData;
-class MPedestalCam;
-class MCerPhotEvt;
-class MRawRunHeader;
-
-class MCerPhotAnal2 : public MTask
-{
-private:
-    MPedestalCam  *fPedestals;  // Pedestals of all pixels in the camera
-    MRawEvtData   *fRawEvt;     // raw event data (time slices)
-    MCerPhotEvt   *fCerPhotEvt; // Cerenkov Photon Event used for calculation
-    MRawRunHeader *fRunHeader;  // RunHeader information
-
-    Byte_t fBefore;
-    Byte_t fAfter;
-
-    Int_t fSkip;                //!
-
-    Int_t  PreProcess(MParList *pList);
-    Bool_t ReInit(MParList *pList);
-    Int_t  Process();
-    Int_t  PostProcess();
-
-public:
-    MCerPhotAnal2(Byte_t b=2, Byte_t a=5, const char *name=NULL, const char *title=NULL);
-
-    ClassDef(MCerPhotAnal2, 0)   // Task to calculate cerenkov photons from raw data
-};
-
-#endif
Index: unk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 6854)
+++ 	(revision )
@@ -1,284 +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): Abelardo Moralejo 7/2002  <mailto:moralejo@pd.infn.it>
-!   Author(s): Thomas Bretz 2002  <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2002-2003
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//   MCerPhotCalc
-//
-//   This is a task which calculates the number of photons from the FADC
-//   time slices. It weights the each slice according to the numbers in
-//   the array fWeight (default: all slices added up with weight 1).
-//
-//   The weights are rescaled, such that sum(weigths)=num slices
-//
-//  Input Containers:
-//   MRawEvtData
-//   MPedestalCam
-//   [MRawRunHeader]
-//
-//  Output Containers:
-//   MCerPhotEvt
-//
-//////////////////////////////////////////////////////////////////////////////
-#include "MCerPhotCalc.h"
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MGeomCam.h"
-#include "MMcRunHeader.hxx"
-
-#include "MRawRunHeader.h"
-#include "MRawEvtData.h"       // MRawEvtData::GetNumPixels
-#include "MCerPhotEvt.h"
-#include "MPedestalPix.h"
-#include "MPedestalCam.h"
-#include "MRawEvtPixelIter.h"
-
-ClassImp(MCerPhotCalc);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MCerPhotCalc::MCerPhotCalc(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MCerPhotCalc";
-    fTitle = title ? title : "Calculate pixel signal from FADC data";
-
-    AddToBranchList("MRawEvtData.fHiGainPixId");
-    AddToBranchList("MRawEvtData.fLoGainPixId");
-    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
-    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
-
-    SetDefaultWeights();
-}
-
-// --------------------------------------------------------------------------
-//
-// The PreProcess searches for the following input containers:
-//  - MRawRunHeader
-//  - MRawEvtData
-//  - MPedestalCam
-//
-// The following output containers are also searched and created if
-// they were not found:
-//  - MCerPhotEvt
-//
-Int_t MCerPhotCalc::PreProcess(MParList *pList)
-{
-    fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!fRunHeader)
-    {
-        *fLog << err << "MRawRunHeader not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
-    if (!fRawEvt)
-    {
-        *fLog << err << "MRawEvtData not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fPedestals = (MPedestalCam*)pList->FindCreateObj(AddSerialNumber("MPedestalCam"));
-    if (!fPedestals)
-    {
-        *fLog << err << "MPedestalCam not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt"));
-    if (!fCerPhotEvt)
-        return kFALSE;
-
-    // Calculate sum and quadratic sum of weights:
-    fSumWeights = 0;
-    fSumQuadWeights = 0;
-    for (Int_t i=0; i<fWeight.GetSize(); i++)
-      {
-	fSumWeights += fWeight[i];
-	fSumQuadWeights += fWeight[i]*fWeight[i];
-      }
-
-    fSumQuadWeights = sqrt(fSumQuadWeights);
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Check for the run type and camera version.
-// If the file is a MC file and the used camera version is <= 40
-// we enable a fix for truncated pedestal means in this version.
-//
-Bool_t MCerPhotCalc::ReInit(MParList *pList)
-{
-    const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!runheader)
-    {
-        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
-        return kTRUE;
-    }
-
-    if (fRunHeader->GetNumSamplesHiGain() != fWeight.GetSize())
-    {
-        *fLog << dbginf << "Number of FADC slices (" << fRunHeader->GetNumSamplesHiGain() <<") is different from assumed one (" << fWeight.GetSize() << ")... aborting." << endl;
-        return kFALSE;
-    }
-
-    if (!runheader->IsMonteCarloRun())
-        return kTRUE;
-
-    MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
-    if (!mcrunheader)
-    {
-        *fLog << warn << dbginf << "Warning - cannot check for camera version, MC run header not found." << endl;
-        return kTRUE;
-    }
-
-    fEnableFix = kFALSE;
-
-    if (mcrunheader->GetCamVersion() <= 40)
-        fEnableFix = kTRUE;
-
-    ScalePedestals();
-
-    return kTRUE;
-}
-
-void MCerPhotCalc::ScalePedestals()
-{
-    const Int_t n = fPedestals->GetSize();
-
-    for (int idx=0; idx<n; idx++)
-    {
-        MPedestalPix &ped = (*fPedestals)[idx];
-
-	// This converts the pedestal info contained in ped  from the pedestal 
-	// of each FADC slice to the pedesal of the pixel signal (depends on
-	// how many FADC slices are added up).
-
-        const Double_t offset = fEnableFix ? ped.GetPedestal()-0.5 : ped.GetPedestal();
-
-        ped.Set(offset*fSumWeights, ped.GetPedestalRms()*fSumQuadWeights);
-    }
-
-    fPedestals->SetReadyToSave();
-}
-
-// --------------------------------------------------------------------------
-//
-// Calculate the integral of the FADC time slices and store them as a new
-// pixel in the MCerPhotEvt container.
-//
-Int_t MCerPhotCalc::Process()
-{
-    //fCerPhotEvt->InitSize(fRawEvt->GetNumPixels());
-
-//    if (fIsMcFile)
-//        ScalePedestals();
-
-    const Int_t n = fWeight.GetSize();
-
-    MRawEvtPixelIter pixel(fRawEvt);
-
-    Int_t saturatedpixels = 0;
-
-    while (pixel.Next())
-    {
-        const UInt_t idx = pixel.GetPixelId();
-
-        MPedestalPix &ped = (*fPedestals)[idx];
-
-        //
-        // Calculate pixel signal unless it has all FADC slices empty:
-        //
-        Byte_t *ptr = pixel.GetHiGainSamples();
-
-        Int_t i;
-        Double_t nphot = 0;
-        for (i=0; i<n; i++)
-        {
-            if (ptr[i]==0xff)
-                break;
-            nphot += ptr[i]*fWeight[i];
-        }
-
-	Bool_t saturatedlg = kFALSE;
-
-        if (i<n)
-        {
-	    nphot = 0;
-
-            ptr = pixel.GetLoGainSamples();
-            if (ptr==NULL)
-            {
-                *fLog << warn << "WARNING - Pixel #" << idx << " saturated but has no lo gains... skipping!" << endl;
-                return kCONTINUE;
-            }
-
-            for (i=0; i<n; i++)
-            {
-                if (ptr[i]==0xff)
-                    saturatedlg = kTRUE;
-
-                nphot += ptr[i]*fWeight[i];
-            }
-
-            nphot -= ped.GetPedestal();
-            nphot *= 10;
-        }
-        else
-            nphot -= ped.GetPedestal();
-
-        fCerPhotEvt->AddPixel(idx, nphot, 0);
-
-	if (saturatedlg)
-	  saturatedpixels++;
-    }
-
-    if (saturatedpixels>0)
-        *fLog << warn << "WARNING: " << saturatedpixels << " pixel(s) had saturating low gains..." << endl;
-
-    fCerPhotEvt->FixSize();
-    fCerPhotEvt->SetReadyToSave();
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Set default values for the number of slices and weights:
-//
-void MCerPhotCalc::SetDefaultWeights()
-{
-    const Float_t dummy[15] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
-    fWeight.Set(15, dummy);
-}
Index: unk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h	(revision 6854)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#ifndef MARS_MCerPhotCalc
-#define MARS_MCerPhotCalc
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCerPhotCalc                                                            //
-//                                                                         //
-// Integrates the desired ADC time slices of one pixel and substracts the  //
-// pedestal (offset) value                                                 //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#ifndef ROOT_TArrayF
-#include <TArrayF.h>
-#endif
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MRawEvtData;
-class MPedestalCam;
-class MCerPhotEvt;
-class MRawRunHeader;
-
-class MCerPhotCalc : public MTask
-{
-    MPedestalCam   *fPedestals;  // Pedestals of all pixels in the camera
-    MRawEvtData    *fRawEvt;     // raw event data (time slices)
-    MCerPhotEvt    *fCerPhotEvt; // Cerenkov Photon Event used for calculation
-    MRawRunHeader  *fRunHeader;  // RunHeader information
- 
-    Bool_t          fEnableFix;  // fix for a bug in files from older camera versions (<=40)
-    Bool_t          fIsMcFile;
-
-    TArrayF         fWeight;  // Weights for adding up the ADC slices
-    Float_t         fSumQuadWeights;
-    Float_t         fSumWeights;
-
-    void SetDefaultWeights();
-
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
-
-    Bool_t ReInit(MParList *pList);
-    void ScalePedestals();
-
-public:
-    MCerPhotCalc(const char *name=NULL, const char *title=NULL);
-
-    // FIXME: The array size should be checked!
-    void   SetWeights(const TArrayF &w) { fWeight = w; }
-
-    ClassDef(MCerPhotCalc, 0)   // Task to calculate cerenkov photons from raw data
-};
- 
-
-#endif
Index: unk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 6854)
+++ 	(revision )
@@ -1,648 +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/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!   Author(s): Harald Kornmayer, 1/2001
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//            
-// MCerPhotEvt
-//
-// NOTE: This container is NOT ment for I/O. Write it to a file on your own
-//       risk!
-//
-// Class Version 4:
-// ----------------
-//  - added Short_t       fNumSinglePixels;
-//  - added Float_t       fSizeSinglePixels;
-//  - added Float_t       fSizeSubIslands;
-//  - added Float_t       fSizeMainIsland;
-//
-// Class Version 3:
-// ----------------
-//  - added fNumIslands
-//            
-// Class Version 2:
-// ----------------
-//  - added fLut to accelerate GetPixById a lot
-//            
-// Class Version 1:
-// ----------------
-//  - first version
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MCerPhotEvt.h"
-
-#include <math.h>
-#include <limits.h>
-#include <fstream>
-
-#include <TArrayD.h>
-#include <TCanvas.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MGeomCam.h"
-#include "MGeomPix.h"
-
-ClassImp(MCerPhotEvt);
-ClassImp(MCerPhotEvtIter);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Creates a MCerPhotPix object for each pixel in the event
-//
-MCerPhotEvt::MCerPhotEvt(const char *name, const char *title) : fNumPixels(0)
-{
-    fName  = name  ? name  : "MCerPhotEvt";
-    fTitle = title ? title : "(Number of Photon)-Event Information";
-
-    fPixels = new TClonesArray("MCerPhotPix", 0);
-}
-
-// --------------------------------------------------------------------------
-//
-// This is not yet implemented like it should.
-//
-/*
-void MCerPhotEvt::Draw(Option_t* option) 
-{
-    //
-    //   FIXME!!! Here the Draw function of the CamDisplay
-    //   should be called to add the CamDisplay to the Pad.
-    //   The drawing should be done in MCamDisplay::Paint
-    //
-
-    //    MGeomCam *geom = fType ? new MGeomCamMagic : new MGeomCamCT1;
-    //    MCamDisplay *disp = new MCamDisplay(geom);
-    //    delete geom;
-    //    disp->DrawPhotNum(this);
-}
-*/
-
-// --------------------------------------------------------------------------
-//
-// reset counter and delete netries in list.
-//
-void MCerPhotEvt::Reset()
-{
-    fNumPixels        =  0;
-    fNumSinglePixels  =  0;
-    fSizeSinglePixels =  0;
-    fSizeSubIslands   =  0;
-    fSizeMainIsland   =  0;
-    fMaxIndex         = -1;
-    fNumIslands       = -1;
-    fLut.Set(0);
-    // fPixels->Delete();
-}
-
-void MCerPhotEvt::FixSize()
-{
-    fLut.Set(fMaxIndex+1);
-
-    if (fPixels->GetEntriesFast() == (Int_t)fNumPixels)
-        return;
-
-    fPixels->ExpandCreateFast(fNumPixels);
-}
-
-// --------------------------------------------------------------------------
-//
-//  Dump the cerenkov photon event to *fLog
-//
-void MCerPhotEvt::Print(Option_t *) const
-{
-    const Int_t entries = fPixels->GetEntries();
-
-    *fLog << GetDescriptor() << dec << endl;
-    *fLog << " Number of Pixels: " << fNumPixels << "(" << entries << ")" << endl;
-
-    for (Int_t i=0; i<entries; i++ )
-        (*this)[i].Print();
-}
-
-// --------------------------------------------------------------------------
-//
-// Checks if in the pixel list is an entry with pixel id
-//
-Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) const
-{
-    return GetPixById(id) ? kTRUE : kFALSE;
-} 
-
-// --------------------------------------------------------------------------
-//
-//   Checks if in the pixel list is an entry with pixel id
-//
-Bool_t MCerPhotEvt::IsPixelUsed(Int_t id) const
-{
-    const MCerPhotPix *pix = GetPixById(id);
-    return pix ? pix->IsPixelUsed() : kFALSE;
-} 
-
-// --------------------------------------------------------------------------
-//
-//   Checks if in the pixel list is an entry with pixel id
-//
-Bool_t MCerPhotEvt::IsPixelCore(Int_t id) const
-{
-    const MCerPhotPix *pix = GetPixById(id);
-    return pix ? pix->IsPixelCore() : kFALSE;
-} 
-
-// --------------------------------------------------------------------------
-//
-// get the minimum number of photons  of all valid pixels in the list
-// If you specify a geometry the number of photons is weighted with the
-// area of the pixel
-//
-Float_t MCerPhotEvt::GetNumPhotonsMin(const MGeomCam *geom) const
-{
-    if (fNumPixels <= 0)
-        return -5.;
-
-    const UInt_t n = geom->GetNumPixels();
-
-    Float_t minval = FLT_MAX;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MCerPhotPix &pix = (*this)[i];
-        if (!pix.IsPixelUsed())
-            continue;
-
-        const UInt_t id = pix.GetPixId();
-        if (id<0 || id>=n)
-            continue;
-
-        Float_t testval = pix.GetNumPhotons();
-
-        if (geom)
-            testval *= geom->GetPixRatio(id);
-
-        if (testval < minval)
-            minval = testval;
-    }
-
-    return minval;
-}
-
-// --------------------------------------------------------------------------
-//
-// get the maximum number of photons of all valid pixels in the list
-// If you specify a geometry the number of photons is weighted with the
-// area of the pixel
-//
-Float_t MCerPhotEvt::GetNumPhotonsMax(const MGeomCam *geom) const
-{
-    if (fNumPixels <= 0)
-        return 50.;
-
-    const UInt_t n = geom->GetNumPixels();
-
-    Float_t maxval = -FLT_MAX;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MCerPhotPix &pix = (*this)[i];
-        if (!pix.IsPixelUsed())
-            continue;
-
-        const UInt_t id = pix.GetPixId();
-        if (id<0 || id>=n)
-            continue;
-
-        Float_t testval = pix.GetNumPhotons();
-        if (geom)
-            testval *= geom->GetPixRatio(id);
-
-        if (testval > maxval)
-            maxval = testval;
-    }
-    return maxval;
-}
-
-// --------------------------------------------------------------------------
-//
-// get the minimum ratio of photons/error
-//
-Float_t MCerPhotEvt::GetRatioMin(const MGeomCam *geom) const
-{
-    if (fNumPixels <= 0)
-        return -5.;
-
-    Float_t minval = FLT_MAX;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MCerPhotPix &pix = (*this)[i];
-        if (!pix.IsPixelUsed())
-            continue;
-
-        Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
-        if (geom)
-            testval *= TMath::Sqrt(geom->GetPixRatio(pix.GetPixId()));
-
-        if (testval < minval)
-            minval = testval;
-    }
-
-    return minval;
-}
-
-// --------------------------------------------------------------------------
-//
-// get the maximum ratio of photons/error
-//
-Float_t MCerPhotEvt::GetRatioMax(const MGeomCam *geom) const
-{
-    if (fNumPixels <= 0)
-        return -5.;
-
-    Float_t maxval = -FLT_MAX;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MCerPhotPix &pix = (*this)[i];
-        if (!pix.IsPixelUsed())
-            continue;
-
-        Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
-        if (geom)
-            testval *= TMath::Sqrt(geom->GetPixRatio(pix.GetPixId()));
-
-        if (testval > maxval)
-            maxval = testval;
-    }
-
-    return maxval;
-}
-
-// --------------------------------------------------------------------------
-//
-// get the minimum of error
-// If you specify a geometry the number of photons is weighted with the
-// area of the pixel
-//
-Float_t MCerPhotEvt::GetErrorPhotMin(const MGeomCam *geom) const
-{
-    if (fNumPixels <= 0)
-        return 50.;
-
-    Float_t minval = FLT_MAX;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MCerPhotPix &pix = (*this)[i];
-        if (!pix.IsPixelUsed())
-            continue;
-
-        Float_t testval = pix.GetErrorPhot();
-
-        if (geom)
-            testval *= geom->GetPixRatio(pix.GetPixId());
-
-        if (testval < minval)
-            minval = testval;
-    }
-    return minval;
-}
-
-// --------------------------------------------------------------------------
-//
-// get the maximum ratio of photons/error
-// If you specify a geometry the number of photons is weighted with the
-// area of the pixel
-//
-Float_t MCerPhotEvt::GetErrorPhotMax(const MGeomCam *geom) const
-{
-    if (fNumPixels <= 0)
-        return 50.;
-
-    Float_t maxval = -FLT_MAX;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MCerPhotPix &pix = (*this)[i];
-        if (!pix.IsPixelUsed())
-            continue;
-
-        Float_t testval = pix.GetErrorPhot();
-
-        if (geom)
-            testval *= geom->GetPixRatio(pix.GetPixId());
-
-        if (testval > maxval)
-            maxval = testval;
-    }
-    return maxval;
-}
-
-void MCerPhotEvt::RemoveUnusedPixels()
-{
-    // Create iterator
-    TIter Next(fPixels);
-    MCerPhotPix *pix = NULL;
-
-    fMaxIndex = -1;
-
-    // Remove all unused pixels from list, calculate new fMaxIndex
-    while ((pix=(MCerPhotPix*)Next()))
-    {
-        if (!pix->IsPixelUsed())
-            fPixels->Remove(pix);
-        else
-            fMaxIndex = TMath::Max(fMaxIndex, pix->GetPixId());
-    }
-
-    // Crompress array
-    fPixels->Compress();
-
-    // Get new number of entries in array
-    fNumPixels=fPixels->GetEntriesFast();
-
-    // Rebuild lookup table
-    RebuildLut();
-}
-
-// --------------------------------------------------------------------------
-//
-// Return a pointer to the pixel with the requested idx. NULL if it doesn't
-// exist. The Look-up-table fLut is used. If its size is zero (according
-// to Rene this will happen if an old class object is loaded) we still
-// try to search in the array.
-//
-MCerPhotPix *MCerPhotEvt::GetPixById(Int_t idx) const
-{
-    if (idx<0)
-        return 0;
-
-    if (fLut.GetSize()>0)
-    {
-        if (idx>=fLut.GetSize())
-            return 0;
-        return fLut[idx]<0 ? 0 : (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx]));
-    }
-
-    TIter Next(fPixels);
-    MCerPhotPix *pix = NULL;
-
-    while ((pix=(MCerPhotPix*)Next()))
-        if (pix->GetPixId()==idx)
-            return pix;
-
-    return NULL;
-}
-
-MCerPhotPix *MCerPhotEvt::AddPixel(Int_t idx, Float_t nph, Float_t er)
-    {
-        //
-        // If this is too slow or takes to much space we might use
-        // MGeomApply and an InitSize member function instead.
-        //
-        if (idx>=fLut.GetSize())
-        {
-            const Int_t n = fLut.GetSize();
-            fLut.Set(idx*2+1); //idx+1 is slower than idx*2+1
-            for (int i=n; i<idx*2+1; i++)
-                fLut[i] = -1;
-        }
-
-        fLut[idx] = fNumPixels;
-        if (idx>fMaxIndex)
-            fMaxIndex=idx;
-
-        return new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er);
-    }
-
-// --------------------------------------------------------------------------
-//
-// This function recursively finds all pixels of one island and assigns
-// the number num as island number to the pixel.
-//
-//  1) Check whether a pixel with the index idx exists, is unused
-//     and has not yet a island number assigned.
-//  2) Assign the island number num to the pixel
-//  3) Loop over all its neighbors taken from the geometry geom. For all
-//     neighbors recursively call this function (CalcIsland)
-//  4) Sum the size of the pixel and all neighbors newly assigned
-//     (by CalcIsland) to this island
-//
-// Returns the sum of the pixel size.
-//
-Double_t MCerPhotEvt::CalcIsland(const MGeomCam &geom, Int_t idx, Int_t num)
-{
-    // Try to get the pixel information of a pixel with this index
-    MCerPhotPix *pix = GetPixById(idx);
-
-    // If a pixel with this index is not existing... do nothing.
-    if (!pix)
-        return 0;
-
-    // If an island number was already assigned to this pixel... do nothing.
-    if (pix->GetIdxIsland()>=0)
-        return 0;
-
-    // If the pixel is an unused pixel... do nothing.
-    if (!pix->IsPixelUsed())
-        return 0;
-
-    // Assign the new island number num to this used pixel
-    pix->SetIdxIsland(num);
-
-    // Get the geometry information (neighbors) of this pixel
-    const MGeomPix &gpix = geom[idx];
-
-    // Get the size of this pixel
-    Double_t size = pix->GetNumPhotons();
-
-    // Now do the same with all its neighbors and sum the
-    // sizes which they correspond to
-    const Int_t n = gpix.GetNumNeighbors();
-    for (int i=0; i<n; i++)
-        size += CalcIsland(geom, gpix.GetNeighbor(i), num);
-
-    // return size of this (sub)cluster
-    return size;
-}
-
-// --------------------------------------------------------------------------
-//
-// Each pixel which is maked as used is assigned an island number
-// (starting from 0). A pixel without an island number assigned
-// has island number -1.
-//
-// The index 0 corresponds to the island with the highest size (sum
-// of GetNumPhotons() in island). The size is decreasing with
-// increasing indices.
-//
-// The information about pixel neighbory is taken from the geometry
-// MGeomCam geom;
-//
-// You can access this island number of a pixel with a call to
-// MCerPhotPix->GetIdxIsland. The total number of islands available
-// can be accessed with MCerPhotEvt->GetNumIslands.
-//
-// CalcIslands returns the number of islands found. If an error occurs,
-// eg the geometry has less pixels than the highest index stored, -1 is
-// returned.
-//
-Int_t MCerPhotEvt::CalcIslands(const MGeomCam &geom)
-{
-    if (fMaxIndex<0 || fNumPixels<=0)
-    {
-        *fLog << err << "ERROR - MCerPhotEvt doesn't contain pixels!" << endl;
-        fNumIslands = 0;
-        return -1;
-    }
-
-    if ((UInt_t)fMaxIndex>=geom.GetNumPixels())
-    {
-        *fLog << err << "ERROR - MCerPhotEvt::CalcIslands: Size mismatch - geometry too small!" << endl;
-        return -1;
-    }
-
-    // Create a list to hold the sizes of the islands (The maximum
-    // number of islands possible is roughly fNumPixels/4)
-    TArrayD size(fNumPixels/3);
-
-    // Calculate Islands
-    Int_t   n=0;
-    Float_t totsize = 0;
-
-    // We could loop over all indices which looks more straight
-    // forward but should be a lot slower (assuming zero supression)
-    MCerPhotPix *pix=0;
-
-    TIter Next(*this);
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
-    {
-        // This 'if' is necessary (although it is done in GetIsland, too)
-        // because otherwise the counter (n) would be wrong.
-        // So only 'start' a new island for used pixels (selected by
-        // using the Iterator) which do not yet belong to another island.
-        if (pix->GetIdxIsland()<0)
-        {
-            // Don't put this in one line! n is used twice...
-            const Double_t sz = CalcIsland(geom, pix->GetPixId(), n);
-            size[n++] = sz;
-            totsize += sz;
-        }
-    }
-
-    // Create an array holding the indices
-    TArrayI idx(n);
-
-    // Sort the sizes descending
-    TMath::Sort(n, size.GetArray(), idx.GetArray(), kTRUE);
-
-    // Replace island numbers by size indices -- After this
-    // islands indices are sorted by the island size
-    Next.Reset();
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
-    {
-        const Short_t i = pix->GetIdxIsland();
-
-        // Find new index
-        Short_t j;
-        for (j=0; j<n; j++)
-            if (idx[j]==i)
-                break;
-
-        pix->SetIdxIsland(j==n ? -1 : j);
-    }
-
-    // Now assign number of islands found
-    fNumIslands     = n;
-    fSizeSubIslands = n>0 ? totsize-size[idx[0]] : 0;
-    fSizeMainIsland = n>0 ? size[idx[0]] : 0;
-
-    // return number of island
-    return fNumIslands;
-}
-
-// --------------------------------------------------------------------------
-//
-// Returns, depending on the type flag:
-//
-//  0: Number of Photons*PixRatio
-//  1: Error*sqrt(PixRatio)
-//  2: Cleaning level = Num Photons*sqrt(PixRatio)/Error
-//  3: Number of Photons
-//  4: Error
-//  5: Island index
-//
-Bool_t MCerPhotEvt::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
-{
-    MCerPhotPix *pix = GetPixById(idx);
-
-    if (!pix || !pix->IsPixelUsed())
-        return kFALSE;
-
-    const Double_t ratio = cam.GetPixRatio(idx);
-
-    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;
-    case 3:
-        val = pix->GetNumPhotons();
-        break;
-    case 4:
-        val = pix->GetErrorPhot();
-        break;
-    case 5:
-        val = pix->GetIdxIsland();
-        break;
-    default:
-        val = pix->GetNumPhotons()*ratio;
-        return kTRUE;
-    }
-    return kTRUE;
-}
-
-void MCerPhotEvt::DrawPixelContent(Int_t num) const
-{
-    *fLog << warn << "MCerPhotEvt::DrawPixelContent - not available." << endl;
-}
-
-TObject *MCerPhotEvtIter::Next()
-{
-    if (!fUsedOnly)
-        return TObjArrayIter::Next();
-
-    MCerPhotPix *pix;
-    while ((pix = (MCerPhotPix*)TObjArrayIter::Next()))
-        if (pix->IsPixelUsed())
-            return pix;
-    return pix;
-}
Index: unk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 6854)
+++ 	(revision )
@@ -1,132 +1,0 @@
-#ifndef MARS_MCerPhotEvt
-#define MARS_MCerPhotEvt
-
-#ifndef ROOT_TClonesArray
-#include <TClonesArray.h>
-#endif
-#ifndef ROOT_TArrayI
-#include <TArrayI.h>
-#endif
-#ifndef MARS_MCamEvent
-#include "MCamEvent.h"
-#endif
-#ifndef MARS_MCerPhotPix
-#include "MCerPhotPix.h"
-#endif
-
-class MGeomCam;
-class MCerPhotPix;
-class MCerPhotEvtIter;
-
-class MCerPhotEvt : public MParContainer, public MCamEvent
-{
-    friend class MCerPhotEvtIter;
-private:
-    UInt_t        fNumPixels;
-    Short_t       fNumIslands;
-    Short_t       fNumSinglePixels;
-    Float_t       fSizeSinglePixels;
-    Float_t       fSizeSubIslands;
-    Float_t       fSizeMainIsland;
-     Int_t        fMaxIndex;
-    TArrayI       fLut;        // Lookup tabel to lookup pixel by index
-    TClonesArray *fPixels;     //-> FIXME: Change TClonesArray away from a pointer?
-
-    void RebuildLut()
-    {
-        // Resize Lut
-        fLut.Set(fMaxIndex+1);
-
-        // Reset Lut
-        fLut.Reset(-1);
-
-        // Rebuild Lut
-        for (UInt_t i=0; i<GetNumPixels(); i++)
-        {
-            const MCerPhotPix &pix = (*this)[i];
-            fLut[pix.GetPixId()] = i;
-        }
-    }
-
-    Double_t CalcIsland(const MGeomCam &geom, Int_t idx, Int_t num);
-
-public:
-    MCerPhotEvt(const char *name=NULL, const char *title=NULL);
-    ~MCerPhotEvt() { delete fPixels; }
-
-    // Setter function to fill pixels
-    MCerPhotPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0);
-    void FixSize();
-
-    // Getter functions
-    UInt_t  GetNumPixels() const { return fNumPixels; }
-    Short_t GetNumIslands() const { return fNumIslands; };
-    Short_t GetNumSinglePixels() const { return fNumSinglePixels; }
-    Float_t GetSizeSinglePixels() const { return fSizeSinglePixels; }
-    Float_t GetSizeSubIslands() const { return fSizeSubIslands; }
-    Float_t GetSizeMainIsland() const { return fSizeMainIsland; }
-
-    // Setter functions for use in image cleaning classes only
-    void SetSinglePixels(Short_t num, Float_t size) { fNumSinglePixels=num; fSizeSinglePixels=size; }
-
-    Bool_t  IsPixelExisting(Int_t id) const;
-    Bool_t  IsPixelUsed    (Int_t id) const;
-    Bool_t  IsPixelCore    (Int_t id) const;
-
-    Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const;
-    Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
-
-    Float_t GetRatioMin(const MGeomCam *geom=NULL) const;
-    Float_t GetRatioMax(const MGeomCam *geom=NULL) const;
-
-    Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
-    Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
-
-    // Getter functions to access single pixels
-    MCerPhotPix &operator[](int i)       { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
-    MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
-
-    MCerPhotPix *GetPixById(Int_t idx) const;
-
-    // Functions to change the contained data
-    void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); }
-    void RemoveUnusedPixels();
-    Int_t CalcIslands(const MGeomCam &geom);
-    void Sort(Int_t upto = kMaxInt)
-    {
-        // Sort pixels by index
-        fPixels->Sort(upto);
-        RebuildLut();
-    } // For convinience: Sort pixels by index
-
-    // class MParContainer
-    void Reset();
-
-    // class TObject
-    void Print(Option_t *opt=NULL) const;
-    void Clear(Option_t *opt=NULL) { Reset(); }
-
-    // class MCamEvent
-    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
-    void DrawPixelContent(Int_t num) const;
-
-    // To build an iterator for this class
-    operator TIterator*() const;
-
-    ClassDef(MCerPhotEvt, 4)    // class for an event containing cerenkov photons
-};
-
-class MCerPhotEvtIter : public TObjArrayIter
-{
-private:
-    Bool_t fUsedOnly;
-public:
-    MCerPhotEvtIter(const MCerPhotEvt *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly) { }
-    TObject *Next();
-    TIterator &operator=(const TIterator &) { return *this; }
-    ClassDef(MCerPhotEvtIter, 0)
-};
-
-inline MCerPhotEvt::operator TIterator*() const { return new MCerPhotEvtIter(this); }
-
-#endif
Index: unk/MagicSoft/Mars/manalysis/MCerPhotPix.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotPix.cc	(revision 6854)
+++ 	(revision )
@@ -1,112 +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/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
-!   Author(s): Harald Kornmayer 1/2001
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MCerPhotPix
-//
-// Storage container for the signal in a pixel in number of photons.
-//
-// NOTE: This container is NOT ment for I/O. Write it to a file on your
-//       own risk!
-//
-// fIsSaturated: boolean variable set to kTRUE whenever one or more of
-//               the low gain FADC slices of the pixel is in saturation.
-//
-// Version 2:
-// ----------
-//  - added fIsSaturated
-//
-// Version 4:
-// ----------
-//  - added fIsHGSaturated
-//
-// Version 5:
-// ----------
-//  - added fIdxIsland
-//
-// Version 6:
-// ----------
-//  - put the '!' into the comment line for
-//      Bool_t   fIsCore;        //! the pixel is a Core pixel -> kTRUE
-//      Short_t  fRing;          //! NT: number of analyzed rings around the core pixels, fRing>0 means: used, fRing= 0 means: unused, fRing= -1 means: unmapped (no possible to use in the calculation of the image parameters)
-//      Short_t  fIdxIsland;     //! the pixel is a Core pixel -> kTRUE
-//      Bool_t   fIsHGSaturated; //! the pixel's high gain is saturated
-//    This is a queick hack to gain storage space - the structure of
-//    the container for calibrated data will change soon.
-//
-////////////////////////////////////////////////////////////////////////////
-#include "MCerPhotPix.h"
-
-#include "MLog.h"
-
-ClassImp(MCerPhotPix);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor. The pixel is assumed as used and not a core pixel.
-// NT 29/04/2003: A pixel is considered used when fRing > 0.
-//
-MCerPhotPix::MCerPhotPix(Int_t pix, Float_t phot, Float_t errphot) :
-    fPixId(pix), fIsCore(kFALSE), fRing(1), fIdxIsland(-1),
-    fPhot(phot), fErrPhot(errphot),
-    fIsSaturated(kFALSE), fIsHGSaturated(kFALSE)
-{
-    MMath::ReducePrecision(fPhot);
-    MMath::ReducePrecision(fErrPhot);
-} 
-
-// --------------------------------------------------------------------------
-//
-// From TObject:
-//  Compare abstract method. Must be overridden if a class wants to be able
-//  to compare itself with other objects. Must return -1 if this is smaller
-//  than obj, 0 if objects are equal and 1 if this is larger than obj.
-//
-// Here:
-//  Index numbers are compared --> This allows sorting by index
-//
-Int_t MCerPhotPix::Compare(const TObject *o) const
-{
-    const Int_t diff = fPixId - static_cast<const MCerPhotPix*>(o)->fPixId;
-    return diff==0 ? 0 : TMath::Sign(1, diff);
-}
-
-// --------------------------------------------------------------------------
-//
-//  Print information to gLog.
-//
-void MCerPhotPix::Print(Option_t *) const
-{ 
-    gLog << GetDescriptor() <<" Pixel: "<< fPixId;
-    gLog << (fRing>0?"   Used ":" Unused ");
-    gLog << (fIsCore?" Core ":"      ");
-    gLog << (fIsSaturated?"   ":"not") << " saturated ";
-    gLog << "High gain " << (fIsHGSaturated?"   ":"not") << " saturated ";
-    gLog << "Nphot= " << fPhot << " Error(Nphot)=" << fErrPhot << endl;
-}
Index: unk/MagicSoft/Mars/manalysis/MCerPhotPix.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h	(revision 6854)
+++ 	(revision )
@@ -1,71 +1,0 @@
-#ifndef MARS_MCerPhotPix_H
-#define MARS_MCerPhotPix_H
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-#ifndef MARS_MMath
-#include "MMath.h"
-#endif
-
-class MCerPhotPix : public MParContainer
-{
-private:
-
-    Int_t    fPixId;         // the pixel Id
-
-    Bool_t   fIsCore;        // the pixel is a Core pixel -> kTRUE
-    Short_t  fRing;          // NT: number of analyzed rings around the core pixels, fRing>0 means: used, fRing= 0 means: unused, fRing= -1 means: unmapped (no possible to use in the calculation of the image parameters)
-    Short_t  fIdxIsland;     // the pixel is a Core pixel -> kTRUE
-
-    Float_t  fPhot;          // The number of Cerenkov photons
-    Float_t  fErrPhot;       // the error of fPhot
-
-    Bool_t   fIsSaturated;   // the pixel's low gain is saturated
-    Bool_t   fIsHGSaturated; // the pixel's high gain is saturated
-
-    // FIXME: arrival time t, and it's error sigma t
-
-public:
-    MCerPhotPix(Int_t pix=-1, Float_t phot=0, Float_t errphot=0);
-
-    Int_t   GetPixId() const            { return fPixId;   }
-    Float_t GetNumPhotons() const       { return fPhot;    }
-    Float_t GetErrorPhot() const        { return fErrPhot; }
-    
-    Bool_t  IsPixelUsed() const         { return fRing>0; }
-    Bool_t  IsPixelUnmapped() const     { return fRing==-1; }
-    void    SetPixelUnused()            { fRing=0; }
-    void    SetPixelUsed()              { fRing=1; }
-    void    SetPixelUnmapped()          { fRing=-1;}
-    void    SetIdxIsland(Short_t num)   { fIdxIsland=num; }
-    Short_t GetIdxIsland() const        { return fIdxIsland; }
-
-    void    SetRing(UShort_t r)         { fRing = r;   }
-    Short_t GetRing() const             { return fRing;}
-
-    void    SetPixelCore(Bool_t b=kTRUE){ fIsCore = b; }
-    Bool_t  IsPixelCore() const         { return fIsCore;  }
-
-    void    SetNumPhotons(Float_t f)    { MMath::ReducePrecision(f); fPhot     = f; }
-    void    SetErrorPhot(Float_t f)     { MMath::ReducePrecision(f); fErrPhot = f; }
-    void    Set(Float_t np, Float_t ep) { MMath::ReducePrecision(np); MMath::ReducePrecision(ep);  fPhot = np; fErrPhot = ep; }
-
-    void    SetPixelSaturated()         { fIsSaturated = kTRUE; }
-    Bool_t  IsPixelSaturated() const    { return fIsSaturated; }
-
-    void    SetPixelHGSaturated()       { fIsHGSaturated = kTRUE; }
-    Bool_t  IsPixelHGSaturated() const  { return fIsHGSaturated; }
-
-    void    AddNumPhotons(Float_t f)    { fPhot += f; }
-
-    void    Scale(Float_t f)            { fPhot/=f; }
-
-    void    Print(Option_t *opt = NULL) const;
-    Int_t   Compare(const TObject *obj) const;
-    Bool_t  IsSortable() const { return kTRUE; }
-
-    ClassDef(MCerPhotPix, 6)  // class containing information about the Cerenkov Photons in a pixel
-};
-
-#endif
Index: /trunk/MagicSoft/Mars/manalysis/MSupercutsCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MSupercutsCalc.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/manalysis/MSupercutsCalc.cc	(revision 6855)
@@ -24,12 +24,11 @@
 
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//   MSupercutsCalc                                                     //
-//                                                                         //
-//   this class calculates the hadronness for the supercuts                //
-//   the parameters of the supercuts are taken                             //
-//                  from the container MSupercuts                       //
-//                                                                         //
-//                                                                         //
+//
+//   MSupercutsCalc
+//
+//   this class calculates the hadronness for the supercuts
+//   the parameters of the supercuts are taken
+//                  from the container MSupercuts
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MSupercutsCalc.h"
@@ -46,5 +45,4 @@
 #include "MNewImagePar.h"
 #include "MMcEvt.hxx"
-#include "MCerPhotEvt.h"
 #include "MGeomCam.h"
 #include "MHadronness.h"
Index: /trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/Makefile	(revision 6854)
+++ /trunk/MagicSoft/Mars/manalysis/Makefile	(revision 6855)
@@ -36,9 +36,4 @@
            MCompProbCalc.cc \
            MMultiDimDistCalc.cc \
-	   MCerPhotPix.cc \
-	   MCerPhotEvt.cc \
-           MCerPhotAnal.cc \
-           MCerPhotAnal2.cc \
-	   MCerPhotCalc.cc \
            MEventRate.cc \
            MEventRateCalc.cc \
Index: /trunk/MagicSoft/Mars/mars.cc
===================================================================
--- /trunk/MagicSoft/Mars/mars.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mars.cc	(revision 6855)
@@ -6,5 +6,5 @@
 #include "MLogManip.h"
 
-#include "MMars.h"
+#include "MCameraDisplay.h"
 #include "MArgs.h"
 #include "MArray.h"
@@ -133,5 +133,5 @@
     // start the main window
     //
-    new MMars;
+    new MCameraDisplay;
 
     //
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 6855)
@@ -34,5 +34,5 @@
 //   This task takes the integrated charge from MExtractedSignal and applies
 //   the calibration constants from MCalibrationCam to convert the summed FADC 
-//   slices into photons. The number of photons obtained is stored in MCerPhotEvt. 
+//   slices into photons. The number of photons obtained is stored in MSignalCam. 
 //   Optionally, the calibration of pedestals from an MPedestalCam container into 
 //   an MPedPhotCam container can be chosen with the member functions 
@@ -89,5 +89,5 @@
 //   Output Containers:
 //    [MPedPhotCam]
-//    [MCerPhotEvt]
+//    [MSignalCam]
 //
 // See also: MJCalibration, MJPedestal, MJExtractSignal, MJExtractCalibTest
@@ -129,5 +129,5 @@
 #include "MBadPixelsPix.h"
 
-#include "MCerPhotEvt.h"
+#include "MSignalCam.h"
 
 ClassImp(MCalibrateData);
@@ -194,5 +194,5 @@
 //
 //  - MPedPhotCam
-//  - MCerPhotEvt
+//  - MSignalCam
 //
 Int_t MCalibrateData::PreProcess(MParList *pList)
@@ -218,5 +218,5 @@
         }
 
-        fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt"));
+        fCerPhotEvt = (MSignalCam*)pList->FindCreateObj(AddSerialNumber("MSignalCam"));
         if (!fCerPhotEvt)
             return kFALSE;
@@ -657,4 +657,7 @@
     const Float_t sqrtslices = TMath::Sqrt(slices);
 
+    Int_t numsatlo=0;
+    Int_t numsathi=0;
+
     for (UInt_t pixidx=0; pixidx<npix; pixidx++)
     {
@@ -699,11 +702,11 @@
             const Float_t nphotErr = TMath::Sqrt(TMath::Abs(nphot)) * fCalibFFactors[pixidx];
             
-            MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
+            fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
 
             if (sig.GetNumHiGainSaturated() > 0)
-                cpix->SetPixelHGSaturated();
+                numsathi++;
 
             if (sig.GetNumLoGainSaturated() > 0)
-              cpix->SetPixelSaturated();
+                numsatlo++;
         } /* if (data) */
       
@@ -735,5 +738,5 @@
     if (data)
     {
-        fCerPhotEvt->FixSize();
+        fCerPhotEvt->SetNumPixelsSaturated(numsathi, numsatlo);
         fCerPhotEvt->SetReadyToSave();
     }
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateData.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateData.h	(revision 6855)
@@ -2,19 +2,4 @@
 #define MARS_MCalibrateData
 
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrateData                                                          //
-//                                                                         //
-// Integrates the desired ADC time slices of one pixel and apply           //
-// calibration constants                                                   //
-//                                                                         //
-// Differences between MCalibrateData and MCalibrate :                     //
-// in MCalibrateData                                                       //
-// - in ReInit the MPedPhot container is filled using                      //
-//      - the pedstals/slice from MPedestalCam                             //
-//      - the number of used FADC slices from MExtractedSignalCam          //
-//      - the photon/ADC conversion factor from MCalibrationCam            //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
 #ifndef MARS_MTask
 #include "MTask.h"
@@ -33,6 +18,7 @@
 
 class MPedPhotCam;
-class MCerPhotEvt;
+class MSignalCam;
 class MCalibConstCam;
+
 class MCalibrateData : public MTask
 {
@@ -50,5 +36,5 @@
   MCalibrationQECam     *fQEs;           //! Quantum efficiencies
   MExtractedSignalCam   *fSignals;       //! Integrated charge in FADCs counts
-  MCerPhotEvt           *fCerPhotEvt;    //! Cerenkov Photon Event used for calculation
+  MSignalCam            *fCerPhotEvt;    //! Cerenkov Photon Event used for calculation
   MCalibConstCam        *fCalibConstCam; //! Temporary calib consts storage
   
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc	(revision 6855)
@@ -29,5 +29,5 @@
 //   This task takes the extracted arrival times from MArrivalTimeCam for each  
 //   pixel and applies the offset calibrated in MCalibrationRelTimeCam 
-//   The calibrated arrival time and its error gets stored in MCerPhotEvt. 
+//   The calibrated arrival time and its error gets stored in MSignalCam. 
 //
 //   Input Containers:
@@ -36,5 +36,5 @@
 //
 //   Output Containers:
-//    MArrivalTime
+//    MSignalCam
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -58,5 +58,6 @@
 #include "MBadPixelsPix.h"
 
-#include "MArrivalTime.h"
+#include "MSignalCam.h"
+#include "MSignalPix.h"
 
 ClassImp(MCalibrateRelTimes);
@@ -112,23 +113,11 @@
 
 
-    fArrivalTime = (MArrivalTime*)pList->FindCreateObj(AddSerialNumber("MArrivalTime"));
+    fArrivalTime = (MSignalCam*)pList->FindCreateObj(AddSerialNumber("MSignalCam"));
     if (!fArrivalTime)
-      {
-        *fLog << err << AddSerialNumber("MArrivalTime") << ": Cannot create ... aborting." << endl;
         return kFALSE;
-      }
     
     return kTRUE;
 }
 
-// --------------------------------------------------------------------------
-//
-// Check for validity of the selected calibration method, switch to a 
-// different one in case of need
-//
-Bool_t MCalibrateRelTimes::ReInit(MParList *pList)
-{
-  return kTRUE;
-}
 // --------------------------------------------------------------------------
 //
@@ -142,5 +131,5 @@
      {
      // FIXME: MArrivalTime must be of variable size -
-     //        like MCerPhotEvt - because we must be able
+     //        like MSignalCam - because we must be able
      //        to reduce size by zero supression
      //        For the moment this check could be done in ReInit...
@@ -172,5 +161,5 @@
         const Float_t time = signal - offset;
 
-        fArrivalTime->SetTime(pixidx, time);
+        (*fArrivalTime)[pixidx].SetArrivalTime(time);
 
     } /* for (UInt_t pixidx=0; pixidx<npix; pixidx++) */
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.h	(revision 6855)
@@ -18,5 +18,6 @@
 class MCalibrationRelTimeCam;
 class MArrivalTimeCam;
-class MArrivalTime;
+class MSignalCam;
+
 class MCalibrateRelTimes : public MTask
 {
@@ -26,8 +27,7 @@
     MBadPixelsCam          *fBadPixels;    // Bad Pixels information
     MArrivalTimeCam        *fSignals;      // Extracted Arrival Time
-    MArrivalTime           *fArrivalTime;  // Calibrated arrival times
+    MSignalCam             *fArrivalTime;  // Calibrated arrival times
 
     Int_t PreProcess(MParList *pList);
-    Bool_t ReInit(MParList *pList);
     Int_t Process();
 
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 6855)
@@ -489,18 +489,12 @@
       fBlindCam = (MCalibrationBlindCam*)pList->FindObject(AddSerialNumber("MCalibrationBlindCam"));
       if (!fBlindCam)
-        {
-          *fLog << endl;
-          *fLog << warn << GetDescriptor() 
-                << ": No MCalibrationBlindCam found... no Blind Pixel method! " << endl;
-        }
+        *fLog << warn << GetDescriptor() 
+              << ": No MCalibrationBlindCam found... no Blind Pixel method! " << endl;
     }
   
   fHBlindCam = (MHCalibrationChargeBlindCam*)pList->FindObject(AddSerialNumber("MHCalibrationChargeBlindCam"));  
   if (!fHBlindCam)
-    {
-      *fLog << endl;
-      *fLog << warn << GetDescriptor() 
-            << ": No MHCalibrationChargeBlindCam found... no Blind Pixel method! " << endl;
-    }
+    *fLog << warn << GetDescriptor() 
+          << ": No MHCalibrationChargeBlindCam found... no Blind Pixel method! " << endl;
 
   fIntensBad = (MBadPixelsIntensityCam*)pList->FindObject(AddSerialNumber("MBadPixelsIntensityCam"));
@@ -522,9 +516,6 @@
   fPINDiode = (MCalibrationChargePINDiode*)pList->FindObject("MCalibrationChargePINDiode");
   if (!fPINDiode)
-    {
-      *fLog << endl;
-      *fLog << warn << GetDescriptor() 
-            << ": MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
-    }
+    *fLog << warn << GetDescriptor() 
+          << ": No MCalibrationChargePINDiode found... no PIN Diode method! " << endl;
   
   MCalibrationQECam     *qecam     = fIntensQE      
@@ -1865,4 +1856,7 @@
     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
 
+  if (!blindcam)
+    return;
+
   //
   // Set the results in the MCalibrationChargeCam
@@ -1956,4 +1950,8 @@
   MBadPixelsCam         *badcam    = fIntensBad 
     ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
+
+  if (!fPINDiode)
+    return;
+
   //
   //  With the knowledge of the overall photon flux, calculate the 
Index: /trunk/MagicSoft/Mars/mhft/MGeomCamMagicEnhance.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhft/MGeomCamMagicEnhance.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhft/MGeomCamMagicEnhance.cc	(revision 6855)
@@ -163,10 +163,10 @@
 
     // Copy result into output MCerPhotEvt
-    fEvtOut->Reset();
+    fEvtOut->InitSize(res.GetSize());
 
     for (UInt_t i=0; i<res.GetSize(); i++)
         fEvtOut->AddPixel(i, res[i], 0);
 
-    fEvtOut->FixSize();
+    //fEvtOut->FixSize();
     fEvtOut->SetReadyToSave();
 
Index: /trunk/MagicSoft/Mars/mhft/MHexagonalFTCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhft/MHexagonalFTCalc.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhft/MHexagonalFTCalc.cc	(revision 6855)
@@ -172,7 +172,7 @@
     fOffset.Reset();
 
-    fMap.Set(lim);
-    for (int i=0; i<lim; i++)
-        fMap[i]=-1;
+    //fMap.Set(lim);
+    //for (int i=0; i<lim; i++)
+    //    fMap[i]=-1;
 
     const Double_t dx = (*geom)[2].GetX(); // -(*geom)[0].GetX()
@@ -190,5 +190,5 @@
         if ((*geom)[idx].GetAidx()==0)
         {
-            fMap[idx]  = i;
+            //fMap[idx]  = i;
             fOffset[i] = 1;
         }
@@ -254,14 +254,14 @@
     MArrayD re(lim);
 
-    MCerPhotPix *pix=0;
-
-    MCerPhotEvtIter Next(fEvtIn, kFALSE);
-
+    //    MCerPhotPix *pix=0;
+    //    MCerPhotEvtIter Next(fEvtIn, kFALSE);
+    //    while ((pix = (MCerPhotPix*)Next()))
     // Copy data from MCerPhotEvt into array
-    while ((pix = (MCerPhotPix*)Next()))
-    {
-        const Int_t idx = pix->GetPixId();
-        if (fMap[idx]>=0)
-            re[fMap[idx]] = pix->GetNumPhotons();
+    const UInt_t npix = fEvtIn->GetNumPixels();
+    for (UInt_t idx=0; idx<npix; idx++)
+    {
+        //const Int_t idx = pix->GetPixId();
+        //if (fMap[idx]>=0)
+        re[idx] = (*fEvtIn)[idx].GetNumPhotons();
     }
 
@@ -307,12 +307,12 @@
         return kTRUE;
 
-    fEvtOut->Reset();
+    fEvtOut->InitSize(lim); // necessary?
     for (int i=0; i<lim; i++)
     {
-        const Int_t map = fMap[i];
-        if (map>=0)
-            fEvtOut->AddPixel(i, out[map]);
-    }
-    fEvtOut->FixSize();
+        //const Int_t map = fMap[i];
+        //if (map>=0)
+        fEvtOut->AddPixel(i, out[i]);
+    }
+    //fEvtOut->FixSize();
     fEvtOut->SetReadyToSave();
 
Index: /trunk/MagicSoft/Mars/mhist/HistLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 6855)
@@ -18,5 +18,5 @@
 #pragma link C++ class MHAlphaEnergyTheta+;
 #pragma link C++ class MHGamma+;
-#pragma link C++ class MHSigmaTheta;
+//#pragma link C++ class MHSigmaTheta;
 #pragma link C++ class MHThetabarTime+;
 #pragma link C++ class MHThetabarTheta+;
Index: /trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 6855)
@@ -33,9 +33,4 @@
 // =====
 //
-// To plot sqrt(variance) instead of the rms use:
-//    MHCamEvent::SetBit(MHCamera::kSqrtVariance);
-//  or
-//    MHCamEvent::EnableSqrtVariance()
-//
 // To count how often a certain pixel is above or below a threshold do:
 //    MHCamEvent::SetThreshold(5.5);  // Default=LowerBound
@@ -121,13 +116,4 @@
     if (fSum)
         delete fSum;
-}
-
-// --------------------------------------------------------------------------
-//
-// use this to display the variance instead of the rms.
-//
-void MHCamEvent::EnableSqrtVariance(Bool_t b)
-{
-    b ? SetBit(MHCamera::kSqrtVariance) : ResetBit(MHCamera::kSqrtVariance);
 }
 
@@ -173,6 +159,4 @@
         fSum->SetYTitle("a.u.");
     fSum->SetBit(MHCamera::kProfile);
-    if (TestBit(MHCamera::kSqrtVariance))
-        fSum->SetBit(MHCamera::kSqrtVariance);
 
     fSum->SetXTitle("Pixel Idx");
@@ -261,28 +245,22 @@
 {
     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    const Int_t col = pad->GetFillColor();
     pad->SetBorderMode(0);
 
     AppendPad();
 
-    TString name = Form("%s_5", pad->GetName());
-    TPad *p = new TPad(name,name,6./8,0.25,0.99,0.5,pad->GetFillColor(),0,0);
-    p->SetNumber(5);
-    p->Draw();
-
-    name = Form("%s_6", pad->GetName());
-    p = new TPad(name,name,6./8,0.01,0.99,0.25,pad->GetFillColor(),0,0);
-    p->SetNumber(6);
-    p->Draw();
-
-    pad->Divide(2,2);
-
-    pad->cd(1);
-    gPad->SetBorderMode(0);
-    gPad->SetPad(0.01, 0.5, 0.66, 0.99);
+    TString name = Form("%s_1", pad->GetName());
+    TPad *p = new TPad(name,name,0.005, 0.5, 0.66, 0.995,col,0,0);
+    p->SetNumber(1);
+    p->Draw();
+    p->cd();
     fSum->Draw("EPhist");
 
-    pad->cd(2);
-    gPad->SetBorderMode(0);
-    gPad->SetPad(0.66, 0.5, 0.99, 0.99);
+    pad->cd();
+    name = Form("%s_2", pad->GetName());
+    p = new TPad(name,name,0.66, 0.5, 0.995, 0.995,col,0,0);
+    p->SetNumber(2);
+    p->Draw();
+    p->cd();
     TH1 *h = fSum->Projection(Form("%s;proj", fName.Data()), 50);
     h->SetTitle("Projection");
@@ -290,16 +268,22 @@
     h->Draw();
 
-    pad->cd(3);
-    gPad->SetPad(0.01, 0.01, 3./8, 0.5);
-    gPad->SetBorderMode(0);
+    pad->cd();
+    name = Form("%s_3", pad->GetName());
+    p = new TPad(name,name,0.005, 0.005, 3./8, 0.5,col,0,0);
+    p->SetNumber(3);
+    p->Draw();
+    p->cd();
     fSum->Draw();
 
-    pad->cd(4);
-    gPad->SetPad(3./8, 0.01, 6./8, 0.5);
-    gPad->SetBorderMode(0);
+    pad->cd();
+    name = Form("%s_4", pad->GetName());
+    p = new TPad(name,name,3./8, 0.005, 6./8-0.005, 0.5,col,0,0);
+    p->SetNumber(4);
+    p->Draw();
+    p->cd();
 
     MHCamera *cam = new MHCamera(*fSum->GetGeometry());
     cam->SetName(Form("%s;err", fName.Data()));
-    cam->SetTitle(fSum->TestBit(MHCamera::kSqrtVariance)?"Sqrt(Variance)":"Root Mean Squared (rms)");
+    cam->SetTitle("Sqrt(Variance)");
     cam->SetYTitle(fSum->GetYaxis()->GetTitle());
     cam->SetCamContent(*fSum, 1);
@@ -307,5 +291,10 @@
     cam->Draw();
 
-    pad->cd(5);
+    pad->cd();
+    name = Form("%s_5", pad->GetName());
+    p = new TPad(name,name,6./8,0.25,0.995,0.5,col,0,0);
+    p->SetNumber(5);
+    p->Draw();
+    p->cd();
     h = (TH1*)fSum->RadialProfile(Form("%s;rad", fName.Data()), 20);
     h->SetTitle("Radial Profile");
@@ -313,5 +302,10 @@
     h->Draw();
 
-    pad->cd(6);
+    pad->cd();
+    name = Form("%s_6", pad->GetName());
+    p = new TPad(name,name,6./8,0.005,0.995,0.25,col,0,0);
+    p->SetNumber(6);
+    p->Draw();
+    p->cd();
     h = (TH1*)fSum->AzimuthProfile(Form("%s;az", fName.Data()), 30);
     h->SetTitle("Azimuth Profile");
Index: /trunk/MagicSoft/Mars/mhist/MHCamEvent.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 6855)
@@ -15,4 +15,5 @@
     static const TString gsDefTitle;
 
+protected:
     MHCamera  *fSum;       // storing the sum
     MCamEvent *fEvt;       //! the current event
@@ -50,5 +51,4 @@
 
     void SetThreshold(Float_t f, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; }
-    void EnableSqrtVariance(Bool_t b=kTRUE);
 
     ClassDef(MHCamEvent, 1) // Histogram to sum camera events
Index: /trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 6855)
@@ -164,5 +164,8 @@
     fUsed.Set(geom.GetNumPixels());
     for (Int_t i=0; i<fNcells-2; i++)
-      ResetUsed(i);
+        ResetUsed(i);
+
+    fBinEntries.Set(geom.GetNumPixels()+2);
+    fBinEntries.Reset();
 }
 
@@ -213,4 +216,5 @@
    const Int_t bin = (Int_t)x+1;
    AddBinContent(bin);
+   fBinEntries[bin]++;
    if (fSumw2.fN)
        fSumw2.fArray[bin]++;
@@ -249,4 +253,5 @@
    const Int_t bin = (Int_t)x+1;
    AddBinContent(bin, w);
+   fBinEntries[bin]++;
    if (fSumw2.fN)
        fSumw2.fArray[bin] += w*w;
@@ -319,10 +324,13 @@
         if ((all || IsUsed(i)) && MatchSector(i, sector, aidx))
         {
-            mean += fArray[i+1];
+            if (TestBit(kProfile) && fBinEntries[i+1]==0)
+                continue;
+
+            mean += TestBit(kProfile) ? fArray[i+1]/fBinEntries[i+1] : fArray[i+1];
             n++;
         }
     }
 
-    return n==0 ? 0 : Profile(mean/n);
+    return n==0 ? 0 : mean/n;
 }
 
@@ -346,6 +354,11 @@
         if ((all || IsUsed(i)) && MatchSector(i, sector, aidx))
         {
-            sum += fArray[i+1];
-            sq  += fArray[i+1]*fArray[i+1];
+            if (TestBit(kProfile) && fBinEntries[i+1]==0)
+                continue;
+
+            const Double_t val = TestBit(kProfile) ? fArray[i+1]/fBinEntries[i+1] : fArray[i+1];
+
+            sum += val;
+            sq  += val*val;
             n++;
         }
@@ -358,5 +371,5 @@
     sq  /= n;
 
-    return Profile(TMath::Sqrt(sq-sum*sum));
+    return TMath::Sqrt(sq-sum*sum);
 }
 
@@ -377,9 +390,15 @@
     Double_t minimum=FLT_MAX;
 
-    for (Int_t idx=0; idx<fNcells-2; idx++)
-        if (MatchSector(idx, sector, aidx) && (all || IsUsed(idx)) && fArray[idx+1]<minimum)
-            minimum = fArray[idx+1];
-
-    return Profile(minimum);
+    for (Int_t i=0; i<fNcells-2; i++)
+    {
+        if (TestBit(kProfile) && fBinEntries[i+1]==0)
+            continue;
+
+        const Double_t val = TestBit(kProfile) ? fArray[i+1]/fBinEntries[i+1] : fArray[i+1];
+        if (MatchSector(i, sector, aidx) && (all || IsUsed(i)) && val<minimum)
+            minimum = val;
+    }
+
+    return minimum;
 }
 
@@ -399,9 +418,15 @@
 
     Double_t maximum=-FLT_MAX;
-    for (Int_t idx=0; idx<fNcells-2; idx++)
-        if (MatchSector(idx, sector, aidx) && (all || IsUsed(idx)) && fArray[idx+1]>maximum)
-            maximum = fArray[idx+1];
-
-    return Profile(maximum);
+    for (Int_t i=0; i<fNcells-2; i++)
+    {
+        if (TestBit(kProfile) && fBinEntries[i+1]==0)
+            continue;
+
+        const Double_t val = TestBit(kProfile) ? fArray[i+1]/fBinEntries[i+1] : fArray[i+1];
+        if (MatchSector(i, sector, aidx) && (all || IsUsed(i)) && val>maximum)
+            maximum = val;
+    }
+
+    return maximum;
 }
 
@@ -458,5 +483,6 @@
         // resized in paint to keep the correct aspect ratio
         //
-        pad->Divide(1, 1, 0, 0, col);
+        // The margin != 0 is a workaround for a problem in root 4.02/00
+        pad->Divide(1, 1, 1e-10, 1e-10, col);
         pad->cd(1);
         gPad->SetBorderMode(0);
@@ -1125,7 +1151,8 @@
         Double_t val=0;
         if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/)
+        {
             SetUsed(idx);
-
-        Fill(idx, val); // FIXME: Slow!
+            Fill(idx, val); // FIXME: Slow!
+        }
     }
     fEntries++;
@@ -1153,6 +1180,34 @@
 }
 
+Stat_t MHCamera::GetBinContent(Int_t bin) const
+{
+    if (fBuffer) ((TProfile*)this)->BufferEmpty();
+    if (bin < 0) bin = 0;
+    if (bin >= fNcells) bin = fNcells-1;
+    if (!fArray) return 0;
+
+    if (!TestBit(kProfile))
+        return Stat_t (fArray[bin]);
+
+    if (fBinEntries.fArray[bin] == 0) return 0;
+    return fArray[bin]/fBinEntries.fArray[bin];
+}
+
 Stat_t MHCamera::GetBinError(Int_t bin) const
 {
+    if (!TestBit(kProfile))
+        return TH1D::GetBinError(bin);
+
+    const UInt_t n = (UInt_t)fBinEntries[bin];
+
+    if (n==0)
+        return 0;
+
+    const Double_t sqr = fSumw2.fArray[bin] / n;
+    const Double_t val = fArray[bin]        / n;
+
+    return sqr>val*val ? TMath::Sqrt(sqr - val*val) / n : 0;
+
+    /*
     Double_t rc = 0;
     if (TestBit(kSqrtVariance) && GetEntries()>0) // error on the mean
@@ -1165,5 +1220,5 @@
         rc = TH1D::GetBinError(bin);
 
-    return Profile(rc);
+    return Profile(rc);*/
 }
 
@@ -1266,12 +1321,49 @@
     {
         Double_t val=threshold;
-        if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/)
+        const Bool_t rc = event.GetPixelContent(val, idx, *fGeomCam, type);
+        if (rc)
+            SetUsed(idx);
+
+        const Bool_t cond =
+            ( isabove && val>threshold) ||
+            (!isabove && val<threshold);
+
+        Fill(idx, rc && cond ? 1 : 0);
+    }
+    fEntries++;
+}
+
+// ------------------------------------------------------------------------
+//
+// Call this function to add a MCamEvent on top of the present contents.
+// - the contents of the pixels in event are added to each pixel
+//   if the pixel of thresevt<threshold (in case isabove is set
+//   to kTRUE == default)
+// - the contents of the pixels in event are  added to each pixel
+//   if the pixel of thresevt<threshold (in case isabove is set
+//   to kFALSE)
+//
+// in unused pixel is not counted if it didn't fullfill the condition.
+//
+void MHCamera::CntCamContent(const MCamEvent &event, Int_t type1, const MCamEvent &thresevt, Int_t type2, Double_t threshold, Bool_t isabove)
+{
+    if (fNcells<=1 || IsFreezed())
+        return;
+
+    // FIXME: Security check missing!
+    for (Int_t idx=0; idx<fNcells-2; idx++)
+    {
+        Double_t th=0;
+        if (!thresevt.GetPixelContent(th, idx, *fGeomCam, type2))
+            continue;
+
+        if ((isabove && th>threshold) || (!isabove && th<threshold))
+            continue;
+
+        Double_t val=th;
+        if (event.GetPixelContent(val, idx, *fGeomCam, type1))
         {
             SetUsed(idx);
-
-            if (isabove && val>threshold)
-                Fill(idx);
-            if (!isabove && val<threshold)
-                Fill(idx);
+            Fill(idx, val);
         }
     }
@@ -1672,5 +1764,5 @@
         return;
 
-    gLog << all << GetTitle() << " <" << GetName() << ">" << endl;
+    gLog << all << GetTitle() << " <" << GetName() << ">" << dec << endl;
     gLog << "Software Pixel Idx: " << idx << endl;
     gLog << "Hardware Pixel Id:  " << idx+1 << endl;
@@ -1678,5 +1770,5 @@
     if (GetBinError(idx+1)>0)
         gLog << " +/- " << GetBinError(idx+1);
-    gLog << "  <" << (IsUsed(idx)?"on":"off") << ">" << endl;
+    gLog << "  <" << (IsUsed(idx)?"on":"off") << ">  n=" << fBinEntries[idx+1] << endl;
 
     if (fNotify && fNotify->GetSize()>0)
Index: /trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 6855)
@@ -10,7 +10,4 @@
 #ifndef ROOT_TArrayI
 #include <TArrayI.h>
-#endif
-#ifndef ROOT_TArrayD
-#include <TArrayD.h>
 #endif
 #ifndef ROOT_MArrayD
@@ -40,12 +37,14 @@
 public:
     enum {
-        kProfile      = BIT(18), // FIXME: When changing change max/min!
-        kFreezed      = BIT(19),
-        kNoLegend     = BIT(20),
-        kSqrtVariance = BIT(21)
+        kProfile            = BIT(18), // FIXME: When changing change max/min!
+        kFreezed            = BIT(19),
+        kNoLegend           = BIT(20)/*,
+        kSqrtVariance       = BIT(21),
+        kSinglePixelProfile = BIT(22)*/
     };
 private:
     MGeomCam      *fGeomCam;     // pointer to camera geometry (y-axis)
     TArrayC        fUsed;        // array containing flags
+    TArrayI        fBinEntries;  // number of entries per bin
 
     TArrayI        fColors;      //! Color conversion table
@@ -59,5 +58,5 @@
 
     void Init();
-
+/*
     Stat_t Profile(Stat_t val) const
     {
@@ -68,5 +67,5 @@
         return n>0 ? val/n : val;
     }
-
+  */
     Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog);
 
@@ -162,6 +161,7 @@
     virtual void     CntCamContent(const MCamEvent &evt, TArrayD threshold, Int_t type=0, Bool_t isabove=kTRUE);
     virtual void     CntCamContent(const TArrayD &evt, Double_t threshold, Bool_t ispos=kTRUE);
-
-    Stat_t   GetBinContent(Int_t bin) const { return Profile(TH1D::GetBinContent(bin)); }
+    virtual void     CntCamContent(const MCamEvent &event, Int_t type1, const MCamEvent &thresevt, Int_t type2, Double_t threshold, Bool_t isabove);
+
+    Stat_t   GetBinContent(Int_t bin) const;
     Stat_t   GetBinContent(Int_t binx, Int_t biny) const { return GetBinContent(binx); }
     Stat_t   GetBinContent(Int_t binx, Int_t biny, Int_t binz) const { return GetBinContent(binx); }
Index: /trunk/MagicSoft/Mars/mhist/MHEvent.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 6855)
@@ -59,5 +59,5 @@
 #include "MTaskList.h"
 #include "MParList.h"
-#include "MCerPhotEvt.h"
+#include "MSignalCam.h"
 #include "MRawEvtHeader.h"
 #include "MRawRunHeader.h"
@@ -239,5 +239,5 @@
         break;
     case kEvtArrTime:
-        fHist->SetCamContent(*event, 0);
+        fHist->SetCamContent(*event, 6);
         break; 
     case kEvtTrigPix:
Index: /trunk/MagicSoft/Mars/mhist/MHEvent.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHEvent.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/MHEvent.h	(revision 6855)
@@ -13,5 +13,5 @@
 class MMcEvt;
 class MMcTrig;
-class MCerPhotEvt;
+class MSignalCam;
 class MImgCleanStd;
 
@@ -34,5 +34,5 @@
     MMcEvt        *fMcEvt;         //!
     MMcTrig       *fMcTrig;        //!
-    MCerPhotEvt   *fCerPhotEvt;    //!
+    MSignalCam    *fCerPhotEvt;    //!
     MImgCleanStd  *fImgCleanStd;   //!
 
Index: /trunk/MagicSoft/Mars/mhist/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mhist/Makefile	(revision 6854)
+++ /trunk/MagicSoft/Mars/mhist/Makefile	(revision 6855)
@@ -40,5 +40,4 @@
            MHThetabarTheta.cc \
            MHGamma.cc \
-           MHSigmaTheta.cc \
 	   MHSigmaPixel.cc \
 	   MHSigmabarTheta.cc \
Index: /trunk/MagicSoft/Mars/mimage/ImageLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/ImageLinkDef.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/ImageLinkDef.h	(revision 6855)
@@ -10,5 +10,4 @@
 #pragma link C++ class MHillas+;
 #pragma link C++ class MHillasSrc+;
-#pragma link C++ class MHillasSrcCalc+;
 #pragma link C++ class MHillasExt+;
 #pragma link C++ class MHillasCalc+;
Index: /trunk/MagicSoft/Mars/mimage/MCameraSmooth.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MCameraSmooth.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MCameraSmooth.cc	(revision 6855)
@@ -41,6 +41,6 @@
 #include "MGeomPix.h"
 #include "MGeomCam.h"
-#include "MCerPhotPix.h"
-#include "MCerPhotEvt.h"
+#include "MSignalPix.h"
+#include "MSignalCam.h"
 
 ClassImp(MCameraSmooth);
@@ -62,13 +62,13 @@
 // --------------------------------------------------------------------------
 //
-//  - get the MCerPhotEvt from the parlist (abort if missing)
+//  - get the MSignalCam from the parlist (abort if missing)
 //  - get MGeomCam from the parameter list
 //
 Int_t MCameraSmooth::PreProcess (MParList *pList)
 {
-    fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
+    fEvt = (MSignalCam*)pList->FindObject("MSignalCam");
     if (!fEvt)
     {
-        *fLog << err << dbginf << "MCerPhotEvt not found... aborting." << endl;
+        *fLog << err << dbginf << "MSignalCam not found... aborting." << endl;
         return kFALSE;
     }
@@ -104,9 +104,9 @@
         for (UShort_t i=0; i<entries; i++)
         {
-            MCerPhotPix &pix = (*fEvt)[i];
+            MSignalPix &pix = (*fEvt)[i];
 
-            const Int_t id = pix.GetPixId();
+            //const Int_t id = pix.GetPixId();
 
-            const MGeomPix &gpix = (*fGeomCam)[id];
+            const MGeomPix &gpix = (*fGeomCam)[i];
 
             const Int_t n = gpix.GetNumNeighbors();
@@ -120,5 +120,5 @@
                 const UShort_t nid = gpix.GetNeighbor(j);
 
-                const MCerPhotPix *evtpix = fEvt->GetPixById(nid);
+                const MSignalPix *evtpix = fEvt->GetPixById(nid);
                 if (evtpix)
                 {
Index: /trunk/MagicSoft/Mars/mimage/MCameraSmooth.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MCameraSmooth.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MCameraSmooth.h	(revision 6855)
@@ -11,11 +11,11 @@
 
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 
 class MCameraSmooth : public MTask
 {
 private:
-    MCerPhotEvt *fEvt;     //! Pointer to data to smooth
-    MGeomCam    *fGeomCam; //! Camera geometry
+    MSignalCam *fEvt;     //! Pointer to data to smooth
+    MGeomCam   *fGeomCam; //! Camera geometry
 
     Byte_t fCounts;           // number of smoothing loops
Index: /trunk/MagicSoft/Mars/mimage/MConcentration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MConcentration.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MConcentration.cc	(revision 6855)
@@ -50,6 +50,6 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotPix.h"
-#include "MCerPhotEvt.h"
+#include "MSignalPix.h"
+#include "MSignalCam.h"
 
 #include "MLog.h"
@@ -106,14 +106,16 @@
 //    Nothing.
 //
-Int_t MConcentration::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hillas)
+Int_t MConcentration::Calc(const MGeomCam &geom, const MSignalCam &evt, const MHillas &hillas)
 {
     Float_t maxpix[9] = {0,0,0,0,0,0,0,0,0};             // [#phot]
 
-    TIter Next(evt);
-    MCerPhotPix *pix = 0;
-    while ((pix=(MCerPhotPix*)Next()))
-    {
-        const Int_t    pixid = pix->GetPixId();
-        const Double_t nphot = pix->GetNumPhotons()* geom.GetPixRatio(pixid);
+   const UInt_t npix = evt.GetNumPixels();
+   for (UInt_t i=0; i<npix; i++)
+   {
+       const MSignalPix &pix = evt[i];
+       if (!pix.IsPixelUsed())
+           continue;
+
+        const Double_t nphot = pix.GetNumPhotons()* geom.GetPixRatio(i);
 
 	// Get number of photons in the 8 most populated pixels	
Index: /trunk/MagicSoft/Mars/mimage/MConcentration.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MConcentration.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MConcentration.h	(revision 6855)
@@ -8,5 +8,5 @@
 class MHillas;
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 
 class MConcentration : public MParContainer
@@ -20,5 +20,5 @@
     void Reset();
 
-    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, const MHillas &hil);
+    Int_t Calc(const MGeomCam &geom, const MSignalCam &pix, const MHillas &hil);
 
     void Print(Option_t *opt=NULL) const;
Index: /trunk/MagicSoft/Mars/mimage/MHillas.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MHillas.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MHillas.cc	(revision 6855)
@@ -69,6 +69,6 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotPix.h"
-#include "MCerPhotEvt.h"
+#include "MSignalPix.h"
+#include "MSignalCam.h"
 
 #include "MLog.h"
@@ -203,15 +203,17 @@
 // Returns:
 //   0  no error
-//   1  number of pixels < 3
+//   1  number of pixels in event == 0 (special MC events)
 //   2  size==0
 //   3  number of used pixel < 3
 //   4  CorrXY == 0
 //
-Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, Int_t island)
-{
-    //
-    // sanity check 1
-    //
-    if (evt.GetNumPixels()<3)
+Int_t MHillas::Calc(const MGeomCam &geom, const MSignalCam &evt, Int_t island)
+{
+    const UInt_t numpix  = evt.GetNumPixels();
+
+    //
+    // sanity check 1 (special MC events)
+    //
+    if (numpix==0)
         return 1;
 
@@ -229,16 +231,22 @@
     fSize  = 0;
 
-    MCerPhotPix *pix = 0;
+    UInt_t numused = 0;
+/*
+    MSignalPix *pix = 0;
 
     TIter Next(evt);
-    UInt_t numused = 0;
-    while ((pix=(MCerPhotPix*)Next()))
+    while ((pix=(MSignalPix*)Next()))*/
+    for (UInt_t i=0; i<numpix; i++)
     {
-        if (island>=0 && pix->GetIdxIsland()!=island)
+        MSignalPix &pix = evt[i];
+        if (!pix.IsPixelUsed())
             continue;
 
-        const MGeomPix &gpix = geom[pix->GetPixId()];
-
-        const Float_t nphot = pix->GetNumPhotons();
+        if (island>=0 && pix.GetIdxIsland()!=island)
+            continue;
+
+        const MGeomPix &gpix = geom[i/*pix->GetPixId()*/];
+
+        const Float_t nphot = pix.GetNumPhotons();
 
         fSize  += nphot;		             // [counter]
@@ -277,16 +285,22 @@
     Double_t corryy=0;                               // [m^2]
 
-    Next.Reset();
-    while ((pix=(MCerPhotPix*)Next()))
+    //Next.Reset();
+    //while ((pix=(MSignalPix*)Next()))
+    //{
+    for (UInt_t i=0; i<numpix; i++)
     {
-        if (island>=0 && pix->GetIdxIsland()!=island)
+        MSignalPix &pix = evt[i];
+        if (!pix.IsPixelUsed())
             continue;
 
-        const MGeomPix &gpix = geom[pix->GetPixId()];
+        if (island>=0 && pix.GetIdxIsland()!=island)
+            continue;
+
+        const MGeomPix &gpix = geom[i/*pix->GetPixId()*/];
 
         const Float_t dx = gpix.GetX() - fMeanX;     // [mm]
         const Float_t dy = gpix.GetY() - fMeanY;     // [mm]
 
-        const Float_t nphot = pix->GetNumPhotons();  // [#phot]
+        const Float_t nphot = pix.GetNumPhotons();   // [#phot]
 
         corrxx += nphot * dx*dx;                     // [mm^2]
Index: /trunk/MagicSoft/Mars/mimage/MHillas.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MHillas.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MHillas.h	(revision 6855)
@@ -10,5 +10,5 @@
 
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 
 class MHillas : public MParContainer
@@ -31,5 +31,5 @@
     void Reset();
 
-    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, Int_t island=-1);
+    Int_t Calc(const MGeomCam &geom, const MSignalCam &pix, Int_t island=-1);
 
     void Print(const MGeomCam &geom) const;
Index: /trunk/MagicSoft/Mars/mimage/MHillasCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MHillasCalc.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MHillasCalc.cc	(revision 6855)
@@ -117,5 +117,5 @@
 //
 //    1) MGeomCam          5) MHillas         8) MImagePar
-//    2) MCerPhotEvt       6) MHillasSrc      9) MNewImagePar
+//    2) MSignalCam       6) MHillasSrc      9) MNewImagePar
 //    3) MSrcPosCam        7) MHillasExt     10) MConcentration
 //    4) fIdxIslands
@@ -138,5 +138,5 @@
 #include "MParList.h"
 
-#include "MCerPhotEvt.h"
+#include "MSignalCam.h"
 
 #include "MHillas.h"
@@ -189,8 +189,8 @@
     if (TestFlags(~kCalcHillasSrc))
     {
-        fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
+        fCerPhotEvt = (MSignalCam*)pList->FindObject(AddSerialNumber("MSignalCam"));
         if (!fCerPhotEvt)
         {
-            *fLog << err << "MCerPhotEvt not found... aborting." << endl;
+            *fLog << err << "MSignalCam not found... aborting." << endl;
             return kFALSE;
         }
@@ -355,5 +355,5 @@
     if (TestFlag(kCalcHillas))
     {
-        PrintSkipped(fErrors[1], "Less than 3 pixels (before cleaning)");
+        PrintSkipped(fErrors[1], "0-Pixel Event (before cleaning, MC event?)");
         PrintSkipped(fErrors[2], "Calculated Size == 0 (after cleaning)");
         PrintSkipped(fErrors[3], "Number of used pixels < 3");
@@ -379,15 +379,15 @@
     *fLog << inf << GetDescriptor() << " calculating:" << endl;
     if (TestFlag(kCalcHillas))
-        *fLog << " - " << fNameHillas << " from MGeomCam, MCerPhotEvt and fIdxIsland=" << fIdxIsland << endl;
+        *fLog << " - " << fNameHillas << " from MGeomCam, MSignalCam and fIdxIsland=" << fIdxIsland << endl;
     if (TestFlag(kCalcHillasSrc))
         *fLog << " - " << fNameHillasSrc << " from " << fNameSrcPosCam << ", " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     if (TestFlag(kCalcHillasExt))
-        *fLog << " - " << fNameHillasExt << " from MGeomCam, MCerPhotEvt, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
+        *fLog << " - " << fNameHillasExt << " from MGeomCam, MSignalCam, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     if (TestFlag(kCalcImagePar))
-        *fLog << " - " << fNameImagePar << " from MCerPhotEvt" << endl;
+        *fLog << " - " << fNameImagePar << " from MSignalCam" << endl;
     if (TestFlag(kCalcNewImagePar))
-        *fLog << " - " << fNameNewImagePar << " from MGeomCam, MCerPhotEvt, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
+        *fLog << " - " << fNameNewImagePar << " from MGeomCam, MSignalCam, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     if (TestFlag(kCalcConc))
-        *fLog << " - " << fNameConc << " from MGeomCam, MCerPhotEvt and " << fNameHillas << endl;
+        *fLog << " - " << fNameConc << " from MGeomCam, MSignalCam and " << fNameHillas << endl;
 }
 
Index: /trunk/MagicSoft/Mars/mimage/MHillasCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MHillasCalc.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MHillasCalc.h	(revision 6855)
@@ -18,5 +18,5 @@
 
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 class MHillas;
 class MHillasExt;
@@ -41,5 +41,5 @@
 
     const MGeomCam      *fGeomCam;          //! Camera Geometry used to calculate Hillas
-    const MCerPhotEvt   *fCerPhotEvt;       //! Cerenkov Photon Event used for calculation
+    const MSignalCam    *fCerPhotEvt;       //! Cerenkov Photon Event used for calculation
 
     MHillas             *fHillas;           //! output container to store result
Index: /trunk/MagicSoft/Mars/mimage/MHillasExt.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MHillasExt.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MHillasExt.cc	(revision 6855)
@@ -68,6 +68,6 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotPix.h"
-#include "MCerPhotEvt.h"
+#include "MSignalPix.h"
+#include "MSignalCam.h"
 
 #include "MLog.h"
@@ -137,5 +137,5 @@
 // and the cerenkov photon event
 //
-Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil, Int_t island)
+Int_t MHillasExt::Calc(const MGeomCam &geom, const MSignalCam &evt, const MHillas &hil, Int_t island)
 {
     //
@@ -155,19 +155,25 @@
     Float_t maxdist = 0;
 
-    MCerPhotPix *pix = 0;
-
-    TIter Next(evt);
-    while ((pix=(MCerPhotPix*)Next()))
+    //    MSignalPix *pix = 0;
+    //    TIter Next(evt);
+    //    while ((pix=(MSignalPix*)Next()))
+
+    const UInt_t npix = evt.GetNumPixels();
+    for (UInt_t i=0; i<npix; i++)
     {
-        if (island>=0 && pix->GetIdxIsland()!=island)
+        const MSignalPix &pix = evt[i];
+        if (!pix.IsPixelUsed())
             continue;
 
-        const Int_t pixid = pix->GetPixId();
-
-        const MGeomPix &gpix = geom[pixid];
+        if (island>=0 && pix.GetIdxIsland()!=island)
+            continue;
+
+        //const Int_t pixid = pix->GetPixId();
+
+        const MGeomPix &gpix = geom[i/*pixid*/];
         const Double_t dx = gpix.GetX() - hil.GetMeanX();      // [mm]
         const Double_t dy = gpix.GetY() - hil.GetMeanY();      // [mm]
 
-        Double_t nphot = pix->GetNumPhotons();                  // [1]
+        Double_t nphot = pix.GetNumPhotons();                  // [1]
 
         const Double_t dzx =  hil.GetCosDelta()*dx + hil.GetSinDelta()*dy; // [mm]
@@ -185,10 +191,10 @@
         // must take pixel size into account
         //
-        nphot *= geom.GetPixRatio(pixid);
+        nphot *= geom.GetPixRatio(i/*pixid*/);
 
         if (nphot>maxpix)
         {
             maxpix   = nphot;                                  // [1]
-            maxpixid = pixid;
+            maxpixid = i;//pixid;
             continue;                                          // [1]
         }
Index: /trunk/MagicSoft/Mars/mimage/MHillasExt.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MHillasExt.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MHillasExt.h	(revision 6855)
@@ -10,5 +10,5 @@
 class MHillas;
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 
 class MHillasExt : public MParContainer
@@ -33,5 +33,5 @@
     Float_t GetMaxDist() const { return fMaxDist; }
 
-    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix,
+    Int_t Calc(const MGeomCam &geom, const MSignalCam &pix,
                const MHillas &hil, Int_t island=-1);
 
Index: /trunk/MagicSoft/Mars/mimage/MImagePar.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MImagePar.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MImagePar.cc	(revision 6855)
@@ -48,6 +48,5 @@
 #include "MLogManip.h"
 
-#include "MCerPhotEvt.h"
-#include "MCerPhotPix.h"
+#include "MSignalCam.h"
 
 ClassImp(MImagePar);
@@ -86,20 +85,9 @@
 //  Calculation of new image parameters
 //
-void MImagePar::Calc(const MCerPhotEvt &evt)
+void MImagePar::Calc(const MSignalCam &evt)
 {
     // Get number of saturating pixels
-    fNumSatPixelsHG = 0;
-    fNumSatPixelsLG = 0;
-
-    const UInt_t npixevt = evt.GetNumPixels();
-    for (UInt_t i=0; i<npixevt; i++)
-    {
-        const MCerPhotPix &pix = evt[i];
-
-	if (pix.IsPixelHGSaturated())
-            fNumSatPixelsHG++;
-	if (pix.IsPixelSaturated())
-            fNumSatPixelsLG++;
-    }
+    fNumSatPixelsHG   = evt.GetNumPixelsSaturatedHiGain();
+    fNumSatPixelsLG   = evt.GetNumPixelsSaturatedLoGain();
 
     // Get number of islands
Index: /trunk/MagicSoft/Mars/mimage/MImagePar.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MImagePar.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MImagePar.h	(revision 6855)
@@ -8,5 +8,5 @@
 class MHillas;
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 
 class MImagePar : public MParContainer
@@ -39,5 +39,5 @@
     void Print(Option_t *opt=NULL) const;
 
-    void Calc(const MCerPhotEvt &evt);
+    void Calc(const MSignalCam &evt);
 
     ClassDef(MImagePar, 2) // Container to hold (geometry and island independant) image parameters
Index: /trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc	(revision 6855)
@@ -61,7 +61,7 @@
 //
 // When an event is read, before the image cleaning, all the pixels that
-// are in MCerPhotEvt are set as USED and NOT CORE. All the pixels belong
+// are in MSignalCam are set as USED and NOT CORE. All the pixels belong
 // to RING number 1 (like USED pixels).
-// Look at MCerPhotPix.h to see how these informations of the pixel are
+// Look at MSignalPix.h to see how these informations of the pixel are
 // stored.
 // The default  cleaning METHOD is the STANDARD one and the number of the
@@ -84,5 +84,5 @@
 // This avoids problems of deformations of the shower images.
 // The signal S_i and the pedestal RMS Prms_i of the pixel are called from
-// the object MCerPhotPix.
+// the object MSignalPix.
 // If (default method = kStandard)
 //Begin_Html
@@ -281,8 +281,8 @@
 //   MGeomCam
 //   MPedPhotCam
-//   MCerPhotEvt
+//   MSignalCam
 //
 //  Output Containers:
-//   MCerPhotEvt
+//   MSignalCam
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -307,6 +307,6 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotPix.h"
-#include "MCerPhotEvt.h"
+#include "MSignalPix.h"
+#include "MSignalCam.h"
 
 #include "MGGroupFrame.h" // MGGroupFrame
@@ -325,5 +325,5 @@
 
 const TString MImgCleanStd::gsNamePedPhotCam="MPedPhotCam"; // default name of the 'MPedPhotCam' container
-const TString MImgCleanStd::gsNameCerPhotEvt="MCerPhotEvt"; // default name of the 'MCerPhotEvt' container
+const TString MImgCleanStd::gsNameSignalCam ="MSignalCam"; // default name of the 'MSignalCam' container
 const TString MImgCleanStd::gsNameGeomCam   ="MGeomCam";    // default name of the 'MGeomCam' container
 
@@ -341,5 +341,5 @@
     fCleanLvl2(lvl2), fCleanRings(1), fKeepSinglePixels(kFALSE),
     fNamePedPhotCam(gsNamePedPhotCam), fNameGeomCam(gsNameGeomCam),
-    fNameCerPhotEvt(gsNameCerPhotEvt)
+    fNameSignalCam(gsNameSignalCam)
 {
     fName  = name  ? name  : gsDefName.Data();
@@ -374,11 +374,14 @@
     // set them to 'unused' state if necessary
     //
-    MCerPhotPix *pix;
-
-    // Loop over all pixels
-    MCerPhotEvtIter Next(fEvt, kFALSE);
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
-        if (!pix->IsPixelUnmapped() && data[pix->GetPixId()] <= fCleanLvl1)
-            pix->SetPixelUnused();
+    const UInt_t npixevt = fEvt->GetNumPixels();
+    for (UInt_t idx=0; idx<npixevt; idx++)
+    {
+        if (data[idx]>fCleanLvl1)
+            continue;
+
+        MSignalPix &pix = (*fEvt)[idx];
+        if (!pix.IsPixelUnmapped())
+            pix.SetPixelUnused();
+    }
 }
 
@@ -395,13 +398,10 @@
     size = 0;
 
-    MCerPhotPix *pix;
-
-    // Loop over used pixels only
-    TIter Next(*fEvt);
-
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
-    {
-        // get pixel id of this entry
-        const Int_t idx = pix->GetPixId();
+    const UInt_t npixevt = fEvt->GetNumPixels();
+    for (UInt_t idx=0; idx<npixevt; idx++)
+    {
+        MSignalPix &pix = (*fEvt)[idx];
+        if (!pix.IsPixelUsed())
+            continue;
  
         // check for 'used' neighbors of this pixel
@@ -427,15 +427,15 @@
         {
             if (!fKeepSinglePixels)
-                pix->SetPixelUnused();
-            size += pix->GetNumPhotons();
+                pix.SetPixelUnused();
+            size += pix.GetNumPhotons();
             n++;
         }
     }
 
-    Next.Reset();
-    while ((pix=static_cast<MCerPhotPix*>(Next())))
-    {
-	if (pix->IsPixelUsed())
-            pix->SetPixelCore();
+    for (UInt_t idx=0; idx<npixevt; idx++)
+    {
+        MSignalPix &pix = (*fEvt)[idx];
+	if (pix.IsPixelUsed())
+            pix.SetPixelCore();
     }
 
@@ -443,7 +443,7 @@
 } 
 
-void MImgCleanStd::CleanStep3b(MCerPhotPix &pix)
-{
-    const Int_t idx = pix.GetPixId();
+void MImgCleanStd::CleanStep3b(Int_t idx)
+{
+    MSignalPix &pix = (*fEvt)[idx];
 
     //
@@ -475,6 +475,8 @@
 //   If a value<2 for fCleanRings is used, no CleanStep4 is done.
 //
-void MImgCleanStd::CleanStep4(UShort_t r, MCerPhotPix &pix)
-{
+void MImgCleanStd::CleanStep4(UShort_t r, Int_t idx/*MSignalPix &pix*/)
+{
+    MSignalPix &pix = (*fEvt)[idx];
+
     //
     // Skip events that have already a defined status;
@@ -488,6 +490,4 @@
     // and tell to which ring it belongs to.
     //
-    const Int_t idx = pix.GetPixId();
-
     MGeomPix  &gpix  = (*fCam)[idx];
 
@@ -498,5 +498,5 @@
         const Int_t idx2 = gpix.GetNeighbor(j);
 
-        MCerPhotPix *npix = fEvt->GetPixById(idx2);
+        MSignalPix *npix = fEvt->GetPixById(idx2);
         if (!npix || !npix->IsPixelUsed() || npix->GetRing()>r-1 ) 
             continue;
@@ -519,24 +519,23 @@
     for (UShort_t r=1; r<fCleanRings+1; r++)
     {
-        MCerPhotPix *pix;
-
         // Loop over all pixels
-
-        MCerPhotEvtIter NextAll(fEvt, kFALSE);
-        while ((pix=static_cast<MCerPhotPix*>(NextAll())))
+        const UInt_t npixevt = fEvt->GetNumPixels();
+        for (UInt_t idx=0; idx<npixevt; idx++)
         {
+            MSignalPix &pix = (*fEvt)[idx];
+
             //
 	    // if pixel is a core pixel or unmapped, go to the next pixel
             //
-            if (pix->IsPixelCore() || pix->IsPixelUnmapped())
+            if (pix.IsPixelCore() || pix.IsPixelUnmapped())
                 continue;
 
-            if (data[pix->GetPixId()] <= fCleanLvl2)
+            if (data[idx] <= fCleanLvl2)
                 continue;
 
             if (r==1)
-                CleanStep3b(*pix);
+                CleanStep3b(idx);
             else
-                CleanStep4(r, *pix);
+                CleanStep4(r, idx);
         }
     }
@@ -557,8 +556,8 @@
     }
 
-    fEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber(fNameCerPhotEvt), "MCerPhotEvt");
+    fEvt = (MSignalCam*)pList->FindObject(AddSerialNumber(fNameSignalCam), "MSignalCam");
     if (!fEvt)
     {
-        *fLog << err << fNameCerPhotEvt << " [MCerPhotEvt] not found... aborting." << endl;
+        *fLog << err << fNameSignalCam << " [MSignalCam] not found... aborting." << endl;
         return kFALSE;
     }
@@ -570,8 +569,4 @@
         return kFALSE;
     }
-
-    fTime = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime"));
-    if (!fTime && fCleaningMethod==kProbability)
-        *fLog << warn << "MArrivalTime not found... probability cleaning done with signal only!" << endl;
 
     fData = (MCameraData*)pList->FindCreateObj(AddSerialNumber("MCameraData"));
@@ -602,5 +597,5 @@
         break;
     case kProbability:
-        fData->CalcCleaningProbability(*fEvt, *fPed, *fCam, fTime);
+        fData->CalcCleaningProbability(*fEvt, *fPed, *fCam);
         break;
     case kAbsolute:
@@ -819,6 +814,6 @@
     if (gsNameGeomCam!=fNameGeomCam)
         out << "   " << GetUniqueName() << ".SetNameGeomCam(\"" << fNameGeomCam << "\");" << endl;
-    if (gsNameCerPhotEvt!=fNameCerPhotEvt)
-        out << "   " << GetUniqueName() << ".SetNameCerPhotEvt(\"" << fNameCerPhotEvt << "\");" << endl;
+    if (gsNameSignalCam!=fNameSignalCam)
+        out << "   " << GetUniqueName() << ".SetNameSignalCam(\"" << fNameSignalCam << "\");" << endl;
     if (fKeepSinglePixels)
         out << "   " << GetUniqueName() << ".SetKeepSinglePixels();" << endl;
Index: /trunk/MagicSoft/Mars/mimage/MImgCleanStd.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MImgCleanStd.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MImgCleanStd.h	(revision 6855)
@@ -8,6 +8,5 @@
 class MGeomCam;
 class MSigmabar;
-class MCerPhotPix;
-class MCerPhotEvt;
+class MSignalCam;
 class MPedPhotCam;
 class MArrivalTime;
@@ -30,10 +29,9 @@
     static const TString gsNamePedPhotCam; // default name of the 'MPedPhotCam' container
     static const TString gsNameGeomCam;    // default name of the 'MGeomCam' container
-    static const TString gsNameCerPhotEvt; // default name of the 'MCerPhotEvt' container
+    static const TString gsNameSignalCam;  // default name of the 'MSignalCam' container
 
     const MGeomCam     *fCam;  //!
-          MCerPhotEvt  *fEvt;  //!
+          MSignalCam  *fEvt;  //!
           MPedPhotCam  *fPed;  //!
-          MArrivalTime *fTime; //!
           MCameraData  *fData; //!
 
@@ -48,5 +46,5 @@
     TString  fNamePedPhotCam; // name of the 'MPedPhotCam' container
     TString  fNameGeomCam;    // name of the 'MGeomCam' container
-    TString  fNameCerPhotEvt; // name of the 'MCerPhotEvt' container
+    TString  fNameSignalCam;  // name of the 'MSignalCam' container
 
     // MImgCleanStd
@@ -54,6 +52,6 @@
     Short_t CleanStep2(Float_t &size);
     void    CleanStep3();
-    void    CleanStep3b(MCerPhotPix &pix);
-    void    CleanStep4(UShort_t r, MCerPhotPix &pix);
+    void    CleanStep3b(Int_t idx);
+    void    CleanStep4(UShort_t r, Int_t idx);
 
     // MGTask, MTask, MParContainer
@@ -81,5 +79,5 @@
 
     void SetNamePedPhotCam(const char *name)  { fNamePedPhotCam = name; }
-    void SetNameCerPhotEvt(const char *name)  { fNameCerPhotEvt = name; }
+    void SetNameSignalCam(const char *name)   { fNameSignalCam = name; }
     void SetNameGeomCam(const char *name)     { fNameGeomCam = name; }
 
Index: /trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 6855)
@@ -77,6 +77,6 @@
 #include "MGeomPix.h"
 
-#include "MCerPhotEvt.h"
-#include "MCerPhotPix.h"
+#include "MSignalCam.h"
+#include "MSignalPix.h"
 
 ClassImp(MNewImagePar);
@@ -121,5 +121,5 @@
 //  Calculation of new image parameters
 //
-void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
+void MNewImagePar::Calc(const MGeomCam &geom, const MSignalCam &evt,
                         const MHillas &hillas, Int_t island)
 {
@@ -141,19 +141,26 @@
     Float_t maxpix2 = 0;                                 // [#phot]
 
-    MCerPhotPix *pix = 0;
-
+    /*
+    MSignalPix *pix = 0;
     TIter Next(evt);
-    while ((pix=(MCerPhotPix*)Next()))
+    while ((pix=(MSignalPix*)Next()))
+    */
+    UInt_t npix = evt.GetNumPixels();
+    for (UInt_t i=0; i<npix; i++)
     {
+        const MSignalPix &pix = evt[i];
+        if (!pix.IsPixelUsed())
+            continue;
+
         // Check for requested islands
-        if (island>=0 && pix->GetIdxIsland()!=island)
+        if (island>=0 && pix.GetIdxIsland()!=island)
             continue;
 
         // Get geometry of pixel
-        const Int_t pixid = pix->GetPixId();
-        const MGeomPix &gpix = geom[pixid];
+        //const Int_t pixid = pix->GetPixId();
+        const MGeomPix &gpix = geom[i/*pixid*/];
 
         // count used and core pixels
-        if (pix->IsPixelCore())
+        if (pix.IsPixelCore())
         {
             fNumCorePixels++;
@@ -165,5 +172,5 @@
         fUsedArea += gpix.GetA();
 
-        Double_t nphot = pix->GetNumPhotons();
+        Double_t nphot = pix.GetNumPhotons();
 
         //
@@ -179,13 +186,13 @@
         // must take pixel size into account
         //
-        nphot *= geom.GetPixRatio(pixid);
+        nphot *= geom.GetPixRatio(i/*pixid*/);
 
 	// count inner pixels: To dependent on MAGIC Camera --> FIXME
 
-        if (pixid<397){
+        if (i<397){
             fInnerSize += nphot;
-            if(pixid>270){
+            if(i>270){
                 edgepixin2 += nphot;
-                if(pixid>330)
+                if(i>330)
                     edgepixin1 += nphot;
             }
Index: /trunk/MagicSoft/Mars/mimage/MNewImagePar.h
===================================================================
--- /trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 6855)
@@ -8,5 +8,5 @@
 class MHillas;
 class MGeomCam;
-class MCerPhotEvt;
+class MSignalCam;
 
 class MNewImagePar : public MParContainer
@@ -53,5 +53,5 @@
     void Print(const MGeomCam &geom) const;
 
-    void Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
+    void Calc(const MGeomCam &geom, const MSignalCam &evt,
               const MHillas &hillas, Int_t island=-1);
 
Index: /trunk/MagicSoft/Mars/mimage/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mimage/Makefile	(revision 6854)
+++ /trunk/MagicSoft/Mars/mimage/Makefile	(revision 6855)
@@ -19,7 +19,7 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../mhbase -I../mgeom -I../manalysis \
+INCLUDES = -I. -I../mbase -I../mhbase -I../mgeom -I../msignal \
 	   -I../mgui -I../mmc -I../mpointing -I../mpedestal \
-           -I../mhist
+           -I../mhist -I../manalysis
 
 # mhist: MHHillas (MHCamera)
@@ -32,5 +32,4 @@
            MHillasExt.cc \
            MHillasCalc.cc \
-           MHillasSrcCalc.cc \
            MImagePar.cc \
 	   MNewImagePar.cc \
