Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 609)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 653)
@@ -2,4 +2,5 @@
 
 #include <math.h>
+
 #include <TClonesArray.h>
 #include <TCanvas.h>
@@ -9,96 +10,103 @@
 
 #include "MHexagon.h"
-#include "MCamGeom.h"
+#include "MGeomCam.h"
 
 #include "MCerPhotEvt.h" 
 
+#define kITEMS_LEGEND 25
 
 ClassImp(MCamDisplay)
 
-MCamDisplay::MCamDisplay (Int_t type ) 
+    MCamDisplay::MCamDisplay (Int_t type ) : fAutoScale(kTRUE)
 { 
-  //    default constructor
-
-  //    set the color palette 
-
-  gStyle->SetPalette(1,0) ; 
-
-  fAutoScale  = kTRUE ; 
-  
-  MCamGeom *geometry  = new MCamGeom( type ) ; 
-
-  fNbPixels = geometry->GetNbPixels() ; 
-  fPixels = new TClonesArray("MHexagon", fNbPixels ) ; 
-
-  //  create the hexagons of the display
-  
-  TClonesArray &obj = *fPixels ; 
-  
-  for (Int_t i=0; i< fNbPixels; i++ ) 
-    { 
-      new (obj[i]) MHexagon(geometry->GetX(i) , 
-			    geometry->GetY(i) , 
-			    geometry->GetR(i) ) ; 
-    } 
-
-  // set the range to default
-
-  fMinPhe  = -2.  ; 
-  fMaxPhe  = 50. ; 
-
-  // set up the Legend 
-
-  fLegend = new TClonesArray("TBox", ITEMS_LEGEND ) ; 
-  TClonesArray &obj1 = *fLegend ; 
-
-  fLegText = new TClonesArray("TText", ITEMS_LEGEND ) ; 
-  TClonesArray &obj2 = *fLegText ; 
-  
-  char text[100] ; 
-
-  Float_t help ; 
-
-  help = 50. / ITEMS_LEGEND ; 
-
-  for ( Int_t il = 0 ; il < ITEMS_LEGEND ; il++ ) 
-    { 
-      new ( obj1[il] ) TBox(650, il*40-500 , 700, il*40-460 ) ; 
-      ( (TBox*) fLegend->At(il))->SetFillColor( GetColor ( (Float_t) help*il) ) ;
-  
-      sprintf ( text, "%5.1f",  (Float_t) help * il ) ; 
-      new ( obj2[il] ) TText(720, il*40-480, text ) ;
-      ( (TText*) fLegText->At(il))->SetTextSize (0.025) ; 
-      ( (TText*) fLegText->At(il))->SetTextAlign(12) ; 
-  } 
-} 
+    // default constructor
+
+    //
+    // create a object which contains the camera geometry
+    //
+    MGeomCam geom(type) ;
+
+    //
+    //    set the color palette
+    //
+    gStyle->SetPalette(1,0) ;
+
+    //
+    //  create the hexagons of the display
+    //
+    fNbPixels = geom.GetNbPixels() ;
+    fPixels   = new TClonesArray("MHexagon", fNbPixels ) ;
+
+    for (Int_t i=0; i< fNbPixels; i++ )
+    {
+        (*fPixels)[i] = new MHexagon(geom[i]) ;
+    }
+
+    //
+    // set the range to default
+    //
+    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++ )
+    {
+        const Int_t y = il*40;
+
+        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) ;
+
+        (*fLegend) [il] = newbox;
+        (*fLegText)[il] = newtxt;
+    }
+}
 
 MCamDisplay::~MCamDisplay() 
 { 
-  delete fPixels ; 
-} 
+    delete fPixels ;
+}
 
 
 void MCamDisplay::Init() 
 { 
-
-  // Set the right colors
-  
-  gStyle->SetPalette(1, 0) ; 
-
-  if ( ! gPad ) new TCanvas("display", "MAGIC display", 0, 0, 650, 500) ;
-  
-  for (Int_t i=0; i< fNbPixels; i++) 
-    { 
-      ( (MHexagon*) fPixels->At(i))->Draw() ; 
-    } 
-
-  for (Int_t i=0; i< ITEMS_LEGEND; i++) 
-    { 
-      
-      ( (TBox*) fLegend->At(i))->Draw() ; 
-
-      ( (TText*) fLegText->At(i))->Draw() ; 
-    } 
-  
+    //
+    // Set the right colors
+    //
+    gStyle->SetPalette(1, 0) ;
+
+    //
+    // 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
+    //
+    for (Int_t i=0; i< fNbPixels; i++)
+        (*this)[i].Draw();
+
+    //
+    // draw legend
+    //
+    for (Int_t i=0; i< kITEMS_LEGEND; i++)
+    {
+        GetBox(i)->Draw();
+        GetText(i)->Draw();
+    }
 } 
 
@@ -108,69 +116,91 @@
   // 
 
-  //  check if there a pad exists
-
-  if ( ! gPad ) Init() ; 
-
-  gPad->Range (-600, -600, 900, 600) ; 
-  gPad->SetFillColor(22) ; 
-
-  //
-  
-  gPad->Modified() ; 
-  gPad->Update() ; 
-
-  //gPad->Update() ; 
+    //
+    //  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::Draw( MCerPhotEvt *event) 
-{
-
-  // loop over all pixels in the MCerPhotEvt and
-  // determine the Pixel Id and the content
-
-  Reset() ; 
-
-  //  if the autoscale is true, set the values for the range for 
-  //  each event 
-  
-  if ( fAutoScale == kTRUE ) 
-    { 
-      fMinPhe = event->GetMinimumPhoton() ; 
-      fMaxPhe = event->GetMaximumPhoton() ;
-
-      if ( fMaxPhe < 20. ) fMaxPhe = 20. ; 
-
-
-      UpdateLegend() ; 
-    }  
-
-  //   update the picture 
-
-  for (Int_t i=0 ; i<event->GetNbPixels() ; i++ )
-    {
-      if ( event->IsPixelUsed(i) == kTRUE ) 
-	( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetPhotons(i))) ; 
-   
-    } 
- 
-  Draw() ; 
-  
+void MCamDisplay::DrawPhotNum( MCerPhotEvt *event)
+{
+
+    //
+    // loop over all pixels in the MCerPhotEvt and
+    // determine the Pixel Id and the content
+    //
+    Reset() ;
+
+    //
+    //  if the autoscale is true, set the values for the range for
+    //  each event
+    //
+    if ( fAutoScale )
+    {
+        fMinPhe = event->GetMinNumPhotons() ;
+        fMaxPhe = event->GetMaxNumPhotons() ;
+
+        if (fMaxPhe < 20.)
+            fMaxPhe = 20. ;
+
+        UpdateLegend() ;
+    }
+
+    //
+    //   update the colors in the picture
+    //
+    const Int_t entries = event->GetNbPixels();
+
+    for (Int_t i=0 ; i<entries; i++ )
+    {
+        MCerPhotPix &pix = (*event)[i];
+
+        if (!pix.IsPixelUsed())
+            continue;
+
+        SetPixColor(pix);
+    }
+
+    //
+    // update the picture
+    //
+    Draw() ;
 }  
 
-void MCamDisplay::DrawError( MCerPhotEvt *event) 
-{
-  // 
-
-  // loop over all pixels in the MCerPhotEvt and
-  // determine the Pixel Id and the content
-  Reset() ; 
-
-  for (Int_t i=0 ; i<event->GetNbPixels() ; i++ )
-    {
-      ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetErrorPhot(i)) ) ; 
-    } 
-  
-  Draw() ; 
-  
+void MCamDisplay::DrawPhotErr( MCerPhotEvt *event)
+{
+    //
+    // reset the all pixel colors to a default value
+    //
+    Reset() ;
+
+    //
+    // loop over all pixels in the MCerPhotEvt and
+    // determine the Pixel Id and the content
+    //
+    const Int_t entries = event->GetNbPixels() ;
+
+    for (Int_t i=0 ; i<entries; i++ )
+    {
+        MCerPhotPix &pix = (*event)[i];
+
+        SetPixColor(pix);
+    }
+
+    //
+    // update display
+    //
+    Draw() ;
 }  
 
@@ -178,65 +208,62 @@
 void MCamDisplay::Reset() 
 {
-  for ( Int_t i=0 ; i< fNbPixels ; i++  )
-    { 
-      ( (MHexagon*) fPixels->At(i))->SetFillColor(10) ;
-    } 
-
+    //
+    // reset the all pixel colors to a default value
+    //
+    for ( Int_t i=0 ; i< fNbPixels ; i++ )
+        (*this)[i].SetFillColor(10) ;
 } 
 
-Int_t MCamDisplay::GetColor(Float_t wert ) 
-{
-  //   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
-
-  if ( wert >= fMaxPhe ) 
-    return gStyle->GetColorPalette( 49 )   ; 
-
-  if ( wert <= fMinPhe ) 
-    return gStyle->GetColorPalette( 0 )  ;
-
-  // calculate the color index 
-
-  Int_t ColIndex ; 
-
-  ColIndex =  (Int_t) wert ; 
-  
-  ColIndex =  (Int_t) ( .5 + ( (wert-fMinPhe) * 49. / (fMaxPhe-fMinPhe) ) ) ; 
-
-  return (gStyle->GetColorPalette(ColIndex) ) ; 
-
-} 
-
+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 )
+        return gStyle->GetColorPalette(maxcolidx);
+
+    if (val <= fMinPhe )
+        return gStyle->GetColorPalette( 0 );
+
+    //
+    // calculate the color index
+    //
+    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[100] ; 
-  
-  Float_t x, y, wert,  help ;
-  
-  help = 50./ITEMS_LEGEND ;  
-  
-  for (Int_t il=0; il < ITEMS_LEGEND; il++)
-    { 
-      wert = fMinPhe + (il*help)/50 * (fMaxPhe-fMinPhe) ; 
-      
-      sprintf ( text, "%5.1f", wert ) ; 
-      
-      x = ( (TText*) fLegText->At(il))->GetX () ; 
-      y = ( (TText*) fLegText->At(il))->GetY () ; 
-      ( (TText*) fLegText->At(il))->SetText (x, y,  text ) ; 
-    }  
-  
-} 
+{
+    //
+    //    change the text on the legend according to the range of the
+    //    Display
+    //
+
+    char text[10] ;
+
+    for (Int_t il=0; il < kITEMS_LEGEND; il++)
+    {
+        const Float_t val = fMinPhe + (Float_t)il/kITEMS_LEGEND * (fMaxPhe-fMinPhe) ;
+
+        sprintf(text, "%5.1f", val);
+
+        TText &txt = *GetText(il);
+
+        txt.SetText(txt.GetX(), txt.GetY(), text) ;
+    }
+}
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 609)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 653)
@@ -2,26 +2,46 @@
 #define MCAMDISPLAY_H
 
-#include <iostream>
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+#ifndef MHEXAGON_H
+#include "MHexagon.h"
+#endif
+#ifndef MCERPHOTPIX_H
+#include "MCerPhotPix.h"
+#endif
+#ifndef MCERPHOTEVT_H
+#include "MCerPhotEvt.h"
+#endif
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
+#endif
 
