Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 694)
+++ trunk/MagicSoft/Mars/Changelog	(revision 695)
@@ -1,3 +1,43 @@
                                                                   -*-*- END -*-*-
+
+ 2000/03/20: Thomas Bretz
+                                                                  
+   * manalysis/MPedestalPix.[h,cc], manalysis/MPedestalCam.[h,cc],
+     manalysis/MHillas.[h,cc], manalysis/MHillasCalc.[h,cc],
+     mgui/MGeomCamCT1.[h,cc], mgui/MGeomCamMagic.[h,cc]
+     - added
+
+   * macros/readCT1.C:
+     - added calculation of Hillas parameters
+     - changed from pointers to objects
+
+   * manalysis/AnalysisLinkDef.h, manalysis/Makefile:
+     - added MPedestalPix/Cam, MHillas, MHillasCalc
+
+   * manalysis/MCerPhotEvt.[h,cc]:
+     - removed fType
+     - commented out Draw function - should be fixed soon
+     - renamed *Nb* to *Num*
+     - renamed Get[Min,Max]NumPhotons to GetNumPhontons[Min,Max]
+
+   * meventdisp/MGFadcDisp.[h,cc]:
+     - changed parameter of ReadinEvent to unsigned
+
+   * mgui/GuiLinkDef.h, mgui/Makefile:
+     - added MGeomCamCT1, MGeomCamMagic
+
+   * mgui/MCamDisplay.[h,cc]:
+     - changed constructor argument from int to MGeomCam
+     - renamed *Nb* to *Num*
+
+   * mgui/MGeomCam.[h,cc]:
+     - removed all camara specific stuff
+     - MGeomCam is now used as a base class for the classes
+       MGeomCam[Magic,CT1] which are containing the camera specific stuff
+
+   * mgui/MGeomPix.h:
+     - added Set function
+   
+                                                                  
  2000/03/02: Thomas Bretz
    
Index: trunk/MagicSoft/Mars/macros/readCT1.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readCT1.C	(revision 694)
+++ trunk/MagicSoft/Mars/macros/readCT1.C	(revision 695)
@@ -1,44 +1,66 @@
 void readCT1()
 {
-    MParList  *plist = new MParList() ;
+    MParList plist;
 
-    MCT1ReadAscii *readct1 = new MCT1ReadAscii("CT1_99_on1.dat") ;
+    MGeomCamMagic camct1;
+    MHillas       hillas;
+    MTaskList     tlist;
 
-    if (!readct1->PreProcess(plist))
+    plist->AddToList(&camct1);
+    plist->AddToList(&hillas);
+    plist->AddToList(&tlist);
+
+    MCT1ReadAscii readct1("CT1_99_on1.dat") ;
+    MHillasCalc hcalc;
+
+    tlist.AddToList(&readct1);
+    tlist.AddToList(&hcalc);
+
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.PreProcess())
         return;
 
-    MCerPhotEvt *phevt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
+    MCerPhotEvt &phevt = *(MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
 
     Int_t icount = 0 ;
-    MCamDisplay display(0) ;
+    MCamDisplay display(&camct1) ;
 
-    while ( readct1->Process() )
+    while (readct1.Process())
     {
         cout << "Event: " << icount++  << endl  ;
 
-        if (icount >= 45 )
-        {
-            display->DrawPhotNum( phevt ) ;
+        if (icount < 45 )
+            continue;
 
-            gClient->HandleInput();
-            if(getchar()=='q')
-                break;
+        display.DrawPhotNum(&phevt);
+        gClient->HandleInput();
+        if(getchar()=='q')
+            break;
 
-            phevt->CleanLevel1() ;
-            phevt->CleanLevel2() ;
-            display->DrawPhotNum( phevt ) ;
-            gClient->HandleInput();
-            if(getchar()=='q')
-                break;
+        phevt.CleanLevel1();
+        phevt.CleanLevel2();
+        display.DrawPhotNum(&phevt);
+        gClient->HandleInput();
+        if(getchar()=='q')
+            break;
 
-            phevt->CleanLevel3() ;
+        phevt.CleanLevel3();
 
-            display->DrawPhotNum( phevt ) ;
-            gClient->HandleInput();
-            if(getchar()=='q')
-                break;
-        }
+        hcalc.Process();
+
+        hillas.Print();
+        hillas.Draw();
+
+        display.DrawPhotNum(&phevt);
+
+        gClient->HandleInput();
+        if(getchar()=='q')
+            break;
+
+        hillas.Clear();
     } 
 
-    readct1->PostProcess();
+    evtloop.PostProcess();
 }
