Index: trunk/MagicSoft/Mars/manalysis/MRanForest.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForest.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForest.cc	(revision 1870)
@@ -43,4 +43,5 @@
 
 #include <TMatrix.h>
+#include <TRandom3.h>
 
 #include "MHMatrix.h"
@@ -60,4 +61,16 @@
     fName  = name  ? name  : "MRanForest";
     fTitle = title ? title : "Storage container for Random Forest";
+
+    fForest=new TObjArray();
+    fForest->SetOwner(kTRUE);
+}
+
+// --------------------------------------------------------------------------
+//
+// Destructor. 
+//
+MRanForest::~MRanForest()
+{
+    delete fForest;
 }
 
@@ -88,7 +101,10 @@
 {
     Double_t hadroness=0;
-    Double_t ntree=0;
+    Int_t ntree=0;
     MRanTree *tree;
+
     TIter forest(fForest);
+    forest.Reset();
+
     while ((tree=(MRanTree*)forest.Next()))
     {
@@ -97,26 +113,15 @@
         ntree++;
     }
-    return hadroness/ntree;
-}
-
-void MRanForest::SetupForest()
-{
-    fForest=new TObjArray();
-    fForest->SetOwner(kTRUE);
-}
-
-void MRanForest::SetTree(MRanTree *rantree)
-{
-    // initialize current tree for tree-growing loop in GrowForest
-    // ndsize + numtry are set in MRanForestGrow!!
-    fRanTree=rantree;
-}
-
-Bool_t MRanForest::AddTree()
-{
+    return hadroness/Double_t(ntree);
+}
+
+Bool_t MRanForest::AddTree(MRanTree *rantree=NULL)
+{
+    if (rantree)
+        fRanTree=rantree;
     if (!fRanTree)
         return kFALSE;
-    MRanTree *newtree=(MRanTree*)fRanTree->Clone();
-    fForest->Add(newtree);
+
+    fForest->Add((MRanTree*)fRanTree->Clone());
 
     return kTRUE;
@@ -149,6 +154,4 @@
     fNTimesOutBag.Reset();
 
-    fGiniDec.Set(fNumDim);
-
     fDataSort.Set(fNumDim*fNumData);
     fDataRang.Set(fNumDim*fNumData);
@@ -175,7 +178,9 @@
     CreateDataSort();
 
-    SetupForest();
-
-    if(!fRanTree)return kFALSE;
+    if(!fRanTree)
+    {
+        *fLog << err << dbginf << "MRanForest, fRanTree not initialized... aborting." << endl;
+        return kFALSE;
+    }
     fRanTree->SetRules(fGammas->GetColumns());
     fTreeNo=0;
@@ -187,8 +192,8 @@
 {
     Int_t ninbag=0;
-    TArrayI datsortinbag; 
-    TArrayF classpopw; 
-    TArrayI jinbag;      
-    TArrayF winbag;     
+    TArrayI datsortinbag;
+    TArrayF classpopw;
+    TArrayI jinbag;
+    TArrayF winbag;
 
     jinbag.Set(fNumData);
@@ -220,5 +225,7 @@
     for (Int_t n=0;n<fNumData;n++)
     {
-        Int_t k=Int_t(fNumData*fRand.Rndm());
+        if(!gRandom)
+            gRandom=new TRandom3(0);
+        Int_t k=Int_t(fNumData*gRandom->Rndm());
 
         classpopw[fHadTrue[k]]+=fWeight[k];
@@ -237,5 +244,5 @@
     // growing single tree
     fRanTree->GrowTree(hadrons,gammas,fNumData,fNumDim,fHadTrue,datsortinbag,
-                       fDataRang,fGiniDec,classpopw,jinbag,winbag,fWeight,fRand);
+                       fDataRang,classpopw,jinbag,winbag,fWeight);
 
     // error-estimates from out-of-bag data (oob data):
@@ -267,5 +274,4 @@
     fErr=0;
     for(Int_t ievt=0;ievt<fNumData;ievt++)
-    {                                                                                                
         if(fNTimesOutBag[ievt]!=0)
         {
@@ -273,5 +279,5 @@
             n++;
         }
-    }
+
     fErr/=Float_t(n);
     fErr=TMath::Sqrt(fErr);
@@ -305,5 +311,4 @@
     // value of all fData(m,.). There may be more then 1 event with rang r (due to bagging).
 
-
     TArrayF v(fNumData);
     TArrayI isort(fNumData);
@@ -313,13 +318,8 @@
 
     for (Int_t j=0;j<fNumHad;j++)
-    {
         fHadTrue[j]=1;
-    }
 
     for (Int_t j=0;j<fNumGam;j++)
-    {
         fHadTrue[j+fNumHad]=0;
-    }
-
 
     for (Int_t mvar=0;mvar<fNumDim;mvar++)
Index: trunk/MagicSoft/Mars/manalysis/MRanForest.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForest.h	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForest.h	(revision 1870)
@@ -18,4 +18,8 @@
 #endif
 
+#ifndef ROOT_TObjArray
+#include <TObjArray.h>
+#endif
+
 #ifndef ROOT_TRandom
 #include <TRandom.h>
@@ -32,5 +36,4 @@
     Int_t fTreeNo;
 
-    TRandom fRand;
     MRanTree *fRanTree;
     TObjArray *fForest;
@@ -42,9 +45,9 @@
     Int_t   fNumGam;
     Int_t   fNumHad;
-    Int_t   fNumData;    
-    Int_t   fNumDim;  
+    Int_t   fNumData;
+    Int_t   fNumDim;
 
     // true  and estimated hadronness
-    TArrayI fHadTrue; 
+    TArrayI fHadTrue;
     TArrayF fHadEst;
 
@@ -57,5 +60,5 @@
     Bool_t  fUsePriors;
     TArrayF fPrior;
-    TArrayF fWeight;    
+    TArrayF fWeight;
     TArrayI fNTimesOutBag;
 
@@ -63,7 +66,4 @@
     TArrayD fTreeHad;
     Float_t fErr;
-
-    // decrease in Gini-index
-    TArrayF fGiniDec;   
 
 protected:
@@ -74,4 +74,5 @@
 public:
     MRanForest(const char *name=NULL, const char *title=NULL);
+    ~MRanForest();
 
     // initialize forest
@@ -80,18 +81,18 @@
 
     // tree growing
-    void   SetupForest();
-    void   SetTree(MRanTree *rantree);
-    Bool_t AddTree();
+    //void   SetupForest();
     Bool_t SetupGrow(MHMatrix *mhad,MHMatrix *mgam);
     Bool_t GrowForest();
+    void SetCurTree(MRanTree *rantree) { fRanTree=rantree; }
+    Bool_t AddTree(MRanTree *rantree);
 
     // getter methods
     TObjArray *GetForest() { return fForest; }
+    MRanTree *GetCurTree() { return fRanTree; }
     Int_t      GetNumTrees() const { return fNumTrees; }
     Int_t      GetNumData() const { return fNumData; }
     Int_t      GetNumDim() const { return fNumDim; }
     Double_t   GetTreeHad(Int_t i) const { return fTreeHad.At(i); }
-    Float_t    GetGiniDec(Int_t i) const { return fGiniDec.At(i); }
-
+ 
     // use forest to calculate hadronness of event
     Double_t CalcHadroness(TVector &event);
Index: trunk/MagicSoft/Mars/manalysis/MRanForestCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForestCalc.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForestCalc.cc	(revision 1870)
@@ -37,4 +37,5 @@
 
 #include "MHMatrix.h" // must be before MLogManip.h
+#include "MDataArray.h"
 
 #include "MLog.h"
@@ -104,5 +105,11 @@
     }
 
-    fData = fRanTree->GetData();
+    /*if(!fRanForest->GetCurTree())
+    {
+        *fLog << err << dbginf << "MRanForest does not contain trees... aborting." << endl;
+        return kFALSE;
+    }*/
+
+    fData = fRanTree->GetRules();
 
     if (!fData)
Index: trunk/MagicSoft/Mars/manalysis/MRanForestFill.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForestFill.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForestFill.cc	(revision 1870)
@@ -46,5 +46,5 @@
 
 static const TString gsDefName  = "MRanForestFill";
-static const TString gsDefTitle = "Tree Classification Loop 1/2";
+static const TString gsDefTitle = "Tree Classification Loop";
 
 // --------------------------------------------------------------------------
@@ -86,5 +86,4 @@
     }
 
