source: trunk/MagicSoft/Mars/mfilter/MFCT1Supercuts.cc@ 1905

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