-#include "MAGIC.h"
-
-#define   ITEMS_LEGEND         25 
-
-class TClonesArray ; 
-class MCerPhotEvt  ; 
+class TClonesArray ;
+class MCerPhotEvt  ;
+class TBox;
+class TText;
 
 class MCamDisplay : public TObject
 {
  private: 
-  Bool_t        fAutoScale ;  //  indicating the autoscale function
+  Bool_t        fAutoScale ;   //!  indicating the autoscale function
   
-  Int_t         fNbPixels ;   // 
-  TClonesArray  *fPixels   ;  //!
+  Int_t         fNbPixels ;    //!
+  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 ;    //! 
+
+  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()));
+  }
 
  public:
@@ -35,8 +55,10 @@
   void Draw(Option_t *option = "" ) ; 
 
-  void Draw( MCerPhotEvt *event) ; 
-  void DrawError( MCerPhotEvt *event) ; 
+  void DrawPhotNum( MCerPhotEvt *event) ;
+  void DrawPhotErr( MCerPhotEvt *event) ;
 
   void Reset() ; 
+
+  MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
 
   Int_t GetColor( Float_t wert ) ; 
@@ -49,7 +71,5 @@
     } 
 
-  //Int_t    GetNbPixels() ; 
-  
-  ClassDef(MCamDisplay, 1)		// Base (abstract) class for a task
+  ClassDef(MCamDisplay, 1) // Display the magic camera
 };
 
