1 | void trainenergy()
|
---|
2 | {
|
---|
3 | MDataSet set("/home/dorner/155vn/spec-ds0604/mcdataset.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); // New slope for mc spectrum
|
---|
48 | slope.SetMcMinEnergy(80); // Set break energy from -2.6 to -2.8
|
---|
49 | opt.AddPreCut(&slope); // throw away events to change slope
|
---|
50 |
|
---|
51 | -------------------- Other cuts ----------------------
|
---|
52 | opt.AddPreCut("MHillasSrc.fDist*MGeomCam.fConvMm2Deg<1.0");
|
---|
53 | opt.AddPreCut("MHillas.fSize>200");
|
---|
54 | */
|
---|
55 |
|
---|
56 | opt.Train("rf-energy.root", set, 30000);
|
---|
57 | }
|
---|
58 | /*
|
---|
59 | // SequencesOn: Monte Carlo Sequences used for training
|
---|
60 | // SequencesOff: Monte Carlo Sequences used for testing
|
---|
61 |
|
---|
62 | // Use:
|
---|
63 | // opt.AddPreCut to use cut for test and training
|
---|
64 | // opt.AddTestCut to use cut for test only
|
---|
65 | // opt.AddTrainCut to use cut for train only
|
---|
66 | */
|
---|