Index: trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc	(revision 9367)
+++ trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc	(revision 9369)
@@ -226,6 +226,6 @@
             if (fUseThreshold!=kNoBound)
             {
-                if (val>fThreshold && fUseThreshold==kIsLowerBound ||
-                    val<fThreshold && fUseThreshold==kIsUpperBound)
+                if ((val>fThreshold && fUseThreshold==kIsLowerBound) ||
+                    (val<fThreshold && fUseThreshold==kIsUpperBound))
                     fHist.Fill(cx[ix], cy[iy]);
             }
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 9367)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 9369)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.118 2009-03-01 12:51:03 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.119 2009-03-01 21:48:14 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -79,5 +79,4 @@
 #include "MString.h"
 #include "MBinning.h"
-#include "MHexagon.h"
 
 #include "MGeomPix.h"
@@ -109,7 +108,7 @@
     gROOT->GetListOfCleanups()->Add(fNotify);
 
+    /*
     TVirtualPad *save = gPad;
     gPad = 0;
-    /*
 #if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
     SetPalette(1, 0);
@@ -123,6 +122,6 @@
     SetInvDeepBlueSeaPalette();
 #endif
+    gPad = save;
 */
-    gPad = save;
 }
 
@@ -218,5 +217,5 @@
 Bool_t MHCamera::MatchSector(Int_t idx, const TArrayI &sector, const TArrayI &aidx) const
 {
-    const MGeomPix &pix = (*fGeomCam)[idx];
+    const MGeom &pix = (*fGeomCam)[idx];
     return FindVal(sector, pix.GetSector()) && FindVal(aidx, pix.GetAidx());
 }
@@ -980,8 +979,11 @@
         gPad->GetX2()> maxr || gPad->GetY2()>maxr ? 1 : fGeomCam->GetConvMm2Deg();
 
-    MHexagon hex;
+    TAttLine line;
+    TAttFill fill;
+    line.SetLineStyle(kSolid);
+    line.SetLineColor(kBlack);
     for (Int_t i=0; i<fNcells-2; i++)
     {
-        hex.SetFillStyle(issame || (IsTransparent() && !IsUsed(i)) ? 0 : 1001);
+        fill.SetFillStyle(issame || (IsTransparent() && !IsUsed(i)) ? 0 : 1001);
 
         if (!issame)
@@ -990,5 +992,5 @@
             if (!IsUsed(i) || !iscol || isnan)
             {
-                hex.SetFillColor(10);
+                fill.SetFillColor(10);
 
                 if (isnan)
@@ -996,24 +998,25 @@
             }
             else
-                hex.SetFillColor(GetColor(GetBinContent(i+1), min, max, islog));
+                fill.SetFillColor(GetColor(GetBinContent(i+1), min, max, islog));
         }
 
-        const MGeomPix &pix = (*fGeomCam)[i];
-
-        Float_t x = pix.GetX()*conv/(fAbberation+1);
-        Float_t y = pix.GetY()*conv/(fAbberation+1);
-        Float_t d = pix.GetD()*conv;
-
-        if (!isbox)
-            if (IsUsed(i) || !TestBit(kNoUnused))
-                hex.PaintHexagon(x, y, d);
-        else
-            if (IsUsed(i) && TMath::Finite(fArray[i+1]))
-            {
-                Float_t size = d*(GetBinContent(i+1)-min)/(max-min);
-                if (size>d)
-                    size=d;
-                hex.PaintHexagon(x, y, size);
-            }
+        const MGeom &pix = (*fGeomCam)[i];
+
+        Double_t scale = 1;//conv/(fAbberation+1);
+
+        if (!isbox && !IsUsed(i) && TestBit(kNoUnused))
+            continue;
+
+        if (isbox && (!IsUsed(i) || !TMath::Finite(fArray[i+1])))
+            continue;
+
+        if (isbox)
+        {
+            scale = (GetBinContent(i+1)-min)/(max-min);
+            if (scale>1)
+                scale=1;
+        }
+
+        pix.PaintPrimitive(line, fill, conv, scale/(fAbberation+1));
     }
 }
@@ -1319,5 +1322,5 @@
     for (Int_t i=0; i<fNcells-2; i++)
     {
-        const MGeomPix &h = (*fGeomCam)[i];
+        const MGeom &h = (*fGeomCam)[i];
 
         TString num;
@@ -1335,5 +1338,5 @@
         //(GetColor(GetBinContent(i+1), min, max, 0));
         txt.SetTextColor(kRed);
-        txt.SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
+        txt.SetTextSize(0.3*h.GetT()/fGeomCam->GetMaxRadius()/1.05);
         txt.PaintText(h.GetX(), h.GetY(), num);
     }
@@ -2024,13 +2027,8 @@
         return -1;
 
-    Int_t i;
-    for (i=0; i<fNcells-2; i++)
-    {
-        MHexagon hex((*fGeomCam)[i]);
-        if (hex.DistancetoPrimitive(px, py, conv)>0)
-            continue;
-
-        return i;
-    }
+    for (Int_t i=0; i<fNcells-2; i++)
+        if ((*fGeomCam)[i].DistancetoPrimitive(px*conv, py*conv)<=0)
+            return i;
+
     return -1;
 }
