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 02/2003 <wittek@mppmu.mpg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MSelStandard //
|
---|
28 | // //
|
---|
29 | // This is a task 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 "MSelStandard.h"
|
---|
37 |
|
---|
38 | #include "MParList.h"
|
---|
39 |
|
---|
40 | #include "MHillas.h"
|
---|
41 | #include "MHillasSrc.h"
|
---|
42 | #include "MCerPhotEvt.h"
|
---|
43 | #include "MMcEvt.hxx"
|
---|
44 | #include "MGeomCam.h"
|
---|
45 | #include "MGeomPix.h"
|
---|
46 |
|
---|
47 | #include "MLog.h"
|
---|
48 | #include "MLogManip.h"
|
---|
49 |
|
---|
50 | ClassImp(MSelStandard);
|
---|
51 |
|
---|
52 | // --------------------------------------------------------------------------
|
---|
53 | //
|
---|
54 | // Default constructor.
|
---|
55 | //
|
---|
56 | MSelStandard::MSelStandard(const MHillas *parhil, const MHillasSrc *parhilsrc,
|
---|
57 | const char *name, const char *title)
|
---|
58 | {
|
---|
59 | fName = name ? name : "MSelStandard";
|
---|
60 | fTitle = title ? title : "Task to evaluate the Standard Cuts";
|
---|
61 |
|
---|
62 | fHil = parhil;
|
---|
63 | fHilsrc = parhilsrc;
|
---|
64 | }
|
---|
65 |
|
---|
66 | // --------------------------------------------------------------------------
|
---|
67 | //
|
---|
68 | //
|
---|
69 | //
|
---|
70 | //
|
---|
71 | //
|
---|
72 | Bool_t MSelStandard::PreProcess(MParList *pList)
|
---|
73 | {
|
---|
74 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
75 | if (!fMcEvt)
|
---|
76 | {
|
---|
77 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
78 | return kFALSE;
|
---|
79 | }
|
---|
80 |
|
---|
81 | fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
82 | if (!fEvt)
|
---|
83 | {
|
---|
84 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
85 | return kFALSE;
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
90 | if (!fCam)
|
---|
91 | {
|
---|
92 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
93 | return kFALSE;
|
---|
94 | }
|
---|
95 | fMm2Deg = fCam->GetConvMm2Deg();
|
---|
96 |
|
---|
97 | *fLog << "fMm2Deg = " << fMm2Deg << endl;
|
---|
98 |
|
---|
99 | memset(fErrors, 0, sizeof(fErrors));
|
---|
100 |
|
---|
101 | return kTRUE;
|
---|
102 | }
|
---|
103 |
|
---|
104 | // --------------------------------------------------------------------------
|
---|
105 | //
|
---|
106 | // Evaluate standard cuts
|
---|
107 | //
|
---|
108 | // if cuts are fulfilled : return 0
|
---|
109 | // if they are not fullfilled : skip the remaining tasks for this event
|
---|
110 | //
|
---|
111 | //
|
---|
112 | Bool_t MSelStandard::Process()
|
---|
113 | {
|
---|
114 | Int_t rc = 0;
|
---|
115 |
|
---|
116 | //Double_t fLength = fHil->GetLength() * fMm2Deg;
|
---|
117 | //Double_t fWidth = fHil->GetWidth() * fMm2Deg;
|
---|
118 | Double_t fDist = fHilsrc->GetDist()* fMm2Deg;
|
---|
119 | //Double_t fDelta = fHil->GetDelta() * kRad2Deg;
|
---|
120 | Double_t fSize = fHil->GetSize();
|
---|
121 | Int_t fNumUsedPixels = fHil->GetNumUsedPixels();
|
---|
122 | Int_t fNumCorePixels = fHil->GetNumCorePixels();
|
---|
123 |
|
---|
124 | if ( fSize <= 60.0 || fDist< 0.4 || fDist > 1.1
|
---|
125 | || fNumUsedPixels >= 92 || fNumCorePixels < 4)
|
---|
126 | {
|
---|
127 | //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
|
---|
128 | // << fSize << ", " << fDist << ", " << fNumUsedPixels << ", "
|
---|
129 | // << fNumCorePixels << endl;
|
---|
130 | rc = 1;
|
---|
131 | }
|
---|
132 |
|
---|
133 |
|
---|
134 | fErrors[rc]++;
|
---|
135 |
|
---|
136 | return rc==0 ? kTRUE : kCONTINUE;
|
---|
137 | }
|
---|
138 |
|
---|
139 | // --------------------------------------------------------------------------
|
---|
140 | //
|
---|
141 | // Prints some statistics about the Standard selections.
|
---|
142 | //
|
---|
143 | Bool_t MSelStandard::PostProcess()
|
---|
144 | {
|
---|
145 | if (GetNumExecutions()==0)
|
---|
146 | return kTRUE;
|
---|
147 |
|
---|
148 | *fLog << inf << endl;
|
---|
149 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
---|
150 | *fLog << dec << setfill(' ');
|
---|
151 | *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Standard selections are not fullfilled" << endl;
|
---|
152 |
|
---|
153 | *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Standard selections!" << endl;
|
---|
154 | *fLog << endl;
|
---|
155 |
|
---|
156 | return kTRUE;
|
---|
157 | }
|
---|