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