Index: trunk/MagicSoft/Mars/mgui/MCamGeom.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamGeom.cc	(revision 609)
+++ 	(revision )
@@ -1,403 +1,0 @@
-#include "MCamGeom.h"
-
-#include <math.h>
-#include <TClonesArray.h>
-#include "TCanvas.h"
-
-#include "MHexagon.h"
-
-ClassImp(MPixGeom)
-ClassImp(MCamGeom)
-
-MPixGeom::MPixGeom(Float_t x, Float_t y, Float_t r ) 
-{ 
-  //  default constructor
-  fX = x ; 
-  fY = y ; 
-  fR = r ; 
-} 
-
-
-void MPixGeom::Print() 
-{ 
-  //   information about a pixel
-  cout << "MPixGeom:  x= " << fX
-       << "  y= " << fY
-       << "  r= " << fR
-       << endl ; 
-} 
-
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-MCamGeom::MCamGeom (Int_t type ) 
-{ 
-  //    default constructor
-
-  if ( type == 1 ) {
-    // set up the Geometry of CT1 
-    
-    fNbPixels = 127 ; 
-    fPixels = new TObjArray ( fNbPixels ) ; 
-    
-    CreateCT1() ; 
-  } 
-  else { 
-    // set up the standard Geometry MAGIC
-    fNbPixels = 577 ; 
-    fPixels = new TObjArray ( fNbPixels ) ; 
-
-    CreateMagic() ; 
-  } 
-} 
-
-void MCamGeom::Draw( Option_t * ) 
-{ 
-  TCanvas *can = new TCanvas("can", "Camera Geometry", 4 ) ; 
-  
-  //   set the range of the canvas
-  if ( fNbPixels == 127 )        // case of CT1
-    can->Range(-175, -175, 175, 175 ) ; 
-  else
-    can->Range(-600, -600, 600, 600 ) ; 
-
-  //   draw all pixels
-  
-  for ( Int_t i=0; i < fNbPixels ; i++ ) {   
-    MHexagon *el = new MHexagon ( GetX(i) , GetY(i) , GetR(i) )    ;   
-    el->Draw() ;     
-  } 
-  
-} 
-
-void MCamGeom::Print() 
-{ 
-  //   Print Information about the Geometry of the camera
-  cout << "++++++++++++++++++++++++++++++++++++++++" << endl ; 
-  cout << " Number of Pixels: " << fNbPixels << endl ; 
-
-  for ( Int_t i=0; i<fNbPixels; i++ ) { 
-    cout << " Pixel: " << i << "  " ; 
-    ((MPixGeom *)fPixels->At(i))->Print() ;  
-  } 
-} 
-
-Int_t MCamGeom::GetNbPixels () 
-{ 
-  //   return the Number of pixels in the MCamGeom class
-  return fNbPixels ; 
-
-} 
-Float_t MCamGeom::GetX(Int_t iPix) 
-{
-  //   return the X coordinate of Pixel iPix 
-
-  return ( ((MPixGeom*) fPixels->At(iPix))->GetX() ) ; 
-} 
-
-Float_t MCamGeom::GetY(Int_t iPix) 
-{
-  //   return the Y coordinate of Pixel iPix 
-  return ( ((MPixGeom*) fPixels->At(iPix))->GetY() ) ;  
-}
-
-Float_t MCamGeom::GetR(Int_t iPix) 
-{
-  //   return the radius r of Pixel iPix 
-  return ( ((MPixGeom*) fPixels->At(iPix))->GetR() ) ; 
-}
-
-
-void MCamGeom::CreateMagic() 
-{ 
-  //   fill the geometry class with the coordinates of the MAGIC camera
-  cout << " Create Magic geometry " << endl ;
-
-  //   here define the hardwire things of the magic telescope
-  //
-  Float_t xtemp[577] = { 
-    0.000,   30.000,   15.000,  -15.000,  -30.000,  -15.000,   15.000,   60.000,
-   45.000,   30.000,    0.000,  -30.000,  -45.000,  -60.000,  -45.000,  -30.000,
-    0.000,   30.000,   45.000,   90.000,   75.000,   60.000,   45.000,   15.000,
-  -15.000,  -45.000,  -60.000,  -75.000,  -90.000,  -75.000,  -60.000,  -45.000,
-  -15.000,   15.000,   45.000,   60.000,   75.000,  120.000,  105.000,   90.000,
-   75.000,   60.000,   30.000,    0.000,  -30.000,  -60.000,  -75.000,  -90.000,
- -105.000, -120.000, -105.000,  -90.000,  -75.000,  -60.000,  -30.000,    0.000,
-   30.000,   60.000,   75.000,   90.000,  105.000,  150.000,  135.000,  120.000,
-  105.000,   90.000,   75.000,   45.000,   15.000,  -15.000,  -45.000,  -75.000,
-  -90.000, -105.000, -120.000, -135.000, -150.000, -135.000, -120.000, -105.000,
-  -90.000,  -75.000,  -45.000,  -15.000,   15.000,   45.000,   75.000,   90.000,
-  105.000,  120.000,  135.000,  180.000,  165.000,  150.000,  135.000,  120.000,
-  105.000,   90.000,   60.000,   30.000,    0.000,  -30.000,  -60.000,  -90.000,
- -105.000, -120.000, -135.000, -150.000, -165.000, -180.000, -165.000, -150.000,
- -135.000, -120.000, -105.000,  -90.000,  -60.000,  -30.000,    0.000,   30.000,
-   60.000,   90.000,  105.000,  120.000,  135.000,  150.000,  165.000,  210.000,
-  195.000,  180.000,  165.000,  150.000,  135.000,  120.000,  105.000,   75.000,
-   45.000,   15.000,  -15.000,  -45.000,  -75.000, -105.000, -120.000, -135.000,
- -150.000, -165.000, -180.000, -195.000, -210.000, -195.000, -180.000, -165.000,
- -150.000, -135.000, -120.000, -105.000,  -75.000,  -45.000,  -15.000,   15.000,
-   45.000,   75.000,  105.000,  120.000,  135.000,  150.000,  165.000,  180.000,
-  195.000,  240.000,  225.000,  210.000,  195.000,  180.000,  165.000,  150.000,
-  135.000,  120.000,   90.000,   60.000,   30.000,    0.000,  -30.000,  -60.000,
-  -90.000, -120.000, -135.000, -150.000, -165.000, -180.000, -195.000, -210.000,
- -225.000, -240.000, -225.000, -210.000, -195.000, -180.000, -165.000, -150.000,
- -135.000, -120.000,  -90.000,  -60.000,  -30.000,    0.000,   30.000,   60.000,
-   90.000,  120.000,  135.000,  150.000,  165.000,  180.000,  195.000,  210.000,
-  225.000,  270.000,  255.000,  240.000,  225.000,  210.000,  195.000,  180.000,
-  165.000,  150.000,  135.000,  105.000,   75.000,   45.000,   15.000,  -15.000,
-  -45.000,  -75.000, -105.000, -135.000, -150.000, -165.000, -180.000, -195.000,
- -210.000, -225.000, -240.000, -255.000, -270.000, -255.000, -240.000, -225.000,
- -210.000, -195.000, -180.000, -165.000, -150.000, -135.000, -105.000,  -75.000,
-  -45.000,  -15.000,   15.000,   45.000,   75.000,  105.000,  135.000,  150.000,
-  165.000,  180.000,  195.000,  210.000,  225.000,  240.000,  255.000,  300.000,
-  285.000,  270.000,  255.000,  240.000,  225.000,  210.000,  195.000,  180.000,
-  165.000,  150.000,  120.000,   90.000,   60.000,   30.000,    0.000,  -30.000,
-  -60.000,  -90.000, -120.000, -150.000, -165.000, -180.000, -195.000, -210.000,
- -225.000, -240.000, -255.000, -270.000, -285.000, -300.000, -285.000, -270.000,
- -255.000, -240.000, -225.000, -210.000, -195.000, -180.000, -165.000, -150.000,
- -120.000,  -90.000,  -60.000,  -30.000,    0.000,   30.000,   60.000,   90.000,
-  120.000,  150.000,  165.000,  180.000,  195.000,  210.000,  225.000,  240.000,
-  255.000,  270.000,  285.000,  330.000,  315.000,  300.000,  285.000,  270.000,
-  255.000,  240.000,  225.000,  210.000,  195.000,  180.000,  165.000,  135.000,
-  105.000,   75.000,   45.000,   15.000,  -15.000,  -45.000,  -75.000, -105.000,
- -135.000, -165.000, -180.000, -195.000, -210.000, -225.000, -240.000, -255.000,
- -270.000, -285.000, -300.000, -315.000, -330.000, -315.000, -300.000, -285.000,
- -270.000, -255.000, -240.000, -225.000, -210.000, -195.000, -180.000, -165.000,
- -135.000, -105.000,  -75.000,  -45.000,  -15.000,   15.000,   45.000,   75.000,
-  105.000,  135.000,  165.000,  180.000,  195.000,  210.000,  225.000,  240.000,
-  255.000,  270.000,  285.000,  300.000,  315.000,  360.000,  330.000,  300.000,
-  270.000,  240.000,  210.000,  150.000,   90.000,   30.000,  -30.000,  -90.000,
- -150.000, -210.000, -240.000, -270.000, -300.000, -330.000, -360.000, -360.000,
- -330.000, -300.000, -270.000, -240.000, -210.000, -150.000,  -90.000,  -30.000,
-   30.000,   90.000,  150.000,  210.000,  240.000,  270.000,  300.000,  330.000,
-  360.000,  420.000,  390.000,  360.000,  330.000,  300.000,  270.000,  240.000,
-  180.000,  120.000,   60.000,    0.000,  -60.000, -120.000, -180.000, -240.000,
- -270.000, -300.000, -330.000, -360.000, -390.000, -420.000, -420.000, -390.000,
- -360.000, -330.000, -300.000, -270.000, -240.000, -180.000, -120.000,  -60.000,
-    0.000,   60.000,  120.000,  180.000,  240.000,  270.000,  300.000,  330.000,
-  360.000,  390.000,  420.000,  480.000,  450.000,  420.000,  390.000,  360.000,
-  330.000,  300.000,  270.000,  210.000,  150.000,   90.000,   30.000,  -30.000,
-  -90.000, -150.000, -210.000, -270.000, -300.000, -330.000, -360.000, -390.000,
- -420.000, -450.000, -480.000, -480.000, -450.000, -420.000, -390.000, -360.000,
- -330.000, -300.000, -270.000, -210.000, -150.000,  -90.000,  -30.000,   30.000,
-   90.000,  150.000,  210.000,  270.000,  300.000,  330.000,  360.000,  390.000,
-  420.000,  450.000,  480.000,  540.000,  510.000,  480.000,  450.000,  420.000,
-  390.000,  360.000,  330.000,  300.000,  240.000,  180.000,  120.000,   60.000,
-    0.000,  -60.000, -120.000, -180.000, -240.000, -300.000, -330.000, -360.000,
- -390.000, -420.000, -450.000, -480.000, -510.000, -540.000, -540.000, -510.000,
- -480.000, -450.000, -420.000, -390.000, -360.000, -330.000, -300.000, -240.000,
- -180.000, -120.000,  -60.000,    0.000,   60.000,  120.000,  180.000,  240.000,
-  300.000,  330.000,  360.000,  390.000,  420.000,  450.000,  480.000,  510.000,
-  540.000 
-  } ; 
-
-  Float_t ytemp[577] = { 
-    0.000,    0.000,   25.981,   25.981,    0.000,  -25.981,  -25.981,    0.000,
-   25.981,   51.961,   51.961,   51.961,   25.981,    0.000,  -25.981,  -51.961,
-  -51.961,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,   77.942,
-   77.942,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
-  -77.942,  -77.942,  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,
-   77.942,  103.923,  103.923,  103.923,  103.923,  103.923,   77.942,   51.961,
-   25.981,    0.000,  -25.981,  -51.961,  -77.942, -103.923, -103.923, -103.923,
- -103.923, -103.923,  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,
-   77.942,  103.923,  129.904,  129.904,  129.904,  129.904,  129.904,  129.904,
-  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
- -103.923, -129.904, -129.904, -129.904, -129.904, -129.904, -129.904, -103.923,
-  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,
-  129.904,  155.885,  155.885,  155.885,  155.885,  155.885,  155.885,  155.885,
-  129.904,  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,
-  -77.942, -103.923, -129.904, -155.885, -155.885, -155.885, -155.885, -155.885,
- -155.885, -155.885, -129.904, -103.923,  -77.942,  -51.961,  -25.981,    0.000,
-   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,  181.865,  181.865,
-  181.865,  181.865,  181.865,  181.865,  181.865,  181.865,  155.885,  129.904,
-  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
- -103.923, -129.904, -155.885, -181.865, -181.865, -181.865, -181.865, -181.865,
- -181.865, -181.865, -181.865, -155.885, -129.904, -103.923,  -77.942,  -51.961,
-  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,
-  181.865,  207.846,  207.846,  207.846,  207.846,  207.846,  207.846,  207.846,
-  207.846,  207.846,  181.865,  155.885,  129.904,  103.923,   77.942,   51.961,
-   25.981,    0.000,  -25.981,  -51.961,  -77.942, -103.923, -129.904, -155.885,
- -181.865, -207.846, -207.846, -207.846, -207.846, -207.846, -207.846, -207.846,
- -207.846, -207.846, -181.865, -155.885, -129.904, -103.923,  -77.942,  -51.961,
-  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,
-  181.865,  207.846,  233.827,  233.827,  233.827,  233.827,  233.827,  233.827,
-  233.827,  233.827,  233.827,  233.827,  207.846,  181.865,  155.885,  129.904,
-  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
- -103.923, -129.904, -155.885, -181.865, -207.846, -233.827, -233.827, -233.827,
- -233.827, -233.827, -233.827, -233.827, -233.827, -233.827, -233.827, -207.846,
- -181.865, -155.885, -129.904, -103.923,  -77.942,  -51.961,  -25.981,    0.000,
-   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,  181.865,  207.846,
-  233.827,  259.808,  259.808,  259.808,  259.808,  259.808,  259.808,  259.808,
-  259.808,  259.808,  259.808,  259.808,  233.827,  207.846,  181.865,  155.885,
-  129.904,  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,
-  -77.942, -103.923, -129.904, -155.885, -181.865, -207.846, -233.827, -259.808,
- -259.808, -259.808, -259.808, -259.808, -259.808, -259.808, -259.808, -259.808,
- -259.808, -259.808, -233.827, -207.846, -181.865, -155.885, -129.904, -103.923,
-  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,
-  129.904,  155.885,  181.865,  207.846,  233.827,  259.808,  285.788,  285.788,
-  285.788,  285.788,  285.788,  285.788,  285.788,  285.788,  285.788,  285.788,
-  285.788,  285.788,  259.808,  233.827,  207.846,  181.865,  155.885,  129.904,
-  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
- -103.923, -129.904, -155.885, -181.865, -207.846, -233.827, -259.808, -285.788,
- -285.788, -285.788, -285.788, -285.788, -285.788, -285.788, -285.788, -285.788,
- -285.788, -285.788, -285.788, -259.808, -233.827, -207.846, -181.865, -155.885,
- -129.904, -103.923,  -77.942,  -51.961,  -25.981,   34.641,   86.603,  138.564,
-  190.526,  242.487,  294.449,  329.090,  329.090,  329.090,  329.090,  329.090,
-  329.090,  294.449,  242.487,  190.526,  138.564,   86.603,   34.641,  -34.641,
-  -86.603, -138.564, -190.526, -242.487, -294.449, -329.090, -329.090, -329.090,
- -329.090, -329.090, -329.090, -294.449, -242.487, -190.526, -138.564,  -86.603,
-  -34.641,   34.641,   86.603,  138.564,  190.526,  242.487,  294.449,  346.410,
-  381.051,  381.051,  381.051,  381.051,  381.051,  381.051,  381.051,  346.410,
-  294.449,  242.487,  190.526,  138.564,   86.603,   34.641,  -34.641,  -86.603,
- -138.564, -190.526, -242.487, -294.449, -346.410, -381.051, -381.051, -381.051,
- -381.051, -381.051, -381.051, -381.051, -346.410, -294.449, -242.487, -190.526,
- -138.564,  -86.603,  -34.641,   34.641,   86.603,  138.564,  190.526,  242.487,
-  294.449,  346.410,  398.372,  433.013,  433.013,  433.013,  433.013,  433.013,
-  433.013,  433.013,  433.013,  398.372,  346.410,  294.449,  242.487,  190.526,
-  138.564,   86.603,   34.641,  -34.641,  -86.603, -138.564, -190.526, -242.487,
- -294.449, -346.410, -398.372, -433.013, -433.013, -433.013, -433.013, -433.013,
- -433.013, -433.013, -433.013, -398.372, -346.410, -294.449, -242.487, -190.526,
- -138.564,  -86.603,  -34.641,   34.641,   86.603,  138.564,  190.526,  242.487,
-  294.449,  346.410,  398.372,  450.333,  484.974,  484.974,  484.974,  484.974,
-  484.974,  484.974,  484.974,  484.974,  484.974,  450.333,  398.372,  346.410,
-  294.449,  242.487,  190.526,  138.564,   86.603,   34.641,  -34.641,  -86.603,
- -138.564, -190.526, -242.487, -294.449, -346.410, -398.372, -450.333, -484.974,
- -484.974, -484.974, -484.974, -484.974, -484.974, -484.974, -484.974, -484.974,
- -450.333, -398.372, -346.410, -294.449, -242.487, -190.526, -138.564,  -86.603,
- -34.641
-  } ; 
-
-  Float_t rtemp[577] = { 
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
-    30.00,30.00,30.00,30.00,30.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
-    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,  
-    60.00  } ; 
-  
-  //   fill the pixels list with this data
-  
-  for ( Int_t i = 0 ; i< fNbPixels ; i++ ) {     
-    fPixels->Add( new MPixGeom(xtemp[i], ytemp[i], rtemp[i]) ) ;     
-  }   
-} 
-
-void MCamGeom::CreateCT1() 
-{  
-  //   fill the geometry class with the coordinates of the CT1 camera
-   cout << " Create CT1 geometry " << endl ; 
-   //      use a function from Martin Kestel
-   
-   float  fpixdiameter = 21. ;    // units are cm 
-   int ring_counter=1, ipix; 
-   int num_pix_this_ring;
-   int new_ring_start, end_this_ring;
-   int end_last_ring = 1; 
-   float fang, ffrac_ang, frad;
-   float pi=4.*atan(1.);
-
-   //  add the first pixel to the list 
-
-   fPixels->Add( new MPixGeom(  0. ,0., fpixdiameter ) ) ; 
-   for (ring_counter=1;ring_counter<7;ring_counter++) {
-     /* calc. numofpix in ring number i first */
-     num_pix_this_ring = ring_counter*6;
-     
-     /* get then the start-of-ring pixel number */
-     new_ring_start = end_last_ring;
-     
-     /* .... this means the ring ends with pixnum ... */
-     end_this_ring = end_last_ring + num_pix_this_ring;
-     
-     /* calc. coords for this ring counting from the 
-	starting number to the ending number */
-     for (ipix = 0; 
-	  ipix < num_pix_this_ring; 
-	  ipix++) {
-       fang = 60./(float)ring_counter * (float)ipix;
-       ffrac_ang = fang - 60.*((int)(floor(fang/60.)));
-       fang *= pi/180.;
-       ffrac_ang *= pi/180.;
-       frad = (float)ring_counter * fpixdiameter ;
-       frad *= sqrt(3.)/(2.*sin(2./3.*pi-ffrac_ang));
-      
-       //   fill the ObjArray with the pixels data ; 
-
-       fPixels->Add( new MPixGeom(  frad * cos(fang) ,frad * sin(fang) , fpixdiameter ) ) ; 
-     }
-    
-    /* set the end-of-ring number correctly */
-    end_last_ring = end_this_ring ;
-  }
-
-} 
-
Index: trunk/MagicSoft/Mars/mgui/MCamGeom.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamGeom.h	(revision 609)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#ifndef MCAMGEOM_H
-#define MCAMGEOM_H
-
-#include <iostream>
-
-#include "MAGIC.h"
-
-class TObjArray ; 
-
-class MPixGeom : public TObject
-{ 
- private:
-  Float_t  fX ;  //   the x coordinate 
-  Float_t  fY ;  //   the y coordinate
-  Float_t  fR ;  //   the y coordinate
-
- public:
-  
-  MPixGeom(Float_t x=0. , Float_t y=0., Float_t r=0.) ; 
-  
-  void Print() ; 
-  
-  void SetX ( Float_t x ) 
-    {
-      fX = x ; 
-    }
-  
-  void SetY ( Float_t y ) 
-    {
-      fY = y ; 
-    }
-   
-  void SetR ( Float_t r ) 
-    {
-      fR = r ; 
-    }
-  
-  Float_t GetX() 
-    { 
-      return fX ; 
-    } 
-   
-  Float_t GetY() 
-    { 
-      return fY ; 
-    } 
-  
-  Float_t GetR()
-    { 
-      return fR ; 
-    } 
-  
-
-  ClassDef(MPixGeom, 1)		// Geometric class for the pixel
-} ; 
-
-
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-class MCamGeom
-{
- private: 
-  Int_t         fNbPixels ;   // 
-  TObjArray     *fPixels   ;  //!
-  
-  void CreateMagic() ; 
-  void CreateCT1() ; 
-  
- public:
-  
-  MCamGeom( Int_t type=0 ) ; 
-
-  void Draw(Option_t *option = "" ) ; 
- 
-  Int_t    GetNbPixels() ; 
-  Float_t  GetX(Int_t iPix ) ; 
-  Float_t  GetY(Int_t iPix ) ; 
-  Float_t  GetR(Int_t iPix ) ; 
-  
-  void Print() ; 
-
-  ClassDef(MCamGeom, 1)		// Base (abstract) class for a task
-};
-
-#endif
-
Index: trunk/MagicSoft/Mars/mgui/MCamNeighbor.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamNeighbor.cc	(revision 609)
+++ trunk/MagicSoft/Mars/mgui/MCamNeighbor.cc	(revision 653)
@@ -1,7 +1,7 @@
 #include "MCamNeighbor.h"
 
