source: trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc@ 2105

Last change on this file since 2105 was 2105, checked in by wittek, 21 years ago
*** empty log message ***
File size: 8.6 KB
Line 
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
46ClassImp(MCT1SupercutsCalc);
47
48void 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//
137MCT1SupercutsCalc::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//
149Bool_t MCT1SupercutsCalc::PreProcess(MParList *pList)
150{
151 fHil = (MHillas*)pList->FindObject(fHilName, "MHillas");
152 if (!fHil)
153 {
154 *fLog << err << fHilName << " [MHillas] not found... aborting." << endl;
155 return kFALSE;
156 }
157
158 fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
159 if (!fHilSrc)
160 {
161 *fLog << err << fHilSrcName << " [MHillasSrc] not found... aborting." << endl;
162 return kFALSE;
163 }
164
165 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
166 if (!fMcEvt)
167 {
168 *fLog << err << "MMcEvt not found... aborting." << endl;
169 return kFALSE;
170 }
171
172 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
173 if (!cam)
174 {
175 *fLog << err << "MGeomCam (Camera Geometry) not found... aborting." << endl;
176 return kFALSE;
177 }
178
179 fMm2Deg = cam->GetConvMm2Deg();
180
181 fHadronness = (MHadronness*)pList->FindCreateObj("MHadronness", fHadronnessName);
182 if (!fHadronness)
183 {
184 *fLog << err << fHadronnessName << " [MHadronness] not found... aborting." << endl;
185 return kFALSE;
186 }
187
188
189 return kTRUE;
190}
191
192// --------------------------------------------------------------------------
193//
194// Calculation of upper and lower limits
195//
196Double_t MCT1SupercutsCalc::CtsMCut(Double_t *a, Double_t ls, Double_t ct,
197 Double_t ls2, Double_t dd2)
198{
199 // define cut-function
200 //
201 // dNOMLOGSIZE = 4.1 (=log(60.0)
202 // dNOMCOSZA = 1.0
203 //
204 // a: array of cut parameters
205 // ls: log(SIZE) - dNOMLOGSIZE
206 // ls2: ls^2
207 // ct: Cos(ZA.) - dNOMCOSZA
208 // dd2: DIST^2
209
210 const Double_t limit =
211 a[0] + a[1] * dd2 + a[2] * ct +
212 ls * (a[3] + a[4] * dd2 + a[5] * ct) +
213 ls2 * (a[6] + a[7] * dd2);
214
215 //*fLog << "MCT1SupercutsCalc::CtsMCut; *a = "
216 // << *a << ", " << *(a+1) << ", " << *(a+2) << ", "
217 // << *(a+3) << ", " << *(a+4) << ", " << *(a+5) << ", "
218 // << *(a+6) << ", " << *(a+7) << endl;
219
220 //*fLog << "MCT1SupercutsCalc::CtsMCut; ls, ls2, ct, dd2, limit = " << ls
221 // << ", " << ls2 << ", " << ct << ", " << dd2 << ", "
222 // << limit << endl;
223
224 return limit;
225}
226
227// ---------------------------------------------------------------------------
228//
229// Evaluate dynamical supercuts for CT1 Mkn421 2001 (Daniel Kranich)
230// optimized for mkn 421 2001 data
231//
232// set hadronness to 0.25 if cuts are fullfilled
233// 0.75 otherwise
234//
235Bool_t MCT1SupercutsCalc::Process()
236{
237 const Double_t dNOMLOGSIZE = 4.1;
238 const Double_t dNOMCOSZA = 1.0;
239
240 const Double_t newdist = fHilSrc->GetDist() * fMm2Deg;
241
242 const Double_t xbar = fHil->GetMeanX();
243 const Double_t ybar = fHil->GetMeanY();
244 const Double_t dist = sqrt(xbar*xbar + ybar*ybar) * fMm2Deg;
245 const Double_t dd2 = dist * dist;
246
247 const Double_t dmls = log(fHil->GetSize()) - dNOMLOGSIZE;
248 const Double_t dmls2 = dmls * dmls;
249
250 const Double_t dmcza = cos(fMcEvt->GetTelescopeTheta()) - dNOMCOSZA;
251
252 const Double_t length = fHil->GetLength() * fMm2Deg;
253 const Double_t width = fHil->GetWidth() * fMm2Deg;
254
255 //*fLog << "MCT1SupercutsCalc::Process; dmls, dmcza, dmls2, dd2 = "
256 // << dmls << ", " << dmcza << ", " << dmls2 << ", "
257 // << dd2 << endl;
258
259 //*fLog << "MCT1SupercutsCalc::Process; newdist, dist, length, width = "
260 // << newdist << ", " << dist << ", " << length << ", "
261 // << width << endl;
262
263 if (newdist < 1.05 &&
264 newdist < CtsMCut (fDistUp, dmls, dmcza, dmls2, dd2) &&
265 newdist > CtsMCut (fDistLo, dmls, dmcza, dmls2, dd2) &&
266 dist < 1.05 &&
267 length < CtsMCut (fLengthUp, dmls, dmcza, dmls2, dd2) &&
268 length > CtsMCut (fLengthLo, dmls, dmcza, dmls2, dd2) &&
269 width < CtsMCut (fWidthUp, dmls, dmcza, dmls2, dd2) &&
270 width > CtsMCut (fWidthLo, dmls, dmcza, dmls2, dd2) &&
271 //asym < CtsMCut (asymup, dmls, dmcza, dmls2, dd2) &&
272 //asym > CtsMCut (asymlow, dmls, dmcza, dmls2, dd2) &&
273 dist < CtsMCut (fDistUp, dmls, dmcza, dmls2, dd2) &&
274 dist > CtsMCut (fDistLo, dmls, dmcza, dmls2, dd2) )
275 fHadronness->SetHadronness(0.25);
276 else
277 fHadronness->SetHadronness(0.75);
278
279 fHadronness->SetReadyToSave();
280
281 return kTRUE;
282}
283
284
285
286
287
288
289
290
291
292
293
294
295
Note: See TracBrowser for help on using the repository browser.