Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4449)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4450)
@@ -28,4 +28,5 @@
 
 
+
  2004/08/04: Thomas Bretz
 
@@ -36,4 +37,41 @@
    * manalysis/Makefile, manalysis/AnalysisLinkDef.h:
      - removed the MBlind* entries
+
+   * merpp.cc:
+     - moved interpretation of command line options to MLog
+     - added a check for unknown options
+
+   * manalysis/MCameraData.[h,cc]:
+     - added some comments
+     - fixed some errors in the documentation
+     - changed ClassDef to 1
+     - changed the new algorithms such that any number of different pixel-
+       sizes are supported
+     - small modifications to the sanity checks
+
+   * mbadpixels/MBadPixelsTreat.h:
+     - fixed the argument type of SetNumMinNeighbors
+
+   * mbase/MArgs.cc:
+     - comment updated
+
+   * mbase/MEvtLoop.cc:
+     - added reading and writing of fLog environment
+
+   * mbase/MLog.[h,cc]:
+     - added Reading and writing Environment (ReadEnv, WriteEnv)
+     - added a function to setup MLog from command line arguments
+
+   * mbase/MTaskInteractive.[h,cc]:
+     - added an example
+
+   * mbase/MTime.cc:
+     - added a warning for the SetTimeFormat usage
+
+   * mimage/MImgCleanStd.[h,cc]:
+     - some updates to the old comments
+     - NEW COMMENTS FOR SCALED CLEANING STILL MISSING!
+     - implemented scaled image cleaning
+     - replaced usage of MSigmabar by MPedPhotCam for democratic cleaning
 
 
Index: trunk/MagicSoft/Mars/manalysis/MCameraData.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCameraData.cc	(revision 4449)
+++ trunk/MagicSoft/Mars/manalysis/MCameraData.cc	(revision 4450)
@@ -17,7 +17,7 @@
 !
 !   Author(s): Thomas Bretz, 10/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
-!              Hendrik Bartko, 08/2004 <mailto:hbartko@mppmu.mpg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
+!   Author(s): Hendrik Bartko, 08/2004 <mailto:hbartko@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 !
@@ -27,4 +27,7 @@
 //
 // MCameraData
+//
+// This is a generalized class storing camera data. For example the cleaning
+// level for the image cleaning is one possibility.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -56,5 +59,5 @@
 {
     fName  = name  ? name  : "MCameraData";
-    fTitle = title ? title : "Photons/PedRMS Information";
+    fTitle = title ? title : "Generalized storage container for camera contents";
 }
 
@@ -91,5 +94,6 @@
 // scales with the inverse square root of the pixel area.
 //
-
+// FIXME: Should the check noise<=0 be replaced by MBadPixels?
+//
 void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MPedPhotCam &cam,
                                     const MGeomCam &geom)
@@ -138,30 +142,32 @@
 // inner and outer pixels into account.
 //
