source: trunk/MagicSoft/Mars/mfilter/MFCT1SelStandard.cc@ 1956

Last change on this file since 1956 was 1905, checked in by wittek, 22 years ago
*** empty log message ***
File size: 7.1 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// MFCT1SelStandard //
28// //
29// This is a class to evaluate the Standard Cuts //
30// //
31// to be called after the calculation of the image parameters //
32// before the g/h separation //
33// //
34/////////////////////////////////////////////////////////////////////////////
35
36#include "MFCT1SelStandard.h"
37
38#include "MParList.h"
39
40#include "MHillas.h"
41#include "MHillasExt.h"
42#include "MHillasSrc.h"
43#include "MCerPhotEvt.h"
44#include "MMcEvt.hxx"
45#include "MGeomCam.h"
46#include "MGeomPix.h"
47
48#include "MLog.h"
49#include "MLogManip.h"
50
51ClassImp(MFCT1SelStandard);
52
53// --------------------------------------------------------------------------
54//
55// Default constructor.
56//
57MFCT1SelStandard::MFCT1SelStandard(const char *HilName, const char *HilSrcName,
58 const char *name, const char *title)
59{
60 fName = name ? name : "MFCT1SelStandard";
61 fTitle = title ? title : "Class to evaluate the Standard Cuts";
62
63 fHilName = HilName;
64 fHilSrcName = HilSrcName;
65
66 // default values of cuts
67 SetCuts(92, 4, 60, 0.4, 1.05, 0.0, 0.0);
68}
69
70// --------------------------------------------------------------------------
71//
72// Set the values for the cuts
73//
74//
75void MFCT1SelStandard::SetCuts(Float_t usedpixelsmax, Float_t corepixelsmin,
76 Float_t sizemin, Float_t distmin, Float_t distmax,
77 Float_t lengthmin, Float_t widthmin)
78{
79 fUsedPixelsMax = usedpixelsmax;
80 fCorePixelsMin = corepixelsmin;
81 fSizeMin = sizemin;
82 fDistMin = distmin;
83 fDistMax = distmax;
84 fLengthMin = lengthmin;
85 fWidthMin = widthmin;
86
87 *fLog << inf << "MFCT1SelStandard cut values : fUsedPixelsMax, fCorePixelsMin = "
88 << fUsedPixelsMax << ", " << fCorePixelsMin << endl;
89 *fLog << inf << " fSizeMin, fDistMin, fDistMax = " << fSizeMin
90 << ", " << fDistMin << ", " << fDistMax << endl;
91 *fLog << inf << " fLengthMin, fWidthMin = " << fLengthMin
92 << ", " << fWidthMin << endl;
93}
94
95// --------------------------------------------------------------------------
96//
97//
98//
99//
100//
101Bool_t MFCT1SelStandard::PreProcess(MParList *pList)
102{
103 fHil = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
104 if (!fHil)
105 {
106 *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
107 return kFALSE;
108 }
109
110 fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
111 if (!fHilSrc)
112 {
113 *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
114 return kFALSE;
115 }
116
117
118 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
119 if (!fMcEvt)
120 {
121 *fLog << dbginf << "MMcEvt not found... aborting." << endl;
122 return kFALSE;
123 }
124
125 fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
126 if (!fEvt)
127 {
128 *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
129 return kFALSE;
130 }
131
132
133 fCam = (MGeomCam*)pList->FindObject("MGeomCam");
134 if (!fCam)
135 {
136 *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
137 return kFALSE;
138 }
139 fMm2Deg = fCam->GetConvMm2Deg();
140
141 //*fLog << "fMm2Deg = " << fMm2Deg << endl;
142
143 memset(fCut, 0, sizeof(fCut));
144
145 return kTRUE;
146}
147
148// --------------------------------------------------------------------------
149//
150// Evaluate standard cuts
151//
152// if selections are fulfilled set fResult = kTRUE;
153//
154//
155Bool_t MFCT1SelStandard::Process()
156{
157 Int_t rc = 0;
158 fResult = kFALSE;
159
160 Double_t length = fHil->GetLength() * fMm2Deg;
161 Double_t width = fHil->GetWidth() * fMm2Deg;
162 Double_t dist = fHilSrc->GetDist()* fMm2Deg;
163 //Double_t delta = fHil->GetDelta() * kRad2Deg;
164 Double_t size = fHil->GetSize();
165 Int_t numusedpixels = fHil->GetNumUsedPixels();
166 Int_t numcorepixels = fHil->GetNumCorePixels();
167
168 if ( numusedpixels >= fUsedPixelsMax || numcorepixels <= fCorePixelsMin )
169 {
170 rc = 1;
171 fResult = kTRUE;
172 }
173
174 else if ( size <= fSizeMin )
175 {
176 rc = 2;
177 fResult = kTRUE;
178 }
179
180 else if ( dist< fDistMin || dist > fDistMax )
181 {
182 rc = 3;
183 fResult = kTRUE;
184 }
185
186 else if ( length <= fLengthMin || width <= fWidthMin )
187 {
188 rc = 4;
189 fResult = kTRUE;
190 }
191
192 fCut[rc]++;
193
194 return kTRUE;
195}
196
197// --------------------------------------------------------------------------
198//
199// Prints some statistics about the Standard selections.
200//
201Bool_t MFCT1SelStandard::PostProcess()
202{
203 if (GetNumExecutions()==0)
204 return kTRUE;
205
206 *fLog << inf << endl;
207 *fLog << GetDescriptor() << " execution statistics:" << endl;
208 *fLog << dec << setfill(' ');
209 *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
210 << (int)(fCut[1]*100/GetNumExecutions())
211 << "%) Evts skipped due to: Used pixels >= " << fUsedPixelsMax
212 << " or Core pixels <= " << fCorePixelsMin << endl;
213
214 *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
215 << (int)(fCut[2]*100/GetNumExecutions())
216 << "%) Evts skipped due to: SIZE <= " << fSizeMin << endl;
217
218 *fLog << " " << setw(7) << fCut[3] << " (" << setw(3)
219 << (int)(fCut[3]*100/GetNumExecutions())
220 << "%) Evts skipped due to: DIST < " << fDistMin
221 << " or DIST > " << fDistMax << endl;
222
223 *fLog << " " << setw(7) << fCut[4] << " (" << setw(3)
224 << (int)(fCut[4]*100/GetNumExecutions())
225 << "%) Evts skipped due to: LENGTH <= " << fLengthMin
226 << " or WIDTH <= " << fWidthMin << endl;
227
228 *fLog << " " << fCut[0] << " ("
229 << (int)(fCut[0]*100/GetNumExecutions())
230 << "%) Evts survived Standard selections!" << endl;
231 *fLog << endl;
232
233 return kTRUE;
234}
Note: See TracBrowser for help on using the repository browser.