-    fRanForest->SetupForest();
     fNum=0;
 
@@ -98,6 +97,5 @@
 {
     fNum++;
-    fRanForest->SetTree(fRanTree);
-    if(!(fRanForest->AddTree()))
+    if(!(fRanForest->AddTree(fRanTree)))
         return kFALSE;
 
Index: trunk/MagicSoft/Mars/manalysis/MRanForestFill.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForestFill.h	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForestFill.h	(revision 1870)
Index: trunk/MagicSoft/Mars/manalysis/MRanForestGrow.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForestGrow.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForestGrow.cc	(revision 1870)
@@ -96,8 +96,8 @@
 
     fRanTree = (MRanTree*)plist->FindCreateObj("MRanTree");
-    if (!fRanTree)                                                              
-    {                                                                           
-        *fLog << err << dbginf << "MRanTree not found... aborting." << endl;    
-        return kFALSE;                                                          
+    if (!fRanTree)
+    {
+        *fLog << err << dbginf << "MRanTree not found... aborting." << endl;
+        return kFALSE;
     }
 
@@ -111,7 +111,6 @@
     fRanTree->SetNumTry(fNumTry);
     fRanTree->SetNdSize(fNdSize);
-
+    fRanForest->SetCurTree(fRanTree);
     fRanForest->SetNumTrees(fNumTrees);
-    fRanForest->SetTree(fRanTree);
 
     return fRanForest->SetupGrow(fMHadrons,fMGammas);
@@ -136,17 +135,2 @@
     return kTRUE;
 }
-
-void MRanForestGrow::SetNumTrees(Int_t n)
-{
-    fNumTrees=n;
-}
-
-void MRanForestGrow::SetNumTry(Int_t n)
-{
-    fNumTry=n;
-}
-
-void MRanForestGrow::SetNdSize(Int_t n)
-{
-    fNdSize=n;
-}
Index: trunk/MagicSoft/Mars/manalysis/MRanForestGrow.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanForestGrow.h	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanForestGrow.h	(revision 1870)
@@ -34,7 +34,7 @@
     MRanForestGrow(const char *name=NULL, const char *title=NULL);
 
-    void SetNumTrees(Int_t n);
-    void SetNumTry(Int_t n);
-    void SetNdSize(Int_t n);
+    void SetNumTrees(Int_t n){    fNumTrees=n;}
+    void SetNumTry(Int_t n)  {    fNumTry=n;  }
+    void SetNdSize(Int_t n)  {    fNdSize=n;  }
 
     Bool_t PreProcess(MParList *pList);
Index: trunk/MagicSoft/Mars/manalysis/MRanTree.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanTree.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanTree.cc	(revision 1870)
@@ -47,13 +47,17 @@
 // Default constructor.
 //
-MRanTree::MRanTree(const char *name, const char *title):fData(NULL)
-{
+MRanTree::MRanTree(const char *name, const char *title):fNdSize(0), fNumTry(3), fData(NULL)
+{
+
     fName  = name  ? name  : "MRanTree";
-    fTitle = title ? title : "Storage container for structure of a single tree and additional information";
+    fTitle = title ? title : "Storage container for structure of a single tree";
 }
 
 void MRanTree::SetNdSize(Int_t n)
 {
-    // minimum nodesize of terminal nodes
+    // threshold nodesize of terminal nodes, i.e. the training data is splitted
+    // until there is only pure date in the subsets(=terminal nodes) or the
+    // subset size is LE n
+
     fNdSize=TMath::Max(1,n);//at least 1 event per node
 }
@@ -62,28 +66,29 @@
 {
     // number of trials in random split selection:
-    // choose at least 1 variable to split in...
+    // choose at least 1 variable to split in
+
     fNumTry=TMath::Max(1,n);
-    // and not more candidates than available
-    if(fData)
-        fNumTry=TMath::Min(fData->GetNumEntries(),n);
-}
-
-void MRanTree::GrowTree(TMatrix &mhad,TMatrix &mgam,Int_t numdata, Int_t numdim,TArrayI &hadtrue,TArrayI &datasort,
-                        TArrayI &datarang,TArrayF &ginidec,TArrayF &tclasspop,TArrayI &jinbag,
-                        TArrayF &winbag,TArrayF &weight,TRandom &rand)
-{
-    //Int_t nrnodes=2*(numdata/fNdSize)+1;
+}
+
+void MRanTree::GrowTree(TMatrix &mhad,TMatrix &mgam,Int_t numdata, Int_t numdim,TArrayI &hadtrue,
+                        TArrayI &datasort,TArrayI &datarang,TArrayF &tclasspop,TArrayI &jinbag,
+                        TArrayF &winbag,TArrayF &weight)
+{
+    // arrays have to be initialized with generous size, so number of total nodes (nrnodes)
+    // is estimated for worst case
     Int_t nrnodes=2*numdata+1;
+
+    // number of events in bootstrap sample
     Int_t ninbag=0;
     for (Int_t n=0;n<numdata;n++)
         if(jinbag[n]==1) ninbag++;
 
+    // weighted class populations after split
+    TArrayF wl(2); // left node
+    TArrayF wc(2); 
+    TArrayF wr(2); // right node
+    TArrayI nc(2);
 
     TArrayI bestsplit(nrnodes);
-    TArrayF wl(2);
-    TArrayF wc(2);
-    TArrayF wr(2);
-    TArrayI nc(2);
-
     TArrayI bestsplitnext(nrnodes);
     TArrayI nodepop(nrnodes);
@@ -107,9 +112,13 @@
     fBestSplit.Reset();
 
+    fGiniDec.Set(numdim);
+    fGiniDec.Reset();
+
     // tree growing
     BuildTree(datasort,datarang,hadtrue,numdim,numdata,bestsplit,
-              bestsplitnext,ginidec,nodepop,nodestart,tclasspop,nrnodes,
-              idmove,ncase,parent,jinbag,iv,winbag,wr,wc,wl,ninbag,rand);
-
+              bestsplitnext,nodepop,nodestart,tclasspop,nrnodes,
+              idmove,ncase,parent,jinbag,iv,winbag,wr,wc,wl,ninbag);
+
+    // post processing, determine cut (or split) values fBestSplit
     Int_t nhad=mhad.GetNrows();
 
@@ -128,4 +137,5 @@
     }
 
+    // resizing arrays to save memory
     fBestVar.Set(fNumNodes);
     fTreeMap1.Set(fNumNodes);
@@ -138,7 +148,8 @@
                              Int_t &msplit,Float_t &decsplit,Int_t &nbest,TArrayI &ncase,
                              TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr,
-                             TArrayF &wc,TArrayF &wl,Int_t kbuild,TRandom &rand)
-{
-    // For the best split, msplit is the variable split on. decsplit is the dec. in impurity.
+                             TArrayF &wc,TArrayF &wl,Int_t kbuild)
+{
+    // For the best split, msplit is the index of the variable (e.g Hillas par., zenith angle ,...)
+    // split on. decsplit is the decreae in impurity measured by Gini-index.
     // nsplit is the case number of value of msplit split on,
     // and nsplitnext is the case number of the next larger value of msplit.
@@ -148,5 +159,6 @@
     Float_t rrn, rrd, rln, rld, u;
 
-    // compute initial values of numerator and denominator of Gini
+    // compute initial values of numerator and denominator of Gini-index,
+    // Gini index= pno/dno
     Float_t pno=0;
     Float_t pdo=0;
@@ -160,11 +172,15 @@
     jstat=0;
 
-    // start main loop through variables to find best split
+    // start main loop through variables to find best split,
+    // (Gini-index as criterium crit)
 
     critmax=-1.0e20;
+
+    // random split selection, number of trials = fNumTry
     for(Int_t mt=0;mt<fNumTry;mt++)
     {
-        mvar=Int_t(mdim*rand.Rndm());
-
+        mvar=Int_t(mdim*gRandom->Rndm());
+
+        // Gini index = rrn/rrd+rln/rld
         rrn=pno;
         rrd=pdo;
@@ -263,8 +279,6 @@
         for (Int_t n=ndstart;n<=ndend;n++)
         {
-
             ih=datasort[msh*numdata+n];
-            if (idmove[ih]==0)
-            {
+            if (idmove[ih]==0){
                 k++;
                 tdatasort[k]=datasort[msh*numdata+n];
@@ -272,15 +286,11 @@
         }
         for(Int_t k=ndstart;k<=ndend;k++)
-        {
             datasort[msh*numdata+k]=tdatasort[k];
-        }
-    }
- 
+    }
+
     // compute case nos. for right and left nodes.
 
     for(Int_t n=ndstart;n<=ndend;n++)
-    {
         ncase[n]=datasort[msplit*numdata+n];
-    }
 
     return;
@@ -289,8 +299,8 @@
 void MRanTree::BuildTree(TArrayI &datasort,TArrayI &datarang,TArrayI &hadtrue,Int_t mdim,
                          Int_t numdata,TArrayI &bestsplit,TArrayI &bestsplitnext,
-                         TArrayF &ginidec,TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop,
+                         TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop,
                          Int_t nrnodes,TArrayI &idmove,TArrayI &ncase,TArrayI &parent,
                          TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr,TArrayF &wc,
-                         TArrayF &wl,Int_t ninbag,TRandom &rand)
+                         TArrayF &wl,Int_t ninbag)
 {
     // Buildtree consists of repeated calls to two void functions, FindBestSplit and MoveData.
@@ -336,5 +346,5 @@
           if (kbuild>ncur) break;
           if (nodestatus[kbuild]!=2) continue;
-        
+
           // initialize for next call to FindBestSplit
 
@@ -342,12 +352,10 @@
           ndend=ndstart+nodepop[kbuild]-1;
           for (Int_t j=0;j<2;j++)
-          {
             tclasspop[j]=classpop[j*nrnodes+kbuild];
-          }
 
           jstat=FindBestSplit(datasort,datarang,hadtrue,mdim,numdata,
                               ndstart,ndend,tclasspop,msplit,decsplit,
                               nbest,ncase,jinbag,iv,winbag,wr,wc,wl,
-                              kbuild,rand);
+                              kbuild);
 
           if(jstat==1) {
@@ -356,5 +364,5 @@
           }else{
               fBestVar[kbuild]=msplit;
-              ginidec[msplit]+=decsplit;
+              fGiniDec[msplit]+=decsplit;
 
               bestsplit[kbuild]=datasort[msplit*numdata+nbest];
@@ -373,5 +381,5 @@
 
           // find class populations in both nodes
-        
+
           for (Int_t n=ndstart;n<=ndendl;n++)
           {
@@ -386,9 +394,8 @@
               Int_t j=hadtrue[nc];
               classpop[j*nrnodes+ncur+2]+=winbag[nc];
-        
           }
 
           // check on nodestatus
-  
+
           nodestatus[ncur+1]=2;
           nodestatus[ncur+2]=2;
@@ -402,5 +409,5 @@
             popt2+=classpop[j*nrnodes+ncur+2];
           }
-          
+
           for (Int_t j=0;j<2;j++)
           {
@@ -408,5 +415,5 @@
             if (classpop[j*nrnodes+ncur+2]==popt2) nodestatus[ncur+2]=-1;
           }
-  
+
           fTreeMap1[kbuild]=ncur+1;
           fTreeMap2[kbuild]=ncur+2;
@@ -428,5 +435,4 @@
     fNumEndNodes=0;
     for (Int_t kn=0;kn<fNumNodes;kn++)
-    {
         if(nodestatus[kn]==-1)
         {
@@ -438,5 +444,5 @@
                 {
                     // class + status of node kn coded into fBestVar[kn]
-                    fBestVar[kn]=j-2; 
+                    fBestVar[kn]=j-2;
                     pp=classpop[j*nrnodes+kn];
                 }
@@ -445,5 +451,5 @@
             fBestSplit[kn]/=(classpop[0*nrnodes+kn]+classpop[1*nrnodes+kn]);
         }
-    }
+
     return;
 }