-#include <stdlib.h> 
-
-ClassImp(MCamNeighbor) 
+#include "MLog.h"
+
+ClassImp(MCamNeighbor)
 
 MCamNeighbor::MCamNeighbor()
@@ -341,107 +341,107 @@
   { 269,    270,    328,    330,    394,    395} ,
   { 217,    270,    271,    329,    395,    396} ,
-  { 271,    332,    396,    397,    432,  -9999} ,
-  { 271,    272,    331,    333,    397,  -9999} ,
-  { 272,    273,    332,    334,    398,  -9999} ,
-  { 273,    274,    333,    335,    398,  -9999} ,
-  { 274,    275,    334,    336,    399,  -9999} ,
-  { 275,    276,    335,    337,    399,  -9999} ,
-  { 276,    277,    336,    338,    400,  -9999} ,
-  { 277,    278,    337,    339,    400,  -9999} ,
-  { 278,    279,    338,    340,    401,  -9999} ,
-  { 279,    280,    339,    341,    401,  -9999} ,
-  { 280,    281,    340,    342,    402,  -9999} ,
-  { 281,    341,    343,    402,    403,  -9999} ,
-  { 281,    282,    342,    344,    403,  -9999} ,
-  { 282,    283,    343,    345,    404,  -9999} ,
-  { 283,    284,    344,    346,    404,  -9999} ,
-  { 284,    285,    345,    347,    405,  -9999} ,
-  { 285,    286,    346,    348,    405,  -9999} ,
-  { 286,    287,    347,    349,    406,  -9999} ,
-  { 287,    288,    348,    350,    406,  -9999} ,
-  { 288,    289,    349,    351,    407,  -9999} ,
-  { 289,    290,    350,    352,    407,  -9999} ,
-  { 290,    291,    351,    353,    408,  -9999} ,
-  { 291,    352,    354,    408,    409,  -9999} ,
-  { 291,    292,    353,    355,    409,  -9999} ,
-  { 292,    293,    354,    356,    410,  -9999} ,
-  { 293,    294,    355,    357,    410,  -9999} ,
-  { 294,    295,    356,    358,    411,  -9999} ,
-  { 295,    296,    357,    359,    411,  -9999} ,
-  { 296,    297,    358,    360,    412,  -9999} ,
-  { 297,    298,    359,    361,    412,  -9999} ,
-  { 298,    299,    360,    362,    413,  -9999} ,
-  { 299,    300,    361,    363,    413,  -9999} ,
-  { 300,    301,    362,    364,    414,  -9999} ,
-  { 301,    363,    365,    414,    415,  -9999} ,
-  { 301,    302,    364,    366,    415,  -9999} ,
-  { 302,    303,    365,    367,    416,  -9999} ,
-  { 303,    304,    366,    368,    416,  -9999} ,
-  { 304,    305,    367,    369,    417,  -9999} ,
-  { 305,    306,    368,    370,    417,  -9999} ,
-  { 306,    307,    369,    371,    418,  -9999} ,
-  { 307,    308,    370,    372,    418,  -9999} ,
-  { 308,    309,    371,    373,    419,  -9999} ,
-  { 309,    310,    372,    374,    419,  -9999} ,
-  { 310,    311,    373,    375,    420,  -9999} ,
-  { 311,    374,    376,    420,    421,  -9999} ,
-  { 311,    312,    375,    377,    421,  -9999} ,
-  { 312,    313,    376,    378,    422,  -9999} ,
-  { 313,    314,    377,    379,    422,  -9999} ,
-  { 314,    315,    378,    380,    423,  -9999} ,
-  { 315,    316,    379,    381,    423,  -9999} ,
-  { 316,    317,    380,    382,    424,  -9999} ,
-  { 317,    318,    381,    383,    424,  -9999} ,
-  { 318,    319,    382,    384,    425,  -9999} ,
-  { 319,    320,    383,    385,    425,  -9999} ,
-  { 320,    321,    384,    386,    426,  -9999} ,
-  { 321,    385,    387,    426,    427,  -9999} ,
-  { 321,    322,    386,    388,    427,  -9999} ,
-  { 322,    323,    387,    389,    428,  -9999} ,
-  { 323,    324,    388,    390,    428,  -9999} ,
-  { 324,    325,    389,    391,    429,  -9999} ,
-  { 325,    326,    390,    392,    429,  -9999} ,
-  { 326,    327,    391,    393,    430,  -9999} ,
-  { 327,    328,    392,    394,    430,  -9999} ,
-  { 328,    329,    393,    395,    431,  -9999} ,
-  { 329,    330,    394,    396,    431,  -9999} ,
-  { 271,    330,    331,    395,    432,  -9999} ,
+  { 271,    332,    396,    397,    432,  -1} ,
+  { 271,    272,    331,    333,    397,  -1} ,
+  { 272,    273,    332,    334,    398,  -1} ,
+  { 273,    274,    333,    335,    398,  -1} ,
+  { 274,    275,    334,    336,    399,  -1} ,
+  { 275,    276,    335,    337,    399,  -1} ,
+  { 276,    277,    336,    338,    400,  -1} ,
+  { 277,    278,    337,    339,    400,  -1} ,
+  { 278,    279,    338,    340,    401,  -1} ,
+  { 279,    280,    339,    341,    401,  -1} ,
+  { 280,    281,    340,    342,    402,  -1} ,
+  { 281,    341,    343,    402,    403,  -1} ,
+  { 281,    282,    342,    344,    403,  -1} ,
+  { 282,    283,    343,    345,    404,  -1} ,
+  { 283,    284,    344,    346,    404,  -1} ,
+  { 284,    285,    345,    347,    405,  -1} ,
+  { 285,    286,    346,    348,    405,  -1} ,
+  { 286,    287,    347,    349,    406,  -1} ,
+  { 287,    288,    348,    350,    406,  -1} ,
+  { 288,    289,    349,    351,    407,  -1} ,
+  { 289,    290,    350,    352,    407,  -1} ,
+  { 290,    291,    351,    353,    408,  -1} ,
+  { 291,    352,    354,    408,    409,  -1} ,
+  { 291,    292,    353,    355,    409,  -1} ,
+  { 292,    293,    354,    356,    410,  -1} ,
+  { 293,    294,    355,    357,    410,  -1} ,
+  { 294,    295,    356,    358,    411,  -1} ,
+  { 295,    296,    357,    359,    411,  -1} ,
+  { 296,    297,    358,    360,    412,  -1} ,
+  { 297,    298,    359,    361,    412,  -1} ,
+  { 298,    299,    360,    362,    413,  -1} ,
+  { 299,    300,    361,    363,    413,  -1} ,
+  { 300,    301,    362,    364,    414,  -1} ,
+  { 301,    363,    365,    414,    415,  -1} ,
+  { 301,    302,    364,    366,    415,  -1} ,
+  { 302,    303,    365,    367,    416,  -1} ,
+  { 303,    304,    366,    368,    416,  -1} ,
+  { 304,    305,    367,    369,    417,  -1} ,
+  { 305,    306,    368,    370,    417,  -1} ,
+  { 306,    307,    369,    371,    418,  -1} ,
+  { 307,    308,    370,    372,    418,  -1} ,
+  { 308,    309,    371,    373,    419,  -1} ,
+  { 309,    310,    372,    374,    419,  -1} ,
+  { 310,    311,    373,    375,    420,  -1} ,
+  { 311,    374,    376,    420,    421,  -1} ,
+  { 311,    312,    375,    377,    421,  -1} ,
+  { 312,    313,    376,    378,    422,  -1} ,
+  { 313,    314,    377,    379,    422,  -1} ,
+  { 314,    315,    378,    380,    423,  -1} ,
+  { 315,    316,    379,    381,    423,  -1} ,
+  { 316,    317,    380,    382,    424,  -1} ,
+  { 317,    318,    381,    383,    424,  -1} ,
+  { 318,    319,    382,    384,    425,  -1} ,
+  { 319,    320,    383,    385,    425,  -1} ,
+  { 320,    321,    384,    386,    426,  -1} ,
+  { 321,    385,    387,    426,    427,  -1} ,
+  { 321,    322,    386,    388,    427,  -1} ,
+  { 322,    323,    387,    389,    428,  -1} ,
+  { 323,    324,    388,    390,    428,  -1} ,
+  { 324,    325,    389,    391,    429,  -1} ,
+  { 325,    326,    390,    392,    429,  -1} ,
+  { 326,    327,    391,    393,    430,  -1} ,
+  { 327,    328,    392,    394,    430,  -1} ,
+  { 328,    329,    393,    395,    431,  -1} ,
+  { 329,    330,    394,    396,    431,  -1} ,
+  { 271,    330,    331,    395,    432,  -1} ,
   { 331,    332,    398,    432,    433,    434} ,
-  { 333,    334,    397,    399,    434,  -9999} ,
-  { 335,    336,    400,    435,    436,  -9999} ,
-  { 337,    338,    399,    401,    437,  -9999} ,
-  { 339,    340,    400,    402,    438,  -9999} ,
+  { 333,    334,    397,    399,    434,  -1} ,
+  { 335,    336,    400,    435,    436,  -1} ,
+  { 337,    338,    399,    401,    437,  -1} ,
+  { 339,    340,    400,    402,    438,  -1} ,
   { 341,    342,    401,    403,    438,    439} ,
   { 342,    343,    402,    404,    440,    441} ,
-  { 344,    345,    403,    441,    442,  -9999} ,
-  { 346,    347,    404,    442,    443,  -9999} ,
-  { 348,    349,    405,    443,    444,  -9999} ,
-  { 350,    351,    406,    444,    445,  -9999} ,
+  { 344,    345,    403,    441,    442,  -1} ,
+  { 346,    347,    404,    442,    443,  -1} ,
+  { 348,    349,    405,    443,    444,  -1} ,
+  { 350,    351,    406,    444,    445,  -1} ,
   { 352,    353,    407,    409,    445,    446} ,
   { 353,    354,    408,    410,    447,    448} ,
-  { 355,    356,    409,    411,    448,  -9999} ,
-  { 357,    358,    410,    412,    449,  -9999} ,
-  { 359,    360,    411,    450,    451,  -9999} ,
-  { 361,    362,    412,    414,    452,  -9999} ,
+  { 355,    356,    409,    411,    448,  -1} ,
+  { 357,    358,    410,    412,    449,  -1} ,
+  { 359,    360,    411,    450,    451,  -1} ,
+  { 361,    362,    412,    414,    452,  -1} ,
   { 363,    364,    413,    415,    452,    453} ,
   { 364,    365,    414,    416,    454,    455} ,
