Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 2409)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 2410)
@@ -351,6 +351,8 @@
 // --------------------------------------------------------------------------
 //
-// Return a pointer to the pixel with the requested id. NULL if it doesn't
-// exist.
+// Return a pointer to the pixel with the requested idx. NULL if it doesn't
+// exist. The Look-up-table fLut is used. If its size is zero (according
+// to Rene this will happen if an old class object is loaded) we still
+// try to search in the array.
 //
 MCerPhotPix *MCerPhotEvt::GetPixById(int idx) const
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 2409)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h	(revision 2410)
@@ -4,4 +4,7 @@
 #ifndef ROOT_TClonesArray
 #include <TClonesArray.h>
+#endif
+#ifndef ROOT_TArrayI
+#include <TArrayI.h>
 #endif
 #ifndef MARS_MCamEvent
@@ -19,4 +22,5 @@
 private:
     UInt_t        fNumPixels;
+    TArrayI       fLut;        // Lookup tabel to lookup pixel by index
     TClonesArray *fPixels;     //-> FIXME: Change TClonesArray away from a pointer?
 
@@ -28,12 +32,18 @@
     //void   InitSize(UInt_t num) { fPixels->Expand(num); }
 
-    void   AddPixel(Int_t id, Float_t nph, Float_t er)
+    void   AddPixel(Int_t idx, Float_t nph, Float_t er)
     {
-        new ((*fPixels)[fNumPixels++]) MCerPhotPix(id, nph, er);
+        //
+        // If this is too slow or takes to much space we might use
+        // MGeomApply and an InitSize member function instead.
+        //
+        if (idx>=fLut.GetSize())
+            fLut.Set(idx+1);
+
+        fLut[idx] = fNumPixels;
+        new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er);
     }
 
     void FixSize();
-
-    //Bool_t  AddEvent(const MCerPhotEvt &evt);
 
     Bool_t  IsPixelExisting(Int_t id) const;
@@ -53,23 +63,19 @@
     MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
 
-    void Scale(Double_t f);
+    void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); }
     void RemoveUnusedPixels();
 
-    MCerPhotPix *GetPixById(int id) const;
+    MCerPhotPix *GetPixById(int idx) const;// { return idx>=0 && idx<fLut.GetSize() ? (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])) : 0; } // Return a pointer to the pixel with the requested id. NULL if it doesn't exist.
 
     void Reset();
 
-    void Draw(Option_t* option = "");
     void Print(Option_t *opt=NULL) const;
     void Clear(Option_t *opt=NULL) { Reset(); }
 
     Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
-    void DrawPixelContent(Int_t num) const
-    {
-    }
+    void DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const;
 
-    ClassDef(MCerPhotEvt, 1)    // class for an event containing cerenkov photons
+    ClassDef(MCerPhotEvt, 2)    // class for an event containing cerenkov photons
 };
 
 #endif
-
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 2409)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 2410)
@@ -92,5 +92,5 @@
 MPedestalPix &MPedestalCam::operator[](Int_t i)
 {
-    return *(MPedestalPix*)fArray->UncheckedAt(i);
+    return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
 }
 
@@ -101,5 +101,5 @@
 MPedestalPix &MPedestalCam::operator[](Int_t i) const
 {
-    return *(MPedestalPix*)fArray->UncheckedAt(i);
+    return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
 }
 
@@ -194,2 +194,7 @@
     return val>=0;
 }
+
+void MPedestalCam::DrawPixelContent(Int_t num, TVirtualPad *pad) const
+{
+    *fLog << warn << "MPedestalCam::DrawPixelContent - not available." << endl;
+}
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 2409)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.h	(revision 2410)
@@ -36,7 +36,5 @@
 
     Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
-    void DrawPixelContent(Int_t num) const
-    {
-    }
+    void DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const;
 
     ClassDef(MPedestalCam, 1)	// Storage Container for all pedestal information of the camera
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 2409)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 2410)
@@ -114,5 +114,4 @@
 TObject *MParContainer::Clone(const char *newname) const
 {
-
    MParContainer *named = (MParContainer*)TObject::Clone();
    if (newname && strlen(newname)) named->SetName(newname);
@@ -584,2 +583,57 @@
     return ((TEnv&)env).GetValue(prefix, dflt);
 }
+
+void MParContainer::DrawTS(TObject *obj, TVirtualPad *pad, Option_t *option)
+{
+    if (!obj)
+    {
+        gLog << warn << "MParContainer::DrawTS: obj==NULL" << endl;
+        return;
+    }
+
+    if (!pad)
+        pad = gPad;
+
+    // FIXME: Move MH to mbase
+    //if (!pad)
+    //    pad = MakeDefCanvas(this);
+
+    if (!pad)
+    {
+        if (!gROOT->GetMakeDefCanvas())
+            return;
+        (gROOT->GetMakeDefCanvas())();
+        pad = gPad;
+    }
+
+    if (!pad->IsEditable())
+        return;
+
+    obj->SetBit(kMustCleanup);
+
+    pad->GetListOfPrimitives()->Add(obj, option);
+    pad->Modified(kTRUE);
+}
+
+TObject *MParContainer::DrawCloneTS(const TObject *obj, TVirtualPad *pad, Option_t *option)
+{
+    // Draw a clone of this object in the current pad
+    if (!obj)
+        return 0;
+
+    TObject *newobj = obj->Clone();
+    if (!newobj)
+        return 0;
+
+    /*
+     gLog << dbg << "MParConatiner::DrawCloneTS - ";
+     gLog << (int)newobj->InheritsFrom(MParContainer::Class()) << " ";
+     gLog << pad << endl;
+     */
+    if (newobj->InheritsFrom(MParContainer::Class()))
+        ((MParContainer*)newobj)->DrawTS(pad, strlen(option) ? option : obj->GetDrawOption());
+    else
+        DrawTS(newobj, pad, strlen(option) ? option : obj->GetDrawOption());
+
+    return newobj;
+}
