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