Index: trunk/MagicSoft/Mars/manalysis/AnalysisIncl.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/AnalysisIncl.h	(revision 694)
+++ trunk/MagicSoft/Mars/manalysis/AnalysisIncl.h	(revision 695)
@@ -1,4 +1,3 @@
 #ifndef __CINT__
-
 
 #include <TClonesArray.h>
Index: trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 694)
+++ trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 695)
@@ -11,3 +11,9 @@
 #pragma link C++ class MCT1Pedestals;
 
+#pragma link C++ class MPedestalPix;
+#pragma link C++ class MPedestalCam;
+
+#pragma link C++ class MHillas;
+#pragma link C++ class MHillasCalc;
+
 #endif
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 694)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 695)
@@ -8,5 +8,4 @@
 
 #include "MLog.h"
-#include "MGeomCam.h"
 #include "MCamNeighbor.h"
 #include "MCamDisplay.h"
@@ -15,5 +14,5 @@
 ClassImp(MCerPhotEvt)
 
-MCerPhotEvt::MCerPhotEvt(const char *name, const char *title ) : fType(0), fNbPixels(0)
+MCerPhotEvt::MCerPhotEvt(const char *name, const char *title) : fNumPixels(0)
 {
   //   the default constructor 
@@ -31,17 +30,24 @@
 }
 
+#include "MGeomCamMagic.h"
+#include "MGeomCamCT1.h"
+
 void MCerPhotEvt::Draw(Option_t* option) 
 {
-  //   FIXME!!!
-  // 
-  
-  MCamDisplay *disp = new MCamDisplay(fType)  ; 
-  
-  disp->DrawPhotNum(this) ;
-}
-
-Int_t MCerPhotEvt::GetNbPixels() 
-{
-  return fNbPixels;
+    //
+    //   FIXME!!! Here the Draw function of the CamDisplay
+    //   should be called to add the CamDisplay to the Pad.
+    //   The drawing should be done in MCamDisplay::Paint
+    //
+
+    //    MGeomCam *geom = fType ? new MGeomCamMagic : new MGeomCamCT1;
+    //    MCamDisplay *disp = new MCamDisplay(geom);
+    //    delete geom;
+    //    disp->DrawPhotNum(this);
+}
+
+Int_t MCerPhotEvt::GetNumPixels()
+{
+    return fNumPixels;
 } 
 
@@ -52,5 +58,5 @@
     // of valid pixels in the list by one
     //
-    (*fPixels)[fNbPixels++] = new MCerPhotPix( id, nph, err);
+    (*fPixels)[fNumPixels++] = new MCerPhotPix( id, nph, err);
 }
 
@@ -60,5 +66,5 @@
     // reset counter and delete netries in list.
     //
-    fNbPixels = 0 ;
+    fNumPixels = 0 ;
     fPixels->Clear() ;
 }
@@ -69,5 +75,5 @@
 
     *fLog << "MCerPhotEvt::Print()" << endl
-        << "Number of Pixels: " << fNbPixels
+        << "Number of Pixels: " << fNumPixels
         << "(" << entries << ")"
         << endl ;
@@ -276,10 +282,10 @@
 } 
 
-Float_t MCerPhotEvt::GetMinNumPhotons()
+Float_t MCerPhotEvt::GetNumPhotonsMin()
 {
     //
     // get the minimum number of photons of all valid pixels in the list
     //
-    if (fNbPixels <= 0)
+    if (fNumPixels <= 0)
         return -5. ;
 
@@ -287,5 +293,5 @@
 
     Float_t testval;
-    for (Int_t i=1 ; i<fNbPixels; i++ )
+    for (Int_t i=1 ; i<fNumPixels; i++ )
     {
         testval = (*this)[i].GetNumPhotons();
@@ -298,10 +304,10 @@
 }
 
-Float_t MCerPhotEvt::GetMaxNumPhotons()
+Float_t MCerPhotEvt::GetNumPhotonsMax()
 {
     //
     // get the maximum number of photons of all valid pixels in the list
     //
-    if (fNbPixels <= 0)
+    if (fNumPixels <= 0)
         return 50.;
 
@@ -309,5 +315,5 @@
 
     Float_t testval;
-    for (Int_t i=1; i<fNbPixels; i++)
+    for (Int_t i=1; i<fNumPixels; i++)
     {
         testval = (*this)[i].GetNumPhotons();
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 694)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 695)
@@ -21,6 +21,5 @@
 private:
 
-    Int_t         fType;
-    Int_t         fNbPixels;
+    Int_t         fNumPixels;
     TClonesArray *fPixels;
 
@@ -32,5 +31,5 @@
   void Draw(Option_t* option = "" ) ; 
 
-  Int_t    GetNbPixels() ; 
+  Int_t    GetNumPixels() ;
 
   void AddPixel(Int_t id, Float_t nph, Float_t err );
@@ -48,6 +47,6 @@
   Bool_t  IsPixelCore    ( Int_t id ) ;
  
-  Float_t GetMinNumPhotons();
-  Float_t GetMaxNumPhotons();
+  Float_t GetNumPhotonsMin();
+  Float_t GetNumPhotonsMax();
 
   MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->At(i)); }
