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 <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 |
|
---|
68 | // --------------------------------------------------------------------------
|
---|
69 | //
|
---|
70 | //
|
---|
71 | //
|
---|
72 | //
|
---|
73 | //
|
---|
74 | Bool_t MSelStandard::PreProcess(MParList *pList)
|
---|
75 | {
|
---|
76 | fHil = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
|
---|
77 | if (!fHil)
|
---|
78 | {
|
---|
79 | *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
|
---|
80 | return kFALSE;
|
---|
81 | }
|
---|
82 |
|
---|
83 | fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
|
---|
84 | if (!fHilSrc)
|
---|
85 | {
|
---|
86 | *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
|
---|
87 | return kFALSE;
|
---|
88 | }
|
---|
89 |
|
---|
90 |
|
---|
91 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
92 | if (!fMcEvt)
|
---|
93 | {
|
---|
94 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
95 | return kFALSE;
|
---|
96 | }
|
---|
97 |
|
---|
98 | fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
99 | if (!fEvt)
|
---|
100 | {
|
---|
101 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
102 | return kFALSE;
|
---|
103 | }
|
---|
104 |
|
---|
105 |
|
---|
106 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
107 | if (!fCam)
|
---|
108 | {
|
---|
109 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
110 | return kFALSE;
|
---|
111 | }
|
---|
112 | fMm2Deg = fCam->GetConvMm2Deg();
|
---|
113 |
|
---|
114 | //*fLog << "fMm2Deg = " << fMm2Deg << endl;
|
---|
115 |
|
---|
116 | memset(fErrors, 0, sizeof(fErrors));
|
---|
117 |
|
---|
118 | return kTRUE;
|
---|
119 | }
|
---|
120 |
|
---|
121 | // --------------------------------------------------------------------------
|
---|
122 | //
|
---|
123 | // Evaluate standard cuts
|
---|
124 | //
|
---|
125 | // if cuts are fulfilled : return 0
|
---|
126 | // if they are not fullfilled : skip the remaining tasks for this event
|
---|
127 | //
|
---|
128 | //
|
---|
129 | Bool_t MSelStandard::Process()
|
---|
130 | {
|
---|
131 | Int_t rc = 0;
|
---|
132 |
|
---|
133 | Double_t fLength = fHil->GetLength() * fMm2Deg;
|
---|
134 | Double_t fWidth = fHil->GetWidth() * fMm2Deg;
|
---|
135 | Double_t fDist = fHilSrc->GetDist()* fMm2Deg;
|
---|
136 | //Double_t fDelta = fHil->GetDelta() * kRad2Deg;
|
---|
137 | Double_t fSize = fHil->GetSize();
|
---|
138 | Int_t fNumUsedPixels = fHil->GetNumUsedPixels();
|
---|
139 | Int_t fNumCorePixels = fHil->GetNumCorePixels();
|
---|
140 |
|
---|
141 | if ( fNumUsedPixels >= 92 || fNumCorePixels < 4 )
|
---|
142 | {
|
---|
143 | //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
|
---|
144 | // << fSize << ", " << fDist << ", " << fNumUsedPixels << ", "
|
---|
145 | // << fNumCorePixels << endl;
|
---|
146 | rc = 1;
|
---|
147 | }
|
---|
148 |
|
---|
149 | else if ( fSize <= 60.0 || fDist< 0.4 || fDist > 1.1 )
|
---|
150 | {
|
---|
151 | //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
|
---|
152 | // << fSize << ", " << fDist << ", " << fNumUsedPixels << ", "
|
---|
153 | // << fNumCorePixels << endl;
|
---|
154 | rc = 2;
|
---|
155 | }
|
---|
156 |
|
---|
157 | else if ( fLength <= 0.0 || fWidth <= 0.0 )
|
---|
158 | {
|
---|
159 | //*fLog << "MSelStandard::Process; fLength, fWidth = "
|
---|
160 | // << fLength << ", " << fWidth << endl;
|
---|
161 | rc = 3;
|
---|
162 | }
|
---|
163 |
|
---|
164 |
|
---|
165 | fErrors[rc]++;
|
---|
166 |
|
---|
167 | return rc==0 ? kTRUE : kCONTINUE;
|
---|
168 | }
|
---|
169 |
|
---|
170 | // --------------------------------------------------------------------------
|
---|
171 | //
|
---|
172 | // Prints some statistics about the Standard selections.
|
---|
173 | //
|
---|
174 | Bool_t MSelStandard::PostProcess()
|
---|
175 | {
|
---|
176 | if (GetNumExecutions()==0)
|
---|
177 | return kTRUE;
|
---|
178 |
|
---|
179 | *fLog << inf << endl;
|
---|
180 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
---|
181 | *fLog << dec << setfill(' ');
|
---|
182 | *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Requirements on no.of used or core pxels not fullfilled" << endl;
|
---|
183 |
|
---|
184 | *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Requirements on SIZE or DIST not fullfilled" << endl;
|
---|
185 |
|
---|
186 | *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Length or Width is <= 0" << endl;
|
---|
187 |
|
---|
188 | *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Standard selections!" << endl;
|
---|
189 | *fLog << endl;
|
---|
190 |
|
---|
191 | return kTRUE;
|
---|
192 | }
|
---|
193 |
|
---|
194 |
|
---|