@@ -468,11 +474,11 @@
 
         Int_t m=fBestVar[kt];
+
         if (event(m)<=fBestSplit[kt])
-        {
             kt=fTreeMap1[kt];
-        }else{
+        else
             kt=fTreeMap2[kt];
-        }
-    }
+    }
+
     return fBestSplit[kt];
 }
@@ -500,11 +506,12 @@
 
         Int_t m=fBestVar[kt];
+
         if (event(m)<=fBestSplit[kt])
-        {
             kt=fTreeMap1[kt];
-        }else{
+        else
             kt=fTreeMap2[kt];
-        }
-    }
+
+    }
+
     return fBestSplit[kt];
 }
Index: trunk/MagicSoft/Mars/manalysis/MRanTree.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MRanTree.h	(revision 1869)
+++ trunk/MagicSoft/Mars/manalysis/MRanTree.h	(revision 1870)
@@ -30,7 +30,9 @@
 
     TArrayI fBestVar;
-    TArrayI fTreeMap1; 
-    TArrayI fTreeMap2; 
+    TArrayI fTreeMap1;
+    TArrayI fTreeMap2;
     TArrayF fBestSplit;
+
+    TArrayF fGiniDec;
 
 public:
@@ -41,5 +43,5 @@
     void SetRules(MDataArray *rules);
 