-
+// FIXME: Should the check noise<=0 be replaced by MBadPixels?
+//
 void MCameraData::CalcCleaningLevel2(const MCerPhotEvt &evt, const MPedPhotCam &cam,
-                                    const MGeomCam &geom)
-{
-    const Int_t n = geom.GetNumPixels();
-
-    fData.Set(n);
-    fData.Reset();
-
-    fValidity.Set(n);
-    fValidity.Reset();
-
-    const Int_t entries = evt.GetNumPixels();
-
-    const Float_t meannoise[2] = {cam.GetArea(0).GetRms(), cam.GetArea(1).GetRms()} ; // mean noise for the inner and the outer pixels
-
-    //
-    // check the number of all pixels against the noise level and
-    // set them to 'unused' state if necessary
-    // 
-    for (Int_t i=0; i<entries; i++)
-    {
-        const MCerPhotPix &pix = evt[i];
-
-        const Int_t idx = pix.GetPixId();
-        const Float_t noise = cam[idx].GetRms();
+                                     const MGeomCam &geom)
+{
+    const Int_t n = geom.GetNumPixels();
+
+    fData.Set(n);
+    fData.Reset();
+
+    fValidity.Set(n);
+    fValidity.Reset();
+
+    const Int_t entries   = evt.GetNumPixels();
+    const Float_t anoise0 = cam.GetArea(0).GetRms();
+    if (anoise0<=0)
+        return;
+
+    //
+    // check the number of all pixels against the noise level and
+    // set them to 'unused' state if necessary
+    // 
+    for (Int_t i=0; i<entries; i++)
+    {
+        const MCerPhotPix &pix = evt[i];
+
+        const Int_t   idx   = pix.GetPixId();
+        const Float_t noide = cam[idx].GetRms();
 
         if (noise<=0) // fData[idx]=0, fValidity[idx]=0
@@ -174,15 +180,8 @@
 	// with the square root of the pixel area.
 	// 
-
-	const UInt_t aidx = geom[idx].GetAidx();
-
-
-	if (meannoise[0] > 0 && meannoise[1] > 0)  
-	{
-	  fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) * meannoise[aidx] / meannoise[0] / noise;
-	 
-	}
-	else fData[idx] = pix.GetNumPhotons() * geom.GetPixRatioSqrt(idx) / noise;
-
+        const UInt_t  aidx  = geom[idx].GetAidx();
+        const Float_t ratio = cam.GetArea(aidx).GetRms()/noise0;
+
+        fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) * ratio / noise;
         fValidity[idx] = 1;
     }
@@ -231,5 +230,4 @@
 }
 
-
 // --------------------------------------------------------------------------
 //
@@ -238,6 +236,7 @@
 // inner pixel and the average pedestal RMS of the inner pixels (democratic
 // image cleaning, see TDAS 02-14).
-
-
+//
+// FIXME: Should the check noise<=0 be replaced by MBadPixels?
+//
 void MCameraData::CalcCleaningLevelDemocratic(const MCerPhotEvt &evt, const MPedPhotCam &cam,
                                               const MGeomCam &geom)
@@ -251,51 +250,35 @@
     fValidity.Reset();
 
-    const Int_t entries = evt.GetNumPixels();
-
-    const Float_t meannoise[2] = {cam.GetArea(0).GetRms(), cam.GetArea(1).GetRms()} ; // mean noise for the inner and the outer pixels
-
-        
-    //
-    // check the number of all pixels against the noise level and
-    // set them to 'unused' state if necessary
-    // 
-    for (Int_t i=0; i<entries; i++)
-    {
-      const MCerPhotPix &pix = evt[i];
-      
-      const Int_t idx = pix.GetPixId();
-      const Float_t noise = cam[idx].GetRms();
-      
-      if (noise<=0)
-	continue;
-	
-      //
-      // We calculate a correction factor which accounts for the     
-      // fact that pixels have different size (see TDAS 02-14).
-      // 
-      
-      
-      if (meannoise[0]>0) // fData[idx]=0, fValidity[idx]=0
-      {
-	fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) / meannoise[0];
-	fValidity[idx] = 1;
-      }
-      else 
-	fValidity[idx] = 0;
-    }
-    
-}
-
-
-
-// --------------------------------------------------------------------------
-//
-// 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
+    const Int_t   entries = evt.GetNumPixels();
+    const Float_t noise0  = cam.GetArea(0).GetRms();
+    if (noise0<=0)
+        return;
+
+    //
+    // check the number of all pixels against the noise level and
+    // set them to 'unused' state if necessary
+    // 
+    for (Int_t i=0; i<entries; i++)
+    {
+        const MCerPhotPix &pix = evt[i];
+
+        const Int_t idx     = pix.GetPixId();
+        const Float_t noise = cam[idx].GetRms();
+
+        if (noise<=0)
+            continue;
+
+        //
+        // We calculate a correction factor which accounts for the
+        // fact that pixels have different size (see TDAS 02-14).
+        //
+        fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) / noise0;
+        fValidity[idx] = 1;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the contents of the pixel.
 //
 Bool_t MCameraData::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
