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 | // MSelFinal //
|
---|
28 | // //
|
---|
29 | // This is a task to evaluate the Final Cuts //
|
---|
30 | // (these cuts define the final sample of gammas; //
|
---|
31 | // relevant for the calculation of the effective collection areas) //
|
---|
32 | // //
|
---|
33 | // to be called after the calculation of the hadroness //
|
---|
34 | // //
|
---|
35 | /////////////////////////////////////////////////////////////////////////////
|
---|
36 |
|
---|
37 | #include "math.h"
|
---|
38 | #include "MSelFinal.h"
|
---|
39 |
|
---|
40 | #include "MParList.h"
|
---|
41 |
|
---|
42 | #include "MHillas.h"
|
---|
43 | #include "MHillasSrc.h"
|
---|
44 | #include "MCerPhotEvt.h"
|
---|
45 | #include "MMcEvt.hxx"
|
---|
46 | #include "MGeomCam.h"
|
---|
47 | #include "MGeomPix.h"
|
---|
48 | #include "MHadronness.h"
|
---|
49 |
|
---|
50 | #include "MLog.h"
|
---|
51 | #include "MLogManip.h"
|
---|
52 |
|
---|
53 | ClassImp(MSelFinal);
|
---|
54 |
|
---|
55 | // --------------------------------------------------------------------------
|
---|
56 | //
|
---|
57 | // Default constructor.
|
---|
58 | //
|
---|
59 | MSelFinal::MSelFinal(MHillas *parhil, MHillasSrc *parhilsrc,
|
---|
60 | const char *name, const char *title)
|
---|
61 | {
|
---|
62 | fName = name ? name : "MSelFinal";
|
---|
63 | fTitle = title ? title : "Task to evaluate the Final Cuts";
|
---|
64 |
|
---|
65 | fHil = parhil;
|
---|
66 | fHilsrc = parhilsrc;
|
---|
67 | }
|
---|
68 |
|
---|
69 | // --------------------------------------------------------------------------
|
---|
70 | //
|
---|
71 | //
|
---|
72 | //
|
---|
73 | //
|
---|
74 | //
|
---|
75 | Bool_t MSelFinal::PreProcess(MParList *pList)
|
---|
76 | {
|
---|
77 | fHadronness = (MHadronness*)pList->FindObject("MHadronness");
|
---|
78 | if (!fHadronness)
|
---|
79 | {
|
---|
80 | *fLog << dbginf << "MHadronness not found... aborting." << endl;
|
---|
81 | return kFALSE;
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
86 | if (!fMcEvt)
|
---|
87 | {
|
---|
88 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
89 | return kFALSE;
|
---|
90 | }
|
---|
91 |
|
---|
92 | fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
93 | if (!fEvt)
|
---|
94 | {
|
---|
95 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
96 | return kFALSE;
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|
100 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
101 | if (!fCam)
|
---|
102 | {
|
---|
103 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
104 | return kFALSE;
|
---|
105 | }
|
---|
106 | fMm2Deg = fCam->GetConvMm2Deg();
|
---|
107 |
|
---|
108 | *fLog << "fMm2Deg = " << fMm2Deg << endl;
|
---|
109 |
|
---|
110 | memset(fErrors, 0, sizeof(fErrors));
|
---|
111 |
|
---|
112 | return kTRUE;
|
---|
113 | }
|
---|
114 |
|
---|
115 | // --------------------------------------------------------------------------
|
---|
116 | //
|
---|
117 | // Evaluate final cuts
|
---|
118 | //
|
---|
119 | // if cuts are fulfilled : return 0
|
---|
120 | // if they are not fullfilled : skip the remaining tasks for this event
|
---|
121 | //
|
---|
122 | Bool_t MSelFinal::Process()
|
---|
123 | {
|
---|
124 | Int_t rc = 0;
|
---|
125 |
|
---|
126 | Double_t alphacut = 20.0;
|
---|
127 |
|
---|
128 | Double_t modalpha = fabs( fHilsrc->GetAlpha() );
|
---|
129 | Double_t h = fHadronness->GetHadronness();
|
---|
130 |
|
---|
131 | if ( h>0.5 || modalpha > alphacut )
|
---|
132 | {
|
---|
133 | //*fLog << "MSelFinal::Process; h, alpha = " << h << ", "
|
---|
134 | // << fHilsrc->GetAlpha() << endl;
|
---|
135 | rc = 1;
|
---|
136 | }
|
---|
137 |
|
---|
138 | fErrors[rc]++;
|
---|
139 |
|
---|
140 | return rc==0 ? kTRUE : kCONTINUE;
|
---|
141 | }
|
---|
142 |
|
---|
143 | // --------------------------------------------------------------------------
|
---|
144 | //
|
---|
145 | // Prints some statistics about the Final selections.
|
---|
146 | //
|
---|
147 | Bool_t MSelFinal::PostProcess()
|
---|
148 | {
|
---|
149 | if (GetNumExecutions()==0)
|
---|
150 | return kTRUE;
|
---|
151 |
|
---|
152 | *fLog << inf << endl;
|
---|
153 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
---|
154 | *fLog << dec << setfill(' ');
|
---|
155 | *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Final selections are not fullfilled" << endl;
|
---|
156 |
|
---|
157 | *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Final selections!" << endl;
|
---|
158 | *fLog << endl;
|
---|
159 |
|
---|
160 | return kTRUE;
|
---|
161 | }
|
---|