Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3513)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3514)
@@ -20,8 +20,8 @@
 
  2004/03/15: Markus Gaug 
-   * mcalib/MCalibrationChargePix.[h,cc]
-   * mcalib/MCalibrationChargeCam.[h,cc]
-   * mcalib/MCalibrationChargeCalc.cc
-
+
+   * mcalib/MCalibrationChargePix.[h,cc],
+     mcalib/MCalibrationChargeCam.[h,cc],
+     mcalib/MCalibrationChargeCalc.cc:
    - conversion from hi- to logain now not applied until the value is 
      exported outside the class. This is necessary for the error 
@@ -29,5 +29,4 @@
      number of Phe, the conversion factors cancel out and do not 
      enlarge the errors 
-
    - pixels with number of phe's outside the range defined by 
      fPheFFactorRelErrLimit are not any more declared as: 
@@ -38,11 +37,10 @@
      no reasonable results in the calibration without bothering that
      too many pixels fall out. Enjoy!
-
    - In that procedure, the classes passed _internally_ from calculation
      of sigmas to calculation of variances which saves all the useless 
      square rooting.
-
    - took out pointers to MCalibraitonChargeBlindPix and 
      MCalibrationChargePINDiode in MCalibrationChargeCam.
+
 
 
@@ -119,4 +117,12 @@
    * mbase/Makefile, mbase/BaseLinkDef.h:
      - added MStatusArray
+
+   * mraw/MRawEvtPixelIter.cc:
+     - GetIdxMaxLoGainSample(const Byte_t lofirst) const
+       accelerated and fixed (the first slice was compared to itself
+       and the last slice was not taken into account)
+
+   * mhits/MHCamera.[h,cc], mgui/MHexagon.[h,cc]:
+     - improved drawing MHCamera with 'same' option
 
 
Index: trunk/MagicSoft/Mars/mgui/MHexagon.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 3513)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 3514)
@@ -112,11 +112,11 @@
 // All calcutations are running in pixel coordinates
 //
-Int_t MHexagon::DistancetoPrimitive(Int_t px, Int_t py)
+Int_t MHexagon::DistancetoPrimitive(Int_t px, Int_t py, Float_t conv)
 {
     //
     //  compute the distance of the Point to the center of the Hexagon
     //
-    const Int_t pxhex = gPad->XtoAbsPixel(fX);
-    const Int_t pyhex = gPad->YtoAbsPixel(fY);
+    const Int_t pxhex = gPad->XtoAbsPixel(fX*conv);
+    const Int_t pyhex = gPad->YtoAbsPixel(fY*conv);
 
     const Double_t x = TMath::Abs(px-pxhex);
@@ -137,6 +137,6 @@
     const Double_t dy = fD/2 * sina;
 
-    const Int_t pxborder = gPad->XtoAbsPixel(fX + dx);
-    const Int_t pyborder = gPad->YtoAbsPixel(fY + dy);
+    const Int_t pxborder = gPad->XtoAbsPixel((fX + dx)*conv);
+    const Int_t pyborder = gPad->YtoAbsPixel((fY + dy)*conv);
 
     const Double_t bx = pxhex-pxborder;
@@ -149,5 +149,5 @@
     //  here in the first implementation is just circle inside
     //
-    return distborder < disthex ? (int)(disthex-distborder+1) : 0;
+    return distborder < disthex ? (int)((disthex-distborder)/conv+1) : 0;
 }
 
Index: trunk/MagicSoft/Mars/mgui/MHexagon.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 3513)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 3514)
@@ -49,5 +49,9 @@
         ;
 
-    virtual Int_t   DistancetoPrimitive(Int_t px, Int_t py);
+    Int_t DistancetoPrimitive(Int_t px, Int_t py, Float_t conv);
+    virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
+    {
+        return DistancetoPrimitive(px, py, 1);
+    }
     virtual Float_t DistanceToPrimitive(Float_t px, Float_t py);
     virtual void  DrawHexagon(Float_t x, Float_t y, Float_t d);
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 3513)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 3514)
@@ -1262,5 +1262,14 @@
         return TH1D::DistancetoPrimitive(px, py);
 
-    if (GetPixelIndex(px, py)>=0)
+    const Bool_t issame = TString(GetDrawOption()).Contains("same", TString::kIgnoreCase);
+
+    const Float_t maxr = (1-fGeomCam->GetConvMm2Deg())*fGeomCam->GetMaxRadius()/2;
+    const Float_t conv = !issame ||
+        gPad->GetX1()<-maxr || gPad->GetY1()<-maxr ||
+        gPad->GetX2()> maxr || gPad->GetY2()>maxr ? 1 : fGeomCam->GetConvMm2Deg();
+
+    cout << conv << endl;
+
+    if (GetPixelIndex(px, py, conv)>=0)
         return 0;
 
@@ -1279,5 +1288,5 @@
 //
 //
-Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py) const
+Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py, Float_t conv) const
 {
     if (fNcells<=1)
@@ -1288,5 +1297,5 @@
     {
         MHexagon hex((*fGeomCam)[i]);
-        if (hex.DistancetoPrimitive(px, py)>0)
+        if (hex.DistancetoPrimitive(px, py, conv)>0)
             continue;
 
Index: trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 3513)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 3514)
@@ -66,5 +66,5 @@
     TPaveStats *GetStatisticBox();
 
-    Int_t GetPixelIndex(Int_t px, Int_t py) const;
+    Int_t GetPixelIndex(Int_t px, Int_t py, Float_t conv=1) const;
 
     void PaintAxisTitle();
