1 | void trainenergy()
|
---|
2 | {
|
---|
3 | MDataSet set("mctesttrain.txt");
|
---|
4 | set.SetNumAnalysis(1); // Necessary
|
---|
5 |
|
---|
6 | MJTrainEnergy opt;
|
---|
7 | //opt.SetDebug();
|
---|
8 |
|
---|
9 | // ------- Parameters to train Random Forest --------
|
---|
10 | opt.AddParameter("MHillas.fSize");
|
---|
11 | opt.AddParameter("MHillasSrc.fDist");
|
---|
12 | opt.AddParameter("MPointingPos.fZd");
|
---|
13 | opt.AddParameter("MHillas.GetArea");
|
---|
14 | opt.AddParameter("MNewImagePar.fUsedArea");
|
---|
15 | opt.AddParameter("MNewImagePar.fCoreArea");
|
---|
16 | opt.AddParameter("MNewImagePar.fLeakage1");
|
---|
17 | opt.AddParameter("MNewImagePar.fLeakage2");
|
---|
18 | opt.AddParameter("MNewImagePar.fConc");
|
---|
19 | opt.AddParameter("MNewImagePar.fConc1");
|
---|
20 |
|
---|
21 | // -------------------- Run ----------------------------
|
---|
22 |
|
---|
23 | MStatusDisplay *d = new MStatusDisplay;
|
---|
24 | opt.SetDisplay(d);
|
---|
25 |
|
---|
26 | /*
|
---|
27 | -------------------- Magic-Cuts ----------------------
|
---|
28 | MFMagicCuts cuts;
|
---|
29 | cuts.SetHadronnessCut(MFMagicCuts::kArea);
|
---|
30 | cuts.SetThetaCut(MFMagicCuts::kOn);
|
---|
31 |
|
---|
32 | TArrayD arr(10);
|
---|
33 | arr[0]= 1.3245;
|
---|
34 | arr[1]= 0.208700;
|
---|
35 | arr[2]= 0.229200;
|
---|
36 | arr[3]= 5.305200;
|
---|
37 | arr[4]= 0.098930;
|
---|
38 | arr[5]= -0.082950;
|
---|
39 | arr[6]= 8.2957;
|
---|
40 | arr[7]= 0.8677;
|
---|
41 |
|
---|
42 | cuts.SetVariables(arr);
|
---|
43 |
|
---|
44 | opt.AddPreCut(&cuts);
|
---|
45 |
|
---|
46 | -------------------- Energy Slope --------------------
|
---|
47 | MFEnergySlope slope(-2.8);
|
---|
48 | opt.AddPreCut(&slope);
|
---|
49 |
|
---|
50 | -------------------- Other cuts ----------------------
|
---|
51 | opt.AddPreCut("MHillasSrc.fDist*MGeomCam.fConvMm2Deg<1.0");
|
---|
52 | opt.AddPreCut("MHillas.fSize>200");
|
---|
53 | */
|
---|
54 |
|
---|
55 | opt.Train("rf-energy.root", set, 30000);
|
---|
56 | }
|
---|
57 | /*
|
---|
58 | // SequencesOn: Monte Carlo Sequences used for training
|
---|
59 | // SequencesOff: Monte Carlo Sequences used for testing
|
---|
60 |
|
---|
61 | // Use:
|
---|
62 | // opt.AddPreCut to use cut for test and training
|
---|
63 | // opt.AddTestCut to use cut for test only
|
---|
64 | // opt.AddTrainCut to use cut for train only
|
---|
65 | */
|
---|