Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 6023)
+++ trunk/MagicSoft/Mars/Changelog	(revision 6024)
@@ -21,4 +21,8 @@
                                                  -*-*- END OF LINE -*-*-
  2005/01/26 Abelardo Moralejo
+
+   * mtemp/mpadova/macros/RanForestDISP.C
+     - added possibility to set the number of hadrons read in for the 
+       training.
 
    * mtemp/mpadova/macros/resize.C
Index: trunk/MagicSoft/Mars/mtemp/mpadova/macros/RanForestDISP.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mpadova/macros/RanForestDISP.C	(revision 6023)
+++ trunk/MagicSoft/Mars/mtemp/mpadova/macros/RanForestDISP.C	(revision 6024)
@@ -61,14 +61,24 @@
 
 
-    MReadMarsFile  read("Events", "/data1/magic/mc_data/root/Period021_0.73_mirror/FixedWindowPeakSearch/WOBBLE_Star_6slices_tc32/star_gamma_train_new.root");
+    MReadMarsFile  read("Events", "/data1/magic/mc_data/root/Period021_0.73_mirror/FixedWindowPeakSearch/WOBBLE_Calib_6slices/tc_3.84_2.56/star_gamma_train_new.root");
     Float_t numgammas = read.GetEntries();
 
-    read.AddFile("/data2/magic/data/rootdata/Crab/Period021/20040915/star_train_20040915_CrabNebulaW1.root");
+    read.AddFile("star_train_20050110_CrabNebulaW1.root");
     Float_t numhadrons = read.GetEntries() - numgammas;
 
     // Fraction of gammas to be used in training:
     //    Float_t gamma_frac = 1.5*(numhadrons / numgammas);
-
     Float_t gamma_frac = 1.;
+
+    // Total hadron number to be processed in training:
+    // If you run RF over different data runs, using always the same # of training gammas,
+    // you should also use always a fixed number of hadrons for training (although the data 
+    // runs may be of different duration). Otherwise the meaning of the output hadronness 
+    // would be different for the different subsamples, since its absolute values depend on 
+    // the statistics of the training sample. The number set here is the number BEFORE the
+    // "a priori cuts" set above through "skipevents".
+
+    Float_t select_n_hadrons = 37000.;  
+    Float_t hadron_frac = select_n_hadrons / numhadrons;
 
     read.DisableAutoScheme();
@@ -165,13 +175,21 @@
     plist.AddToList(&matrixh);
 
+    MFEventSelector reduce_training_hadrons;
+    reduce_training_hadrons.SetSelectionRatio(hadron_frac);
+    MFilterList hadfilter;
+    hadfilter.AddToList(&reduce_training_hadrons);
+    hadfilter.AddToList(&fhadrons);
+    tlist.AddToList(&hadfilter);
+
     MFillH fillmath("MatrixHadrons");
-    fillmath.SetFilter(&fhadrons);
+    fillmath.SetFilter(&hadfilter);
     tlist.AddToList(&fillmath);
+
+    MContinue skiphad(&fhadrons);
+    tlist.AddToList(&skiphad);
 
     MFEventSelector reduce_training_gammas;
     reduce_training_gammas.SetSelectionRatio(gamma_frac);
     tlist.AddToList(&reduce_training_gammas);
-    MContinue skiphad(&fhadrons);
-    tlist.AddToList(&skiphad);
 
     MFillH fillmatg("MatrixGammas");
@@ -263,5 +281,5 @@
 
 
-    MReadMarsFile  read3("Events", "/data2/magic/data/rootdata/Crab/Period021/20040915/star_20040915_CrabNebulaW1.root");
+    MReadMarsFile  read3("Events", "star_20050110_CrabNebulaW1.root");
 
     read3.DisableAutoScheme();
@@ -280,5 +298,5 @@
     TString outfname = "star_S";
     outfname += minsize;
-    outfname += "_20040915_CrabNebulaW1.root";
+    outfname += "_20050110_CrabNebulaW1.root";
     MWriteRootFile write(outfname, "recreate");
 
