Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1129)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1130)
@@ -27,4 +27,15 @@
      - fix bug of Pedestal and Pedestal fluctuaions correspondence.
 
+ 2001/12/19: Thomas Bretz
+ 
+   * mbase/MEvtLoop.cc:
+     - added #ifdef directive to make it work on older root also
+     
+   * mbase/MReadTree.cc:
+     - added #ifdef directive to get rid of the memory leak in prior
+       root 3.02/* versions
+
+
+     
  2001/12/18: Thomas Bretz
  
Index: /trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1129)
+++ /trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1130)
@@ -180,6 +180,5 @@
     pedestals->InitSize(num);
 
-    MGeomPix &pixgeom0 = (*geometry)[0];
-    const Float_t size0   = pixgeom0.GetR()*pixgeom0.GetR();
+    const Float_t size0 = (*geometry)[0].GetR()*(*geometry)[0].GetR();
 
     for (int i=0; i<num; i++)
@@ -188,8 +187,10 @@
 	MGeomPix     &pixgeom = (*geometry)[i];
 
-        const Float_t pedrms = pix.GetSigma();
-	const Float_t size   = pixgeom.GetR()*pixgeom.GetR()/size0;
+        const Float_t pedrms  = pix.GetSigma();
+        const Float_t size    = pixgeom.GetR()*pixgeom.GetR()/size0;
 
-	pix.SetSigma(sqrt(pedrms*pedrms+fDnsbPixel*fadc->GetAmplitud()*fadc->GetAmplitud()*size));
+        const Float_t ampl    = fadc->GetAmplitud();
+
+	pix.SetSigma(sqrt(pedrms*pedrms + fDnsbPixel*ampl*ampl*size));
     }
 
Index: /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1129)
+++ /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1130)
@@ -190,5 +190,9 @@
             {
                 fProgress->SetPosition(++dummy);
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
+                gSystem->ProcessEvents();
+#else
                 gClient->ProcessEventsFor(fProgress);
+#endif
             }
         else
@@ -200,5 +204,9 @@
             {
                 fProgress->SetPosition(maxcnt - dummy);
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
+                gSystem->ProcessEvents();
+#else
                 gClient->ProcessEventsFor(fProgress);
+#endif
             }
         else
Index: /trunk/MagicSoft/Mars/mbase/MReadTree.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1129)
+++ /trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1130)
@@ -565,4 +565,7 @@
 //  If the end of the file is reached the Eventloop is stopped.
 //
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
+#include "../mraw/MRawEvtData.h"
+#endif
 Bool_t MReadTree::Process()
 {
@@ -573,4 +576,21 @@
     if (fNumEntry >= fNumEntries)
         return kFALSE;
+
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
+    //
+    // This fixes 99.9% of a memory leak using a root version prior
+    // to 3.02/??
+    //
+    TChainElement *element=NULL;
+    TIter Next(fChain->GetStatus());
+    while ((element=(TChainElement*)Next()))
+    {
+        MParContainer **c = (MParContainer**)element->GetBaddress();
+        if (!c) continue;
+        if ((*c)->InheritsFrom(MRawEvtData::Class()))
+            ((MRawEvtData*)(*c))->DeletePixels(kFALSE);
+
+    }
+#endif
 
     Bool_t rc = fChain->GetEntry(fNumEntry++) != 0;
