Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 859)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 959)
@@ -12,56 +12,58 @@
 #include "MGeomCam.h"
 
-#include "MCerPhotEvt.h" 
+#include "MCerPhotEvt.h"
 
 #define kITEMS_LEGEND 25
 
-ClassImp(MCamDisplay)
-
-MCamDisplay::MCamDisplay (MGeomCam *geom) : fAutoScale(kTRUE)
-{ 
-    // default constructor
-
+ClassImp(MCamDisplay);
+
+// ------------------------------------------------------------------------
+//
+//  default constructor
+//
+MCamDisplay::MCamDisplay(MGeomCam *geom) : fAutoScale(kTRUE)
+{
     //
     //    set the color palette
     //
-    gStyle->SetPalette(1,0) ;
+    gStyle->SetPalette(1, 0);
 
     //
     //  create the hexagons of the display
     //
-    fNumPixels = geom->GetNumPixels() ;
-    fPixels    = new TClonesArray("MHexagon", fNumPixels ) ;
-
-    for (UInt_t i=0; i< fNumPixels; i++ )
-        (*fPixels)[i] = new MHexagon((*geom)[i]) ;
+    fNumPixels = geom->GetNumPixels();
+    fPixels    = new TClonesArray("MHexagon", fNumPixels);
+
+    for (UInt_t i=0; i<fNumPixels; i++)
+        (*fPixels)[i] = new MHexagon((*geom)[i]);
 
     //
     // set the range to default
     //
-    fMinPhe  = -2.  ;
-    fMaxPhe  = 50. ;
+    fMinPhe = -2.;
+    fMaxPhe = 50.;
 
     //
     // set up the Legend
     //
-    fLegend  = new TClonesArray("TBox",  kITEMS_LEGEND ) ;
-    fLegText = new TClonesArray("TText", kITEMS_LEGEND ) ;
-
-    char text[10] ;
-    for ( Int_t il = 0 ; il < kITEMS_LEGEND ; il++ )
+    fLegend  = new TClonesArray("TBox",  kITEMS_LEGEND);
+    fLegText = new TClonesArray("TText", kITEMS_LEGEND);
+
+    char text[10];
+    for (Int_t il = 0; il<kITEMS_LEGEND; il++)
     {
         const Int_t y = il*40;
 
-        TBox  *newbox = new TBox (650, y-500, 700, y-460 );
-        TText *newtxt = new TText(720, y-480, text );
+        TBox  *newbox = new TBox (650, y-500, 700, y-460);
+        TText *newtxt = new TText(720, y-480, text);
 
         const Float_t lvl = 50. / kITEMS_LEGEND * il;
 
-        newbox->SetFillColor( GetColor(lvl) );
-
-        sprintf ( text, "%5.1f", lvl ) ;
-
-        newtxt->SetTextSize (0.025) ;
-        newtxt->SetTextAlign(12) ;
+        newbox->SetFillColor(GetColor(lvl));
+
+        sprintf(text, "%5.1f", lvl);
+
+        newtxt->SetTextSize(0.025);
+        newtxt->SetTextAlign(12);
 
         (*fLegend) [il] = newbox;
@@ -70,24 +72,36 @@
 }
 
-MCamDisplay::~MCamDisplay() 
-{ 
-    delete fPixels ;
-}
-
-
-void MCamDisplay::Init() 
-{ 
-    //
-    // Set the right colors
-    //
-    gStyle->SetPalette(1, 0) ;
-
+// ------------------------------------------------------------------------
+//
+//
+MCamDisplay::~MCamDisplay()
+{
+    delete fPixels;
+}
+
+// ------------------------------------------------------------------------
+//
+//
+void MCamDisplay::Draw(Option_t *option)
+{
     //
     // if no canvas is yet existing to draw into, create a new one
     //
-    if (!gPad) new TCanvas("display", "MAGIC display", 0, 0, 650, 500);
-
-    //
-    // draw all pixels of the camera
+    if (!gPad)
+        new TCanvas("CamDisplay", "Magic Camera Display", 0, 0, 650, 500);
+    else
+        gPad->Clear();
+
+    //
+    // Setup the correct environment
+    //
+    gStyle->SetPalette(1, 0);
+
+    gPad->Range(-600, -600, 900, 600);
+    gPad->SetFillColor(22);
+
+    //
+    // Draw all pixels of the camera
+    //  (means apend all pixelobjects to the current pad)
     //
     for (UInt_t i=0; i<fNumPixels; i++)
@@ -102,30 +116,10 @@
         GetText(i)->Draw();
     }
-} 
-
-
-void MCamDisplay::Draw(Option_t *option  ) 
-{
-  // 
-
-    //
-    //  check if there a pad exists, if not create one
-    //
-    if ( !gPad ) Init() ;
-
-    //
-    // set init values
-    //
-    gPad->Range (-600, -600, 900, 600) ;
-    gPad->SetFillColor(22) ;
-
-    //
-    // mark pad as modified and update screen
-    //
-    gPad->Modified() ;
-    gPad->Update() ;
-}  
-
-void MCamDisplay::DrawPhotNum( MCerPhotEvt *event)
+}
+
+// ------------------------------------------------------------------------
+//
+//
+void MCamDisplay::DrawPhotNum(const MCerPhotEvt *event)
 {
 
@@ -134,5 +128,5 @@
     // determine the Pixel Id and the content
     //
-    Reset() ;
+    Reset();
 
     //
@@ -140,13 +134,13 @@
     //  each event
     //
-    if ( fAutoScale )
-    {
-        fMinPhe = event->GetNumPhotonsMin() ;
-        fMaxPhe = event->GetNumPhotonsMax() ;
+    if (fAutoScale)
+    {
+        fMinPhe = event->GetNumPhotonsMin();
+        fMaxPhe = event->GetNumPhotonsMax();
 
         if (fMaxPhe < 20.)
-            fMaxPhe = 20. ;
-
-        UpdateLegend() ;
+            fMaxPhe = 20.;
+
+        UpdateLegend();
     }
 
@@ -156,5 +150,5 @@
     const Int_t entries = event->GetNumPixels();
 
-    for (Int_t i=0 ; i<entries; i++ )
+    for (Int_t i=0; i<entries; i++)
     {
         MCerPhotPix &pix = (*event)[i];
@@ -167,15 +161,19 @@
 
     //
-    // update the picture
-    //
-    Draw() ;
-}  
-
-void MCamDisplay::DrawPhotErr( MCerPhotEvt *event)
+    // Update display physically
+    //
+    gPad->Modified();
+    gPad->Update();
+}
+
+// ------------------------------------------------------------------------
+//
+//
+void MCamDisplay::DrawPhotErr(const MCerPhotEvt *event)
 {
     //
     // reset the all pixel colors to a default value
     //
-    Reset() ;
+    Reset();
 
     //
@@ -183,7 +181,7 @@
     // determine the Pixel Id and the content
     //
-    const Int_t entries = event->GetNumPixels() ;
-
-    for (Int_t i=0 ; i<entries; i++ )
+    const Int_t entries = event->GetNumPixels();
+
+    for (Int_t i=0 ; i<entries; i++)
     {
         MCerPhotPix &pix = (*event)[i];
@@ -193,42 +191,44 @@
 
     //
-    // update display
-    //
-    Draw() ;
-}  
-
-
-void MCamDisplay::Reset() 
-{
-    //
-    // reset the all pixel colors to a default value
-    //
-    for ( UInt_t i=0 ; i< fNumPixels ; i++ )
-        (*this)[i].SetFillColor(10) ;
+    // Update display physically
+    //
+    gPad->Modified();
+    gPad->Update();
+}
+
+
+// ------------------------------------------------------------------------
+//
+// reset the all pixel colors to a default value
+//
+void MCamDisplay::Reset()
+{
+    for (UInt_t i=0; i<fNumPixels; i++)
+        (*this)[i].SetFillColor(10);
 } 
 
+// ------------------------------------------------------------------------
+//
+//   Here we calculate the color index for the current value.
+//   The color index is defined with the class TStyle and the
+//   Color palette inside. We use the command gStyle->SetPalette(1,0)
+//   for the display. So we have to convert the value "wert" into
+//   a color index that fits the color palette.
+//   The range of the color palette is defined by the values fMinPhe
+//   and fMaxRange. Between this values we have 50 color index, starting
+//   with 0 up to 49.
+//
 Int_t MCamDisplay::GetColor(Float_t val)
 {
     //
-    //   Here we calculate the color index for the current value.
-    //   The color index is defined with the class TStyle and the
-    //   Color palette inside. We use the command gStyle->SetPalette(1,0)
-    //   for the display. So we have to convert the value "wert" into
-    //   a color index that fits the color palette.
-    //   The range of the color palette is defined by the values fMinPhe
-    //   and fMaxRange. Between this values we have 50 color index, starting
-    //   with 0 up to 49.
-    //
-
-    //
     //   first treat the over- and under-flows
     //
     const Float_t maxcolidx = 49.0;
 
-    if (val >= fMaxPhe )
+    if (val >= fMaxPhe)
         return gStyle->GetColorPalette(maxcolidx);
 
-    if (val <= fMinPhe )
-        return gStyle->GetColorPalette( 0 );
+    if (val <= fMinPhe)
+        return gStyle->GetColorPalette(0);
 
     //
@@ -236,17 +236,17 @@
     //
     const Float_t ratio  = (val-fMinPhe) / (fMaxPhe-fMinPhe);
-    const Int_t   colidx = (Int_t)(maxcolidx*ratio + .5) ;
-
-    return gStyle->GetColorPalette(colidx) ;
-}
-
-void MCamDisplay::UpdateLegend() 
-{
-    //
-    //    change the text on the legend according to the range of the
-    //    Display
-    //
-
-    char text[10] ;
+    const Int_t   colidx = (Int_t)(maxcolidx*ratio + .5);
+
+    return gStyle->GetColorPalette(colidx);
+}
+
+// ------------------------------------------------------------------------
+//
+//    change the text on the legend according to the range of the
+//    Display
+//
+void MCamDisplay::UpdateLegend()
+{
+    char text[10];
 
     for (Int_t il=0; il < kITEMS_LEGEND; il++)
@@ -258,5 +258,5 @@
         TText &txt = *GetText(il);
 
-        txt.SetText(txt.GetX(), txt.GetY(), text) ;
-    }
-}
+        txt.SetText(txt.GetX(), txt.GetY(), text);
+    }
+}
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 859)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 959)
@@ -27,23 +27,23 @@
 class MCamDisplay : public TObject
 {
- private: 
-     Bool_t         fAutoScale;   //  indicating the autoscale function
+private:
+    Bool_t         fAutoScale;   //  indicating the autoscale function
 
-     UInt_t         fNumPixels;
-     TClonesArray  *fPixels ;
+    UInt_t         fNumPixels;
+    TClonesArray  *fPixels;
 
-     Float_t        fMinPhe;      //  The minimal number of Phe
-     Float_t        fMaxPhe;      //  The maximum number of Phe
+    Float_t        fMinPhe;      //  The minimal number of Phe
+    Float_t        fMaxPhe;      //  The maximum number of Phe
 
-     TClonesArray  *fLegend;
-     TClonesArray  *fLegText;
+    TClonesArray  *fLegend;
+    TClonesArray  *fLegText;
 
-     TBox *GetBox(Int_t i)   { return (TBox*) fLegend->At(i); }
-     TText *GetText(Int_t i) { return (TText*)fLegText->At(i); }
+    TBox *GetBox(Int_t i)   { return (TBox*) fLegend->At(i); }
+    TText *GetText(Int_t i) { return (TText*)fLegText->At(i); }
 
-     void SetPixColor(MCerPhotPix &pix)
-     {
-         (*this)[pix.GetPixId()].SetFillColor( GetColor(pix.GetNumPhotons()));
-     }
+    void SetPixColor(MCerPhotPix &pix)
+    {
+        (*this)[pix.GetPixId()].SetFillColor( GetColor(pix.GetNumPhotons()));
+    }
 
 public:
@@ -51,12 +51,10 @@
     MCamDisplay (MGeomCam *geom);
 
-    ~MCamDisplay ();
+    ~MCamDisplay();
 
-    void Init();
+    void Draw(Option_t *option = "");
 
-    void Draw(Option_t *option = "" );
-
-    void DrawPhotNum( MCerPhotEvt *event);
-    void DrawPhotErr( MCerPhotEvt *event);
+    void DrawPhotNum(const MCerPhotEvt *event);
+    void DrawPhotErr(const MCerPhotEvt *event);
 
     void Reset();
@@ -64,9 +62,9 @@
     MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
 
-    Int_t GetColor( Float_t wert );
+    Int_t GetColor(Float_t wert);
 
     void UpdateLegend();
 
-    void SetAutoScale (Bool_t input = kTRUE )
+    void SetAutoScale(Bool_t input = kTRUE)
     {
         fAutoScale = input;
Index: trunk/MagicSoft/Mars/mgui/MHexagon.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 859)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 959)
@@ -30,45 +30,64 @@
 #include "MHexagon.h"
 
