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

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