Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 9259)
@@ -244,5 +244,5 @@
         const UInt_t  s = pix.GetAidx();
 
-        const Float_t d = pix.GetD();
+        const Float_t d = pix.GetT();
         const Float_t r = pix.GetDist();
 
@@ -340,9 +340,27 @@
 // --------------------------------------------------------------------------
 //
+// The maximum possible distance from the origin.
+//
+Float_t MGeomCam::GetMaxRadius() const
+{
+    return fMaxRadius[0];
+}
+
+// --------------------------------------------------------------------------
+//
+// The minimum possible distance from the origin.
+//
+Float_t MGeomCam::GetMinRadius() const
+{
+    return fMinRadius[0];
+}
+
+// --------------------------------------------------------------------------
+//
 // Have to call the radii of the subcameras starting to count from 1
 //
 Float_t MGeomCam::GetMaxRadius(const Int_t i) const
 {
-    return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMaxRadius[i+1];
+    return i<0 || i>=(Int_t)GetNumAreas() ? -1 : fMaxRadius[i+1];
 }
 
@@ -353,5 +371,5 @@
 Float_t MGeomCam::GetMinRadius(const Int_t i) const
 {
-    return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMinRadius[i+1];
+    return i<0 || i>=(Int_t)GetNumAreas() ? -1 : fMinRadius[i+1];
 }
 
@@ -379,4 +397,18 @@
     // The const_cast is necessary to support older root version
     return i<fNumPixels ? const_cast<TArrayF&>(fPixRatioSqrt)[i] : 0;
+}
+
+// --------------------------------------------------------------------------
+//
+// Check if the position given in the focal plane (so z can be ignored)
+// is a position which might hit the detector. It is meant to be a rough
+// and fast estimate not a precise calculation. All positions dicarded
+// must not hit the detector. All positions accepted might still miss
+// the detector.
+//
+Bool_t MGeomCam::HitDetector(const MQuaternion &v, Double_t offset) const
+{
+    const Double_t max = fMaxRadius[0]/10+offset; // cm --> mm
+    return v.R2()<max*max;
 }
 
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 9259)
@@ -78,6 +78,8 @@
     UInt_t  GetNumPixels()  const { return fNumPixels; }
 
-    Float_t GetMaxRadius(const Int_t i=-1) const;
-    Float_t GetMinRadius(const Int_t i=-1) const;
+    Float_t GetMaxRadius() const;
+    Float_t GetMinRadius() const;
+    Float_t GetMaxRadius(const Int_t i) const;
+    Float_t GetMinRadius(const Int_t i) const;
 
     Float_t GetDist(UShort_t i, UShort_t j=0) const;
@@ -113,5 +115,5 @@
 
     virtual Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const { return kFALSE; }
-    virtual Bool_t HitDetector(const MQuaternion &p) const { return kFALSE; }
+    virtual Bool_t HitDetector(const MQuaternion &p, Double_t offset=0) const;
 
     void Print(Option_t *opt=NULL) const;
Index: trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.cc	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.cc	(revision 9259)
@@ -133,20 +133,4 @@
 // --------------------------------------------------------------------------
 //
-// Check if the position given in the focal plane (so z can be ignored)
-// is a position which might hit the detector. It is meant to be a rough
-// and fast estimate not a precise calculation. All positions dicarded
-// must not hit the detector. All positions accepted might still miss
-// the detector.
-//
-// The units are cm.
-//
-Bool_t MGeomCamDwarf::HitDetector(const MQuaternion &v) const
-{
-    // Add 10% to the max radius and convert from mm to cm
-    return v.R()<GetMaxRadius()*0.11;//60.2;
-}
-
-// --------------------------------------------------------------------------
-//
 // Calculate in the direction 0-5 (kind of sector) in the ring-th ring
 // the x and y coordinate of the i-th pixel. The unitx are unity,
Index: trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.h	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.h	(revision 9259)
@@ -29,5 +29,4 @@
 
     Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const;
-    Bool_t HitDetector(const MQuaternion &p) const;
 
     ClassDef(MGeomCamDwarf, 1) // Geometry class for the Dwarf camera
Index: trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.cc	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.cc	(revision 9259)
@@ -67,17 +67,4 @@
 
     return TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
-}
-
-// --------------------------------------------------------------------------
-//
-// Check if the position given in the focal plane (so z can be ignored)
-// is a position which might hit the detector. It is meant to be a rough
-// and fast estimate not a precise calculation. All positions dicarded
-// must not hit the detector. All positions accepted might still miss
-// the detector.
-//
-Bool_t MGeomCamMagic::HitDetector(const MQuaternion &v) const
-{
-    return v.R()<60.2;
 }
 
Index: trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.h	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCamMagic.h	(revision 9259)
@@ -16,5 +16,4 @@
 
     Bool_t HitFrame(MQuaternion p, const MQuaternion &u) const;
-    Bool_t HitDetector(const MQuaternion &p) const;
 
     ClassDef(MGeomCamMagic, 1)		// Geometry class for the Magic camera
Index: trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomPix.cc	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomPix.cc	(revision 9259)
@@ -66,6 +66,6 @@
 using namespace std;
 
-const Float_t MGeomPix::gsTan30 = tan(30/kRad2Deg);
-const Float_t MGeomPix::gsTan60 = tan(60/kRad2Deg);
+const Float_t MGeomPix::gsTan30 = TMath::Tan(30/kRad2Deg); // sqrt(3)/3
+const Float_t MGeomPix::gsTan60 = TMath::Tan(60/kRad2Deg); // sqrt(3)
 
 // --------------------------------------------------------------------------
@@ -73,5 +73,5 @@
 // Initializes one pixel
 //
-MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r, UInt_t s, UInt_t a)
+MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r, UInt_t s, UInt_t a) : fUserBits(0)
 {
     //  default constructor
Index: trunk/MagicSoft/Mars/mgeom/MGeomPix.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomPix.h	(revision 9258)
+++ trunk/MagicSoft/Mars/mgeom/MGeomPix.h	(revision 9259)
@@ -9,4 +9,5 @@
 class TVector2;
 class TOrdCollection;
+
 
 class MGeomPix : public MParContainer
@@ -75,6 +76,7 @@
     Float_t GetX() const  { return fX; }
     Float_t GetY() const  { return fY; }
-    Float_t GetD() const  { return fD; }
+    Float_t GetD() const  { return fD; }         // Distance between two parellel sides
     Float_t GetL() const  { return fD*gsTan30; } // Length of one of the parallel sides
+    Float_t GetT() const  { return fD/gsTan60; } // Distance between two opposite edges (traverse)
     UInt_t  GetSector() const { return fSector; }
 
@@ -101,4 +103,6 @@
     //Double_t CalcOverlapArea(const MGeomPix &cam) const;
 
+    //TObject *GetGraphics() { return new MHexagon(*this); }
+
     ClassDef(MGeomPix, 4) // Geometry class describing the geometry of one pixel
 };