+#include <iostream.h>
+
 #include <TVirtualPad.h>  // gPad
 
 #include "MGeomPix.h"     // GetX
 
-ClassImp(MHexagon) 
-
-MHexagon::MHexagon() 
-{
-  //   default constructor for MHexagon 
-
+ClassImp(MHexagon);
+
+// ------------------------------------------------------------------------
+//
+//   default constructor for MHexagon
+//
+MHexagon::MHexagon()
+{
+}
+
+// ------------------------------------------------------------------------
+//
+//    normal constructor for MHexagon
+//
+MHexagon::MHexagon(Float_t x, Float_t y, Float_t d)
+: TAttFill(0, 1001), fX(x), fY(y), fD(d)
+{
+}
+
+// ------------------------------------------------------------------------
+//
+//    normal constructor for MHexagon
+//
+MHexagon::MHexagon(MGeomPix &pix)
+: TAttFill(0, 1001)
+{
+    fX = pix.GetX();
+    fY = pix.GetY();
+    fD = pix.GetR();
+}
+
+// ------------------------------------------------------------------------
+//
+//    copy constructor for MHexagon
+//
+MHexagon::MHexagon(const MHexagon &hexagon)
+{
+    ((MHexagon&) hexagon).Copy(*this);
 } 
 
-MHexagon::MHexagon(Float_t x, Float_t y, Float_t d )
- : TAttFill(0, 1001), fX(x), fY(y), fD(d)
-{ 
-  //    normal constructor for MHexagon
-}
-
-MHexagon::MHexagon(MGeomPix &pix)
- : TAttFill(0, 1001)
-{
-  //    normal constructor for MHexagon
-   fX = pix.GetX();
-   fY = pix.GetY();
-   fD = pix.GetR();
-}
-
-MHexagon::MHexagon( const MHexagon &hexagon)
-{
-  //    copy constructor for MHexagon 
-  ((MHexagon&) hexagon).Copy(*this) ; 
-} 
-
+// ------------------------------------------------------------------------
+//
+//     default destructor for MHexagon
+//
 MHexagon::~MHexagon()
-{ 
-  //     default destructor for MHexagon
-}  
-
-void MHexagon::Copy( TObject &obj ) 
-{ 
-    //     copy this hexagon to hexagon
+{
+}
+
+// ------------------------------------------------------------------------
+//
+//     copy this hexagon to hexagon
+//
+void MHexagon::Copy(TObject &obj)
+{
     MHexagon &hex = (MHexagon&) obj;
 
@@ -77,144 +96,158 @@
     TAttFill::Copy(hex);
 
-    hex.fX = fX ;
-    hex.fY = fY ;
-    hex.fD = fD ;
-}
-Int_t MHexagon::DistancetoPrimitive( Int_t px, Int_t py )
-{
-    //   compute the distance of a point (px,py) to the Hexagon
-    //   this functions needed for graphical primitives, that
-    //   means without this function you are not able to interact
-    //   with the graphical primitive with the mouse!!!
-    //
-    //   All calcutations are running in pixel coordinates
-
-    //       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 Double_t DistPointHexagon = TMath::Sqrt( Double_t ((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py))) ; 
-  const Double_t cosa = TMath::Abs(px-pxhex) / DistPointHexagon ; 
-  const Double_t sina = TMath::Abs(py-pyhex) / DistPointHexagon ; 
-
-  //       comput the distance to pixel border 
-  
-  const Double_t   dx = fD * cosa / 2 ; 
-  const Double_t   dy = fD * sina / 2 ; 
-  
-  const Double_t   xborder = fX + dx ; 
-  const Double_t   yborder = fY + dy ; 
-
-  const Int_t  pxborder = gPad->XtoAbsPixel( xborder ) ; 
-  const Int_t  pyborder = gPad->YtoAbsPixel( yborder ) ; 
-  
-  const Double_t DistBorderHexagon = TMath::Sqrt( Double_t ((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex))) ;  
-  
- 
-  //       compute the distance from the border of Pixel  
-  //       here in the first implementation is just circle inside
-
-  return DistBorderHexagon <  DistPointHexagon ? 999999 : 0;
-} 
-
-void MHexagon::DrawHexagon( Float_t x, Float_t y, Float_t d )
+    hex.fX = fX;
+    hex.fY = fY;
+    hex.fD = fD;
+}
+
+// ------------------------------------------------------------------------
+//
+// compute the distance of a point (px,py) to the Hexagon
+// this functions needed for graphical primitives, that
+// means without this function you are not able to interact
+// with the graphical primitive with the mouse!!!
+//
+// All calcutations are running in pixel coordinates
+//
+Int_t MHexagon::DistancetoPrimitive(Int_t px, Int_t py)
+{
+    //
+    //  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 Double_t disthex = TMath::Sqrt((Double_t)((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py)));
+
+    const Double_t cosa = TMath::Abs(px-pxhex) / disthex;
+    const Double_t sina = TMath::Abs(py-pyhex) / disthex;
+
+    //
+    // comput the distance to pixel border
+    //
+    const Double_t dx = fD * cosa / 2;
+    const Double_t dy = fD * sina / 2;
+
+    const Double_t xborder = fX + dx;
+    const Double_t yborder = fY + dy;
+
+    const Int_t pxborder = gPad->XtoAbsPixel(xborder);
+    const Int_t pyborder = gPad->YtoAbsPixel(yborder);
+
+    const Double_t distborder = TMath::Sqrt((Double_t)((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex)));
+
+    //
+    //  compute the distance from the border of Pixel
+    //  here in the first implementation is just circle inside
+    //
+    return distborder < disthex ? 999999 : 0;
+}
+
+// ------------------------------------------------------------------------
+//
+//  Draw this ellipse with new coordinate
+//
+void MHexagon::DrawHexagon(Float_t x, Float_t y, Float_t d)
 { 
-  //   Draw this ellipse with new coordinate
-  
-  MHexagon *newhexagon = new MHexagon(x, y, d ) ; 
-  TAttLine::Copy(*newhexagon) ; 
-  TAttFill::Copy(*newhexagon) ; 
-
-  newhexagon->SetBit (kCanDelete) ; 
-  newhexagon->AppendPad() ; 
-} 
-
-void MHexagon::ExecuteEvent(Int_t event, Int_t px, Int_t py ) { 
-  //    This is the first test of implementing a clickable interface
-  //    for one pixel
-
-  switch ( event ) { 
-
-  case kButton1Down: 
-    
-    printf ("\n kButton1Down \n" ) ; 
-    SetFillColor(2) ;
-    gPad->Modified() ; 
-    break;     
-
-  case kButton1Double: 
-    SetFillColor(0) ;
-    gPad->Modified() ; 
-    break;     
-    //  case kMouseEnter:  
-    //     printf ("\n Mouse inside object \n" ) ; 
-    //     break; 
-  } 
-
-} 
-
-
-
-void MHexagon::ls( Option_t *)
-{
-  //     list this hexagon with its attributes
-  TROOT::IndentLevel() ; 
-  printf ("%s:  X= %f  Y= %f R= %f \n", GetName(), fX, fY, fD ) ;
-} 
-
-void MHexagon::Paint(Option_t * ) 
-{
-  //     paint this hexagon with its attribute
-
-  PaintHexagon(fX, fY, fD ) ; 
-} 
-
-
-void MHexagon::PaintHexagon (Float_t inX, Float_t inY, Float_t inD ) 
+    MHexagon *newhexagon = new MHexagon(x, y, d);
+
+    TAttLine::Copy(*newhexagon);
+    TAttFill::Copy(*newhexagon);
+
+    newhexagon->SetBit(kCanDelete);
+    newhexagon->AppendPad();
+}
+
+// ------------------------------------------------------------------------
+//
+//  This is the first test of implementing a clickable interface
+//  for one pixel
+//
+void MHexagon::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+{
+
+    switch (event)
+    {
+    case kButton1Down:
+        cout << endl << "kButton1Down" << endl;
+        SetFillColor(2);
+        gPad->Modified();
+        break;
+
+    case kButton1Double:
+        SetFillColor(0);
+        gPad->Modified();
+        break;
+        //  case kMouseEnter:
+        //     printf ("\n Mouse inside object \n" ) ;
+        //     break;
+    }
+}
+
+// ------------------------------------------------------------------------
+//
+//  list this hexagon with its attributes
+//
+void MHexagon::ls(Option_t *)
+{
+    TROOT::IndentLevel();
+    Print();
+}
+
+// ------------------------------------------------------------------------
+//
+//  paint this hexagon with its attribute
+//
+void MHexagon::Paint(Option_t *)
+{
+    PaintHexagon(fX, fY, fD);
+}
+
+// ------------------------------------------------------------------------
+//
+//  draw this hexagon with the coordinates
+//
+void MHexagon::PaintHexagon(Float_t inX, Float_t inY, Float_t inD)
 { 
-  //      draw this hexagon with the coordinates
-
-  const Int_t np =  6 ; 
-  
-  const Float_t dx[np+1] = { .5   , 0.    , -.5   , -.5   , 0.    ,  .5   , .5    } ;
-  const Float_t dy[np+1] = { .2886,  .5772,  .2886, -.2886, -.5772, -.2886, .2886 } ;
-
-  static Float_t x[np+1], y[np+1] ; 
-  
-  TAttLine::Modify() ;    // Change line attributes only if neccessary
-  TAttFill::Modify() ;    // Change fill attributes only if neccessary
-    
-  //  calculate the positions of the pixel corners
-
-  for ( Int_t i=0; i<=np; i++ ) { 
-    x[i] = inX + dx[i]* inD ; 
-    y[i] = inY + dy[i]* inD ; 
-  } 
-
-  //   paint the pixel (hopefully) 
-  
-  if ( GetFillColor() ) gPad->PaintFillArea(np, x, y) ; 
-  if ( GetLineStyle() ) gPad->PaintPolyLine(np+1, x, y) ; 
-  
-} 
-
-void MHexagon::Print( Option_t * )
-{
-  //     print/dump this hexagon with its attributes
-  printf ("Ellipse:  X= %f  Y= %f R= %f ", fX, fY, fD ) ;
-  
-  if ( GetLineColor() != 1 ) printf (" Color=%d", GetLineColor() ) ; 
-  if ( GetLineStyle() != 1 ) printf (" Color=%d", GetLineStyle() ) ; 
-  if ( GetLineWidth() != 1 ) printf (" Color=%d", GetLineWidth() ) ;
-
-  if ( GetFillColor() != 0 ) printf (" FillColor=%d", GetFillColor() ) ; 
-
-  printf ("\n") ; 
-} 
-
-
-
-
-
-
+
+    const Int_t np = 6;
+
+    const Float_t dx[np+1] = { .5   , 0.    , -.5   , -.5   , 0.    ,  .5   , .5    };
+    const Float_t dy[np+1] = { .2886,  .5772,  .2886, -.2886, -.5772, -.2886, .2886 };
+
+    static Float_t x[np+1], y[np+1];
+
+    TAttLine::Modify();    // Change line attributes only if neccessary
+    TAttFill::Modify();    // Change fill attributes only if neccessary
+
+    //  calculate the positions of the pixel corners
+
+    for (Int_t i=0; i<=np; i++)
+    {
+        x[i] = inX + dx[i]* inD;
+        y[i] = inY + dy[i]* inD;
+    }
+
+    //   paint the pixel (hopefully)
+
+    if (GetFillColor())
+        gPad->PaintFillArea(np, x, y);
+
+    if (GetLineStyle())
+        gPad->PaintPolyLine(np+1, x, y);
+
+}
+
+// ------------------------------------------------------------------------
+//
+//  print/dump this hexagon with its attributes
+//
+void MHexagon::Print(Option_t *)
+{
+    cout << GetName() << ": X=" << fX << " Y=" << fY << "R=" << fD << endl;
+
+    cout << " Color="     << GetLineColor() << endl;
+    cout << " Style="     << GetLineStyle() << endl;
+    cout << " Width="     << GetLineWidth() << endl;
+    cout << " FillColor=" << GetFillColor() << endl;
+}