-  { 366,    367,    415,    417,    455,  -9999} ,
-  { 368,    369,    418,    456,    457,  -9999} ,
-  { 370,    371,    417,    419,    458,  -9999} ,
-  { 372,    373,    418,    420,    459,  -9999} ,
+  { 366,    367,    415,    417,    455,  -1} ,
+  { 368,    369,    418,    456,    457,  -1} ,
+  { 370,    371,    417,    419,    458,  -1} ,
+  { 372,    373,    418,    420,    459,  -1} ,
   { 374,    375,    419,    421,    459,    460} ,
   { 375,    376,    420,    422,    461,    462} ,
-  { 377,    378,    421,    462,    463,  -9999} ,
-  { 379,    380,    422,    463,    464,  -9999} ,
-  { 381,    382,    423,    464,    465,  -9999} ,
-  { 383,    384,    424,    465,    466,  -9999} ,
+  { 377,    378,    421,    462,    463,  -1} ,
+  { 379,    380,    422,    463,    464,  -1} ,
+  { 381,    382,    423,    464,    465,  -1} ,
+  { 383,    384,    424,    465,    466,  -1} ,
   { 385,    386,    425,    427,    466,    467} ,
   { 386,    387,    426,    428,    468,    469} ,
-  { 388,    389,    427,    429,    469,  -9999} ,
-  { 390,    391,    428,    430,    470,  -9999} ,
-  { 392,    393,    429,    471,    472,  -9999} ,
-  { 394,    395,    430,    432,    473,  -9999} ,
+  { 388,    389,    427,    429,    469,  -1} ,
+  { 390,    391,    428,    430,    470,  -1} ,
+  { 392,    393,    429,    471,    472,  -1} ,
+  { 394,    395,    430,    432,    473,  -1} ,
   { 331,    396,    397,    431,    473,    474} ,
-  { 397,    434,    474,    475,    476,  -9999} ,
+  { 397,    434,    474,    475,    476,  -1} ,
   { 397,    398,    433,    435,    476,    477} ,
   { 398,    399,    434,    436,    477,    478} ,
@@ -449,6 +449,6 @@
   { 400,    401,    436,    438,    479,    480} ,
   { 401,    402,    437,    439,    480,    481} ,
-  { 402,    438,    440,    481,    482,  -9999} ,
-  { 403,    439,    441,    483,    484,  -9999} ,
+  { 402,    438,    440,    481,    482,  -1} ,
+  { 403,    439,    441,    483,    484,  -1} ,
   { 403,    404,    440,    442,    484,    485} ,
   { 404,    405,    441,    443,    485,    486} ,
@@ -456,6 +456,6 @@
   { 406,    407,    443,    445,    487,    488} ,
   { 407,    408,    444,    446,    488,    489} ,
-  { 408,    445,    447,    489,    490,  -9999} ,
-  { 409,    446,    448,    491,    492,  -9999} ,
+  { 408,    445,    447,    489,    490,  -1} ,
+  { 409,    446,    448,    491,    492,  -1} ,
   { 409,    410,    447,    449,    492,    493} ,
   { 410,    411,    448,    450,    493,    494} ,
@@ -463,6 +463,6 @@
   { 412,    413,    450,    452,    495,    496} ,
   { 413,    414,    451,    453,    496,    497} ,
-  { 414,    452,    454,    497,    498,  -9999} ,
-  { 415,    453,    455,    499,    500,  -9999} ,
+  { 414,    452,    454,    497,    498,  -1} ,
+  { 415,    453,    455,    499,    500,  -1} ,
   { 415,    416,    454,    456,    500,    501} ,
   { 416,    417,    455,    457,    501,    502} ,
@@ -470,6 +470,6 @@
   { 418,    419,    457,    459,    503,    504} ,
   { 419,    420,    458,    460,    504,    505} ,
-  { 420,    459,    461,    505,    506,  -9999} ,
-  { 421,    460,    462,    507,    508,  -9999} ,
+  { 420,    459,    461,    505,    506,  -1} ,
+  { 421,    460,    462,    507,    508,  -1} ,
   { 421,    422,    461,    463,    508,    509} ,
   { 422,    423,    462,    464,    509,    510} ,
@@ -477,6 +477,6 @@
   { 424,    425,    464,    466,    511,    512} ,
   { 425,    426,    465,    467,    512,    513} ,
-  { 426,    466,    468,    513,    514,  -9999} ,
-  { 427,    467,    469,    515,    516,  -9999} ,
+  { 426,    466,    468,    513,    514,  -1} ,
+  { 427,    467,    469,    515,    516,  -1} ,
   { 427,    428,    468,    470,    516,    517} ,
   { 428,    429,    469,    471,    517,    518} ,
@@ -484,6 +484,6 @@
   { 430,    431,    471,    473,    519,    520} ,
   { 431,    432,    472,    474,    520,    521} ,
-  { 432,    433,    473,    521,    522,  -9999} ,
-  { 433,    476,    522,    523,    524,  -9999} ,
+  { 432,    433,    473,    521,    522,  -1} ,
+  { 433,    476,    522,    523,    524,  -1} ,
   { 433,    434,    475,    477,    524,    525} ,
   { 434,    435,    476,    478,    525,    526} ,
@@ -492,6 +492,6 @@
   { 437,    438,    479,    481,    528,    529} ,
   { 438,    439,    480,    482,    529,    530} ,
-  { 439,    481,    483,    530,    531,  -9999} ,
-  { 440,    482,    484,    532,    533,  -9999} ,
+  { 439,    481,    483,    530,    531,  -1} ,
+  { 440,    482,    484,    532,    533,  -1} ,
   { 440,    441,    483,    485,    533,    534} ,
   { 441,    442,    484,    486,    534,    535} ,
@@ -500,6 +500,6 @@
   { 444,    445,    487,    489,    537,    538} ,
   { 445,    446,    488,    490,    538,    539} ,
-  { 446,    489,    491,    539,    540,  -9999} ,
-  { 447,    490,    492,    541,    542,  -9999} ,
+  { 446,    489,    491,    539,    540,  -1} ,
+  { 447,    490,    492,    541,    542,  -1} ,
   { 447,    448,    491,    493,    542,    543} ,
   { 448,    449,    492,    494,    543,    544} ,
@@ -508,6 +508,6 @@
   { 451,    452,    495,    497,    546,    547} ,
   { 452,    453,    496,    498,    547,    548} ,
-  { 453,    497,    499,    548,    549,  -9999} ,
-  { 454,    498,    500,    550,    551,  -9999} ,
+  { 453,    497,    499,    548,    549,  -1} ,
+  { 454,    498,    500,    550,    551,  -1} ,
   { 454,    455,    499,    501,    551,    552} ,
   { 455,    456,    500,    502,    552,    553} ,
@@ -516,6 +516,6 @@
   { 458,    459,    503,    505,    555,    556} ,
   { 459,    460,    504,    506,    556,    557} ,
-  { 460,    505,    507,    557,    558,  -9999} ,
-  { 461,    506,    508,    559,    560,  -9999} ,
+  { 460,    505,    507,    557,    558,  -1} ,
+  { 461,    506,    508,    559,    560,  -1} ,
   { 461,    462,    507,    509,    560,    561} ,
   { 462,    463,    508,    510,    561,    562} ,
@@ -524,6 +524,6 @@
   { 465,    466,    511,    513,    564,    565} ,
   { 466,    467,    512,    514,    565,    566} ,
-  { 467,    513,    515,    566,    567,  -9999} ,
-  { 468,    514,    516,    568,    569,  -9999} ,
+  { 467,    513,    515,    566,    567,  -1} ,
+  { 468,    514,    516,    568,    569,  -1} ,
   { 468,    469,    515,    517,    569,    570} ,
   { 469,    470,    516,    518,    570,    571} ,
@@ -532,105 +532,108 @@
   { 472,    473,    519,    521,    573,    574} ,
   { 473,    474,    520,    522,    574,    575} ,