-    MDataArray *GetData() { return fData;}
+    MDataArray *GetRules() { return fData;}
 
     Int_t GetNdSize() const { return fNdSize; }
@@ -55,8 +57,10 @@
     Float_t GetBestSplit(Int_t i)const { return fBestSplit.At(i); }
 
+    Float_t GetGiniDec(Int_t i)  const { return fGiniDec.At(i); }
+
     // functions used in tree growing process
     void GrowTree(TMatrix &mhad,TMatrix &mgam,Int_t numdata, Int_t numdim,TArrayI &hadtrue,
-                  TArrayI &datasort,TArrayI &datarang,TArrayF &ginidec,TArrayF &classpopw,
-                  TArrayI &jinbag,TArrayF &winbag,TArrayF &weight,TRandom &rand);
+                  TArrayI &datasort,TArrayI &datarang,TArrayF &tclasspop,TArrayI &jinbag,
+                  TArrayF &winbag,TArrayF &weight);
 
     Int_t FindBestSplit(TArrayI &datasort,TArrayI &datarang,TArrayI &hadtrue,Int_t mdim,
@@ -64,5 +68,5 @@
                         Int_t &msplit,Float_t &decsplit,Int_t &nbest,TArrayI &ncase,
                         TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr,
-                        TArrayF &wc,TArrayF &wl,Int_t kbuild,TRandom &rand);
+                        TArrayF &wc,TArrayF &wl,Int_t kbuild);
 
     void MoveData(TArrayI &datasort,Int_t mdim,Int_t numdata,Int_t ndstart,
@@ -72,8 +76,8 @@
     void BuildTree(TArrayI &datasort,TArrayI &datarang,TArrayI &hadtrue,Int_t mdim,
                    Int_t numdata,TArrayI &bestsplit,TArrayI &bestsplitnext,
-                   TArrayF &ginidec,TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop,
+                   TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop,
                    Int_t nrnodes,TArrayI &idmove,TArrayI &ncase,TArrayI &parent,
                    TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr,TArrayF &wc,
-                   TArrayF &wl,Int_t ninbag,TRandom &rand);
+                   TArrayF &wl,Int_t ninbag);
 
     Double_t TreeHad(TVector &event);
