Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 3442)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 3545)
@@ -16,9 +16,9 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
-!   Author(s): Harald Kornmayer 1/2001
-!
-!   Copyright: MAGIC Software Development, 2000-2002
-!
+!   Author(s): Thomas Bretz     12/2000 <mailto:tbretz@uni-sw.gwdg.de>
+!              Harald Kornmayer 01/2001
+!              Markus Gaug      03/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
 !
 \* ======================================================================== */
@@ -68,5 +68,5 @@
 //
 MGeomCam::MGeomCam()
-    : fNumPixels(0), fCamDist(0), fConvMm2Deg(0)
+    : fNumPixels(0), fCamDist(0), fConvMm2Deg(0), fMaxRadius(1), fMinRadius(1)
 {
     fName  = "MGeomCam";
@@ -80,5 +80,6 @@
 //
 MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
-    : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), fPixels(npix), fPixRatio(npix), fPixRatioSqrt(npix)
+    : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), 
+      fPixels(npix), fMaxRadius(1), fMinRadius(1), fPixRatio(npix), fPixRatioSqrt(npix)
 {
     fName  = name  ? name  : "MGeomCam";
@@ -159,5 +160,5 @@
     for (UInt_t i=0; i<fNumPixels; i++)
     {
-        const UInt_t s = (*this)[i].GetSector();
+        const Int_t s = (*this)[i].GetSector();
 
         if (s>fNumSectors)
@@ -179,5 +180,5 @@
     for (UInt_t i=0; i<fNumPixels; i++)
     {
-        const UInt_t s = (*this)[i].GetAidx();
+        const Int_t s = (*this)[i].GetAidx();
 
         if (s>fNumAreas)
@@ -194,19 +195,34 @@
 void MGeomCam::CalcMaxRadius()
 {
-    fMaxRadius = 0;
-
-    for (UInt_t i=0; i<fNumPixels; i++)
-    {
-        const MGeomPix &pix = (*this)[i];
-
-        const Float_t x = pix.GetX();
-        const Float_t y = pix.GetY();
-        const Float_t d = pix.GetD();
-
-        const Float_t maxr = sqrt(x*x+y*y) + d;
-
-        if (maxr>fMaxRadius)
-            fMaxRadius = maxr;
-    }
+
+  fMaxRadius.Set(fNumAreas);
+  fMinRadius.Set(fNumAreas);  
+
+  for (Int_t i=0; i<fNumAreas; i++)
+    {
+      fMaxRadius.AddAt(0.,i);
+      fMinRadius.AddAt(3.3e38,i);
+    }
+  
+  for (UInt_t i=0; i<fNumPixels; i++)
+    {
+
+      const MGeomPix &pix = (*this)[i];
+
+      const UInt_t  s = pix.GetAidx();      
+      const Float_t x = pix.GetX();
+      const Float_t y = pix.GetY();
+      const Float_t d = pix.GetD();
+      const Float_t r = sqrt(x*x+y*y);
+
+      const Float_t maxr = r + d;
+      const Float_t minr = r;
+      
+      if (maxr>fMaxRadius.At(s))
+        fMaxRadius.AddAt(maxr,s);
+      if (minr<fMinRadius.At(s))
+        fMinRadius.AddAt(minr,s);
+    }
+
 }
 
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 3442)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 3545)
@@ -18,5 +18,4 @@
 private:
     UInt_t    fNumPixels;    // Number of pixels in this camera
-    Float_t   fMaxRadius;    // maximum radius of the camera (eg. for GUI layout)
 
     Float_t   fCamDist;      // [m] Average distance of the camera from the mirror
@@ -25,11 +24,14 @@
     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)
 
-    UInt_t    fNumSectors;   // Number of sectors
-    UInt_t    fNumAreas;     // Number of different pixel sizes
+    Int_t     fNumSectors;   // Number of sectors
+    Int_t     fNumAreas;     // Number of different pixel sizes
 
 protected:
+
     void CalcMaxRadius();
     void CalcNumSectors();
@@ -60,15 +62,22 @@
     Float_t GetConvMm2Deg() const { return fConvMm2Deg; }
 
-    UInt_t  GetNumPixels() const  { return fNumPixels; }
-    Float_t GetMaxRadius() const  { return fMaxRadius; }
-    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;
+    UInt_t  GetNumPixels()  const { return fNumPixels; }
+
+    Float_t GetMaxRadius(const Int_t i=-1) const { if (i >= fNumAreas) return -1.;
+                                                  else if (i==-1) return fMaxRadius.At(fNumAreas-1);
+                                                  else return fMaxRadius.At(i);  }
+    Float_t GetMinRadius(const Int_t i=-1) const { if (i >= fNumAreas) return -1.;
+                                                  else if (i==-1) return fMinRadius.At(0);
+                                                  else return fMinRadius.At(i);  }
+
+    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;
 
     MGeomPix &operator[](Int_t i);
-    MGeomPix &operator[](Int_t i) const;
+    MGeomPix &operator[](Int_t i)          const;
 
-    virtual void Print(Option_t *opt=NULL) const;
+    virtual void Print(Option_t *opt=NULL)   const;
 
     ClassDef(MGeomCam, 3)  // Geometry base class for the camera