-  { 474,    475,    521,    575,    576,  -9999} ,
-  { 475,    524,    576,  -9999,  -9999,  -9999} ,
-  { 475,    476,    523,    525,  -9999,  -9999} ,
-  { 476,    477,    524,    526,  -9999,  -9999} ,
-  { 477,    478,    525,    527,  -9999,  -9999} ,
-  { 478,    479,    526,    528,  -9999,  -9999} ,
-  { 479,    480,    527,    529,  -9999,  -9999} ,
-  { 480,    481,    528,    530,  -9999,  -9999} ,
-  { 481,    482,    529,    531,  -9999,  -9999} ,
-  { 482,    530,    532,  -9999,  -9999,  -9999} ,
-  { 483,    531,    533,  -9999,  -9999,  -9999} ,
-  { 483,    484,    532,    534,  -9999,  -9999} ,
-  { 484,    485,    533,    535,  -9999,  -9999} ,
-  { 485,    486,    534,    536,  -9999,  -9999} ,
-  { 486,    487,    535,    537,  -9999,  -9999} ,
-  { 487,    488,    536,    538,  -9999,  -9999} ,
-  { 488,    489,    537,    539,  -9999,  -9999} ,
-  { 489,    490,    538,    540,  -9999,  -9999} ,
-  { 490,    539,    541,  -9999,  -9999,  -9999} ,
-  { 491,    540,    542,  -9999,  -9999,  -9999} ,
-  { 491,    492,    541,    543,  -9999,  -9999} ,
-  { 492,    493,    542,    544,  -9999,  -9999} ,
-  { 493,    494,    543,    545,  -9999,  -9999} ,
-  { 494,    495,    544,    546,  -9999,  -9999} ,
-  { 495,    496,    545,    547,  -9999,  -9999} ,
-  { 496,    497,    546,    548,  -9999,  -9999} ,
-  { 497,    498,    547,    549,  -9999,  -9999} ,
-  { 498,    548,    550,  -9999,  -9999,  -9999} ,
-  { 499,    549,    551,  -9999,  -9999,  -9999} ,
-  { 499,    500,    550,    552,  -9999,  -9999} ,
-  { 500,    501,    551,    553,  -9999,  -9999} ,
-  { 501,    502,    552,    554,  -9999,  -9999} ,
-  { 502,    503,    553,    555,  -9999,  -9999} ,
-  { 503,    504,    554,    556,  -9999,  -9999} ,
-  { 504,    505,    555,    557,  -9999,  -9999} ,
-  { 505,    506,    556,    558,  -9999,  -9999} ,
-  { 506,    557,    559,  -9999,  -9999,  -9999} ,
-  { 507,    558,    560,  -9999,  -9999,  -9999} ,
-  { 507,    508,    559,    561,  -9999,  -9999} ,
-  { 508,    509,    560,    562,  -9999,  -9999} ,
-  { 509,    510,    561,    563,  -9999,  -9999} ,
-  { 510,    511,    562,    564,  -9999,  -9999} ,
-  { 511,    512,    563,    565,  -9999,  -9999} ,
-  { 512,    513,    564,    566,  -9999,  -9999} ,
-  { 513,    514,    565,    567,  -9999,  -9999} ,
-  { 514,    566,    568,  -9999,  -9999,  -9999} ,
-  { 515,    567,    569,  -9999,  -9999,  -9999} ,
-  { 515,    516,    568,    570,  -9999,  -9999} ,
-  { 516,    517,    569,    571,  -9999,  -9999} ,
-  { 517,    518,    570,    572,  -9999,  -9999} ,
-  { 518,    519,    571,    573,  -9999,  -9999} ,
-  { 519,    520,    572,    574,  -9999,  -9999} ,
-  { 520,    521,    573,    575,  -9999,  -9999} ,
-  { 521,    522,    574,    576,  -9999,  -9999} ,
-  { 522,    523,    575,  -9999,  -9999,  -9999}  } ; 
-
+  { 474,    475,    521,    575,    576,  -1} ,
+  { 475,    524,    576,  -1,  -1,  -1} ,
+  { 475,    476,    523,    525,  -1,  -1} ,
+  { 476,    477,    524,    526,  -1,  -1} ,
+  { 477,    478,    525,    527,  -1,  -1} ,
+  { 478,    479,    526,    528,  -1,  -1} ,
+  { 479,    480,    527,    529,  -1,  -1} ,
+  { 480,    481,    528,    530,  -1,  -1} ,
+  { 481,    482,    529,    531,  -1,  -1} ,
+  { 482,    530,    532,  -1,  -1,  -1} ,
+  { 483,    531,    533,  -1,  -1,  -1} ,
+  { 483,    484,    532,    534,  -1,  -1} ,
+  { 484,    485,    533,    535,  -1,  -1} ,
+  { 485,    486,    534,    536,  -1,  -1} ,
+  { 486,    487,    535,    537,  -1,  -1} ,
+  { 487,    488,    536,    538,  -1,  -1} ,
+  { 488,    489,    537,    539,  -1,  -1} ,
+  { 489,    490,    538,    540,  -1,  -1} ,
+  { 490,    539,    541,  -1,  -1,  -1} ,
+  { 491,    540,    542,  -1,  -1,  -1} ,
+  { 491,    492,    541,    543,  -1,  -1} ,
+  { 492,    493,    542,    544,  -1,  -1} ,
+  { 493,    494,    543,    545,  -1,  -1} ,
+  { 494,    495,    544,    546,  -1,  -1} ,
+  { 495,    496,    545,    547,  -1,  -1} ,
+  { 496,    497,    546,    548,  -1,  -1} ,
+  { 497,    498,    547,    549,  -1,  -1} ,
+  { 498,    548,    550,  -1,  -1,  -1} ,
+  { 499,    549,    551,  -1,  -1,  -1} ,
+  { 499,    500,    550,    552,  -1,  -1} ,
+  { 500,    501,    551,    553,  -1,  -1} ,
+  { 501,    502,    552,    554,  -1,  -1} ,
+  { 502,    503,    553,    555,  -1,  -1} ,
+  { 503,    504,    554,    556,  -1,  -1} ,
+  { 504,    505,    555,    557,  -1,  -1} ,
+  { 505,    506,    556,    558,  -1,  -1} ,
+  { 506,    557,    559,  -1,  -1,  -1} ,
+  { 507,    558,    560,  -1,  -1,  -1} ,
+  { 507,    508,    559,    561,  -1,  -1} ,
+  { 508,    509,    560,    562,  -1,  -1} ,
+  { 509,    510,    561,    563,  -1,  -1} ,
+  { 510,    511,    562,    564,  -1,  -1} ,
+  { 511,    512,    563,    565,  -1,  -1} ,
+  { 512,    513,    564,    566,  -1,  -1} ,
+  { 513,    514,    565,    567,  -1,  -1} ,
+  { 514,    566,    568,  -1,  -1,  -1} ,
+  { 515,    567,    569,  -1,  -1,  -1} ,
+  { 515,    516,    568,    570,  -1,  -1} ,
+  { 516,    517,    569,    571,  -1,  -1} ,
+  { 517,    518,    570,    572,  -1,  -1} ,
+  { 518,    519,    571,    573,  -1,  -1} ,
+  { 519,    520,    572,    574,  -1,  -1} ,
+  { 520,    521,    573,    575,  -1,  -1} ,
+  { 521,    522,    574,    576,  -1,  -1} ,
+  { 522,    523,    575,  -1,  -1,  -1}  } ; 
 
   for (Int_t ip=0; ip<577; ip++)
-    for (Int_t in=0; in<6; in++)
-      fNN[ip][in] = help[ip][in] ;  
-
-
+      for (Int_t in=0; in<6; in++)
+          fNN[ip][in] = help[ip][in];
 } 
 
-Int_t MCamNeighbor::GetNN(Int_t pix, Int_t inn ) 
+Int_t MCamNeighbor::GetNN(Int_t pix, Int_t inn)
 { 
-  // return the number of one neighbor
-
-  if ( pix >= 577 ) { 
-    cout << "ERROR GetNN -> pixel out of range" << endl  ;
-    exit (123) ; 
-  } 
-  
-  if ( inn >= 6 ) { 
-    cout << "ERROR GetNN -> not more than 6 neighbors" << endl  ;
-    exit (123) ; 
-  } 
-  
-  return fNN[pix][inn] ; 
+    // return the number of one neighbor
+
+    if ( pix >= 577 )
+    {
+        gLog << "WARNING: GetNN -> pixel out of range" << endl;
+        return -1;
+    }
+
+    if ( inn >= 6 )
+    {
+        gLog << "WARNING: GetNN -> not more than 6 neighbors" << endl;
+        return -1;
+    }
+
+    return fNN[pix][inn] ;
 } 
 
 void MCamNeighbor::CheckPixel(Int_t  pix) 
 { 
-  cout << " Pixel " << pix << " has neighbors " ; 
-  for (Int_t i=0; i<6; i++ ) 
-    cout << fNN[pix][i] << "/" ; 
-  cout << endl ; 
-    
+  gLog << " Pixel " << pix << " has neighbors " ;
+
+  gLog << fNN[pix][0];
+
+  for (Int_t i=1; i<6; i++ )
+      if (fNN[pix][i] >= 0)
+          gLog << ", " << fNN[pix][i];
+
+  gLog << endl ;
+
 } 
 
-void MCamNeighbor::Print() 
+void MCamNeighbor::Print(Option_t *)
 { 
-  for (Int_t i=0; i<577; i++ ) { 
-    
-    cout << " Pixel " << i  ; 
-
-    for (Int_t j=0; j<6; j++ ) { 
-      cout << " ->" << fNN[i][j] ; 
-    } 
-    cout << endl ; 
-
-  } 
+    for (Int_t i=0; i<577; i++ )
+    {
+        gLog << " Pixel " << i << ":";
+
+        for (Int_t j=0; j<6; j++ )
+            gLog << " " << fNN[i][j];
+
+        gLog << endl;
+    }
 } 
Index: trunk/MagicSoft/Mars/mgui/MCamNeighbor.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamNeighbor.h	(revision 609)
+++ trunk/MagicSoft/Mars/mgui/MCamNeighbor.h	(revision 653)
@@ -2,7 +2,7 @@
 #define MCAMNEIGHBOR_H
 
-#include <iostream>
-
+#ifndef MAGIC_H
 #include "MAGIC.h"
+#endif
 
 class MCamNeighbor 
@@ -18,7 +18,7 @@
   Int_t GetNN(Int_t pix, Int_t inn) ; 
   void CheckPixel(Int_t pix) ; 
-  void Print() ; 
+  void Print(Option_t *opt=NULL) ;
 
-  ClassDef(MCamNeighbor, 1)		// 
+  ClassDef(MCamNeighbor, 1) // Conatins the neighbors in the magic camera
 } ; 
 
Index: trunk/MagicSoft/Mars/mgui/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 653)
+++ trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 653)
@@ -0,0 +1,363 @@
+#include "MGeomCam.h"
+
+
+#include <math.h>     // floor
+#include "TCanvas.h"
+
+#include "MLog.h"
+#include "MHexagon.h"
+
+ClassImp(MGeomCam)
+
+MGeomCam::MGeomCam(Int_t type )
+{ 
+  //    default constructor
+
+  if ( type == 1 ) {
+    // set up the Geometry of CT1 
+    
+    fNbPixels = 127 ; 
+    fPixels = new TObjArray ( fNbPixels ) ; 
+    
+    CreateCT1() ; 
+  } 
+  else { 
+    // set up the standard Geometry MAGIC
+    fNbPixels = 577 ; 
+    fPixels = new TObjArray ( fNbPixels ) ; 
+
+    CreateMagic() ; 
+  } 
+} 
+
+void MGeomCam::Draw( Option_t * )
+{ 
+  TCanvas *can = new TCanvas("can", "Camera Geometry", 4 ) ; 
+  
+  //   set the range of the canvas
+  if ( fNbPixels == 127 )        // case of CT1
+    can->Range(-175, -175, 175, 175 ) ; 
+  else
+    can->Range(-600, -600, 600, 600 ) ; 
+
+  //   draw all pixels
+  
+  for ( Int_t i=0; i < fNbPixels ; i++ ) {
+      MHexagon *el = new MHexagon ( (*this)[i] )    ;
+
+      el->Draw() ;
+  } 
+  
+} 
+
+void MGeomCam::Print(Option_t *)
+{ 
+  //   Print Information about the Geometry of the camera
+  gLog << " Number of Pixels: " << fNbPixels << endl ;
+
+  for ( Int_t i=0; i<fNbPixels; i++ ) { 
+    gLog << " Pixel: " << i << "  " ;
+    (*this)[i].Print() ;
+  } 
+} 
+
+Int_t MGeomCam::GetNbPixels ()
+{ 
+  //   return the Number of pixels in the MCamGeom class
+  return fNbPixels ; 
+
+} 
+
+
+void MGeomCam::CreateMagic()
+{ 
+  //   fill the geometry class with the coordinates of the MAGIC camera
+  gLog << " Create Magic geometry " << endl ;
+
+  //   here define the hardwire things of the magic telescope
+  //
+  Float_t xtemp[577] = { 
+    0.000,   30.000,   15.000,  -15.000,  -30.000,  -15.000,   15.000,   60.000,
+   45.000,   30.000,    0.000,  -30.000,  -45.000,  -60.000,  -45.000,  -30.000,
+    0.000,   30.000,   45.000,   90.000,   75.000,   60.000,   45.000,   15.000,
+  -15.000,  -45.000,  -60.000,  -75.000,  -90.000,  -75.000,  -60.000,  -45.000,
+  -15.000,   15.000,   45.000,   60.000,   75.000,  120.000,  105.000,   90.000,
+   75.000,   60.000,   30.000,    0.000,  -30.000,  -60.000,  -75.000,  -90.000,
+ -105.000, -120.000, -105.000,  -90.000,  -75.000,  -60.000,  -30.000,    0.000,
+   30.000,   60.000,   75.000,   90.000,  105.000,  150.000,  135.000,  120.000,
+  105.000,   90.000,   75.000,   45.000,   15.000,  -15.000,  -45.000,  -75.000,
+  -90.000, -105.000, -120.000, -135.000, -150.000, -135.000, -120.000, -105.000,
+  -90.000,  -75.000,  -45.000,  -15.000,   15.000,   45.000,   75.000,   90.000,
+  105.000,  120.000,  135.000,  180.000,  165.000,  150.000,  135.000,  120.000,
+  105.000,   90.000,   60.000,   30.000,    0.000,  -30.000,  -60.000,  -90.000,
+ -105.000, -120.000, -135.000, -150.000, -165.000, -180.000, -165.000, -150.000,
+ -135.000, -120.000, -105.000,  -90.000,  -60.000,  -30.000,    0.000,   30.000,
+   60.000,   90.000,  105.000,  120.000,  135.000,  150.000,  165.000,  210.000,
+  195.000,  180.000,  165.000,  150.000,  135.000,  120.000,  105.000,   75.000,
+   45.000,   15.000,  -15.000,  -45.000,  -75.000, -105.000, -120.000, -135.000,
+ -150.000, -165.000, -180.000, -195.000, -210.000, -195.000, -180.000, -165.000,
+ -150.000, -135.000, -120.000, -105.000,  -75.000,  -45.000,  -15.000,   15.000,
+   45.000,   75.000,  105.000,  120.000,  135.000,  150.000,  165.000,  180.000,
+  195.000,  240.000,  225.000,  210.000,  195.000,  180.000,  165.000,  150.000,
+  135.000,  120.000,   90.000,   60.000,   30.000,    0.000,  -30.000,  -60.000,
+  -90.000, -120.000, -135.000, -150.000, -165.000, -180.000, -195.000, -210.000,
+ -225.000, -240.000, -225.000, -210.000, -195.000, -180.000, -165.000, -150.000,
+ -135.000, -120.000,  -90.000,  -60.000,  -30.000,    0.000,   30.000,   60.000,
+   90.000,  120.000,  135.000,  150.000,  165.000,  180.000,  195.000,  210.000,
+  225.000,  270.000,  255.000,  240.000,  225.000,  210.000,  195.000,  180.000,
+  165.000,  150.000,  135.000,  105.000,   75.000,   45.000,   15.000,  -15.000,
+  -45.000,  -75.000, -105.000, -135.000, -150.000, -165.000, -180.000, -195.000,
+ -210.000, -225.000, -240.000, -255.000, -270.000, -255.000, -240.000, -225.000,
+ -210.000, -195.000, -180.000, -165.000, -150.000, -135.000, -105.000,  -75.000,
+  -45.000,  -15.000,   15.000,   45.000,   75.000,  105.000,  135.000,  150.000,
+  165.000,  180.000,  195.000,  210.000,  225.000,  240.000,  255.000,  300.000,
+  285.000,  270.000,  255.000,  240.000,  225.000,  210.000,  195.000,  180.000,
+  165.000,  150.000,  120.000,   90.000,   60.000,   30.000,    0.000,  -30.000,
+  -60.000,  -90.000, -120.000, -150.000, -165.000, -180.000, -195.000, -210.000,
+ -225.000, -240.000, -255.000, -270.000, -285.000, -300.000, -285.000, -270.000,
+ -255.000, -240.000, -225.000, -210.000, -195.000, -180.000, -165.000, -150.000,
+ -120.000,  -90.000,  -60.000,  -30.000,    0.000,   30.000,   60.000,   90.000,
+  120.000,  150.000,  165.000,  180.000,  195.000,  210.000,  225.000,  240.000,
+  255.000,  270.000,  285.000,  330.000,  315.000,  300.000,  285.000,  270.000,
+  255.000,  240.000,  225.000,  210.000,  195.000,  180.000,  165.000,  135.000,
+  105.000,   75.000,   45.000,   15.000,  -15.000,  -45.000,  -75.000, -105.000,
+ -135.000, -165.000, -180.000, -195.000, -210.000, -225.000, -240.000, -255.000,
+ -270.000, -285.000, -300.000, -315.000, -330.000, -315.000, -300.000, -285.000,
+ -270.000, -255.000, -240.000, -225.000, -210.000, -195.000, -180.000, -165.000,
+ -135.000, -105.000,  -75.000,  -45.000,  -15.000,   15.000,   45.000,   75.000,
+  105.000,  135.000,  165.000,  180.000,  195.000,  210.000,  225.000,  240.000,
+  255.000,  270.000,  285.000,  300.000,  315.000,  360.000,  330.000,  300.000,
+  270.000,  240.000,  210.000,  150.000,   90.000,   30.000,  -30.000,  -90.000,
+ -150.000, -210.000, -240.000, -270.000, -300.000, -330.000, -360.000, -360.000,
+ -330.000, -300.000, -270.000, -240.000, -210.000, -150.000,  -90.000,  -30.000,
+   30.000,   90.000,  150.000,  210.000,  240.000,  270.000,  300.000,  330.000,
+  360.000,  420.000,  390.000,  360.000,  330.000,  300.000,  270.000,  240.000,
+  180.000,  120.000,   60.000,    0.000,  -60.000, -120.000, -180.000, -240.000,
+ -270.000, -300.000, -330.000, -360.000, -390.000, -420.000, -420.000, -390.000,
+ -360.000, -330.000, -300.000, -270.000, -240.000, -180.000, -120.000,  -60.000,
+    0.000,   60.000,  120.000,  180.000,  240.000,  270.000,  300.000,  330.000,
+  360.000,  390.000,  420.000,  480.000,  450.000,  420.000,  390.000,  360.000,
+  330.000,  300.000,  270.000,  210.000,  150.000,   90.000,   30.000,  -30.000,
+  -90.000, -150.000, -210.000, -270.000, -300.000, -330.000, -360.000, -390.000,
+ -420.000, -450.000, -480.000, -480.000, -450.000, -420.000, -390.000, -360.000,
+ -330.000, -300.000, -270.000, -210.000, -150.000,  -90.000,  -30.000,   30.000,
+   90.000,  150.000,  210.000,  270.000,  300.000,  330.000,  360.000,  390.000,
+  420.000,  450.000,  480.000,  540.000,  510.000,  480.000,  450.000,  420.000,
+  390.000,  360.000,  330.000,  300.000,  240.000,  180.000,  120.000,   60.000,
+    0.000,  -60.000, -120.000, -180.000, -240.000, -300.000, -330.000, -360.000,
+ -390.000, -420.000, -450.000, -480.000, -510.000, -540.000, -540.000, -510.000,
+ -480.000, -450.000, -420.000, -390.000, -360.000, -330.000, -300.000, -240.000,
+ -180.000, -120.000,  -60.000,    0.000,   60.000,  120.000,  180.000,  240.000,
+  300.000,  330.000,  360.000,  390.000,  420.000,  450.000,  480.000,  510.000,
+  540.000 
+  } ; 
+
+  Float_t ytemp[577] = { 
+    0.000,    0.000,   25.981,   25.981,    0.000,  -25.981,  -25.981,    0.000,
+   25.981,   51.961,   51.961,   51.961,   25.981,    0.000,  -25.981,  -51.961,
+  -51.961,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,   77.942,
+   77.942,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
+  -77.942,  -77.942,  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,
+   77.942,  103.923,  103.923,  103.923,  103.923,  103.923,   77.942,   51.961,
+   25.981,    0.000,  -25.981,  -51.961,  -77.942, -103.923, -103.923, -103.923,
+ -103.923, -103.923,  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,
+   77.942,  103.923,  129.904,  129.904,  129.904,  129.904,  129.904,  129.904,
+  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
+ -103.923, -129.904, -129.904, -129.904, -129.904, -129.904, -129.904, -103.923,
+  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,
+  129.904,  155.885,  155.885,  155.885,  155.885,  155.885,  155.885,  155.885,
+  129.904,  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,
+  -77.942, -103.923, -129.904, -155.885, -155.885, -155.885, -155.885, -155.885,
+ -155.885, -155.885, -129.904, -103.923,  -77.942,  -51.961,  -25.981,    0.000,
+   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,  181.865,  181.865,
+  181.865,  181.865,  181.865,  181.865,  181.865,  181.865,  155.885,  129.904,
+  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
+ -103.923, -129.904, -155.885, -181.865, -181.865, -181.865, -181.865, -181.865,
+ -181.865, -181.865, -181.865, -155.885, -129.904, -103.923,  -77.942,  -51.961,
+  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,
+  181.865,  207.846,  207.846,  207.846,  207.846,  207.846,  207.846,  207.846,
+  207.846,  207.846,  181.865,  155.885,  129.904,  103.923,   77.942,   51.961,
+   25.981,    0.000,  -25.981,  -51.961,  -77.942, -103.923, -129.904, -155.885,
+ -181.865, -207.846, -207.846, -207.846, -207.846, -207.846, -207.846, -207.846,
+ -207.846, -207.846, -181.865, -155.885, -129.904, -103.923,  -77.942,  -51.961,
+  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,
+  181.865,  207.846,  233.827,  233.827,  233.827,  233.827,  233.827,  233.827,
+  233.827,  233.827,  233.827,  233.827,  207.846,  181.865,  155.885,  129.904,
+  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
+ -103.923, -129.904, -155.885, -181.865, -207.846, -233.827, -233.827, -233.827,
+ -233.827, -233.827, -233.827, -233.827, -233.827, -233.827, -233.827, -207.846,
+ -181.865, -155.885, -129.904, -103.923,  -77.942,  -51.961,  -25.981,    0.000,
+   25.981,   51.961,   77.942,  103.923,  129.904,  155.885,  181.865,  207.846,
+  233.827,  259.808,  259.808,  259.808,  259.808,  259.808,  259.808,  259.808,
+  259.808,  259.808,  259.808,  259.808,  233.827,  207.846,  181.865,  155.885,
+  129.904,  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,
+  -77.942, -103.923, -129.904, -155.885, -181.865, -207.846, -233.827, -259.808,
+ -259.808, -259.808, -259.808, -259.808, -259.808, -259.808, -259.808, -259.808,
+ -259.808, -259.808, -233.827, -207.846, -181.865, -155.885, -129.904, -103.923,
+  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,  103.923,
+  129.904,  155.885,  181.865,  207.846,  233.827,  259.808,  285.788,  285.788,
+  285.788,  285.788,  285.788,  285.788,  285.788,  285.788,  285.788,  285.788,
+  285.788,  285.788,  259.808,  233.827,  207.846,  181.865,  155.885,  129.904,
+  103.923,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
+ -103.923, -129.904, -155.885, -181.865, -207.846, -233.827, -259.808, -285.788,
+ -285.788, -285.788, -285.788, -285.788, -285.788, -285.788, -285.788, -285.788,
+ -285.788, -285.788, -285.788, -259.808, -233.827, -207.846, -181.865, -155.885,
+ -129.904, -103.923,  -77.942,  -51.961,  -25.981,   34.641,   86.603,  138.564,
+  190.526,  242.487,  294.449,  329.090,  329.090,  329.090,  329.090,  329.090,
+  329.090,  294.449,  242.487,  190.526,  138.564,   86.603,   34.641,  -34.641,
+  -86.603, -138.564, -190.526, -242.487, -294.449, -329.090, -329.090, -329.090,
+ -329.090, -329.090, -329.090, -294.449, -242.487, -190.526, -138.564,  -86.603,
+  -34.641,   34.641,   86.603,  138.564,  190.526,  242.487,  294.449,  346.410,
+  381.051,  381.051,  381.051,  381.051,  381.051,  381.051,  381.051,  346.410,
+  294.449,  242.487,  190.526,  138.564,   86.603,   34.641,  -34.641,  -86.603,
+ -138.564, -190.526, -242.487, -294.449, -346.410, -381.051, -381.051, -381.051,
+ -381.051, -381.051, -381.051, -381.051, -346.410, -294.449, -242.487, -190.526,
+ -138.564,  -86.603,  -34.641,   34.641,   86.603,  138.564,  190.526,  242.487,
+  294.449,  346.410,  398.372,  433.013,  433.013,  433.013,  433.013,  433.013,
+  433.013,  433.013,  433.013,  398.372,  346.410,  294.449,  242.487,  190.526,
+  138.564,   86.603,   34.641,  -34.641,  -86.603, -138.564, -190.526, -242.487,
+ -294.449, -346.410, -398.372, -433.013, -433.013, -433.013, -433.013, -433.013,
+ -433.013, -433.013, -433.013, -398.372, -346.410, -294.449, -242.487, -190.526,
+ -138.564,  -86.603,  -34.641,   34.641,   86.603,  138.564,  190.526,  242.487,
+  294.449,  346.410,  398.372,  450.333,  484.974,  484.974,  484.974,  484.974,
+  484.974,  484.974,  484.974,  484.974,  484.974,  450.333,  398.372,  346.410,
+  294.449,  242.487,  190.526,  138.564,   86.603,   34.641,  -34.641,  -86.603,
+ -138.564, -190.526, -242.487, -294.449, -346.410, -398.372, -450.333, -484.974,
+ -484.974, -484.974, -484.974, -484.974, -484.974, -484.974, -484.974, -484.974,
+ -450.333, -398.372, -346.410, -294.449, -242.487, -190.526, -138.564,  -86.603,
+ -34.641
+  } ; 
+
+  Float_t rtemp[577] = { 
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,30.00,30.00,30.00,
+    30.00,30.00,30.00,30.00,30.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,
+    60.00,60.00,60.00,60.00,60.00,60.00,60.00,60.00,  
+    60.00  } ; 
+  
+  //   fill the pixels list with this data
+  
+  for ( Int_t i = 0 ; i< fNbPixels ; i++ ) {     
+    fPixels->Add( new MGeomPix(xtemp[i], ytemp[i], rtemp[i]) ) ;
+  }   
+} 
+
+void MGeomCam::CreateCT1()
+{
+    //
+    // fill the geometry class with the coordinates of the CT1 camera
+    //
+    gLog << " Create CT1 geometry " << endl ;
+
+    //
+    // this algorithm is from Martin Kestel originally
+    // it was punt into a root/C++ context by Harald Kornmayer and Thomas Bretz
+   
+    const Float_t pixdiameter = 21 ;    // units are cm
+
+    //
+    //  add the first pixel to the list
+    //
+    fPixels->Add( new MGeomPix( 0, 0, pixdiameter ) ) ;
+
+    const Float_t kS32  = sqrt(3)/2;
+    const Float_t kPI23 = kPI*2/3;
+
+    for (Int_t ringcounter=1; ringcounter<7; ringcounter++) {
+        //
+        // calc. numofpix in ring number i first
+        //
+        const Int_t numpixthisring = ringcounter*6;
+
+        //
+        // calc. coords for this ring counting from the
+        // starting number to the ending number
+        //
+        for (Int_t ipix = 0; ipix < numpixthisring; ipix++) {
+
+            Float_t ang     = 60.0/ringcounter * ipix;
+            Float_t fracang = ang - 60*(int)floor(ang/60);
+
+            ang     /= kRad2Deg;
+            fracang /= kRad2Deg;
+
+            Float_t rad  = pixdiameter * ringcounter;
+                    rad *= sin(kPI23-fracang) * kS32;
+
+            //   fill the ObjArray with the pixels data ;
+
+            fPixels->Add( new MGeomPix(rad * cos(ang),
+                                       rad * sin(ang),
+                                       pixdiameter ) ) ;
+        }
+    }
+}
+
Index: trunk/MagicSoft/Mars/mgui/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 653)
+++ trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 653)
@@ -0,0 +1,40 @@
+#ifndef MGEOMCAM_H
+#define MGEOMCAM_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+#ifndef ROOT_TObjArray
+#include <TObjArray.h>
+#endif
+#ifndef MGEOMPIX_H
+#include "MGeomPix.h"
+#endif
+
+class MGeomCam
+{
+private:
+    Int_t          fNbPixels ;  //!
+    TObjArray     *fPixels   ;  //!
+  
+    void CreateMagic() ;
+    void CreateCT1() ;
+
+public:
+
+    MGeomCam( Int_t type=0 ) ;
+    virtual ~MGeomCam() { delete fPixels; }
+
+    void Draw(Option_t *option = "" ) ;
+
+    Int_t    GetNbPixels() ;
+
+    MGeomPix &operator[](Int_t i) { return *(MGeomPix*)fPixels->At(i); }
+
+    void Print(Option_t *opt=NULL) ;
+
+    ClassDef(MGeomCam, 1)		// Geometry class for the camera
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/mgui/MGeomPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomPix.cc	(revision 653)
+++ trunk/MagicSoft/Mars/mgui/MGeomPix.cc	(revision 653)
@@ -0,0 +1,21 @@
+#include "MGeomPix.h"
+
+#include "MLog.h"
+
+ClassImp(MGeomPix)
+
+MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r ) : fX(x), fY(y), fR(r)
+{
+    //  default constructor
+}
+
+
+void MGeomPix::Print()
+{ 
+    //   information about a pixel
+    gLog << "MPixGeom:  x= " << fX
+        << "  y= " << fY
+        << "  r= " << fR
+        << endl ;
+}
+
Index: trunk/MagicSoft/Mars/mgui/MGeomPix.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomPix.h	(revision 653)
+++ trunk/MagicSoft/Mars/mgui/MGeomPix.h	(revision 653)
@@ -0,0 +1,32 @@
+#ifndef MGEOMPIX_H
+#define MGEOMPIX_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+
+class MGeomPix : public TObject
+{ 
+ private:
+  Float_t  fX ;  //   the x coordinate 
+  Float_t  fY ;  //   the y coordinate
+  Float_t  fR ;  //   the y coordinate
+
+ public:
+  
+  MGeomPix(Float_t x=0. , Float_t y=0., Float_t r=0.) ;
+  
+  void Print() ; 
+  
+  void SetX ( Float_t x )     {      fX = x ;    }
+  void SetY ( Float_t y )     {      fY = y ;    }
+  void SetR ( Float_t r )     {      fR = r ;    }
+  Float_t GetX()              {      return fX ;    }
+  Float_t GetY()              {      return fY ;    }
+  Float_t GetR()              {      return fR ;    }
+
+  ClassDef(MGeomPix, 1)		// Geometric class for one pixel
+} ; 
+
+#endif
+
Index: trunk/MagicSoft/Mars/mgui/MHexagon.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 609)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 653)
@@ -1,22 +1,15 @@
-#include <stdlib.h>
-#include <fstream.h>
-#include <iostream.h>
-
-#include "TROOT.h" 
-#include "TVirtualPad.h" 
-#include "TMath.h" 
-
-#include "MHexagon.h" 
-
+//
+//  The class MHexagon is needed for the Event Display of
+//  MAGIC.
+//
+#include "MHexagon.h"
+
+#include <TVirtualPad.h>  // gPad
+
+#include "MGeomPix.h"     // GetX
 
 ClassImp(MHexagon) 
 
