Index: trunk/MagicSoft/Mars/macros/starmc.C
===================================================================
--- trunk/MagicSoft/Mars/macros/starmc.C	(revision 3489)
+++ trunk/MagicSoft/Mars/macros/starmc.C	(revision 3534)
@@ -52,8 +52,8 @@
   // differences in gain of outer pixels)
   //
-  CalibrationFilename = new TString("nonoise/Gamma_zbin0_90_7_507*.root");
+  CalibrationFilename = new TString("nonoise/Gamma_zbin0_90_*.root");
   // File to be used in the calibration (must be a camera file without added noise)
 
-  Char_t* AnalysisFilename = "Gamma_zbin0*.root";  // File to be analyzed
+  Char_t* AnalysisFilename = "Gamma_zbin*.root";  // File to be analyzed
 
   // ------------- user change -----------------
@@ -63,6 +63,11 @@
 
   OutFilename1 = new TString("star_train.root");   // Output file name 1 (test)
-  //  OutFilename2 = new TString("star_test.root");    // Output file name 2 (train)
-
+  OutFilename2 = new TString("star_test.root");    // Output file name 2 (train)
+  //
+  // Fraction of events (taken at random) which one wants to process from the 
+  // file to be analyzed (useful to make smaller files if starting sample is
+  // too large).
+  //
+  Float_t accepted_fraction = 1.;
 
   Float_t CleanLev[2] = {4., 3.}; // Tail cuts for image analysis
@@ -206,6 +211,15 @@
   read2.AddFile(AnalysisFilename);
   read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read, "All");
+  tlist.AddToListBefore(&read2, &read);
   tlist.RemoveFromList(&read);
+
+  //
+  // Analyzed only the desired fraction of events, skip the rest:
+  //
+  MFEventSelector eventselector;
+  Float_t rejected_fraction = 1. - accepted_fraction; 
+  eventselector.SetSelectionRatio(rejected_fraction);
+  MContinue skip(&eventselector);
+  tlist.AddToListBefore(&skip, &sigextract);
 
   bar.SetWindowName("Analyzing...");
