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

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