Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2848)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2849)
@@ -4,4 +4,20 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/01/19: Abelardo Moralejo
+
+   * manalysis/MCerPhotPix.[h,cc]
+     - Added fIsSaturated to flag whether low gain of the pixel is
+       saturated. Added corresponding getter and setter functions.
+       Updated ClassDef to version 2.
+
+   * mcalib/MCalibrate.cc
+     - Set the new saturation flag of MCerPhotPix to kTRUE if at least 
+       one low gain FADC slice is saturated.
+
+   * mimage/MNewImagePar.[h,cc]
+     - Added new member variable fNumSaturatedPixels to count how many
+       pixels were saturated. Updated ClassDef to version 2.
+
 
  2004/01/19: Thomas Bretz
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotPix.cc	(revision 2848)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotPix.cc	(revision 2849)
@@ -23,4 +23,18 @@
 !
 \* ======================================================================== */
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MCerPhotPix
+//
+// Storage container for the signal in a pixel in number of photons.
+//
+// Version 2:
+// Added fIsSaturated, boolean variable set to kTRUE whenever one or more of 
+// the low gain FADC slices of the pixel is in saturation.
+//
+////////////////////////////////////////////////////////////////////////////
+
 #include "MCerPhotPix.h"
 
@@ -37,5 +51,5 @@
 //
 MCerPhotPix::MCerPhotPix(Int_t pix, Float_t phot, Float_t errphot) :
-    fPixId(pix), fRing(1), fIsCore(kFALSE), fPhot(phot), fErrPhot(errphot)
+  fPixId(pix), fRing(1), fIsCore(kFALSE), fPhot(phot), fErrPhot(errphot), fIsSaturated(kFALSE)
 {
 } 
@@ -50,4 +64,5 @@
     gLog << (fRing>0?"   Used ":" Unused ");
     gLog << (fIsCore?" Core ":"      ");
+    gLog << (fIsSaturated?" Saturated ":"Not Saturated");
     gLog << "Nphot= " << fPhot << " Error(Nphot)=" << fErrPhot << endl;
 }
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h	(revision 2848)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h	(revision 2849)
@@ -14,4 +14,5 @@
     UShort_t fRing;      // NT: number of analyzed rings around the core pixels (fRing>0 means: used)
     Bool_t   fIsCore;    // the pixel is a Core pixel -> kTRUE
+    Bool_t   fIsSaturated; // the pixel is saturated
 
     Float_t  fPhot;      // The number of Cerenkov photons
@@ -41,4 +42,7 @@
     void     Set(Float_t np, Float_t ep) { fPhot = np; fErrPhot = ep; }
 
+    void     SetPixelSaturated()         { fIsSaturated = kTRUE; }
+    Bool_t   IsPixelSaturated() const    { return fIsSaturated; }
+
     void     AddNumPhotons(Float_t f)    { fPhot += f; }
 
@@ -47,5 +51,5 @@
     void     Print(Option_t *opt = NULL) const;
 
-    ClassDef(MCerPhotPix, 1)  // class containing information about the Cerenkov Photons in a pixel
+    ClassDef(MCerPhotPix, 2)  // class containing information about the Cerenkov Photons in a pixel
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MCalibrate.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrate.cc	(revision 2848)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrate.cc	(revision 2849)
@@ -126,5 +126,5 @@
 
     const UInt_t imaxnumpix = fSignals->GetSize();
-    
+
     for (UInt_t pixidx=0; pixidx<imaxnumpix; pixidx++)
     {
@@ -161,5 +161,9 @@
         nphotErr  = TMath::Sqrt(nphotErr);
 
+
         fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
+
+	if (sig.GetNumLoGainSaturated() > 0)
+	  (*fCerPhotEvt)[pixidx].SetPixelSaturated();
     }
 
Index: trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 2848)
+++ trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 2849)
@@ -32,4 +32,8 @@
 // fLeakage2 ratio: (photons in the 2 outer rings of pixels) over fSize
 //
+// Version 2:
+// Added fNumSaturatedPixels: number of pixels in which at least one slice
+// of the low gain FADC was saturated.
+// 
 /////////////////////////////////////////////////////////////////////////////
 #include "MNewImagePar.h"
@@ -74,4 +78,6 @@
     fNumUsedPixels = -1;
     fNumCorePixels = -1;
+
+    fNumSaturatedPixels = -1;
 }
 
@@ -86,4 +92,6 @@
     fNumCorePixels = 0;
 
+    fNumSaturatedPixels = 0;
+
     const UInt_t npixevt = evt.GetNumPixels();
 
@@ -97,4 +105,8 @@
     {
         const MCerPhotPix &pix = evt[i];
+
+	if (pix.IsPixelSaturated())
+	  fNumSaturatedPixels++;
+
         if (!pix.IsPixelUsed())
             continue;
Index: trunk/MagicSoft/Mars/mimage/MNewImagePar.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 2848)
+++ trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 2849)
@@ -22,4 +22,6 @@
     Short_t fNumCorePixels; // number of core pixels
 
+    Short_t fNumSaturatedPixels; // number of saturated pixels
+
 public:
     MNewImagePar(const char *name=NULL, const char *title=NULL);
@@ -36,4 +38,6 @@
     Int_t GetNumCorePixels() const { return fNumCorePixels; }
 
+    Short_t GetNumSaturatedPixels() const { return fNumSaturatedPixels; }
+
     void Print(Option_t *opt=NULL) const;
 
@@ -41,5 +45,5 @@
               const MHillas &hillas);
 
-    ClassDef(MNewImagePar, 1) // Container to hold new image parameters
+    ClassDef(MNewImagePar, 2) // Container to hold new image parameters
 };
 
