source: trunk/MagicSoft/Mars/macros/optim/optimdisp.C@ 7764

Last change on this file since 7764 was 7409, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.4 KB
Line 
1/* More explanations at the end of the file */
2void optimdisp()
3{
4 MJOptimizeDisp opt; // Initialize optimization class
5 opt.SetDebug(2); // Choose the level of output
6 opt.SetOptimizer(MJOptimize::kMigrad); // Choose the fit algorithm (see MJOptimize)
7 opt.EnableTestTrain(); // Split sample into test and train
8
9 // -------------------- Setup ----------------------------
10 opt.AddParameter("1-(MHillas.fWidth/MHillas.fLength)"); // M[0]
11 opt.AddParameter("log10(MNewImagePar.fLeakage1+1)"); // M[1]
12
13 opt.SetParameter(0, 1.30871); // Setup [0]
14 opt.SetParameter(1, 5.81119); // Setup [1]
15 opt.SetParameter(2, 0.763486); // Setup [2]
16
17 char *r = "([0]+([1]*pow(M[1], [2])))*M[0]"; // Rule to calc Disp
18
19 // -------------------- Run ----------------------------
20
21 MStatusDisplay *d = new MStatusDisplay;
22 opt.SetDisplay(d);
23
24 /*
25 -------------------- Magic-Cuts ----------------------
26 MFMagicCuts cuts;
27 cuts.SetHadronnessCut(MFMagicCuts::kArea);
28 cuts.SetThetaCut(MFMagicCuts::kOn);
29
30 TArrayD arr(10);
31 arr[0]= 1.3245;
32 arr[1]= 0.208700;
33 arr[2]= 0.229200;
34 arr[3]= 5.305200;
35 arr[4]= 0.098930;
36 arr[5]= -0.082950;
37 arr[6]= 8.2957;
38 arr[7]= 0.8677;
39
40 cuts.SetVariables(arr);
41
42 opt.AddPreCut(&cuts);
43
44 -------------------- Energy Slope --------------------
45 MFEnergySlope slope(-2.8);
46 opt.AddPreCut(&slope);
47
48 -------------------- Other cuts ----------------------
49 opt.AddPreCut("MNewImagePar.fLeakage1<0.0001");
50 */
51
52 opt.RunDisp("ganymedmcpart.root", r);
53}
54
55/* ------------------ Good strategy -------------------
56 1) first fix parameters:
57 opt.FixParameter(1, 0);
58 opt.FixParameter(2, 1);
59 and process only showers without leakage
60 opt.AddPreCut("MNewImagePar.fLeakage1<0.0001");
61 2) release parameters 1 and 2 and fix 0 to the result of 1)
62 opt.FixParameter(0, 0.8362);
63 opt.SetParameter(1, 2.0);
64 opt.SetParameter(2, 0.8);
65 and process only showers with leakage
66 opt.AddPreCut("MNewImagePar.fLeakage1>0.0001");
67 3) release all parameters and start with the result of 1) and 2)
68 opt.SetParameter(0, 0.8362);
69 opt.SetParameter(1, 5.84);
70 opt.SetParameter(2, 0.76);
71 and process all showers. (Comment out opt.PreCuts())
72 */
Note: See TracBrowser for help on using the repository browser.