Index: trunk/MagicSoft/Mars/manalysis/MHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 695)
@@ -0,0 +1,172 @@
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MHillas                                                                 //
+//                                                                         //
+// Storage Container for the Hillas parameter                              //
+//                                                                         //
+// FIXME: Here everybody should find an explanation of the parameters      //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#include "MHillas.h"
+
+#include <TEllipse.h>
+
+#include "MCerPhotEvt.h"
+#include "MCerPhotPix.h"
+#include "MGeomCam.h"
+
+#include "MLog.h"
+
+ClassImp(MHillas)
+
+    MHillas::MHillas(const char *name, const char *title) : fEllipse(NULL)
+{
+    *fName  = name  ? name  : "MHillas";
+    *fTitle = title ? title : "Storage container for Hillas parameter of one event";
+
+    // FIXME: Initialization of values missing
+}
+
+MHillas::~MHillas()
+{
+    Clear();
+}
+
+void MHillas::Print(Option_t *)
+{
+    *fLog << "Hillas Parameter:" << endl;
+    *fLog << " - Alpha  = " << fAlpha  << endl;
+    *fLog << " - Width  = " << fWidth  << endl;
+    *fLog << " - Length = " << fLength << endl;
+    *fLog << " - Dist   = " << fDist   << endl;
+}
+
+void MHillas::Draw(Option_t *)
+{
+    //
+    // Instead of adding MHillas itself to the Pad
+    // (s. AppendPad in TObject) we create an ellipse,
+    // which is added to the Pad by it's Draw function
+    // You can remove it by deleting the Ellipse Object
+    // (s. Clear() )
+    //
+
+    Clear();
+
+    fEllipse = new TEllipse(cos(fTheta)*fDist, sin(fTheta)*fDist,
+                            fWidth, fLength,
+                            0, 360, fAlpha);
+
+    fEllipse->SetLineWidth(2);
+    fEllipse->Draw();
+}
+
+void MHillas::Clear(Option_t *)
+{
+    if (!fEllipse)
+        return;
+
+    delete fEllipse;
+
+    fEllipse = NULL;
+}
+
+void MHillas::Calc(MGeomCam &geom, MCerPhotEvt &evt)
+{
+    const UInt_t nevt = evt.GetNumPixels();
+
+    //
+    // calculate mean valu of pixels
+    //
+    float xav =0;
+    float yav =0;
+    float spix=0;
+
+    for (UInt_t i=0; i<nevt; i++)
+    {
+        const MCerPhotPix &pix = evt[i];
+
+        if (!pix.IsPixelUsed())
+            continue;
+
+        const MGeomPix &gpix = geom[pix.GetPixId()];
+
+        const float nphot = pix.GetNumPhotons();
+
+        spix += nphot;
+        xav  += nphot * gpix.GetX();
+        yav  += nphot * gpix.GetY();
+    }
+
+    xav /= spix;
+    yav /= spix;
+
+    //
+    // calculate sdev
+    //
+    float dis11=0;
+    float dis12=0;
+    float dis22=0;
+
+    for (UInt_t i=0; i<nevt; i++)
+    {
+        const MCerPhotPix &pix = evt[i];
+
+        if (!pix.IsPixelUsed())
+            continue;
+
+        const MGeomPix &gpix = geom[pix.GetPixId()];
+
+        const float dx = gpix.GetX() - xav;
+        const float dy = gpix.GetY() - yav;
+
+        const float nphot = pix.GetNumPhotons();
+
+        dis11 += nphot * dx*dx;
+        dis12 += nphot * dx*dy;
+        dis22 += nphot * dy*dy;
+    }
+
+    //
+    // check for orientation
+    //
+    const float theta = atan(dis12/(dis11-dis22)*2)/2;
+
+    float c = cos(theta);
+    float s = sin(theta);
+
+    const float direction = c*xav+s*yav;
+
+    if (direction<0)
+    {
+        c = -c;
+        s = -s;
+    }
+
+    float rot1 =  2.0*c*s*dis12 + c*c*dis11 + s*s*dis22;
+    float rot2 = -2.0*c*s*dis12 + s*s*dis11 + c*c*dis22;
+
+    rot1 /= spix;
+    rot2 /= spix;
+
+    //
+    // check for numerical negatives
+    //
+    if (rot1 < 0) rot1=0;
+    if (rot2 < 0) rot2=0;
+
+    //
+    // check the rotation of the axis
+    //
+    const int rotation = rot1<rot2;
+
+    fLength = rotation ? sqrt(rot2) : sqrt(rot1);
+    fWidth  = rotation ? sqrt(rot1) : sqrt(rot2);
+
+    fAlpha = 180/kPI*atan((-xav*s+yav*c)/direction);
+
+    fDist  = sqrt(xav*xav + yav*yav);
+
+    fTheta = atan(yav/xav);
+    if (xav<0) fTheta += kPI;
+}
Index: trunk/MagicSoft/Mars/manalysis/MHillas.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillas.h	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MHillas.h	(revision 695)
@@ -0,0 +1,40 @@
+#ifndef MHILLAS_H
+#define MHILLAS_H
+
+#ifndef MPARCONTAINER_H
+#include "MParContainer.h"
+#endif
+
+class TEllipse;
+
+class MGeomCam;
+class MCerPhotEvt;
+
+class MHillas : public MParContainer
+{
+private:
+    Float_t fAlpha;     // Angle between the length axis of the ellipse and the camera center
+    Float_t fTheta;     // Angle between the x axis and the center of the ellipse
+    Float_t fWidth;     // Width of the ellipse
+    Float_t fLength;    // Length of the ellipse
+    Float_t fSize;      // Size of the ellipse
+    Float_t fDist;      // Distance of the ellipse COM from the camera center
+
+    TEllipse *fEllipse; //! Graphical Object to Display Ellipse
+
+public:
+    MHillas(const char *name=NULL, const char *title=NULL);
+    ~MHillas();
+
+    void Calc(MGeomCam &geom, MCerPhotEvt &pix);
+
+    void Print(Option_t *opt=NULL);
+    void Draw(Option_t *opt=NULL);
+
+    void Clear(Option_t *opt=NULL);
+
+    ClassDef(MHillas, 1) // Storage Container for Hillas Parameter
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 695)
@@ -0,0 +1,53 @@
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//   MHillas Calc                                                          //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MHillasCalc.h"
+
+#include "MParList.h"
+
+#include "MHillas.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MHillasCalc)
+
+MHillasCalc::MHillasCalc(const char *name, const char *title)
+{
+    *fName  = name  ? name  : "MHillasCalc";
+    *fTitle = title ? title : "Task to calculate Hillas parameters";
+}
+
+Bool_t MHillasCalc::PreProcess( MParList *pList )
+{
+    fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
+    if (!fCerPhotEvt)
+    {
+        *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
+    if (!fGeomCam)
+    {
+        *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
+        return kFALSE;
+    }
+
+    fHillas = (MHillas*)pList->FindCreateObj("MHillas");
+    if (!fHillas)
+        return kFALSE;
+
+    return kTRUE;
+}
+
+Bool_t MHillasCalc::Process()
+{
+    fHillas->Calc(*fGeomCam, *fCerPhotEvt);
+
+    return kTRUE;
+}
+
Index: trunk/MagicSoft/Mars/manalysis/MHillasCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasCalc.h	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MHillasCalc.h	(revision 695)
@@ -0,0 +1,35 @@
+#ifndef MHILLASCALC_H
+#define MHILLASCALC_H
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MHillasCalkc                                                            //
+//                                                                         //
+// Task to calculate Hillas Parameters                                     //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef MTASK_H
+#include "MTask.h"
+#endif
+
+class MGeomCam;
+class MCerPhotEvt;
+class MHillas;
+
+class MHillasCalc : public MTask
+{
+    MGeomCam    *fGeomCam;    // Camera Geometry used to calculate Hillas
+    MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation
+    MHillas     *fHillas;     // ouput container to store result
+
+public:
+    MHillasCalc(const char *name=NULL, const char *title=NULL);
+
+    Bool_t PreProcess(MParList *pList);
+    Bool_t Process();
+
+    ClassDef(MHillasCalc, 0)   // Task to calculate Hillas parameters
+};
+
+#endif
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 695)
@@ -0,0 +1,26 @@
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MPedestalCam                                                            //
+//                                                                         //
+// Hold the Pedestal information for all pixels in the camera              //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#include "MPedestalCam.h"
+
+#include "MLog.h"
+
+ClassImp(MPedestalCam)
+
+MPedestalCam::MPedestalCam(const char *name, const char *title)
+{
+    *fName  = name  ? name  : "MPedestalCam";
+    *fTitle = title ? title : "Storage container for all Pedestal Information in the camera";
+
+    fArray = new TClonesArray("MPedestalPix", 577);
+}
+
+MPedestalCam::~MPedestalCam()
+{
+    delete fArray;
+}
+
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 695)
@@ -0,0 +1,31 @@
+#ifndef MPEDESTALCAM_H
+#define MPEDESTALCAM_H
+
+#ifndef MPARCONTAINER_H
+#include "MParContainer.h"
+#endif
+
+#ifndef MPEDESTALPIX_H
+#include "MPedestalPix.h"
+#endif
+
+#ifndef ROOT_TClonesArray
+#include <TClonesArray.h>
+#endif
+
+class MPedestalCam : public MParContainer
+{
+private:
+    TClonesArray *fArray;
+
+public:
+    MPedestalCam(const char *name=NULL, const char *title=NULL);
+    ~MPedestalCam();
+
+    MPedestalPix &operator[](Int_t i) { return *(MPedestalPix*)fArray->At(i); }
+
+    ClassDef(MPedestalCam, 1)	// Storage Container for all pedestal information of the camera
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc	(revision 695)
@@ -0,0 +1,21 @@
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MPedestalPix                                                            //
+//                                                                         //
+// This is the storage container to hold informations about the pedestal   //
+// (offset) value of one Pixel (PMT).                                      //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#include "MPedestalPix.h"
+
+//#include <fstream.h>
+
+#include "MLog.h"
+
+ClassImp(MPedestalPix)
+
+MPedestalPix::MPedestalPix()
+    : fMean(0.0), fSigma(0.0), fMeanRms(0.0), fSigmaRms(0.0)
+{
+}
+
Index: trunk/MagicSoft/Mars/manalysis/MPedestalPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalPix.h	(revision 695)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalPix.h	(revision 695)
@@ -0,0 +1,33 @@
+#ifndef MPEDESTALPIX_H
+#define MPEDESTALPIX_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+
+class MPedestalPix : public TObject
+{
+private:
+    Float_t fMean;     // mean value of pedestal (PMT offset)
+    Float_t fSigma;    // sigma (standard deviation) of pedestal
+    Float_t fMeanRms;  // root mean square of pedestal
+    Float_t fSigmaRms; // root mean sqare of sigma of the pedestal
+
+public:
+    MPedestalPix();
+
+    Float_t GetMean()     { return fMean;     }
+    Float_t GetSigma()    { return fSigma;    }
+    Float_t GetMeanRms()  { return fMeanRms;  }
+    Float_t GetSigmaRms() { return fSigmaRms; }
+
+    void SetMean(Float_t f)     { fMean = f;     }
+    void SetSigma(Float_t f)    { fSigma = f;    }
+    void SetMeanRms(Float_t f)  { fMeanRms = f;  }
+    void SetSigmaRms(Float_t f) { fSigmaRms = f; }
+
+    ClassDef(MPedestalPix, 1)	// Storage Container for Pedestal information of one pixel
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 694)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 695)
@@ -30,4 +30,8 @@
 SRCFILES = MCT1Pedestals.cc \
 	   MCT1ReadAscii.cc \
