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): Wolfgang Wittek 04/2003 <mailto:wittek@mppmu.mpg.de>
|
---|
19 |
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MCT1SupercutsCalc //
|
---|
28 | // //
|
---|
29 | /////////////////////////////////////////////////////////////////////////////
|
---|
30 | #include "MCT1SupercutsCalc.h"
|
---|
31 |
|
---|
32 | #include <math.h>
|
---|
33 | #include <fstream.h>
|
---|
34 |
|
---|
35 | #include "MLog.h"
|
---|
36 | #include "MLogManip.h"
|
---|
37 |
|
---|
38 | #include "MParList.h"
|
---|
39 | #include "MHillasExt.h"
|
---|
40 | #include "MHillasSrc.h"
|
---|
41 | #include "MMcEvt.hxx"
|
---|
42 | #include "MCerPhotEvt.h"
|
---|
43 | #include "MGeomCam.h"
|
---|
44 | #include "MHadronness.h"
|
---|
45 |
|
---|
46 | ClassImp(MCT1SupercutsCalc);
|
---|
47 |
|
---|
48 | void MCT1SupercutsCalc::InitParams()
|
---|
49 | {
|
---|
50 | //---------------------------------
|
---|
51 | // cut parameters
|
---|
52 | fLengthUp[0] = 0.315585;
|
---|
53 | fLengthUp[1] = 0.001455;
|
---|
54 | fLengthUp[2] = 0.203198;
|
---|
55 | fLengthUp[3] = 0.005532;
|
---|
56 | fLengthUp[4] =-0.001670;
|
---|
57 | fLengthUp[5] =-0.020362;
|
---|
58 | fLengthUp[6] = 0.007388;
|
---|
59 | fLengthUp[7] =-0.013463;
|
---|
60 |
|
---|
61 | fWidthUp[0] = 0.145412;
|
---|
62 | fWidthUp[1] =-0.001771;
|
---|
63 | fWidthUp[2] = 0.054462;
|
---|
64 | fWidthUp[3] = 0.022280;
|
---|
65 | fWidthUp[4] =-0.009893;
|
---|
66 | fWidthUp[5] = 0.056353;
|
---|
67 | fWidthUp[6] = 0.020711;
|
---|
68 | fWidthUp[7] =-0.016703;
|
---|
69 |
|
---|
70 | fDistUp[0] = 1.787943;
|
---|
71 | fDistUp[1] = 0.;
|
---|
72 | fDistUp[2] = 2.942310;
|
---|
73 | fDistUp[3] = 0.199815;
|
---|
74 | fDistUp[4] = 0.;
|
---|
75 | fDistUp[5] = 0.249909;
|
---|
76 | fDistUp[6] = 0.189697;
|
---|
77 | fDistUp[7] = 0.;
|
---|
78 |
|
---|
79 | fLengthLo[0] = 0.151530;
|
---|
80 | fLengthLo[1] = 0.028323;
|
---|
81 | fLengthLo[2] = 0.510707;
|
---|
82 | fLengthLo[3] = 0.053089;
|
---|
83 | fLengthLo[4] = 0.013708;
|
---|
84 | fLengthLo[5] = 2.357993;
|
---|
85 | fLengthLo[6] = 0.000080;
|
---|
86 | fLengthLo[7] =-0.007157;
|
---|
87 |
|
---|
88 | fWidthLo[0] = 0.089187;
|
---|
89 | fWidthLo[1] =-0.006430;
|
---|
90 | fWidthLo[2] = 0.074442;
|
---|
91 | fWidthLo[3] = 0.003738;
|
---|
92 | fWidthLo[4] =-0.004256;
|
---|
93 | fWidthLo[5] =-0.014101;
|
---|
94 | fWidthLo[6] = 0.006126;
|
---|
95 | fWidthLo[7] =-0.002849;
|
---|
96 |
|
---|
97 | fDistLo[0] = 0.589406;
|
---|
98 | fDistLo[1] = 0.;
|
---|
99 | fDistLo[2] =-0.083964;
|
---|
100 | fDistLo[3] =-0.007975;
|
---|
101 | fDistLo[4] = 0.;
|
---|
102 | fDistLo[5] = 0.045374;
|
---|
103 | fDistLo[6] =-0.001750;
|
---|
104 | fDistLo[7] = 0.;
|
---|
105 |
|
---|
106 | fAsymUp[0] = 0.061267;
|
---|
107 | fAsymUp[1] = 0.014462;
|
---|
108 | fAsymUp[2] = 0.014327;
|
---|
109 | fAsymUp[3] = 0.014540;
|
---|
110 | fAsymUp[4] = 0.013391;
|
---|
111 | fAsymUp[5] = 0.012319;
|
---|
112 | fAsymUp[6] = 0.010444;
|
---|
113 | fAsymUp[7] = 0.008328;
|
---|
114 |
|
---|
115 | fAsymLo[0] =-0.012055;
|
---|
116 | fAsymLo[1] = 0.009157;
|
---|
117 | fAsymLo[2] = 0.005441;
|
---|
118 | fAsymLo[3] = 0.000399;
|
---|
119 | fAsymLo[4] = 0.001433;
|
---|
120 | fAsymLo[5] =-0.002050;
|
---|
121 | fAsymLo[6] =-0.000104;
|
---|
122 | fAsymLo[7] =-0.001188;
|
---|
123 |
|
---|
124 | fAlphaUp[0] = 13.123440;
|
---|
125 | fAlphaUp[1] = 0.;
|
---|
126 | fAlphaUp[2] = 0.;
|
---|
127 | fAlphaUp[3] = 0.;
|
---|
128 | fAlphaUp[4] = 0.;
|
---|
129 | fAlphaUp[5] = 0.;
|
---|
130 | fAlphaUp[6] = 0.;
|
---|
131 | fAlphaUp[7] = 0.;
|
---|
132 | //---------------------------------
|
---|
133 | }
|
---|
134 |
|
---|
135 | // --------------------------------------------------------------------------
|
---|
136 | //
|
---|
137 | MCT1SupercutsCalc::MCT1SupercutsCalc(const char *hilname,
|
---|
138 | const char *hilsrcname, const char *name, const char *title)
|
---|
139 | : fHadronnessName("MHadronness"), fHilName(hilname), fHilSrcName(hilsrcname)
|
---|
140 | {
|
---|
141 | fName = name ? name : "MCT1SupercutsCalc";
|
---|
142 | fTitle = title ? title : "Class to evaluate the Supercuts";
|
---|
143 |
|
---|
144 | InitParams();
|
---|
145 | }
|
---|
146 |
|
---|
147 | // --------------------------------------------------------------------------
|
---|
148 | //
|
---|
149 | MCT1SupercutsCalc::~MCT1SupercutsCalc()
|
---|
150 | {
|
---|
151 | }
|
---|
152 |
|
---|
153 |
|
---|
154 | // --------------------------------------------------------------------------
|
---|
155 | //
|
---|
156 | Bool_t MCT1SupercutsCalc::PreProcess(MParList *pList)
|
---|
157 | {
|
---|
158 | fHadronness = (MHadronness*)pList->FindCreateObj("MHadronness", fHadronnessName);
|
---|
159 | if (!fHadronness)
|
---|
160 | {
|
---|
161 | *fLog << dbginf << "MHadronness object " << fHadronnessName << " not found... aborting." << endl;
|
---|
162 | return kFALSE;
|
---|
163 | }
|
---|
164 |
|
---|
165 |
|
---|
166 | fHil = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
|
---|
167 | if (!fHil)
|
---|
168 | {
|
---|
169 | *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
|
---|
170 | return kFALSE;
|
---|
171 | }
|
---|
172 |
|
---|
173 | fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
|
---|
174 | if (!fHilSrc)
|
---|
175 | {
|
---|
176 | *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
|
---|
177 | return kFALSE;
|
---|
178 | }
|
---|
179 |
|
---|
180 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
181 | if (!fMcEvt)
|
---|
182 | {
|
---|
183 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
184 | return kFALSE;
|
---|
185 | }
|
---|
186 |
|
---|
187 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
188 | if (!fCam)
|
---|
189 | {
|
---|
190 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
191 | return kFALSE;
|
---|
192 | }
|
---|
193 |
|
---|
194 | fMm2Deg = fCam->GetConvMm2Deg();
|
---|
195 |
|
---|
196 | return kTRUE;
|
---|
197 | }
|
---|
198 |
|
---|
199 | // --------------------------------------------------------------------------
|
---|
200 | //
|
---|
201 | // Calculation of upper and lower limits
|
---|
202 | //
|
---|
203 | Double_t MCT1SupercutsCalc::CtsMCut(Double_t *a, Double_t ls, Double_t ct,
|
---|
204 | Double_t ls2, Double_t dd2)
|
---|
205 | {
|
---|
206 | // define cut-function
|
---|
207 | //
|
---|
208 | // dNOMLOGSIZE = 4.1 (=log(60.0)
|
---|
209 | // dNOMCOSZA = 1.0
|
---|
210 | //
|
---|
211 | // a: array of cut parameters
|
---|
212 | // ls: log(SIZE) - dNOMLOGSIZE
|
---|
213 | // ls2: ls^2
|
---|
214 | // ct: Cos(ZA.) - dNOMCOSZA
|
---|
215 | // dd2: DIST^2
|
---|
216 |
|
---|
217 | const Double_t limit =
|
---|
218 | a[0] + a[1] * dd2 + a[2] * ct +
|
---|
219 | ls * (a[3] + a[4] * dd2 + a[5] * ct) +
|
---|
220 | ls2 * (a[6] + a[7] * dd2);
|
---|
221 |
|
---|
222 | //*fLog << "MCT1SupercutsCalc::CtsMCut; *a = "
|
---|
223 | // << *a << ", " << *(a+1) << ", " << *(a+2) << ", "
|
---|
224 | // << *(a+3) << ", " << *(a+4) << ", " << *(a+5) << ", "
|
---|
225 | // << *(a+6) << ", " << *(a+7) << endl;
|
---|
226 |
|
---|
227 | //*fLog << "MCT1SupercutsCalc::CtsMCut; ls, ls2, ct, dd2, limit = " << ls
|
---|
228 | // << ", " << ls2 << ", " << ct << ", " << dd2 << ", "
|
---|
229 | // << limit << endl;
|
---|
230 |
|
---|
231 | return limit;
|
---|
232 | }
|
---|
233 |
|
---|
234 | // ---------------------------------------------------------------------------
|
---|
235 | //
|
---|
236 | // Evaluate supercuts for CT1 Mkn421 2001 (Daniel Kranich)
|
---|
237 | //
|
---|
238 | // set hadronness to 0.25 if cuts are fullfilled
|
---|
239 | // 0.75 otherwise
|
---|
240 | //
|
---|
241 | Bool_t MCT1SupercutsCalc::Process()
|
---|
242 | {
|
---|
243 | // apply dynamical Scuts
|
---|
244 | // optimized for mkn 421 2001 data
|
---|
245 |
|
---|
246 | Double_t dNOMLOGSIZE = 4.1;
|
---|
247 | Double_t dNOMCOSZA = 1.0;
|
---|
248 |
|
---|
249 |
|
---|
250 | Double_t newdist = fHilSrc->GetDist() * fMm2Deg;
|
---|
251 |
|
---|
252 | Double_t xbar = fHil->GetMeanX();
|
---|
253 | Double_t ybar = fHil->GetMeanY();
|
---|
254 | Double_t dist = sqrt(xbar*xbar + ybar*ybar) * fMm2Deg;
|
---|
255 | Double_t dd2 = dist * dist;
|
---|
256 |
|
---|
257 | Double_t dmls = log(fHil->GetSize()) - dNOMLOGSIZE;
|
---|
258 | Double_t dmls2 = dmls * dmls;
|
---|
259 |
|
---|
260 | Double_t dmcza = cos(fMcEvt->GetTelescopeTheta()) - dNOMCOSZA;
|
---|
261 |
|
---|
262 | Double_t length = fHil->GetLength() *fMm2Deg;
|
---|
263 | Double_t width = fHil->GetWidth() *fMm2Deg;
|
---|
264 |
|
---|
265 | //*fLog << "MCT1SupercutsCalc::Process; dmls, dmcza, dmls2, dd2 = "
|
---|
266 | // << dmls << ", " << dmcza << ", " << dmls2 << ", "
|
---|
267 | // << dd2 << endl;
|
---|
268 |
|
---|
269 | //*fLog << "MCT1SupercutsCalc::Process; newdist, dist, length, width = "
|
---|
270 | // << newdist << ", " << dist << ", " << length << ", "
|
---|
271 | // << width << endl;
|
---|
272 |
|
---|
273 | if (newdist < 1.05 &&
|
---|
274 | newdist < CtsMCut (fDistUp, dmls, dmcza, dmls2, dd2) &&
|
---|
275 | newdist > CtsMCut (fDistLo, dmls, dmcza, dmls2, dd2) &&
|
---|
276 | dist < 1.05 &&
|
---|
277 | length < CtsMCut (fLengthUp, dmls, dmcza, dmls2, dd2) &&
|
---|
278 | length > CtsMCut (fLengthLo, dmls, dmcza, dmls2, dd2) &&
|
---|
279 | width < CtsMCut (fWidthUp, dmls, dmcza, dmls2, dd2) &&
|
---|
280 | width > CtsMCut (fWidthLo, dmls, dmcza, dmls2, dd2) &&
|
---|
281 | //asym < CtsMCut (asymup, dmls, dmcza, dmls2, dd2) &&
|
---|
282 | //asym > CtsMCut (asymlow, dmls, dmcza, dmls2, dd2) &&
|
---|
283 | dist < CtsMCut (fDistUp, dmls, dmcza, dmls2, dd2) &&
|
---|
284 | dist > CtsMCut (fDistLo, dmls, dmcza, dmls2, dd2) )
|
---|
285 | fHadronness->SetHadronness(0.25);
|
---|
286 | else
|
---|
287 | fHadronness->SetHadronness(0.75);
|
---|
288 |
|
---|
289 | fHadronness->SetReadyToSave();
|
---|
290 |
|
---|
291 | return kTRUE;
|
---|
292 | }
|
---|
293 | // ---------------------------------------------------------------------------
|
---|
294 |
|
---|
295 |
|
---|
296 |
|
---|
297 |
|
---|
298 |
|
---|
299 |
|
---|
300 |
|
---|
301 |
|
---|
302 |
|
---|
303 |
|
---|
304 |
|
---|