1 |
|
---|
2 | /* ======================================================================== *\
|
---|
3 | !
|
---|
4 | ! *
|
---|
5 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
6 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
7 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
8 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
9 | ! *
|
---|
10 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
11 | ! * documentation for any purpose is hereby granted without fee,
|
---|
12 | ! * provided that the above copyright notice appear in all copies and
|
---|
13 | ! * that both that copyright notice and this permission notice appear
|
---|
14 | ! * in supporting documentation. It is provided "as is" without express
|
---|
15 | ! * or implied warranty.
|
---|
16 | ! *
|
---|
17 | !
|
---|
18 | !
|
---|
19 | ! Author(s): Wolfgang Wittek 02/2003 <mailto:wittek@mppmu.mpg.de>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | // //
|
---|
28 | // MSelStandard //
|
---|
29 | // //
|
---|
30 | // This is a task to evaluate the Standard Cuts //
|
---|
31 | // //
|
---|
32 | // to be called after the calculation of the image parameters //
|
---|
33 | // before the g/h separation //
|
---|
34 | // //
|
---|
35 | /////////////////////////////////////////////////////////////////////////////
|
---|
36 |
|
---|
37 | #include "MSelStandard.h"
|
---|
38 |
|
---|
39 | #include "MParList.h"
|
---|
40 |
|
---|
41 | #include "MHillas.h"
|
---|
42 | #include "MHillasExt.h"
|
---|
43 | #include "MHillasSrc.h"
|
---|
44 | #include "MCerPhotEvt.h"
|
---|
45 | #include "MMcEvt.hxx"
|
---|
46 | #include "MGeomCam.h"
|
---|
47 | #include "MGeomPix.h"
|
---|
48 |
|
---|
49 | #include "MLog.h"
|
---|
50 | #include "MLogManip.h"
|
---|
51 |
|
---|
52 | ClassImp(MSelStandard);
|
---|
53 |
|
---|
54 | // --------------------------------------------------------------------------
|
---|
55 | //
|
---|
56 | // Default constructor.
|
---|
57 | //
|
---|
58 | MSelStandard::MSelStandard(const char *HilName, const char *HilSrcName,
|
---|
59 | const char *name, const char *title)
|
---|
60 | {
|
---|
61 | fName = name ? name : "MSelStandard";
|
---|
62 | fTitle = title ? title : "Task to evaluate the Standard Cuts";
|
---|
63 |
|
---|
64 | fHilName = HilName;
|
---|
65 | fHilSrcName = HilSrcName;
|
---|
66 |
|
---|
67 | // default values of cuts
|
---|
68 | fUsedPixelsMax = 92;
|
---|
69 | fCorePixelsMin = 4;
|
---|
70 | fSizeMin = 60;
|
---|
71 | fDistMin = 0.4;
|
---|
72 | fDistMax = 1.05;
|
---|
73 | fLengthMin = 0.0;
|
---|
74 | fWidthMin = 0.0;
|
---|
75 | }
|
---|
76 |
|
---|
77 | // --------------------------------------------------------------------------
|
---|
78 | //
|
---|
79 | //
|
---|
80 | //
|
---|
81 | //
|
---|
82 | //
|
---|
83 | Bool_t MSelStandard::PreProcess(MParList *pList)
|
---|
84 | {
|
---|
85 | fHil = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
|
---|
86 | if (!fHil)
|
---|
87 | {
|
---|
88 | *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
|
---|
89 | return kFALSE;
|
---|
90 | }
|
---|
91 |
|
---|
92 | fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
|
---|
93 | if (!fHilSrc)
|
---|
94 | {
|
---|
95 | *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
|
---|
96 | return kFALSE;
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|
100 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
101 | if (!fMcEvt)
|
---|
102 | {
|
---|
103 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
104 | return kFALSE;
|
---|
105 | }
|
---|
106 |
|
---|
107 | fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
108 | if (!fEvt)
|
---|
109 | {
|
---|
110 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
111 | return kFALSE;
|
---|
112 | }
|
---|
113 |
|
---|
114 |
|
---|
115 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
116 | if (!fCam)
|
---|
117 | {
|
---|
118 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
119 | return kFALSE;
|
---|
120 | }
|
---|
121 | fMm2Deg = fCam->GetConvMm2Deg();
|
---|
122 |
|
---|
123 | //*fLog << "fMm2Deg = " << fMm2Deg << endl;
|
---|
124 |
|
---|
125 | memset(fCut, 0, sizeof(fCut));
|
---|
126 |
|
---|
127 | return kTRUE;
|
---|
128 | }
|
---|
129 |
|
---|
130 | // --------------------------------------------------------------------------
|
---|
131 | //
|
---|
132 | // Evaluate standard cuts
|
---|
133 | //
|
---|
134 | // if cuts are fulfilled : return 0
|
---|
135 | // if they are not fullfilled : skip the remaining tasks for this event
|
---|
136 | //
|
---|
137 | //
|
---|
138 | Bool_t MSelStandard::Process()
|
---|
139 | {
|
---|
140 | Int_t rc = 0;
|
---|
141 |
|
---|
142 | Double_t length = fHil->GetLength() * fMm2Deg;
|
---|
143 | Double_t width = fHil->GetWidth() * fMm2Deg;
|
---|
144 | Double_t dist = fHilSrc->GetDist()* fMm2Deg;
|
---|
145 | //Double_t delta = fHil->GetDelta() * kRad2Deg;
|
---|
146 | Double_t size = fHil->GetSize();
|
---|
147 | Int_t numusedpixels = fHil->GetNumUsedPixels();
|
---|
148 | Int_t numcorepixels = fHil->GetNumCorePixels();
|
---|
149 |
|
---|
150 | if ( numusedpixels >= fUsedPixelsMax || numcorepixels <= fCorePixelsMin )
|
---|
151 | {
|
---|
152 | rc = 1;
|
---|
153 | }
|
---|
154 |
|
---|
155 | else if ( size <= fSizeMin )
|
---|
156 | {
|
---|
157 | rc = 2;
|
---|
158 | }
|
---|
159 |
|
---|
160 | else if ( dist< fDistMin || dist > fDistMax )
|
---|
161 | {
|
---|
162 | rc = 3;
|
---|
163 | }
|
---|
164 |
|
---|
165 | else if ( length <= fLengthMin || width <= fWidthMin )
|
---|
166 | {
|
---|
167 | rc = 4;
|
---|
168 | }
|
---|
169 |
|
---|
170 |
|
---|
171 | fCut[rc]++;
|
---|
172 |
|
---|
173 | return rc==0 ? kTRUE : kCONTINUE;
|
---|
174 | }
|
---|
175 |
|
---|
176 | // --------------------------------------------------------------------------
|
---|
177 | //
|
---|
178 | // Prints some statistics about the Standard selections.
|
---|
179 | //
|
---|
180 | Bool_t MSelStandard::PostProcess()
|
---|
181 | {
|
---|
182 | if (GetNumExecutions()==0)
|
---|
183 | return kTRUE;
|
---|
184 |
|
---|
185 | *fLog << inf << endl;
|
---|
186 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
---|
187 | *fLog << dec << setfill(' ');
|
---|
188 | *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
|
---|
189 | << (int)(fCut[1]*100/GetNumExecutions())
|
---|
190 | << "%) Evts skipped due to: Used pixels >= " << fUsedPixelsMax
|
---|
191 | << " or Core pixels <= " << fCorePixelsMin << endl;
|
---|
192 |
|
---|
193 | *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
|
---|
194 | << (int)(fCut[2]*100/GetNumExecutions())
|
---|
195 | << "%) Evts skipped due to: SIZE <= " << fSizeMin << endl;
|
---|
196 |
|
---|
197 | *fLog << " " << setw(7) << fCut[3] << " (" << setw(3)
|
---|
198 | << (int)(fCut[3]*100/GetNumExecutions())
|
---|
199 | << "%) Evts skipped due to: DIST < " << fDistMin
|
---|
200 | << " or DIST > " << fDistMax << endl;
|
---|
201 |
|
---|
202 | *fLog << " " << setw(7) << fCut[4] << " (" << setw(3)
|
---|
203 | << (int)(fCut[4]*100/GetNumExecutions())
|
---|
204 | << "%) Evts skipped due to: LENGTH <= " << fLengthMin
|
---|
205 | << " or WIDTH <= " << fWidthMin << endl;
|
---|
206 |
|
---|
207 | *fLog << " " << fCut[0] << " ("
|
---|
208 | << (int)(fCut[0]*100/GetNumExecutions())
|
---|
209 | << "%) Evts survived Standard selections!" << endl;
|
---|
210 | *fLog << endl;
|
---|
211 |
|
---|
212 | return kTRUE;
|
---|
213 | }
|
---|
214 |
|
---|
215 |
|
---|
216 |
|
---|
217 |
|
---|
218 |
|
---|
219 |
|
---|
220 |
|
---|
221 |
|
---|
222 |
|
---|
223 |
|
---|
224 |
|
---|
225 |
|
---|