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