Index: /trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 8398)
+++ /trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 8399)
@@ -20,5 +20,5 @@
 !   Author(s): Markus Gaug      03/2004 <mailto:markus@ifae.es>
 !
-!   Copyright: MAGIC Software Development, 2000-2005
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 \* ======================================================================== */
@@ -48,4 +48,17 @@
 // ----------
 //  - added fNumAreas
+//  - added fNumSectors
+//
+// Version 4:
+// ----------
+//  - added fMaxRadius
+//  - added fMinRadius
+//
+// Version 5:
+// ----------
+//  - added fNumPixInSector
+//  - added fNumPixWithAidx
+//  - removed fNumSectors
+//  - removed fNumAreas
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -72,5 +85,5 @@
 MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
     : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), 
-      fPixels(npix), fMaxRadius(1), fMinRadius(1), fPixRatio(npix), fPixRatioSqrt(npix)
+    fPixels(npix), fMaxRadius(1), fMinRadius(1), fPixRatio(npix), fPixRatioSqrt(npix)
 {
     fName  = name  ? name  : "MGeomCam";
@@ -145,15 +158,13 @@
 void MGeomCam::CalcNumSectors()
 {
-    fNumSectors = 0;
-
     for (UInt_t i=0; i<fNumPixels; i++)
     {
         const Int_t s = (*this)[i].GetSector();
 
-        if (s>fNumSectors)
-            fNumSectors = s;
-    }
-
-    fNumSectors++;
+        if (s>=fNumPixInSector.GetSize())
+            fNumPixInSector.Set(s+1);
+
+        fNumPixInSector[s]++;
+    }
 }
 
@@ -165,15 +176,13 @@
 void MGeomCam::CalcNumAreas()
 {
-    fNumAreas = 0;
-
     for (UInt_t i=0; i<fNumPixels; i++)
     {
         const Int_t s = (*this)[i].GetAidx();
 
-        if (s>fNumAreas)
-            fNumAreas = s;
-    }
-
-    fNumAreas++;
+        if (s>=fNumPixWithAidx.GetSize())
+            fNumPixWithAidx.Set(s+1);
+
+        fNumPixWithAidx[s]++;
+    }
 }
 
@@ -184,8 +193,8 @@
 void MGeomCam::CalcMaxRadius()
 {
-    fMaxRadius.Set(fNumAreas+1);
-    fMinRadius.Set(fNumAreas+1);
-
-    for (Int_t i=0; i<fNumAreas+1; i++)
+    fMaxRadius.Set(GetNumAreas()+1);
+    fMinRadius.Set(GetNumAreas()+1);
+
+    for (UInt_t i=0; i<GetNumAreas()+1; i++)
     {
         fMaxRadius[i] = 0.;
@@ -299,5 +308,5 @@
 Float_t MGeomCam::GetMaxRadius(const Int_t i) const
 {
-    return i<-1 || i>fNumAreas ? -1 : fMaxRadius[i+1];
+    return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMaxRadius[i+1];
 }
 
@@ -308,5 +317,5 @@
 Float_t MGeomCam::GetMinRadius(const Int_t i) const
 {
-    return i<-1 || i>fNumAreas ? -1 : fMinRadius[i+1];
+    return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMinRadius[i+1];
 }
 
Index: /trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 8398)
+++ /trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 8399)
@@ -11,4 +11,7 @@
 #include <TArrayF.h>
 #endif
+#ifndef ROOT_TArrayS
+#include <TArrayS.h>
+#endif
 
 class TVector2;
@@ -19,18 +22,21 @@
 {
 private:
-    UInt_t    fNumPixels;    // Number of pixels in this camera
+    UInt_t    fNumPixels;       // Number of pixels in this camera
 
-    Float_t   fCamDist;      // [m] Average distance of the camera from the mirror
-    Float_t   fConvMm2Deg;   // conversion factor to convert mm in the camera plain into degrees
+    Float_t   fCamDist;         // [m] Average distance of the camera from the mirror
+    Float_t   fConvMm2Deg;      // conversion factor to convert mm in the camera plain into degrees
 
-    TObjArray fPixels;       // Array of singel pixels storing the geometry
+    TObjArray fPixels;          // Array of singel pixels storing the geometry
 
-    TArrayF   fMaxRadius;    // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
-    TArrayF   fMinRadius;    // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)    
-    TArrayF   fPixRatio;     // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
-    TArrayF   fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
+    TArrayF   fMaxRadius;       // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
+    TArrayF   fMinRadius;       // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)
+    TArrayF   fPixRatio;        // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
+    TArrayF   fPixRatioSqrt;    // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
 
-    Int_t     fNumSectors;   // Number of sectors
-    Int_t     fNumAreas;     // Number of different pixel sizes
+    TArrayS   fNumPixInSector;  // Number of pixels in sector
+    TArrayS   fNumPixWithAidx;  // Number of pixels with one pixel sizes
+
+//    Int_t     fNumSectors;      // Number of sectors
+//    Int_t     fNumAreas;        // Number of different pixel sizes
 
 protected:
@@ -71,8 +77,12 @@
     Float_t GetAngle(UShort_t i, UShort_t j=0) const;
 
-    UInt_t  GetNumSectors()                const  { return fNumSectors; }
-    UInt_t  GetNumAreas()                  const  { return fNumAreas; }
-    Float_t GetPixRatio(UInt_t i)          const;
-    Float_t GetPixRatioSqrt(UInt_t i)      const;
+    Float_t GetPixRatio(UInt_t i) const;
+    Float_t GetPixRatioSqrt(UInt_t i) const;
+
+    UInt_t  GetNumSectors() const { return fNumPixInSector.GetSize(); }
+    UInt_t  GetNumAreas() const { return fNumPixWithAidx.GetSize(); }
+
+    UShort_t GetNumPixInSector(UInt_t i) const { return (UShort_t)fNumPixInSector[i]; }
+    UShort_t GetNumPixWithAidx(UInt_t i) const { return (UShort_t)fNumPixWithAidx[i]; }
 
     MGeomPix &operator[](Int_t i);
@@ -94,5 +104,5 @@
     virtual void Print(Option_t *opt=NULL)   const;
 
-    ClassDef(MGeomCam, 4)  // Geometry base class for the camera
+    ClassDef(MGeomCam, 5)  // Geometry base class for the camera
 };
 
