Index: /trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 8920)
+++ /trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 8921)
@@ -96,4 +96,6 @@
     fPixels.SetOwner();
 
+    // For root versions <5.18 AddAt is mandatory, for newer
+    // root-version the []-operator can be used safely
     for (UInt_t i=0; i<npix; i++)
         fPixels.AddAt(new MGeomPix, i);
@@ -354,5 +356,4 @@
 }
 
-
 // --------------------------------------------------------------------------
 //
@@ -398,26 +399,4 @@
         fPixels.Print();
 } 
-
-// --------------------------------------------------------------------------
-//
-//  Create a clone of this container. This is very easy, because we
-//  simply have to create a new object of the same type.
-//
-TObject *MGeomCam::Clone(const char *newname) const
-{
-    if (IsA()==MGeomCam::Class())
-    {
-        MGeomCam *cam = new MGeomCam(fNumPixels, fCamDist);
-        for (UInt_t i=0; i<fNumPixels; i++)
-        {
-            //if (fPixels.UncheckedAt(i))
-                (*this)[i].Copy((*cam)[i]);
-        }
-        cam->InitGeometry();
-        return cam;
-    }
-
-    return (TObject*)IsA()->New();
-}
 
 // --------------------------------------------------------------------------
@@ -546,7 +525,24 @@
 }
 
-#if ROOT_VERSION_CODE >= ROOT_VERSION(5,18,00)
-#include <TClass.h>
-#endif
+// --------------------------------------------------------------------------
+//
+// This workaround reproduces (as much as possible) the contents
+// of fPixels which got lost writing MGeomCam in which the
+// fPixels were filles with the []-operator instead of AddAt
+// and a root version previous to 5.18.
+// You try to read broken contents from file if fNumPixels is empty
+// but fNumPixels>0.
+// If you ever read broken contents from a split branch you
+// MUST call this function after reading.
+//
+void MGeomCam::StreamerWorkaround()
+{
+    if (fNumPixels==0 || !fPixels.IsEmpty())
+        return;
+
+    TObject *cam = (TObject*)IsA()->New();
+    cam->Copy(*this);
+    delete cam;
+}
 
 // --------------------------------------------------------------------------
@@ -566,13 +562,5 @@
     {
         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
+        StreamerWorkaround();
     }
     else
Index: /trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 8920)
+++ /trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 8921)
@@ -50,11 +50,14 @@
     MGeomCam(UInt_t npix=0, Float_t dist=1, const char *name=NULL, const char *title=NULL);
 
-    TObject *Clone(const char *newname=NULL) const;
     void Copy(TObject &o) const;
 
-    void CalcPixRatio(); 
     // FIXME, workaround: this function is made public just to allow
     // the use of some camera files from the 0.7 beta version in which the 
     // array containing pixel ratios is not initialized.
+    void CalcPixRatio();
+
+    // FIXME, workaround broken streaming
+    void StreamerWorkaround();
+
     void InitGeometry()
     {
@@ -106,5 +109,5 @@
     Int_t GetNeighbor(UInt_t idx, Int_t dir) const;
 
-    virtual void Print(Option_t *opt=NULL)   const;
+    void Print(Option_t *opt=NULL) const;
 
     ClassDef(MGeomCam, 5)  // Geometry base class for the camera
