1 | void traindisp()
|
---|
2 | {
|
---|
3 | MDataSet set("mctesttrain.txt");
|
---|
4 | set.SetNumAnalysis(1); // Necessary
|
---|
5 |
|
---|
6 | MJTrainDisp opt;
|
---|
7 | //opt.SetDebug();
|
---|
8 |
|
---|
9 | // ------- Parameters to train Random Forest --------
|
---|
10 | opt.AddParameter("MHillas.fLength");
|
---|
11 | opt.AddParameter("MHillas.fWidth");
|
---|
12 | opt.AddParameter("MHillas.fSize");
|
---|
13 | opt.AddParameter("MNewImagePar.fLeakage1");
|
---|
14 | opt.AddParameter("MNewImagePar.fLeakage2");
|
---|
15 | opt.AddParameter("MNewImagePar.fConc");
|
---|
16 | opt.AddParameter("MNewImagePar.fConc1");
|
---|
17 | opt.AddParameter("MPointingPos.fZd");
|
---|
18 | opt.AddParameter("MNewImagePar.fUsedArea");
|
---|
19 | opt.AddParameter("MNewImagePar.fCoreArea");
|
---|
20 | opt.AddParameter("MNewImagePar.fNumUsedPixels");
|
---|
21 | opt.AddParameter("MNewImagePar.fNumCorePixels");
|
---|
22 | opt.AddParameter("MImagePar.fSizeSinglePixels");
|
---|
23 | opt.AddParameter("MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)");
|
---|
24 | opt.AddParameter("MHillasExt.fAsym*sign(MHillasSrc.fCosDeltaAlpha)");
|
---|
25 |
|
---|
26 | // -------------------- Run ----------------------------
|
---|
27 |
|
---|
28 | MStatusDisplay *d = new MStatusDisplay;
|
---|
29 | opt.SetDisplay(d);
|
---|
30 |
|
---|
31 | /*
|
---|
32 | -------------------- Magic-Cuts ----------------------
|
---|
33 | MFMagicCuts cuts;
|
---|
34 | cuts.SetHadronnessCut(MFMagicCuts::kArea);
|
---|
35 | cuts.SetThetaCut(MFMagicCuts::kOn);
|
---|
36 |
|
---|
37 | TArrayD arr(10);
|
---|
38 | arr[0]= 1.3245;
|
---|
39 | arr[1]= 0.208700;
|
---|
40 | arr[2]= 0.229200;
|
---|
41 | arr[3]= 5.305200;
|
---|
42 | arr[4]= 0.098930;
|
---|
43 | arr[5]= -0.082950;
|
---|
44 | arr[6]= 8.2957;
|
---|
45 | arr[7]= 0.8677;
|
---|
46 |
|
---|
47 | cuts.SetVariables(arr);
|
---|
48 |
|
---|
49 | opt.AddPreCut(&cuts);
|
---|
50 |
|
---|
51 | -------------------- Energy Slope --------------------
|
---|
52 | MFEnergySlope slope(-2.8);
|
---|
53 | opt.AddPreCut(&slope);
|
---|
54 |
|
---|
55 | -------------------- Other cuts ----------------------
|
---|
56 | opt.AddPreCut("MNewImagePar.fLeakage1<0.0001");
|
---|
57 | */
|
---|
58 |
|
---|
59 | opt.AddPreCut("MHillas.fSize>200");
|
---|
60 | opt.AddPreCut("MHillasSrc.fDCA*MGeomCam.fConvMm2Deg<0.3");
|
---|
61 |
|
---|
62 | // The number is the number of events read from the file
|
---|
63 | // randomly and is the number of events before cuts
|
---|
64 | opt.Train("rf-disp.root", set, 30000);
|
---|
65 | }
|
---|
66 | /*
|
---|
67 | // SequencesOn: Monte Carlo Sequences used for training
|
---|
68 | // SequencesOff: Monte Carlo Sequences used for testing
|
---|
69 |
|
---|
70 | // Use:
|
---|
71 | // opt.AddPreCut to use cut for test and training
|
---|
72 | // opt.AddTestCut to use cut for test only
|
---|
73 | // opt.AddTrainCut to use cut for train only
|
---|
74 | */
|
---|