Index: trunk/MagicSoft/Mars/mtemp/mifae/programs/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/programs/Makefile	(revision 5879)
+++ trunk/MagicSoft/Mars/mtemp/mifae/programs/Makefile	(revision 5933)
@@ -47,4 +47,5 @@
 	   -I../../../mastro \
 	   -I../../../mreport \
+	   -I../../../mranforest \
            -I../../../mtemp
 
Index: trunk/MagicSoft/Mars/mtemp/mifae/programs/makeHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/programs/makeHillas.cc	(revision 5879)
+++ trunk/MagicSoft/Mars/mtemp/mifae/programs/makeHillas.cc	(revision 5933)
@@ -63,4 +63,7 @@
 #include "MTopology.h"
 #include "MTopologyCalc.h"
+#include "MRanForest.h"
+#include "MRanForestCalc.h"
+#include "MRanForestFill.h"
 
 #include "TApplication.h"
@@ -106,4 +109,5 @@
 Int_t    wsize   = 6;
 Int_t    sext    = 0;
+TString  rffilename;
 
 const TString defaultcard="makehillas.datacard";
@@ -225,6 +229,34 @@
   MPedestalCam pedcamrms;
 
+
+  /************************************************************************/
+  /*                 SECOND LOOP TO READ THE RANDOM FOREST FILE(S)         */
+  /************************************************************************/      
+  MParList  plistrf;
+  MTaskList tlistrf;
+  MRanForest ranforest;
+
+  plistrf.AddToList(&tlistrf);
+  plistrf.AddToList(&ranforest);
+
+  MReadTree readrf("Tree",rffilename);
+  readrf.DisableAutoScheme();
+  
+  MRanForestFill rffill;
+  rffill.SetNumTrees(100);
+  
+  tlistrf.AddToList(&readrf);
+  tlistrf.AddToList(&rffill);
+
+  MEvtLoop evtlooprf;
+  evtlooprf.SetParList(&plistrf);
+  if (!evtlooprf.Eventloop())
+    return;
+  
+  tlistrf.PrintStatistics();
+
+
   /*****************************/
-  /* SECOND LOOP: CALIBRATION  */
+  /* THIRD LOOP: CALIBRATION  */
   /*****************************/        
 
@@ -242,7 +274,6 @@
   chargecam.Print();
 
-
   /************************************************************************/
-  /*                 THIRD (SMALL) LOOP TO GET INITIAl PEDESTALS          */
+  /*                 FOURTH (SMALL) LOOP TO GET INITIAl PEDESTALS          */
   /************************************************************************/      
   MParList  plist3;
@@ -322,5 +353,5 @@
     {
       /************************************************************************/
-      /*                 FOURTH (SMALL) LOOP TO GET INITIAl PEDESTALS RMS     */
+      /*                 SIXTH (SMALL) LOOP TO GET INITIAl PEDESTALS RMS     */
       /************************************************************************/      
       MParList  plist4;
@@ -405,5 +436,6 @@
   plist5.AddToList(&reportdrive);
   plist5.AddToList(&topology);
-  
+  plist5.AddToList(&ranforest);
+
   // cuts
   MF cut(filter);
@@ -435,5 +467,6 @@
   MIslandsCalc       island3;
   island3.SetOutputName("MIslands3");  
-  
+
+  MRanForestCalc hadrcalc;
   
   MHillasCalc       hcalc;
@@ -503,4 +536,6 @@
   if(topflag>0)
     tlist5.AddToList(&topcalc);
+  if(rffilename.Length())
+    tlist5.AddToList(&hadrcalc);
   tlist5.AddToList(&write);
   if(display)
@@ -639,4 +674,12 @@
 	    }
 	  }
+	}
+
+      // random forest file name
+      if(strcmp(word.Data(),"RANFOREST")==0)
+	{
+	  if(rffilename.Length())
+	    cout << "readDataCards Warning: overriding random forest file name" << endl;
+	  ifun >> rffilename;
 	}
       
@@ -703,4 +746,6 @@
   cout << "Cleaning level: ("<<lcore<<","<<ltail<<") - " << lrings << "ring" << endl;
   cout << "Cleaning method: "<< cleanflag << endl;
+  if(rffilename.Length())
+    cout << "Random Forest will be read from " << rffilename << endl;
   if (islflag == 1 || islflag == 2)
     cout << "Island calcultation..." << "using algorithm #" << kalgorithm <<endl;
Index: trunk/MagicSoft/Mars/mtemp/mifae/programs/makehillas.datacard
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/programs/makehillas.datacard	(revision 5879)
+++ trunk/MagicSoft/Mars/mtemp/mifae/programs/makehillas.datacard	(revision 5933)
@@ -63,4 +63,8 @@
 CLEANLEVEL 4.0 3.5 1 1
 
+// Add the following word if you want to include Hadronness calculation, 
+// followed by the name of the Random Forest file
+RANFOREST RFstd.root
+
 //Island calculations
 // 0  same as 1                1:normal algorithm 
