Index: trunk/Mars/Changelog
===================================================================
--- trunk/Mars/Changelog	(revision 9862)
+++ trunk/Mars/Changelog	(revision 9863)
@@ -26,4 +26,11 @@
    * mgeom/MGeomCamFACT.[h,cc]:
      - added
+
+   * mgeom/MGeomCamDwarf.[h,cc], mgeom/MGeomPix.[h,cc]:
+     - moved CalcXY to MGeomPix
+     - removed obsolete includes
+
+   * mgeom/MGeomCamFact.cc:
+     - removed obsolete includes
 
 
Index: trunk/Mars/mgeom/MGeomCamDwarf.cc
===================================================================
--- trunk/Mars/mgeom/MGeomCamDwarf.cc	(revision 9862)
+++ trunk/Mars/mgeom/MGeomCamDwarf.cc	(revision 9863)
@@ -43,8 +43,5 @@
 #include "MGeomCamDwarf.h"
 
-#include <iostream>
-
 #include <TMath.h>
-#include <TArrayI.h>
 
 #include "MGeomPix.h"
@@ -116,54 +113,4 @@
 //
 // 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,
-// distance to (0,0) is retruned.
-//
-Double_t MGeomCamDwarf::CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y)
-{
-    const Double_t kSqrt32 = MGeomPix::gsSin60;
-
-    switch (dir)
-    {
-    case kDirCenter: // Center
-        x = 0;
-        y = 0;
-        break;
-
-    case kDirNE: // Direction North East
-        x = ring-i*0.5;
-        y = i*kSqrt32;
-        break;
-
-    case kDirN: // Direction North
-        x = ring*0.5-i;
-        y = ring*kSqrt32;
-        break;
-
-    case kDirNW: // Direction North West
-        x = -(ring+i)*0.5;
-        y = (ring-i)*kSqrt32;
-        break;
-
-    case kDirSW: // Direction South West
-         x = 0.5*i-ring;
-         y = -i*kSqrt32;
-         break;
-
-    case kDirS: // Direction South
-         x = i-ring*0.5;
-         y = -ring*kSqrt32;
-         break;
-
-    case kDirSE: // Direction South East
-        x = (ring+i)*0.5;
-        y = (-ring+i)*kSqrt32;
-        break;
-    }
-    return TMath::Hypot(x, y);
-}
-
-// --------------------------------------------------------------------------
-//
-// 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 units are unity,
 // distance to (0,0) is retruned.
@@ -193,4 +140,6 @@
 Int_t MGeomCamDwarf::CalcNumPix(Double_t rad)
 {
+    const Double_t r2 = rad*rad;
+
     //
     //  add the first pixel to the list
@@ -206,10 +155,10 @@
         // starting number to the ending number
         //
-        for (Int_t dir=kDirNE; dir<=kDirSE; dir++)
+        for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++)
         {
             for (int i=0; i<ring; i++)
             {
                 Double_t x, y;
-                if (CalcXY(dir, ring, i, x, y)<rad)
+                if (MGeomPix::CalcXY(dir, ring, i, x, y)<r2)
                     n++;
             }
@@ -244,10 +193,10 @@
     for (int ring=1; ring<=rings; ring++)
     {
-        for (Int_t dir=kDirNE; dir<=kDirSE; dir++)
+        for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++)
         {
             for (int i=0; i<ring; i++)
             {
                 Double_t x, y;
-                CalcXY(dir, ring, i, x, y);
+                MGeomPix::CalcXY(dir, ring, i, x, y);
                 SetAt(cnt++, MGeomPix(x*diameter, y*diameter, diameter));
             }
@@ -264,4 +213,6 @@
     //    units for diameter are mm
 
+    const Double_t r2 = rad*rad;
+
     //
     //  add the first pixel to the list
@@ -276,10 +227,10 @@
         Int_t n = 0;
 
-        for (Int_t dir=kDirNE; dir<=kDirSE; dir++)
+        for (Int_t dir=MGeomPix::kDirNE; dir<=MGeomPix::kDirSE; dir++)
         {
             for (int i=0; i<ring; i++)
             {
                 Double_t x, y;
-                if (CalcXY(dir, ring, i, x, y)<rad)
+                if (MGeomPix::CalcXY(dir, ring, i, x, y)<r2)
                     SetAt(cnt+n++, MGeomPix(x*diameter, y*diameter, diameter));
             }
Index: trunk/Mars/mgeom/MGeomCamDwarf.h
===================================================================
--- trunk/Mars/mgeom/MGeomCamDwarf.h	(revision 9862)
+++ trunk/Mars/mgeom/MGeomCamDwarf.h	(revision 9863)
@@ -9,13 +9,9 @@
 {
 private:
-    enum { kDirCenter, kDirNE, kDirN, kDirNW, kDirSW, kDirS, kDirSE };
+    static Int_t CalcNumPix(Double_t rad);
+    static Int_t CalcNumPix(Int_t rings);
 
-    static Double_t CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y);
-
-    static Int_t    CalcNumPix(Double_t rad);
-    static Int_t    CalcNumPix(Int_t rings);
-
-    void  CreateCam(Double_t diameter, Double_t rad);
-    void  CreateCam(Double_t diameter, Int_t rings);
+    void CreateCam(Double_t diameter, Double_t rad);
+    void CreateCam(Double_t diameter, Int_t rings);
 
 public:
Index: trunk/Mars/mgeom/MGeomCamFact.cc
===================================================================
--- trunk/Mars/mgeom/MGeomCamFact.cc	(revision 9862)
+++ trunk/Mars/mgeom/MGeomCamFact.cc	(revision 9863)
@@ -39,8 +39,6 @@
 #include "MGeomCamFact.h"
 
-#include <iostream>
 
 #include <TMath.h>
-#include <TArrayI.h>
 
 #include "MGeomCamDwarf.h"
Index: trunk/Mars/mgeom/MGeomPix.cc
===================================================================
--- trunk/Mars/mgeom/MGeomPix.cc	(revision 9862)
+++ trunk/Mars/mgeom/MGeomPix.cc	(revision 9863)
@@ -209,4 +209,52 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// 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,
+// distance to (0,0) is retruned.
+//
+Double_t MGeomPix::CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y)
+{
+    switch (dir)
+    {
+    case kDirCenter: // Center
+        x = 0;
+        y = 0;
+        break;
+
+    case kDirNE: // Direction North East
+        x = ring-i*0.5;
+        y = i*gsSin60;
+        break;
+
+    case kDirN: // Direction North
+        x = ring*0.5-i;
+        y = ring*gsSin60;
+        break;
+
+    case kDirNW: // Direction North West
+        x = -(ring+i)*0.5;
+        y = (ring-i)*gsSin60;
+        break;
+
+    case kDirSW: // Direction South West
+         x = 0.5*i-ring;
+         y = -i*gsSin60;
+         break;
+
+    case kDirS: // Direction South
+         x = i-ring*0.5;
+         y = -ring*gsSin60;
+         break;
+
+    case kDirSE: // Direction South East
+        x = (ring+i)*0.5;
+        y = (-ring+i)*gsSin60;
+        break;
+    }
+    return x*x + y*y;
+}
+
 // ==============================================================================
 /*
