Index: trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h	(revision 8919)
+++ trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h	(revision 8920)
@@ -6,5 +6,5 @@
 
 #pragma link C++ class MGeomPix+;
-#pragma link C++ class MGeomCam+;
+#pragma link C++ class MGeomCam-;
 #pragma link C++ class MGeomPMT+;
 #pragma link C++ class MGeomMirror+;
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 8919)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 8920)
@@ -20,5 +20,5 @@
 !   Author(s): Markus Gaug      03/2004 <mailto:markus@ifae.es>
 !
-!   Copyright: MAGIC Software Development, 2000-2007
+!   Copyright: MAGIC Software Development, 2000-2008
 !
 \* ======================================================================== */
@@ -65,4 +65,5 @@
 #include "MGeomCam.h"
 
+#include <TMath.h>      // TMath
 #include <TClass.h>     // IsA()->New()
 #include <TArrayI.h>    // TArrayI
@@ -96,5 +97,38 @@
 
     for (UInt_t i=0; i<npix; i++)
-        fPixels[i] = new MGeomPix;
+        fPixels.AddAt(new MGeomPix, i);
+}
+
+// --------------------------------------------------------------------------
+//
+// Copy function. It does intentionally (see workaround in Streamer)
+// not copy name and title.
+//
+void MGeomCam::Copy(TObject &o) const
+{
+    MGeomCam &c = (MGeomCam&)o;
+
+    c.fNumPixels      = fNumPixels;
+    c.fCamDist        = fCamDist;
+    c.fConvMm2Deg     = fConvMm2Deg;
+
+    c.fMaxRadius      = fMaxRadius;
+    c.fMinRadius      = fMinRadius;
+    c.fPixRatio       = fPixRatio;
+    c.fPixRatioSqrt   = fPixRatioSqrt;
+
+    c.fNumPixInSector = fNumPixInSector;
+    c.fNumPixWithAidx = fNumPixWithAidx;
+
+    Int_t n = fPixels.GetEntriesFast();
+    Int_t m = c.fPixels.GetEntriesFast();
+
+    c.fPixels.Expand(n);
+
+    for (int i=m; i<n; i++)
+        c.fPixels.AddAt(new MGeomPix, i);
+
+    for (int i=0; i<n; i++)
+        fPixels[i]->Copy(c[i]);
 }
 
@@ -348,7 +382,9 @@
 // --------------------------------------------------------------------------
 //
-//  Prints the Geometry information of all pixels in the camera
-//
-void MGeomCam::Print(Option_t *) const
+//  Prints the Geometry information of all pixels in the camera.
+//  With the option "simple" you can suppress the output of the contents
+//  of the individual pixels.
+//
+void MGeomCam::Print(Option_t *o) const
 {
     //
@@ -359,5 +395,6 @@
     *fLog << " Min.Radius: " << GetMinRadius() << "  Max.Radius: " << GetMaxRadius() << endl;
 
-    fPixels.Print();
+    if (!TString(o).Contains("simple", TString::kIgnoreCase))
+        fPixels.Print();
 } 
 
@@ -508,2 +545,36 @@
     return -1;
 }
+
+#if ROOT_VERSION_CODE >= ROOT_VERSION(5,18,00)
+#include <TClass.h>
+#endif
+
+// --------------------------------------------------------------------------
+//
+// This is a custom made streamer. Due to a bug in TObjArray::operator[]
+// old root-versions didn't correctly store the contents of the TObjArray.
+// If such a file is detected (TObjArray empty) a new MGeomCam is created
+// with IsA()->New() and its contents is copied to this. Unfortunately
+// this won't work for all MGeomCam derivatives which need arguments
+// in the constructor and MGeomCam itself (no derivative). Fortunately
+// in prodoction we have never stored anything else than MGeomCamMagic yet.
+// The bug in root can be worked around using AddAt instead of operator[].
+//
+void MGeomCam::Streamer(TBuffer &b)
+{
+    if (b.IsReading())
+    {
+        MGeomCam::Class()->ReadBuffer(b, this);
+
+#if ROOT_VERSION_CODE >= ROOT_VERSION(5,18,00)
+        if (IsA()!=MGeomCam::Class() && fPixels.GetEntriesFast()==0)
+        {
+            MGeomCam *c = (MGeomCam*)IsA()->New();
+            c->Copy(*this);
+            delete c;
+        }
+#endif
+    }
+    else
+        MGeomCam::Class()->WriteBuffer(b, this);
+}
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 8919)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 8920)
@@ -50,5 +50,6 @@
     MGeomCam(UInt_t npix=0, Float_t dist=1, const char *name=NULL, const char *title=NULL);
 
-    virtual TObject *Clone(const char *newname=NULL) const;
+    TObject *Clone(const char *newname=NULL) const;
+    void Copy(TObject &o) const;
 
     void CalcPixRatio(); 