-  //
-  //  The class MHexagon is needed for the Event Display of
-  //  MAGIC.
-
-
-
-MHexagon::MHexagon() : TObject(), TAttLine(), TAttFill()
+MHexagon::MHexagon() 
 {
   //   default constructor for MHexagon 
@@ -24,12 +17,19 @@
 } 
 
-MHexagon::MHexagon(Float_t x, Float_t y, Float_t d ) : TObject(), TAttLine(), TAttFill(0, 1001)
+MHexagon::MHexagon(Float_t x, Float_t y, Float_t d )
+ : TAttFill(0, 1001), fX(x), fY(y), fD(d)
 { 
   //    normal constructor for MHexagon
-  fX = x ; 
-  fY = y ; 
-  fD = d ; 
-
-} 
+}
+
+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)
 {
@@ -41,5 +41,4 @@
 { 
   //     default destructor for MHexagon
-
 }  
 
@@ -47,43 +46,42 @@
 { 
   //     copy this hexagon to hexagon 
-
-  TObject::Copy  ( obj ) ; 
-  TAttLine::Copy (((MHexagon&) obj ) ) ; 
-  TAttFill::Copy (((MHexagon&) obj ) ) ; 
- 
-  ((MHexagon&) obj).fX = fX ; 
-  ((MHexagon&) obj).fY = fY ; 
-  ((MHexagon&) obj).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
-
-  Int_t  pxhex = gPad->XtoAbsPixel( fX ) ; 
-  Int_t  pyhex = gPad->YtoAbsPixel( fY ) ; 
-
-  Double_t DistPointHexagon = TMath::Sqrt( Double_t ((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py))) ; 
-  Double_t cosa = TMath::Abs(px-pxhex) / DistPointHexagon ; 
-  Double_t sina = TMath::Abs(py-pyhex) / DistPointHexagon ; 
+    TObject::Copy  ( obj ) ;
+    TAttLine::Copy (((MHexagon&) obj ) ) ;
+    TAttFill::Copy (((MHexagon&) obj ) ) ;
+
+    ((MHexagon&) obj).fX = fX ;
+    ((MHexagon&) obj).fY = fY ;
+    ((MHexagon&) obj).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 
   
-  Double_t   dx = fD * cosa / 2 ; 
-  Double_t   dy = fD * sina / 2 ; 
-  
-  Double_t   xborder = fX + dx ; 
-  Double_t   yborder = fY + dy ; 
-
-  Int_t  pxborder = gPad->XtoAbsPixel( xborder ) ; 
-  Int_t  pyborder = gPad->YtoAbsPixel( yborder ) ; 
-  
-  Double_t DistBorderHexagon = TMath::Sqrt( Double_t ((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex))) ;  
+  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))) ;  
   
  
@@ -91,9 +89,5 @@
   //       here in the first implementation is just circle inside
 
-  if ( DistBorderHexagon <  DistPointHexagon )
-    return 999999 ; 
-  else   
-    //  return Int_t ( DistBorderHexagon - DistPointHexagon ) ; 
-    return 0 ; 
+  return DistBorderHexagon <  DistPointHexagon ? 999999 : 0;
 } 
 
@@ -147,5 +141,5 @@
   //     list this hexagon with its attributes
   TROOT::IndentLevel() ; 
-  printf ("%s:  X= %f  Y= %f R= %f \n", GetName, fX, fY, fD ) ; 
+  printf ("%s:  X= %f  Y= %f R= %f \n", GetName(), fX, fY, fD ) ;
 } 
 
@@ -164,6 +158,6 @@
   const Int_t np =  6 ; 
   
-  Float_t dx[np+1] = { .5   , 0.    , -.5   , -.5   , 0.    ,  .5   , .5    } ; 
-  Float_t dy[np+1] = { .2886,  .5772,  .2886, -.2886, -.5772, -.2886, .2886 } ; 
+  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] ; 
@@ -189,5 +183,5 @@
 {
   //     print/dump this hexagon with its attributes
-  printf ("Ellipse:  X= %f  Y= %f R= %f ", fX, fY, fD ) ; 
+  printf ("Ellipse:  X= %f  Y= %f R= %f ", fX, fY, fD ) ;
   
   if ( GetLineColor() != 1 ) printf (" Color=%d", GetLineColor() ) ; 
Index: trunk/MagicSoft/Mars/mgui/MHexagon.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 609)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 653)
@@ -22,4 +22,6 @@
 #endif 
 
+class MGeomPix;
+
 class MHexagon : public TObject, public TAttLine, public TAttFill 
 { 
@@ -33,5 +35,6 @@
   
   MHexagon() ; 
-  MHexagon(Float_t x, Float_t y, Float_t d ) ; 
+  MHexagon(Float_t x, Float_t y, Float_t d ) ;
+  MHexagon(MGeomPix &pix);
   MHexagon( const MHexagon &hexagon) ; 
   virtual ~MHexagon() ; 
