void trainenergy()
{
    MDataSet set("/home/dorner/155vn/spec-ds0604/mcdataset.txt");
    set.SetNumAnalysis(1);            // Necessary

    MJTrainEnergy opt;
    //opt.SetDebug();

    // ------- Parameters to train Random Forest --------
    opt.AddParameter("MHillas.fSize");
    opt.AddParameter("MHillasSrc.fDist");
    opt.AddParameter("MPointingPos.fZd");
    opt.AddParameter("MHillas.GetArea");
    opt.AddParameter("MNewImagePar.fUsedArea");
    opt.AddParameter("MNewImagePar.fCoreArea");
    opt.AddParameter("MNewImagePar.fLeakage1");
    opt.AddParameter("MNewImagePar.fLeakage2");
    opt.AddParameter("MNewImagePar.fConc");
    opt.AddParameter("MNewImagePar.fConc1");

    // -------------------- Run ----------------------------

    MStatusDisplay *d = new MStatusDisplay;
    opt.SetDisplay(d);

    /*
     -------------------- Magic-Cuts ----------------------
     MFMagicCuts cuts;
     cuts.SetHadronnessCut(MFMagicCuts::kArea);
     cuts.SetThetaCut(MFMagicCuts::kOn);

     TArrayD arr(10);
     arr[0]=  1.3245;
     arr[1]=  0.208700;
     arr[2]=  0.229200;
     arr[3]=  5.305200;
     arr[4]=  0.098930;
     arr[5]= -0.082950;
     arr[6]=  8.2957;
     arr[7]=  0.8677;

     cuts.SetVariables(arr);

     opt.AddPreCut(&cuts);

     -------------------- Energy Slope --------------------
     MFEnergySlope slope(-2.8); // New slope for mc spectrum
     slope.SetMcMinEnergy(80);  // Set break energy from -2.6 to -2.8
     opt.AddPreCut(&slope);     // throw away events to change slope

     -------------------- Other cuts ----------------------
     opt.AddPreCut("MHillasSrc.fDist*MGeomCam.fConvMm2Deg<1.0");
     opt.AddPreCut("MHillas.fSize>200");
    */

     opt.Train("rf-energy.root", set, 30000);
}
/*
 // SequencesOn:   Monte Carlo Sequences used for training
 // SequencesOff:  Monte Carlo Sequences used for testing

 // Use:
 // opt.AddPreCut    to use cut for test and training
 // opt.AddTestCut   to use cut for test only
 // opt.AddTrainCut  to use cut for train only
 */
