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 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MFCT1SelFinal //
|
---|
28 | // //
|
---|
29 | // This is a class 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 "MFCT1SelFinal.h"
|
---|
39 |
|
---|
40 | #include "MParList.h"
|
---|
41 |
|
---|
42 | #include "MHillas.h"
|
---|
43 | #include "MHillasExt.h"
|
---|
44 | #include "MHillasSrc.h"
|
---|
45 | #include "MCerPhotEvt.h"
|
---|
46 | #include "MMcEvt.hxx"
|
---|
47 | #include "MGeomCam.h"
|
---|
48 | #include "MGeomCamCT1.h"
|
---|
49 | #include "MGeomPix.h"
|
---|
50 | #include "MHadronness.h"
|
---|
51 |
|
---|
52 | #include "MLog.h"
|
---|
53 | #include "MLogManip.h"
|
---|
54 |
|
---|
55 | ClassImp(MFCT1SelFinal);
|
---|
56 |
|
---|
57 | // --------------------------------------------------------------------------
|
---|
58 | //
|
---|
59 | // Default constructor.
|
---|
60 | //
|
---|
61 | MFCT1SelFinal::MFCT1SelFinal(const char *HilName, const char *HilSrcName,
|
---|
62 | const char *name, const char *title)
|
---|
63 | {
|
---|
64 | fName = name ? name : "MFCT1SelFinal";
|
---|
65 | fTitle = title ? title : "Class to evaluate the Final Cuts";
|
---|
66 |
|
---|
67 | fHilName = HilName;
|
---|
68 | fHilSrcName = HilSrcName;
|
---|
69 | fHadronnessName = "MHadronness";
|
---|
70 |
|
---|
71 | MGeomCamCT1 camct1;
|
---|
72 | fMm2Deg = camct1.GetConvMm2Deg();
|
---|
73 |
|
---|
74 | // default values of cuts
|
---|
75 | SetCuts(1.0, 100.0, 10.);
|
---|
76 | }
|
---|
77 |
|
---|
78 | // --------------------------------------------------------------------------
|
---|
79 | //
|
---|
80 | // Set cut values
|
---|
81 | //
|
---|
82 | //
|
---|
83 | void MFCT1SelFinal::SetCuts(Float_t hadmax, Float_t alphamax, Float_t distmax)
|
---|
84 | {
|
---|
85 | fHadronnessMax = hadmax;
|
---|
86 | fAlphaMax = alphamax;
|
---|
87 | fDistMax = distmax;
|
---|
88 |
|
---|
89 | *fLog << inf << "MFCT1SelFinal cut values : fHadronnessMax, fAlphaMax = "
|
---|
90 | << fHadronnessMax << ", " << fAlphaMax << ", fDistMax = " << fDistMax
|
---|
91 | << endl;
|
---|
92 | }
|
---|
93 |
|
---|
94 | // --------------------------------------------------------------------------
|
---|
95 | //
|
---|
96 | // Set the pointers
|
---|
97 | //
|
---|
98 | //
|
---|
99 | Bool_t MFCT1SelFinal::PreProcess(MParList *pList)
|
---|
100 | {
|
---|
101 | fHil = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
|
---|
102 | if (!fHil)
|
---|
103 | {
|
---|
104 | *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
|
---|
105 | return kFALSE;
|
---|
106 | }
|
---|
107 |
|
---|
108 | fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
|
---|
109 | if (!fHilSrc)
|
---|
110 | {
|
---|
111 | *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
|
---|
112 | return kFALSE;
|
---|
113 | }
|
---|
114 |
|
---|
115 | fHadronness = (MHadronness*)pList->FindObject(fHadronnessName, "MHadronness");
|
---|
116 | if (!fHadronness)
|
---|
117 | {
|
---|
118 | *fLog << dbginf << "MHadronness not found... aborting." << endl;
|
---|
119 | return kFALSE;
|
---|
120 | }
|
---|
121 |
|
---|
122 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
123 | if (!fMcEvt)
|
---|
124 | {
|
---|
125 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
126 | return kFALSE;
|
---|
127 | }
|
---|
128 |
|
---|
129 | memset(fCut, 0, sizeof(fCut));
|
---|
130 |
|
---|
131 | return kTRUE;
|
---|
132 | }
|
---|
133 |
|
---|
134 | // --------------------------------------------------------------------------
|
---|
135 | //
|
---|
136 | // Evaluate final cuts
|
---|
137 | //
|
---|
138 | // if cuts are fulfilled set fResult = kTRUE
|
---|
139 | //
|
---|
140 | Bool_t MFCT1SelFinal::Process()
|
---|
141 | {
|
---|
142 | Int_t rc = 0;
|
---|
143 | fResult = kFALSE;
|
---|
144 |
|
---|
145 | Double_t modalpha = fabs( fHilSrc->GetAlpha() );
|
---|
146 |
|
---|
147 | Double_t h = fHadronness->GetHadronness();
|
---|
148 |
|
---|
149 | if ( h>fHadronnessMax )
|
---|
150 | {
|
---|
151 | rc = 1;
|
---|
152 | fResult = kTRUE;
|
---|
153 | }
|
---|
154 |
|
---|
155 | else if ( modalpha > fAlphaMax )
|
---|
156 | {
|
---|
157 | rc = 2;
|
---|
158 | fResult = kTRUE;
|
---|
159 | }
|
---|
160 |
|
---|
161 | else if ( fMm2Deg*fHilSrc->GetDist() > fDistMax )
|
---|
162 | {
|
---|
163 | rc = 3;
|
---|
164 | fResult = kTRUE;
|
---|
165 | }
|
---|
166 |
|
---|
167 | fCut[rc]++;
|
---|
168 |
|
---|
169 | return kTRUE;
|
---|
170 | }
|
---|
171 |
|
---|
172 | // --------------------------------------------------------------------------
|
---|
173 | //
|
---|
174 | // Prints some statistics about the Final selections.
|
---|
175 | //
|
---|
176 | Bool_t MFCT1SelFinal::PostProcess()
|
---|
177 | {
|
---|
178 | if (GetNumExecutions()==0)
|
---|
179 | return kTRUE;
|
---|
180 |
|
---|
181 | *fLog << inf << endl;
|
---|
182 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
---|
183 | *fLog << dec << setfill(' ');
|
---|
184 | *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
|
---|
185 | << (int)(fCut[1]*100/GetNumExecutions())
|
---|
186 | << "%) Evts skipped due to: hadronness > "<< fHadronnessMax
|
---|
187 | << " (hadronness from '" << fHadronnessName << "')" << endl;
|
---|
188 |
|
---|
189 | *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
|
---|
190 | << (int)(fCut[2]*100/GetNumExecutions())
|
---|
191 | << "%) Evts skipped due to: |ALPHA| > " << fAlphaMax
|
---|
192 | << " [degrees]" << endl;
|
---|
193 |
|
---|
194 | *fLog << " " << setw(7) << fCut[3] << " (" << setw(3)
|
---|
195 | << (int)(fCut[3]*100/GetNumExecutions())
|
---|
196 | << "%) Evts skipped due to: DIST > " << fDistMax
|
---|
197 | << " [degrees]" << endl;
|
---|
198 |
|
---|
199 | *fLog << " " << fCut[0] << " ("
|
---|
200 | << (int)(fCut[0]*100/GetNumExecutions())
|
---|
201 | << "%) Evts survived Final selections!" << endl;
|
---|
202 | *fLog << endl;
|
---|
203 |
|
---|
204 | return kTRUE;
|
---|
205 | }
|
---|