1 | void trainseparation()
|
---|
2 | {
|
---|
3 | MDataSet settrn("mctrain.txt");
|
---|
4 | MDataSet settst("mctest.txt");
|
---|
5 | settrn.SetNumAnalysis(1);
|
---|
6 | settst.SetNumAnalysis(2);
|
---|
7 |
|
---|
8 | // alternatively use:
|
---|
9 | //MDataSet settrn("mctrain.txt", "/magic/montacrlo/sequences", "/magic/montecarlo/star");
|
---|
10 | //MDataSet settst("mctest.txt" , "/magic/montacrlo/sequences", "/magic/montecarlo/star");
|
---|
11 |
|
---|
12 | MJTrainSeparation opt;
|
---|
13 | //opt.SetDebug();
|
---|
14 |
|
---|
15 | // ------- Parameters to train Random Forest --------
|
---|
16 | opt.AddParameter("MHillas.fSize");
|
---|
17 | opt.AddParameter("MHillas.fWidth");
|
---|
18 | opt.AddParameter("MHillas.fLength");
|
---|
19 | opt.AddParameter("TMath::Abs(MHillasExt.fM3Long)");
|
---|
20 | opt.AddParameter("MNewImagePar.fConc");
|
---|
21 | opt.AddParameter("MNewImagePar.fConc1");
|
---|
22 |
|
---|
23 | // -------------------- Run ----------------------------
|
---|
24 | MStatusDisplay *d = new MStatusDisplay;
|
---|
25 | opt.SetDisplay(d);
|
---|
26 |
|
---|
27 | /*
|
---|
28 | -------------------- Energy Slope --------------------
|
---|
29 | MFEnergySlope slope(-2.8);
|
---|
30 | opt.AddPreCut(&slope);
|
---|
31 |
|
---|
32 | -------------------- Other cuts ----------------------
|
---|
33 | opt.AddPreCut("MHillas.fSize>200");
|
---|
34 | opt.AddPreCut("MHillasSrc.fDCA*MGeomCam.fConvMm2Deg<0.3");
|
---|
35 | */
|
---|
36 |
|
---|
37 | opt.SetDataSetTrain(settrn, 10000, 10000);
|
---|
38 | //opt.SetDataSetTest(settst);
|
---|
39 |
|
---|
40 | opt.Train("rf-separation.root");
|
---|
41 | }
|
---|
42 |
|
---|
43 | /*
|
---|
44 | // SequencesOn: Monte Carlo sequences (gammas)
|
---|
45 | // SequencesOff: Data sequences (background)
|
---|
46 |
|
---|
47 | // Use:
|
---|
48 | // opt.AddPreCut to use cut for test and training
|
---|
49 | // opt.AddTestCut to use cut for test only
|
---|
50 | // opt.AddTrainCut to use cut for train only
|
---|
51 | */
|
---|