+           MPedestalCam.cc \
+           MPedestalPix.cc \
+           MHillas.cc \
+           MHillasCalc.cc \
 	   MCerPhotEvt.cc \
 	   MCerPhotPix.cc 
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 694)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 695)
@@ -339,5 +339,5 @@
 }
 
-void MGFadcDisp::ReadinEvent(Int_t iEvt)
+void MGFadcDisp::ReadinEvent(UInt_t iEvt)
 {
     Int_t buttons = 4;
@@ -346,5 +346,5 @@
     //  first check if the new event is in the range of possible events
   
-    if ( iEvt < 0 || iEvt >= fReadTree->GetEntries() )
+    if ( iEvt >= fReadTree->GetEntries() )
     {
         new TGMsgBox(fClient->GetRoot(), this,
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 694)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 695)
@@ -114,5 +114,5 @@
   void CreatePixelList() ; 
   void UpdateEventCounter() ; 
-  void ReadinEvent(Int_t iEvt) ; 
+  void ReadinEvent(UInt_t iEvt) ;
 
   virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
Index: trunk/MagicSoft/Mars/mgui/GuiLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/GuiLinkDef.h	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/GuiLinkDef.h	(revision 695)
@@ -13,7 +13,10 @@
 
 #pragma link C++ class MHexagon;
+#pragma link C++ class MCamNeighbor;
+
 #pragma link C++ class MGeomPix;
 #pragma link C++ class MGeomCam;
-#pragma link C++ class MCamNeighbor;
+#pragma link C++ class MGeomCamCT1;
+#pragma link C++ class MGeomCamMagic;
 
 #pragma link C++ class MCamDisplay;
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 695)
@@ -18,14 +18,9 @@
 ClassImp(MCamDisplay)
 