Index: trunk/MagicSoft/Mars/mhist/MHRanForest.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForest.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/mhist/MHRanForest.cc	(revision 1870)
@@ -114,5 +114,5 @@
 
     Int_t ntrees=fRanForest->GetNumTrees();
-
+    //cout<<"filling"<<endl;
     for (Int_t i=0;i<ntrees;i++)
     {
Index: trunk/MagicSoft/Mars/mhist/MHRanForest.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForest.h	(revision 1869)
+++ trunk/MagicSoft/Mars/mhist/MHRanForest.h	(revision 1870)
Index: trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc	(revision 1869)
+++ trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc	(revision 1870)
@@ -41,10 +41,9 @@
 #include "MParList.h"
 #include "MBinning.h"
+#include "MRanTree.h"
 #include "MRanForest.h"
 
 #include "MLog.h"
 #include "MLogManip.h"
-
-#include "MMcEvt.hxx"
 
 ClassImp(MHRanForestGini);
@@ -84,11 +83,4 @@
 Bool_t MHRanForestGini::SetupFill(const MParList *plist)
 {
-    fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
-    if (!fMcEvt)
-    {
-        *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
-        return kFALSE;
-    }
-
     fRanForest = (MRanForest*)plist->FindObject("MRanForest");
     if (!fRanForest)
@@ -111,5 +103,5 @@
 {
     for (Int_t i=0;i<fRanForest->GetNumDim();i++)
-        fGini[i]+=fRanForest->GetGiniDec(i);
+        fGini[i]+=fRanForest->GetCurTree()->GetGiniDec(i);
 
     return kTRUE;
@@ -163,5 +155,5 @@
     {
         g.GetXaxis()->SetRangeUser(0, fRanForest->GetNumTrees());
-        g.GetXaxis()->SetTitle("No. of RF-input parameter parameter");
+        g.GetXaxis()->SetTitle("No. of RF-input parameter");
         g.GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
         g.SetMarkerStyle(kFullDotlarge);
@@ -193,5 +185,5 @@
     {
         fGraphGini->GetXaxis()->SetRangeUser(0, 1);
-        fGraphGini->GetXaxis()->SetTitle("No. of parameter");
+        fGraphGini->GetXaxis()->SetTitle("No. of RF-input parameter");
         fGraphGini->GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
 
Index: trunk/MagicSoft/Mars/mhist/MHRanForestGini.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForestGini.h	(revision 1869)
+++ trunk/MagicSoft/Mars/mhist/MHRanForestGini.h	(revision 1870)
@@ -13,15 +13,14 @@
 class TGraph;
 class MParList;
-class MMcEvt;
 class MRanForest;
+class MRanTree;
 
 class MHRanForestGini : public MH
 {
 private:
-    const MMcEvt *fMcEvt;          //!
-    const MRanForest *fRanForest;  //!
+    MRanForest *fRanForest;
 
-    TArrayF fGini;                 //!
-    TGraph *fGraphGini;            //->
+    TArrayF fGini;
+    TGraph *fGraphGini;
 
 public:
