Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 6931)
+++ trunk/MagicSoft/Mars/Changelog	(revision 6932)
@@ -82,4 +82,7 @@
    * mranforest/MRFEnergyEst.[h,cc]:
      - replaced MEnergyEst by MParameterD
+
+   * mfileio/MReadTree.cc:
+     - shortened the output a bit when siwtching to the next file
 
 
Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 6931)
+++ trunk/MagicSoft/Mars/Makefile	(revision 6932)
@@ -66,5 +66,4 @@
           mgui \
           mranforest \
-          mhistmc \
           mjobs \
           mtools \
Index: trunk/MagicSoft/Mars/ganymed.cc
===================================================================
--- trunk/MagicSoft/Mars/ganymed.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/ganymed.cc	(revision 6932)
@@ -143,4 +143,5 @@
         arg.Print("options");
         gLog << endl;
+        return 2;
     }
 
Index: trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 6931)
+++ trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 6932)
@@ -12,5 +12,4 @@
 #pragma link C++ class MMultiDimDistCalc+;
 
-#pragma link C++ class MEnergyEst+;
 #pragma link C++ class MEnergyEstimate+;
 
Index: trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.cc	(revision 6932)
@@ -47,5 +47,5 @@
 
 #include "MDataChain.h"
-#include "MEnergyEst.h"
+#include "MParameters.h"
 
 #include "MLog.h"
@@ -107,5 +107,5 @@
 Int_t MEnergyEstimate::PreProcess(MParList *plist)
 {
-    fEnergy = (MEnergyEst*)plist->FindCreateObj("MEnergyEst");
+    fEnergy = (MParameterD*)plist->FindCreateObj("MParameterD", "MEnergyEst");
     if (!fEnergy)
         return kFALSE;
@@ -130,7 +130,20 @@
         return kCONTINUE;
 
-    fEnergy->SetEnergy(val);
+    fEnergy->SetVal(val);
     fEnergy->SetReadyToSave();
     return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Print the rule used for energy estimation
+//
+void MEnergyEstimate::Print(Option_t *o) const
+{
+    *fLog << all << GetDescriptor() << ":";
+    if (!fData)
+        *fLog << " <n/a>" << endl;
+    else
+        *fLog << endl << fData->GetRule() << endl;
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h	(revision 6931)
+++ trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h	(revision 6932)
@@ -7,11 +7,11 @@
 
 class MData;
-class MEnergyEst;
+class MParameterD;
 
 class MEnergyEstimate : public MTask
 {
 private:
-    MData      *fData;    //->
-    MEnergyEst *fEnergy;
+    MData       *fData;    //->
+    MParameterD *fEnergy;  //!
 
     Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
@@ -28,5 +28,7 @@
     void SetVariables(const TArrayD &);
 
-    ClassDef(MEnergyEstimate, 0) // Task to estimate the energy by a rule
+    void Print(Option_t *o="") const;
+
+    ClassDef(MEnergyEstimate, 1) // Task to estimate the energy by a rule
 };
 
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 6931)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 6932)
@@ -28,5 +28,4 @@
 SRCFILES = MGeomApply.cc \
            MCameraData.cc \
-           MEnergyEst.cc \
            MEnergyEstimate.cc \
            MMatrixLoop.cc \
Index: trunk/MagicSoft/Mars/mbase/MStatusArray.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusArray.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mbase/MStatusArray.cc	(revision 6932)
@@ -61,4 +61,9 @@
     delete d;
     return 0;
+}
+
+void MStatusArray::DisplayIn(MStatusDisplay &d, const char *tab) const
+{
+    d.Display(*this, tab);
 }
 
@@ -149,11 +154,17 @@
     {
         if (!c)
+        {
+            gLog << warn << "Canvas '" << canvas << "' not found..." << endl;
             return 0;
+        }
 
         TObject *o = FindObjectInPad(c, object, cls);
         if (!o)
+        {
+            gLog << warn << "Object '" << object << "' [" << base << "] not found in canvas '" << canvas << "'..." << endl;
             return 0;
+        }
 
-        return o->InheritsFrom(cls) ? o : 0;
+        return o; //o->InheritsFrom(cls) ? o : 0;
     }
 
@@ -169,4 +180,5 @@
     }
 
+    gLog << warn << "Object '" << object << "' [" << base << "] not found in canvas '" << canvas << "'..." << endl;
     return NULL;
 }
Index: trunk/MagicSoft/Mars/mbase/MStatusArray.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusArray.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mbase/MStatusArray.h	(revision 6932)
@@ -10,4 +10,6 @@
 class TVirtualPad;
 
+class MStatusDisplay;
+
 class MStatusArray : public TObjArray
 {
@@ -18,4 +20,5 @@
 public:
     TObject *DisplayIn(Option_t *o=0) const;         // *MENU*
+    void     DisplayIn(MStatusDisplay &d, const char *tab=0) const;
     TObject *Display() const { return DisplayIn(); } // *MENU*
 
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 6932)
@@ -1686,5 +1686,5 @@
 }
 
-Bool_t MStatusDisplay::Display(const TObjArray &list)
+Bool_t MStatusDisplay::Display(const TObjArray &list, const char *tab)
 {
     TIter Next(&list);
@@ -1702,4 +1702,5 @@
     while ((c=(TCanvas*)Next()))
         //if (!GetCanvas(c->GetName()))
+        if (!tab || c->GetName()==(TString)tab)
             DrawClonePad(AddTab(c->GetName()), *c);
 
@@ -1711,5 +1712,5 @@
 // Reads the contents of a saved MStatusDisplay from a file.
 //
-Int_t MStatusDisplay::Read(const char *name)
+Int_t MStatusDisplay::Read(const char *name, const char *tab)
 {
     if (!gFile)
@@ -1734,5 +1735,5 @@
     }
 
-    if (!Display(list))
+    if (!Display(list, tab))
     {
         *fLog << err << "MStatusDisplay::Display: No entry in " << name << "." << endl;
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 6932)
@@ -122,5 +122,5 @@
     void DrawClonePad(TCanvas &newc, TCanvas &oldc) const;
     void CanvasSetFillColor(TPad &c, Int_t col) const;
-    Bool_t Display(const TObjArray &list);
+    Bool_t Display(const TObjArray &list, const char *tab=0);
 
     void AddExtension(TString &name, const TString &ext, Int_t num) const;
@@ -167,5 +167,9 @@
      Int_t Write(Int_t num, const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0) const;
 
-     Int_t Read(const char *name="MStatusDisplay");
+     Int_t Read(const char *name, const char *tab);
+     Int_t Read(const char *name="MStatusDisplay")
+     {
+         return Read(name, 0);
+     }
      Int_t Write(const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0)
      {
Index: trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc	(revision 6932)
@@ -390,7 +390,8 @@
     {
     case kPhe:
-      *fLog << warn << "WARNING - Renormalization to photo-electrons applied!" << endl;
+      *fLog << inf << "Calibrating in units of equivalent (outer/inner=4) photo-electrons." << endl;
       break;
     case kPhot:
+      *fLog << inf << "Calibrating in units of photons." << endl;
       break;
     }
@@ -403,6 +404,5 @@
         if (fCalibrations->GetSize() != npixels)
           {
-            *fLog << err << GetDescriptor()
-                  << ": Size mismatch between MGeomCam and MCalibrationChargeCam ... abort!" << endl;
+            *fLog << "Size mismatch between MGeomCam and MCalibrationChargeCam... abort!" << endl;
             return kFALSE;
           }
@@ -410,6 +410,5 @@
         if (fBadPixels->GetSize() != npixels)
           {
-            *fLog << err << GetDescriptor()
-                  << ": Size mismatch between MGeomCam and MBadPixelsCam ... abort!" << endl;
+            *fLog << "Size mismatch between MGeomCam and MBadPixelsCam... abort!" << endl;
             return kFALSE;
           }
@@ -417,6 +416,5 @@
         if (fBadPixels->GetSize() != npixels)
           {
-            *fLog << err << GetDescriptor()
-                  << ": Size mismatch between MGeomCam and MBadPixelsCam ... abort!" << endl;
+            *fLog << "Size mismatch between MGeomCam and MBadPixelsCam... abort!" << endl;
             return kFALSE;
           }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 6932)
@@ -270,7 +270,7 @@
                     Form("%s%2.1f%s","Time resolution less than ",fRelTimeResolutionLimit," FADC slices from Mean:   "));
   PrintUncalibrated(MBadPixelsPix::kRelTimeOscillating,   
-                    "Pixels with changing Rel. Times   over time:      ");
+                    "Pixels with changing Rel. Times over time:             ");
   PrintUncalibrated(MBadPixelsPix::kRelTimeNotFitted,     
-                    "Pixels with unsuccesful Gauss fit to the times:   ");
+                    "Pixels with unsuccesful Gauss fit to the times:        ");
 
   if (asciilog)
Index: trunk/MagicSoft/Mars/mfbase/MF.cc
===================================================================
--- trunk/MagicSoft/Mars/mfbase/MF.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mfbase/MF.cc	(revision 6932)
@@ -106,5 +106,5 @@
 // Default Constructor. Don't use.
 //
-MF::MF() : fF(NULL)
+MF::MF() : fF(NULL), fAllowEmpty(kFALSE)
 {
     fName  = gsDefName.Data();
@@ -117,5 +117,5 @@
 // the class description above.
 //
-MF::MF(const char *text, const char *name, const char *title)
+MF::MF(const char *text, const char *name, const char *title) : fAllowEmpty(kFALSE)
 {
     fName  = name  ? name  : gsDefName.Data();
Index: trunk/MagicSoft/Mars/mfbase/MF.h
===================================================================
--- trunk/MagicSoft/Mars/mfbase/MF.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mfbase/MF.h	(revision 6932)
@@ -21,5 +21,6 @@
     static const TString gsDefTitle; //!
 
-    MFilter *fF; // Filter
+    MFilter *fF;                     // Filter
+    Bool_t fAllowEmpty;              // Not a Bit to be stored
 
     Int_t IsRule(TString &txt, TString &rule) const;
@@ -32,6 +33,4 @@
     void StreamPrimitive(ofstream &out) const;
 
-    enum { kAllowEmpty = BIT(14) };
-
 public:
     MF();
@@ -40,6 +39,6 @@
 
     // MF
-    void SetAllowEmpty(Bool_t b=kTRUE) { b ? SetBit(kAllowEmpty) : ResetBit(kAllowEmpty); }
-    Bool_t IsAllowEmpty() const { return TestBit(kAllowEmpty); }
+    void SetAllowEmpty(Bool_t b=kTRUE) { fAllowEmpty = b; }
+    Bool_t IsAllowEmpty() const { return fAllowEmpty; }
 
     // MFilter
@@ -61,5 +60,5 @@
     Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
 
-    ClassDef(MF, 0) // A Filter for cuts in any data member
+    ClassDef(MF, 1) // A Filter for cuts in any data member
 };
 
Index: trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 6932)
@@ -277,6 +277,6 @@
         return kFALSE;
 
-    *fLog << inf << GetDescriptor() << ": Switching to #" << GetFileIndex();
-    *fLog << " '" << GetFileName() << "' (before event #";
+    *fLog << inf << GetDescriptor() << ": Next file #" << GetFileIndex();
+    *fLog << " '" << GetFileName() << "' (next evt #";
     *fLog << GetNumEntry()-1 << ")" << endl;
 
Index: trunk/MagicSoft/Mars/mhbase/MBinning.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MBinning.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mhbase/MBinning.cc	(revision 6932)
@@ -248,9 +248,11 @@
     str = str.Strip(TString::kBoth);
 
-    TString typ;
+    TString typ(str);
     Ssiz_t pos = str.First(' ');
     if (pos>=0)
     {
         typ = str(0, pos);
+        str.Remove(0, pos);
+        str = str.Strip(TString::kBoth);
         if (typ!=(TString)"lin" && typ!=(TString)"log" && typ!=(TString)"cos")
         {
@@ -261,6 +263,4 @@
 
     SetEdges(nbins, loedge, upedge, typ.Data());
-
-    str = str.Strip(TString::kBoth);
 
     if (!str.IsNull())
Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.cc	(revision 6932)
@@ -57,5 +57,4 @@
 #include "MSrcPosCam.h"
 #include "MHillasSrc.h"
-#include "MEnergyEst.h"
 #include "MTime.h"
 #include "MObservatory.h"
@@ -116,5 +115,5 @@
     fHEnergy.UseCurrentStyle();
 
-    fHTheta.SetName("Theta");
+    fHTheta.SetName("ExcessTheta");
     fHTheta.SetTitle(" N_{exc} vs. \\Theta ");
     fHTheta.SetXTitle("\\Theta [\\circ]");
@@ -124,5 +123,5 @@
 
     // effective on time versus time
-    fHTime.SetName("Time");
+    fHTime.SetName("ExcessTime");
     fHTime.SetTitle(" N_{exc} vs. Time ");
     fHTime.SetXTitle("Time");
@@ -268,5 +267,5 @@
     }
     */
-    fEnergy = (MEnergyEst*)pl->FindObject("MEnergyEst");
+    fEnergy = (MParameterD*)pl->FindObject("MEnergyEst", "MParameterD");
     if (!fEnergy)
     { /*
@@ -277,5 +276,5 @@
         } */
 
-        *fLog << warn << "MEnergyEst not found... " << flush;
+        *fLog << warn << "MEnergyEst [MParameterD] not found... " << flush;
 
         if (!fHillas)
@@ -286,5 +285,5 @@
             *fLog << "ignored." << endl;
 
-        fHEnergy.SetName("Size");
+        fHEnergy.SetName("ExcessSize");
         fHEnergy.SetTitle(" N_{exc} vs. Size ");
         fHEnergy.SetXTitle("Size [\\gamma]");
@@ -292,5 +291,5 @@
     else
     {
-        fHEnergy.SetName("Energy");
+        fHEnergy.SetName("ExcessEnergy");
         fHEnergy.SetTitle(" N_{exc} vs. E_{est} ");
         fHEnergy.SetXTitle("E_{est} [GeV]");
@@ -488,5 +487,5 @@
         if (fHillas)
             size = fHillas->GetSize();
-        energy = fEnergy   ? fEnergy->GetEnergy() : (fHillas?fHillas->GetSize():1000);
+        energy = fEnergy   ? fEnergy->GetVal() : (fHillas?fHillas->GetSize():1000);
         theta  = fPointPos ? fPointPos->GetZd()   : 0;
     }
@@ -715,4 +714,6 @@
         pad->cd(2);
         gPad->SetBorderMode(0);
+        gPad->SetGridx();
+        gPad->SetGridy();
         fHEnergy.Draw();
 
@@ -737,4 +738,6 @@
         pad->cd(3);
         gPad->SetBorderMode(0);
+        gPad->SetGridx();
+        gPad->SetGridy();
         fHTime.Draw();
         AppendPad("time");
@@ -746,4 +749,6 @@
     {
         pad->cd(4);
+        gPad->SetGridx();
+        gPad->SetGridy();
         gPad->SetBorderMode(0);
         fHTheta.Draw();
@@ -910,5 +915,5 @@
         if (type==0)
         {
-            fMap[1] = fMatrix->AddColumn("MEnergyEst.fEnergy");
+            fMap[1] = fMatrix->AddColumn("MEnergyEst.fVal");
             fMap[2] = -1;
         }
Index: trunk/MagicSoft/Mars/mhflux/MHAlpha.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHAlpha.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mhflux/MHAlpha.h	(revision 6932)
@@ -20,5 +20,4 @@
 class MParList;
 class MParameterD;
-class MEnergyEst;
 class MHillas;
 class MHMatrix;
@@ -96,5 +95,5 @@
 
     MParameterD  *fResult;      //!
-    MEnergyEst   *fEnergy;      //!
+    MParameterD  *fEnergy;      //!
     MHillas      *fHillas;      //!
     MPointingPos *fPointPos;    //!
Index: trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc	(revision 6932)
@@ -120,8 +120,8 @@
     }
 
-    fEnergy = (MEnergyEst*)plist->FindObject("MEnergyEst");
+    fEnergy = (MParameterD*)plist->FindObject("MEnergyEst", "MParameterD");
     if (!fEnergy)
     {
-        *fLog << err << "MEnergyEst not found... aborting." << endl;
+        *fLog << err << "MEnergyEst [MParameterD] not found... aborting." << endl;
         return kFALSE;
     }
@@ -160,5 +160,5 @@
 Bool_t MHEnergyEst::Fill(const MParContainer *par, const Stat_t w)
 {
-    const Double_t eest  = fEnergy->GetEnergy();
+    const Double_t eest  = fEnergy->GetVal();
     const Double_t etru  = fMatrix ? GetVal(0) : fMcEvt->GetEnergy();
     const Double_t imp   = fMatrix ? GetVal(1) : fMcEvt->GetImpact()/100;
@@ -185,8 +185,14 @@
     fResult->SetVal(sigma);
 
-    *fLog << all << "Mean log10(Energy) Resoltion: " << Form("%.1f%%", TMath::Sqrt(fChisq-fBias*fBias)*100) << endl;
-    *fLog << all << "Mean log10(Energy) Bias:      " << Form("%.1f%%", fBias*100) << endl;
+    Print();
 
     return kTRUE;
+}
+
+void MHEnergyEst::Print(Option_t *o) const
+{
+    *fLog << all;
+    *fLog << "Mean log10(Energy) Resoltion: " << Form("%5.2f%%", TMath::Sqrt(fChisq-fBias*fBias)) << endl;
+    *fLog << "Mean log10(Energy) Bias:      " << Form("%5.2f%%", fBias) << endl;
 }
 
@@ -298,4 +304,5 @@
     gPad->SetGridy();
 
+    // Results in crashes....
     //gROOT->GetListOfCleanups()->Add(gPad); // WHY?
 
@@ -315,6 +322,6 @@
 
     h2->Draw("");
-    h1->Draw("E3same");
-    h1->Draw("Chistsame");
+    h1->Draw("E3 hist C same");
+//    h1->Draw("Chistsame");
 
     return h1;
Index: trunk/MagicSoft/Mars/mhflux/MHEnergyEst.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHEnergyEst.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mhflux/MHEnergyEst.h	(revision 6932)
@@ -15,5 +15,4 @@
 
 class MMcEvt;
-class MEnergyEst;
 class MParList;
 class MParameterD;
@@ -24,5 +23,5 @@
 private:
     MMcEvt      *fMcEvt;  //!
-    MEnergyEst  *fEnergy; //!
+    MParameterD *fEnergy; //!
     MParameterD *fResult; //!
 
@@ -54,4 +53,5 @@
     void Paint(Option_t *opt="");
     void Draw(Option_t *option="");
+    void Print(Option_t *o="") const;
 
     ClassDef(MHEnergyEst, 1) //
Index: trunk/MagicSoft/Mars/mjobs/MJOptimize.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJOptimize.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mjobs/MJOptimize.cc	(revision 6932)
@@ -109,4 +109,5 @@
 #include "MFilterList.h"
 #include "../mfilter/MFMagicCuts.h"
+#include "../mfilter/MFMagicCuts2.h"
 #include "MContinue.h"
 #include "MGeomCamMagic.h"
@@ -333,5 +334,17 @@
 void MJOptimize::AddPreCut(const char *rule)
 {
-    fPreCuts.Add(new MF(rule));
+    MFilter *f = new MF(rule);
+    f->SetBit(kCanDelete);
+    AddPreCut(f);
+}
+
+//------------------------------------------------------------------------
+//
+// Add a cut which is used to fill the matrix. If kCanDelete is set
+// MJOptimize takes the ownership.
+//
+void MJOptimize::AddPreCut(MFilter *f)
+{
+    fPreCuts.Add(f);
 }
 
@@ -823,4 +836,6 @@
     if (filter && filter->InheritsFrom(MFMagicCuts::Class()))
         ((MFMagicCuts*)filter)->InitMapping(&m);
+    if (filter && filter->InheritsFrom(MFMagicCuts2::Class()))
+        ((MFMagicCuts2*)filter)->InitMapping(&m);
 
     MReadTree read("Events");
@@ -898,4 +913,6 @@
     if (filter && filter->InheritsFrom(MFMagicCuts::Class()))
         ((MFMagicCuts*)filter)->InitMapping(&m);
+    if (filter && filter->InheritsFrom(MFMagicCuts2::Class()))
+        ((MFMagicCuts2*)filter)->InitMapping(&m);
 
     parlist.AddToList(&histon);
@@ -1025,4 +1042,6 @@
         return kFALSE;
 
+    hist.Print();
+
     TObjArray cont;
     cont.Add(&est);
Index: trunk/MagicSoft/Mars/mjobs/MJOptimize.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJOptimize.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mjobs/MJOptimize.h	(revision 6932)
@@ -101,4 +101,5 @@
     void AddFilter(const char *rule);
     void AddPreCut(const char *rule);
+    void AddPreCut(MFilter *f);
 
     // Steering of optimization
Index: trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.cc
===================================================================
--- trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.cc	(revision 6931)
+++ trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.cc	(revision 6932)
@@ -34,8 +34,10 @@
 #include <TList.h>
 
-#include <TH1F.h>
-#include <TH2F.h>
+#include <TH1.h>
+#include <TH2.h>
 #include <TStyle.h>
 #include <TCanvas.h>
+#include <TMath.h>
+#include <TVector.h>
 
 #include "MHMatrix.h"
@@ -53,16 +55,5 @@
 
 #include "MData.h"
-
-#include "TFile.h"
-#include "TList.h"
-
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TStyle.h"
-#include "TCanvas.h"
-#include "TMath.h"
-#include "TVector.h"
-
-#include "MEnergyEst.h"
+#include "MParameters.h"
 
 
@@ -287,5 +278,5 @@
         Double_t e_true = (*mptr)(i,ncols-1);
         Double_t e_est = 0;
-        Double_t hmax  = 0;
+        //Double_t hmax  = 0;
         Double_t hsum  = 0;
 
@@ -388,8 +379,8 @@
 Int_t MRFEnergyEst::PreProcess(MParList *plist)
 {
-    fEnergyEst = (MEnergyEst*)plist->FindCreateObj("MEnergyEst");
+    fEnergyEst = (MParameterD*)plist->FindCreateObj("MParameterD", "MEnergyEst");
     if (!fEnergyEst)
     {
-        *fLog << err << dbginf << "MEnergyEst not found... aborting." << endl;
+        *fLog << err << dbginf << "MEnergyEst [MParameterD] not found... aborting." << endl;
         return kFALSE;
     }
@@ -424,6 +415,6 @@
     *fData >> event;
 
-    Double_t e_est = 0;
-    Double_t hmax  = 0;
+    Double_t eest = 0;
+    //Double_t hmax  = 0;
     Double_t hsum  = 0;
         
@@ -438,18 +429,12 @@
         }*/
         hsum+=h;
-        e_est+=h*e;
-    }
-    e_est/=hsum;
-    e_est=pow(10.,e_est);
-
-    fEnergyEst->SetEnergy(e_est);
+        eest+=h*e;
+    }
+    eest/=hsum;
+    eest=pow(10.,eest);
+
+    fEnergyEst->SetVal(eest);
     fEnergyEst->SetReadyToSave();
 
     return kTRUE;
 }
-
-Int_t MRFEnergyEst::PostProcess()
-{
-
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h
===================================================================
--- trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h	(revision 6931)
+++ trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h	(revision 6932)
@@ -16,5 +16,5 @@
 class MHMatrix;
 class MDataArray;
-class MEnergyEst;
+class MParameterD;
 
 class MRFEnergyEst : public MTask
@@ -33,9 +33,8 @@
     TObjArray fEForests;
 
-    MEnergyEst *fEnergyEst;
+    MParameterD *fEnergyEst;
 
     Int_t PreProcess(MParList *plist);
     Int_t Process();
-    Int_t PostProcess();
 
     Int_t ReadForests(MParList *plist=NULL);