-    MCamDisplay::MCamDisplay (Int_t type ) : fAutoScale(kTRUE)
+MCamDisplay::MCamDisplay (MGeomCam *geom) : fAutoScale(kTRUE)
 { 
     // default constructor
 
     //
-    // create a object which contains the camera geometry
-    //
-    MGeomCam geom(type) ;
-
-    //
     //    set the color palette
     //
@@ -35,11 +30,9 @@
     //  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]) ;
-    }
+    fNumPixels = geom->GetNumPixels() ;
+    fPixels    = new TClonesArray("MHexagon", fNumPixels ) ;
+
+    for (UInt_t i=0; i< fNumPixels; i++ )
+        (*fPixels)[i] = new MHexagon((*geom)[i]) ;
 
     //
@@ -98,5 +91,5 @@
     // draw all pixels of the camera
     //
-    for (Int_t i=0; i< fNbPixels; i++)
+    for (UInt_t i=0; i< fNumPixels; i++)
         (*this)[i].Draw();
 
@@ -149,6 +142,6 @@
     if ( fAutoScale )
     {
-        fMinPhe = event->GetMinNumPhotons() ;
-        fMaxPhe = event->GetMaxNumPhotons() ;
+        fMinPhe = event->GetNumPhotonsMin() ;
+        fMaxPhe = event->GetNumPhotonsMax() ;
 
         if (fMaxPhe < 20.)
@@ -161,5 +154,5 @@
     //   update the colors in the picture
     //
-    const Int_t entries = event->GetNbPixels();
+    const Int_t entries = event->GetNumPixels();
 
     for (Int_t i=0 ; i<entries; i++ )
@@ -190,5 +183,5 @@
     // determine the Pixel Id and the content
     //
-    const Int_t entries = event->GetNbPixels() ;
+    const Int_t entries = event->GetNumPixels() ;
 
     for (Int_t i=0 ; i<entries; i++ )
@@ -211,5 +204,5 @@
     // reset the all pixel colors to a default value
     //
-    for ( Int_t i=0 ; i< fNbPixels ; i++ )
+    for ( UInt_t i=0 ; i< fNumPixels ; i++ )
         (*this)[i].SetFillColor(10) ;
 } 
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 695)
@@ -18,22 +18,24 @@
 #endif
 
-class TClonesArray ;
-class MCerPhotEvt  ;
 class TBox;
 class TText;
+class TClonesArray ;
+
+class MCerPhotEvt  ;
+class MGeomCam;
 
 class MCamDisplay : public TObject
 {
  private: 
-  Bool_t        fAutoScale ;   //!  indicating the autoscale function
+  Bool_t         fAutoScale ;   //!  indicating the autoscale function
   
-  Int_t         fNbPixels ;    //!
-  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); }
@@ -47,5 +49,5 @@
  public:
   
-  MCamDisplay ( Int_t type=0 ) ; 
+  MCamDisplay (MGeomCam *geom);
 
   ~MCamDisplay () ; 
Index: trunk/MagicSoft/Mars/mgui/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 695)
@@ -1,7 +1,3 @@
 #include "MGeomCam.h"
-
-
-#include <math.h>     // floor
-#include "TCanvas.h"
 
 #include "MLog.h"
@@ -10,354 +6,45 @@
 ClassImp(MGeomCam)
 
-MGeomCam::MGeomCam(Int_t type )
-{ 
-  //    default constructor
+MGeomCam::MGeomCam(UInt_t npix, const char *name, const char *title)
+{
+    *fName  = name  ? name  : "MGeomCam";
+    *fTitle = title ? title : "Storage container for  a camera geometry";
 
-  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 ) ; 
+    fNumPixels = npix;
+    fPixels    = new TObjArray(npix);
 
-    CreateMagic() ; 
-  } 
-} 
+    //
+    // make sure that the destructor delete all contained objects
+    //
+    fPixels->SetOwner();
+
+    for (UInt_t i=0; i<npix; i++)
+        (*fPixels)[i] = new MGeomPix;
+}
 
 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
+    // Draw the 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 ) ) ;
-        }
+    for (UInt_t i=0; i<fNumPixels; i++)
+    {
+        MHexagon *el = new MHexagon((*this)[i]);
+        el->Draw();
     }
 }
 
+void MGeomCam::Print(Option_t *)
+{
+    //
+    //   Print Information about the Geometry of the camera
+    //
+    *fLog << " Number of Pixels: " << fNumPixels << endl ;
+
+    for (UInt_t i=0; i<fNumPixels; i++ )
+    {
+        *fLog << " Pixel: " << i << "  ";
+        (*this)[i].Print() ;
+    }
+} 
+
Index: trunk/MagicSoft/Mars/mgui/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 695)
@@ -8,31 +8,32 @@
 #include <TObjArray.h>
 #endif
+#ifndef MPARCONTAINER_H
+#include "MParContainer.h"
+#endif
 #ifndef MGEOMPIX_H
 #include "MGeomPix.h"
 #endif
 
-class MGeomCam
+class MGeomCam : public MParContainer
 {
 private:
-    Int_t          fNbPixels ;  //!
-    TObjArray     *fPixels   ;  //!
-  
-    void CreateMagic() ;
-    void CreateCT1() ;
+    UInt_t     fNumPixels;  // Number of pixels in this camera
+    TObjArray *fPixels;     // Array of singel pixels storing the geometry
 
 public:
 
-    MGeomCam( Int_t type=0 ) ;
+    MGeomCam(UInt_t npix, const char *name=NULL, const char *title=NULL);
+
     virtual ~MGeomCam() { delete fPixels; }
 
-    void Draw(Option_t *option = "" ) ;
+    virtual void Draw(Option_t *option = "" );
 
-    Int_t    GetNbPixels() ;
+    UInt_t GetNumPixels() const { return fNumPixels; }
 
     MGeomPix &operator[](Int_t i) { return *(MGeomPix*)fPixels->At(i); }
 
-    void Print(Option_t *opt=NULL) ;
+    virtual void Print(Option_t *opt=NULL);
 
-    ClassDef(MGeomCam, 1)		// Geometry class for the camera
+    ClassDef(MGeomCam, 1)		// Geometry base class for the camera
 };
 
