Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3546)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3547)
@@ -46,5 +46,5 @@
      - new TArrayF fMinRadius of each pixel area type
      - backward compatibility should be given, 
-       call to GetMaxRadius() return fMaxRadius.At(fNumAreas-1)
+       call to GetMaxRadius() returns the value for the whole camera
        (which corresponds to the previous value for the Magic camera)
  
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 3546)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 3547)
@@ -196,11 +196,11 @@
 {
 
-  fMaxRadius.Set(fNumAreas);
-  fMinRadius.Set(fNumAreas);  
-
-  for (Int_t i=0; i<fNumAreas; i++)
-    {
-      fMaxRadius.AddAt(0.,i);
-      fMinRadius.AddAt(3.3e38,i);
+  fMaxRadius.Set(fNumAreas+1);
+  fMinRadius.Set(fNumAreas+1);  
+
+  for (Int_t i=0; i<fNumAreas+1; i++)
+    {
+      fMaxRadius[i] = 0.;
+      fMinRadius[i] = FLT_MAX;
     }
   
@@ -214,16 +214,43 @@
       const Float_t y = pix.GetY();
       const Float_t d = pix.GetD();
-      const Float_t r = sqrt(x*x+y*y);
+
+      const Float_t r = TMath::Hypot(x, y);
 
       const Float_t maxr = r + d;
-      const Float_t minr = r;
+      const Float_t minr = r>d ? r-d : 0;
       
-      if (maxr>fMaxRadius.At(s))
-        fMaxRadius.AddAt(maxr,s);
-      if (minr<fMinRadius.At(s))
-        fMinRadius.AddAt(minr,s);
-    }
-
-}
+      if (maxr>fMaxRadius[s+1])
+        fMaxRadius[s+1] = maxr;
+
+      if (minr<fMinRadius[s+1])
+        fMinRadius[s+1] = minr;
+
+      if (minr<fMinRadius[0])
+        fMinRadius[0] = minr;
+
+      if (maxr>fMaxRadius[0])
+        fMaxRadius[0] = maxr;
+
+    }
+}
+
+//
+// Have to call the radii of the subcameras starting to count from 1
+//
+Float_t MGeomCam::GetMaxRadius(const Int_t i) const
+{
+  if (i==-1) return fMaxRadius[0];
+  return i>fNumAreas ? -1 : fMaxRadius[i+1];
+}
+
+//
+// Have to call the radii of the subcameras starting to count from 1
+//
+Float_t MGeomCam::GetMinRadius(const Int_t i) const
+{
+  if (i==-1) return fMinRadius[0];
+  return i>fNumAreas ? -1 : fMinRadius[i+1];
+}
+
 
 // --------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 3546)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 3547)
@@ -64,11 +64,7 @@
     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);  }
-
+    Float_t GetMaxRadius(const Int_t i=-1) const;
+    Float_t GetMinRadius(const Int_t i=-1) const;
+    
     UInt_t  GetNumSectors()                const  { return fNumSectors; }
     UInt_t  GetNumAreas()                  const  { return fNumAreas; }
