Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2231)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2236)
@@ -364,4 +364,7 @@
     }
 
+    if (min==max)
+        max += 1;
+
     UpdateLegend(min, max, islog);
 
@@ -506,8 +509,11 @@
 void MHCamera::Paint(Option_t *o)
 {
-    const TString opt(o);
-
-    if (opt.Contains("hist", TString::kIgnoreCase))
-    {
+    TString opt(o);
+    opt.ToLower();
+
+    if (opt.Contains("hist"))
+    {
+        opt.ReplaceAll("hist", "");
+
         Int_t mode = gStyle->GetOptStat();
         TVirtualPad *save = gPad;
@@ -525,6 +531,6 @@
     SetRange();
 
-    Bool_t isbox = opt.Contains("box", TString::kIgnoreCase);
-    Bool_t iscol = isbox ? !opt.Contains("nocol", TString::kIgnoreCase) : 1;
+    Bool_t isbox = opt.Contains("box");
+    Bool_t iscol = isbox ? !opt.Contains("nocol") : 1;
 
     // Update Contents of the pixels and paint legend
@@ -595,4 +601,5 @@
 void MHCamera::DrawPixelIndices()
 {
+    // FIXME: Is this correct?
     for (int i=0; i<kItemsLegend; i++)
         fColors[i] = 16;
@@ -609,4 +616,27 @@
         TString num;
         num += i;
+
+        const MGeomPix &h = (*fGeomCam)[i];
+        TText *nt = txt.DrawText(h.GetX(), h.GetY(), num);
+        nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius());
+    }
+}
+
+void MHCamera::DrawSectorIndices()
+{
+    for (int i=0; i<kItemsLegend; i++)
+        fColors[i] = 16;
+
+    if (!gPad)
+        Draw();
+
+    TText txt;
+    txt.SetTextFont(122);
+    txt.SetTextAlign(22);   // centered/centered
+
+    for (Int_t i=0; i<fNcells-2; i++)
+    {
+        TString num;
+        num += (*fGeomCam)[i].GetSector();
 
         const MGeomPix &h = (*fGeomCam)[i];
@@ -678,14 +708,17 @@
 // Only 'used' pixels are added.
 //
-void MHCamera::AddCamContent(const TArrayD &event, Bool_t ispos)
+void MHCamera::AddCamContent(const TArrayD &event, const TArrayC *used)
 {
     if (event.GetSize()!=fNcells-2)
         return;
 
+    if (used && used->GetSize()!=fNcells-2)
+        return;
+
     for (Int_t idx=0; idx<fNcells-2; idx++)
     {
         Fill(idx, const_cast<TArrayD&>(event)[idx]); // FIXME: Slow!
 
-        if (!ispos || fArray[idx+1]>0)
+        if (used && (*used)[idx])
             SetUsed(idx);
     }
@@ -814,4 +847,10 @@
 Int_t MHCamera::GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog)
 {
+    if (TMath::IsNaN(val)) // FIXME: gLog!
+    {
+        cout << "MHCamera::GetColor: " << GetName() << " <" << GetTitle() << "> - Color for val=NaN (Not a Number) requested... set val=min." << endl;
+        val = min;
+    }
+
     //
     //   first treat the over- and under-flows
@@ -833,4 +872,5 @@
     else
         ratio = (val-min) / (max-min);
+
     const Int_t colidx = (Int_t)(ratio*maxcolidx + .5);
     return fColors[colidx];
@@ -930,15 +970,11 @@
         return TH1D::DistancetoPrimitive(px, py);
 
-    Int_t dist = 999999;
-
     for (Int_t i=0; i<fNcells-2; i++)
     {
         MHexagon hex((*fGeomCam)[i]);
-        Int_t d = hex.DistancetoPrimitive(px, py);
-
-        if (d<dist)
-            dist=d;
-    }
-    return dist==0?0:999999;
+        if (hex.DistancetoPrimitive(px, py)==0)
+            return 0;
+    }
+    return 999999;
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2231)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2236)
@@ -90,7 +90,7 @@
     virtual void     AddCamContent(const MCamEvent &evt, Int_t type=0);
     virtual void     AddCamContent(const MHCamera &evt, Int_t type=0);
-    virtual void     AddCamContent(const TArrayD &arr, Bool_t ispos=kTRUE);
+    virtual void     AddCamContent(const TArrayD &arr, const TArrayC *used=NULL);
     virtual void     SetCamContent(const MCamEvent &evt, Int_t type=0) { Reset(); AddCamContent(evt, type); }
-    virtual void     SetCamContent(const TArrayD &evt, Bool_t ispos=kTRUE) { Reset(); AddCamContent(evt, ispos); }
+    virtual void     SetCamContent(const TArrayD &evt, const TArrayC *used=NULL) { Reset(); AddCamContent(evt, used); }
     virtual void     SetCamContent(const MHCamera &d, Int_t type=0) { Reset(), AddCamContent(d, type); }
     virtual void     CntCamContent(const MCamEvent &evt, Double_t threshold, Int_t type=0);
@@ -111,4 +111,5 @@
 
     void  DrawPixelIndices();
+    void  DrawSectorIndices();
 
     void  PrintInfo() const { Print(""); } // *MENU*
