1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz et al, 09/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2002
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 |
|
---|
26 | void estimate()
|
---|
27 | {
|
---|
28 | //
|
---|
29 | // This is a demonstration program which calculates the Hillas
|
---|
30 | // parameter out of a Magic root file (raw data file).
|
---|
31 | //
|
---|
32 |
|
---|
33 | //
|
---|
34 | // Create a empty Parameter List and an empty Task List
|
---|
35 | // The tasklist is identified in the eventloop by its name
|
---|
36 | //
|
---|
37 | MParList plist;
|
---|
38 |
|
---|
39 |
|
---|
40 | MTaskList tlist;
|
---|
41 | plist.AddToList(&tlist);
|
---|
42 |
|
---|
43 | //
|
---|
44 | // Now setup the tasks and tasklist:
|
---|
45 | // ---------------------------------
|
---|
46 | //
|
---|
47 | MReadMarsFile read("Events");
|
---|
48 | read.DisableAutoScheme();
|
---|
49 | /*
|
---|
50 | read.AddFile("star.root");
|
---|
51 | read.AddFile("star2.root");
|
---|
52 | */
|
---|
53 | read.AddFile("gammas.root");
|
---|
54 |
|
---|
55 | // Create a filter for the gamma events
|
---|
56 | MFParticleId fgamma("MMcEvt", '=', kGAMMA);
|
---|
57 |
|
---|
58 | MTaskList tlist2;
|
---|
59 | tlist2.SetFilter(&fgamma);
|
---|
60 |
|
---|
61 | MEnergyEstParam eest;
|
---|
62 | eest.Add("HillasSource");
|
---|
63 |
|
---|
64 | TArrayD fA(5);
|
---|
65 | fA[0] = -2539; // [cm]
|
---|
66 | fA[1] = 900; // [cm]
|
---|
67 | fA[2] = 17.5; // [cm]
|
---|
68 | fA[3] = 4;
|
---|
69 | fA[4] = 58.3;
|
---|
70 |
|
---|
71 | TArrayD fB(7);
|
---|
72 | fB[0] = -8.64; // [GeV]
|
---|
73 | fB[1] = -0.069; // [GeV]
|
---|
74 | fB[2] = 0.00066; // [GeV]
|
---|
75 | fB[3] = 0.033; // [GeV]
|
---|
76 | fB[4] = 0.000226; // [GeV]
|
---|
77 | fB[5] = 4.14e-8; // [GeV]
|
---|
78 | fB[6] = -0.06;
|
---|
79 | /* fb5=size*width, ir 29.8% (RMS=23%)
|
---|
80 | fB[0] = -8.64; // [GeV]
|
---|
81 | fB[1] = -0.069; // [GeV]
|
---|
82 | fB[2] = 0.00066; // [GeV]
|
---|
83 | fB[3] = 0.033; // [GeV]
|
---|
84 | fB[4] = 0.000226; // [GeV]
|
---|
85 | fB[5] = 4.14e-8; // [GeV]
|
---|
86 | fB[6] = -0.06;*/
|
---|
87 | /* size*dist, ir 30%
|
---|
88 | fB[0] = -32; // [GeV]
|
---|
89 | fB[1] = -0.0295; // [GeV]
|
---|
90 | fB[2] = 0.00112; // [GeV]
|
---|
91 | fB[3] = 0.0644; // [GeV]
|
---|
92 | fB[4] = 1e-5; // [GeV]
|
---|
93 | fB[5] = 6.3e-6; // [GeV]
|
---|
94 | fB[6] = -0.06;
|
---|
95 | */
|
---|
96 | /* size*width, ir 30%
|
---|
97 | fB[0] = -17; // [GeV]
|
---|
98 | fB[1] = -0.06; // [GeV]
|
---|
99 | fB[2] = 0.0013; // [GeV]
|
---|
100 | fB[3] = 0.039; // [GeV]
|
---|
101 | fB[4] = 0.00036; // [GeV]
|
---|
102 | fB[5] = 5.6e-6; // [GeV]
|
---|
103 | fB[6] = -0.06;
|
---|
104 | */
|
---|
105 | /* fb5=width, ir 31%
|
---|
106 | fB[0] = 0.14; // [GeV]
|
---|
107 | fB[1] = -0.078; // [GeV]
|
---|
108 | fB[2] = 0.0003; // [GeV]
|
---|
109 | fB[3] = -0.171; // [GeV]
|
---|
110 | fB[4] = 0.00038; // [GeV]
|
---|
111 | fB[5] = 3e-5; // [GeV]
|
---|
112 | fB[6] = -0.06;
|
---|
113 | */
|
---|
114 | /* size*length, ir 32%
|
---|
115 | fB[0] = -1.14; // [GeV]
|
---|
116 | fB[1] = -0.075; // [GeV]
|
---|
117 | fB[2] = 0.0008; // [GeV]
|
---|
118 | fB[3] = -0.148; // [GeV]
|
---|
119 | fB[4] = 0.00037; // [GeV]
|
---|
120 | fB[5] = 8e-7; // [GeV]
|
---|
121 | fB[6] = -0.06;
|
---|
122 | */
|
---|
123 | /* ir/dist 35%
|
---|
124 | fB[0] = 7.7; // [GeV]
|
---|
125 | fB[1] = -0.076; // [GeV]
|
---|
126 | fB[2] = 0.011; // [GeV]
|
---|
127 | fB[3] = -0.175; // [GeV]
|
---|
128 | fB[4] = 0.00038; // [GeV]
|
---|
129 | fB[5] = -0.0001; // [GeV]
|
---|
130 | fB[6] = -0.06;
|
---|
131 | */
|
---|
132 |
|
---|
133 |
|
---|
134 | eest.SetCoeffA(fA);
|
---|
135 | eest.SetCoeffB(fB);
|
---|
136 |
|
---|
137 | MH3 mh3e("MMcEvt.fEnergy", "abs(MEnergyEst.fEnergy/MMcEvt.fEnergy-1)");
|
---|
138 | MH3 mh3i("MMcEvt.fImpact/100", "abs(MEnergyEst.fImpact/MMcEvt.fImpact-1)");
|
---|
139 |
|
---|
140 | mh3e.SetName("HistEnergy");
|
---|
141 | mh3i.SetName("HistImpact");
|
---|
142 |
|
---|
143 | MFillH hfille(&mh3e);
|
---|
144 | MFillH hfilli(&mh3i);
|
---|
145 |
|
---|
146 | MBinning binsex("BinningHistEnergyX");
|
---|
147 | MBinning binsey("BinningHistEnergyY");
|
---|
148 | MBinning binsix("BinningHistImpactX");
|
---|
149 | MBinning binsiy("BinningHistImpactY");
|
---|
150 |
|
---|
151 | binsex.SetEdgesLog(50, 10, 1e4);
|
---|
152 | binsey.SetEdges(50, 0, 7);
|
---|
153 |
|
---|
154 | binsix.SetEdges(50, 0, 300);
|
---|
155 | binsiy.SetEdges(50, 0, 3);
|
---|
156 |
|
---|
157 | plist.AddToList(&binsex);
|
---|
158 | plist.AddToList(&binsey);
|
---|
159 | plist.AddToList(&binsix);
|
---|
160 | plist.AddToList(&binsiy);
|
---|
161 |
|
---|
162 | //
|
---|
163 | // Setup tasklists
|
---|
164 | //
|
---|
165 | tlist.AddToList(&read);
|
---|
166 | tlist.AddToList(&fgamma);
|
---|
167 | tlist.AddToList(&tlist2);
|
---|
168 |
|
---|
169 | tlist2.AddToList(&eest);
|
---|
170 | tlist2.AddToList(&hfille);
|
---|
171 | tlist2.AddToList(&hfilli);
|
---|
172 |
|
---|
173 | /*
|
---|
174 | MPrint p("MEnergyEst");
|
---|
175 | tlist2.AddToList(&p);
|
---|
176 | */
|
---|
177 |
|
---|
178 | //
|
---|
179 | // Create and setup the eventloop
|
---|
180 | //
|
---|
181 | MEvtLoop evtloop;
|
---|
182 | evtloop.SetParList(&plist);
|
---|
183 |
|
---|
184 | //
|
---|
185 | // Execute your analysis
|
---|
186 | //
|
---|
187 | if (!evtloop.Eventloop())
|
---|
188 | return;
|
---|
189 |
|
---|
190 | tlist.PrintStatistics();
|
---|
191 |
|
---|
192 | mh3i.DrawClone("PROFX");
|
---|
193 | mh3e.DrawClone("PROFX");
|
---|
194 | }
|
---|
195 |
|
---|