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

Last change on this file since 2038 was 2038, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 8.5 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 return kFALSE;
184
185 return kTRUE;
186}
187
188// --------------------------------------------------------------------------
189//
190// Calculation of upper and lower limits
191//
192Double_t MCT1SupercutsCalc::CtsMCut(Double_t *a, Double_t ls, Double_t ct,
193 Double_t ls2, Double_t dd2)
194{
195 // define cut-function
196 //
197 // dNOMLOGSIZE = 4.1 (=log(60.0)
198 // dNOMCOSZA = 1.0
199 //
200 // a: array of cut parameters
201 // ls: log(SIZE) - dNOMLOGSIZE
202 // ls2: ls^2
203 // ct: Cos(ZA.) - dNOMCOSZA
204 // dd2: DIST^2
205
206 const Double_t limit =
207 a[0] + a[1] * dd2 + a[2] * ct +
208 ls * (a[3] + a[4] * dd2 + a[5] * ct) +
209 ls2 * (a[6] + a[7] * dd2);
210
211 //*fLog << "MCT1SupercutsCalc::CtsMCut; *a = "
212 // << *a << ", " << *(a+1) << ", " << *(a+2) << ", "
213 // << *(a+3) << ", " << *(a+4) << ", " << *(a+5) << ", "
214 // << *(a+6) << ", " << *(a+7) << endl;
215
216 //*fLog << "MCT1SupercutsCalc::CtsMCut; ls, ls2, ct, dd2, limit = " << ls
217 // << ", " << ls2 << ", " << ct << ", " << dd2 << ", "
218 // << limit << endl;
219
220 return limit;
221}
222
223// ---------------------------------------------------------------------------
224//
225// Evaluate dynamical supercuts for CT1 Mkn421 2001 (Daniel Kranich)
226// optimized for mkn 421 2001 data
227//
228// set hadronness to 0.25 if cuts are fullfilled
229// 0.75 otherwise
230//
231Bool_t MCT1SupercutsCalc::Process()
232{
233 const Double_t dNOMLOGSIZE = 4.1;
234 const Double_t dNOMCOSZA = 1.0;
235
236 const Double_t newdist = fHilSrc->GetDist() * fMm2Deg;
237
238 const Double_t xbar = fHil->GetMeanX();
239 const Double_t ybar = fHil->GetMeanY();
240 const Double_t dist = sqrt(xbar*xbar + ybar*ybar) * fMm2Deg;
241 const Double_t dd2 = dist * dist;
242
243 const Double_t dmls = log(fHil->GetSize()) - dNOMLOGSIZE;
244 const Double_t dmls2 = dmls * dmls;
245
246 const Double_t dmcza = cos(fMcEvt->GetTelescopeTheta()) - dNOMCOSZA;
247
248 const Double_t length = fHil->GetLength() * fMm2Deg;
249 const Double_t width = fHil->GetWidth() * fMm2Deg;
250
251 //*fLog << "MCT1SupercutsCalc::Process; dmls, dmcza, dmls2, dd2 = "
252 // << dmls << ", " << dmcza << ", " << dmls2 << ", "
253 // << dd2 << endl;
254
255 //*fLog << "MCT1SupercutsCalc::Process; newdist, dist, length, width = "
256 // << newdist << ", " << dist << ", " << length << ", "
257 // << width << endl;
258
259 if (newdist < 1.05 &&
260 newdist < CtsMCut (fDistUp, dmls, dmcza, dmls2, dd2) &&
261 newdist > CtsMCut (fDistLo, dmls, dmcza, dmls2, dd2) &&
262 dist < 1.05 &&
263 length < CtsMCut (fLengthUp, dmls, dmcza, dmls2, dd2) &&
264 length > CtsMCut (fLengthLo, dmls, dmcza, dmls2, dd2) &&
265 width < CtsMCut (fWidthUp, dmls, dmcza, dmls2, dd2) &&
266 width > CtsMCut (fWidthLo, dmls, dmcza, dmls2, dd2) &&
267 //asym < CtsMCut (asymup, dmls, dmcza, dmls2, dd2) &&
268 //asym > CtsMCut (asymlow, dmls, dmcza, dmls2, dd2) &&
269 dist < CtsMCut (fDistUp, dmls, dmcza, dmls2, dd2) &&
270 dist > CtsMCut (fDistLo, dmls, dmcza, dmls2, dd2) )
271 fHadronness->SetHadronness(0.25);
272 else
273 fHadronness->SetHadronness(0.75);
274
275 return kTRUE;
276}
Note: See TracBrowser for help on using the repository browser.