Index: trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc	(revision 695)
+++ trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc	(revision 695)
@@ -0,0 +1,81 @@
+#include "MGeomCamCT1.h"
+
+
+#include <math.h>     // floor
+#include "TCanvas.h"
+
+#include "MLog.h"
+
+ClassImp(MGeomCamCT1)
+
+MGeomCamCT1::MGeomCamCT1(const char *name) : MGeomCam(127, name, "Geometry information of CT1 camera")
+{
+    CreateCam();
+} 
+
+void MGeomCamCT1::Draw( Option_t * )
+{ 
+    TCanvas *can = new TCanvas("can", "Camera Geometry", 4 ) ;
+
+    can->Range(-175, -175, 175, 175 ) ;
+
+    MGeomCam::Draw();
+} 
+
+void MGeomCamCT1::CreateCam()
+{
+    //
+    // fill the geometry class with the coordinates of the CT1 camera
+    //
+    *fLog << " 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
+    //
+    (*this)[0].Set(0, 0, pixdiameter);
+    //fPixels->Add( new MGeomPix( ) ;
+
+    const Float_t kS32  = sqrt(3)/2;
+    const Float_t kPI23 = kPI*2/3;
+
+    Int_t pixnum = 1;
+
+    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 Data into the array
+            //
+
+            (*this)[pixnum++].Set(rad * cos(ang),
+                                  rad * sin(ang),
+                                  pixdiameter);
+            // fPixels->Add( new MGeomPix( ) ;
+        }
+    }
+}
+
Index: trunk/MagicSoft/Mars/mgui/MGeomCamCT1.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCamCT1.h	(revision 695)
+++ trunk/MagicSoft/Mars/mgui/MGeomCamCT1.h	(revision 695)
@@ -0,0 +1,27 @@
+#ifndef MGEOMCAMCT1_H
+#define MGEOMCAMCT1_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+#ifndef MGEOMCAM_H
+#include "MGeomCam.h"
+#endif
+
+class MGeomCamCT1 : public MGeomCam
+{
+private:
+
+    void CreateCam();
+
+public:
+
+    MGeomCamCT1(const char *name=NULL);
+
+    void Draw(Option_t *option = "" ) ;
+
+    ClassDef(MGeomCamCT1, 1)		// Geometry class for the camera
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc	(revision 695)
+++ trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc	(revision 695)
@@ -0,0 +1,270 @@
+#include "MGeomCamMagic.h"
+
+#include "TCanvas.h"
+
+#include "MLog.h"
+
+ClassImp(MGeomCamMagic)
+
+MGeomCamMagic::MGeomCamMagic(const char *name) : MGeomCam(577, name, "Geometry information of Magic Camera")
+{
+    CreateCam();
+}
+
+void MGeomCamMagic::Draw(Option_t *)
+{ 
+    TCanvas *can = new TCanvas("can", "Camera Geometry", 4 ) ;
+
+    can->Range(-600, -600, 600, 600 ) ;
+
+    MGeomCam::Draw();
+}
+
+void MGeomCamMagic::CreateCam()
+{
+    //
+    //   fill the geometry class with the coordinates of the MAGIC camera
+    //
+    *fLog << " Creating Magic geometry " << endl ;
+
+    //
+    //   here define the hardwire things of the magic telescope
+    //
+    const Float_t xtemp[577] = {
+        +000.000,   30.000,   15.000,  -15.000,  -30.000,  -15.000,   15.000,   60.000,
+        +045.000,   30.000,    0.000,  -30.000,  -45.000,  -60.000,  -45.000,  -30.000,
+        +000.000,   30.000,   45.000,   90.000,   75.000,   60.000,   45.000,   15.000,
+        -015.000,  -45.000,  -60.000,  -75.000,  -90.000,  -75.000,  -60.000,  -45.000,
+        -015.000,   15.000,   45.000,   60.000,   75.000,  120.000,  105.000,   90.000,
+        +075.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,
+        +030.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,
+        -090.000, -105.000, -120.000, -135.000, -150.000, -135.000, -120.000, -105.000,
+        -090.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,
+        +060.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,
+        +045.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,
+        +045.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,
+        -090.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,
+        +090.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,
+        -045.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,
+        -045.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,
+        -060.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,
+        +030.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,
+        +000.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,
+        -090.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,
+        +090.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,
+        +000.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
+    };
+
+    const Float_t ytemp[577] = {
+        +000.000,    0.000,   25.981,   25.981,    0.000,  -25.981,  -25.981,    0.000,
+        +025.981,   51.961,   51.961,   51.961,   25.981,    0.000,  -25.981,  -51.961,
+        -051.961,  -51.961,  -25.981,    0.000,   25.981,   51.961,   77.942,   77.942,
+        +077.942,   77.942,   51.961,   25.981,    0.000,  -25.981,  -51.961,  -77.942,
+        -077.942,  -77.942,  -77.942,  -51.961,  -25.981,    0.000,   25.981,   51.961,
+        +077.942,  103.923,  103.923,  103.923,  103.923,  103.923,   77.942,   51.961,
+        +025.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,
+        +077.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,
+        -077.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,
+        -077.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,
+        +025.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,
+        -025.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,
+        +025.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,
+        -025.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,
+        +025.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,
+        -077.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,
+        -077.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,
+        -086.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,
+        -034.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,
+        -034.641
+    };
+
+    const 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 (UInt_t i = 0; i<GetNumPixels(); i++)
+    {
+        (*this)[i].Set(xtemp[i], ytemp[i], rtemp[i]) ;
+        //fPixels->Add( new MGeomPix() ;
+    }
+}
+
Index: trunk/MagicSoft/Mars/mgui/MGeomCamMagic.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCamMagic.h	(revision 695)
+++ trunk/MagicSoft/Mars/mgui/MGeomCamMagic.h	(revision 695)
@@ -0,0 +1,26 @@
+#ifndef MGEOMCAMMAGIC_H
+#define MGEOMCAMMAGIC_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+#ifndef MGEOMCAM_H
+#include "MGeomCam.h"
+#endif
+
+class MGeomCamMagic : public MGeomCam
+{
+private:
+    void CreateCam();
+
+public:
+
+    MGeomCamMagic(const char *name=NULL);
+
+    void Draw(Option_t *option = "");
+
+    ClassDef(MGeomCamMagic, 1)		// Geometry class for the camera
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/mgui/MGeomPix.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomPix.h	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/MGeomPix.h	(revision 695)
@@ -11,5 +11,5 @@
   Float_t  fX ;  //   the x coordinate 
   Float_t  fY ;  //   the y coordinate
-  Float_t  fR ;  //   the y coordinate
+  Float_t  fR ;  //   the r coordinate
 
  public:
@@ -18,11 +18,14 @@
   
   void Print(Option_t *opt=NULL) ;
+
+  void Set (Float_t x, Float_t y, Float_t r) { fX=x; fY=y; fR=r; }
   
-  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 ;    }
+  void SetX (Float_t x) { fX = x; }
+  void SetY (Float_t y) { fY = y; }
+  void SetR (Float_t r) { fR = r; }
+
+  Float_t GetX() const  { return fX; }
+  Float_t GetY() const  { return fY; }
+  Float_t GetR() const  { return fR; }
 
   ClassDef(MGeomPix, 1)		// Geometric class for one pixel
Index: trunk/MagicSoft/Mars/mgui/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mgui/Makefile	(revision 694)
+++ trunk/MagicSoft/Mars/mgui/Makefile	(revision 695)
@@ -35,4 +35,6 @@
 	   MGMonteCarloMain.cc \
            MGPrototyp.cc \
+           MGeomCamCT1.cc \
+           MGeomCamMagic.cc \
            MGeomCam.cc \
            MGeomPix.cc \
