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 03/2003 <mailto:wittek@mppmu.mpg.de>
|
---|
19 | ! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MNewImagePar
|
---|
29 | //
|
---|
30 | // Storage Container for new image parameters
|
---|
31 | //
|
---|
32 | // Float_t fLeakage1; // (photons in most outer ring of pixels) over fSize
|
---|
33 | // Float_t fLeakage2; // (photons in the 2 outer rings of pixels) over fSize
|
---|
34 | // Float_t fInnerLeakage1; // (photons in most outer rings of inner pixels) over fInnerSize
|
---|
35 | // Float_t fInnerLeakage2; // (photons in the 2 outer rings of inner pixels) over fInnerSize
|
---|
36 | // Float_t fInnerSize; //
|
---|
37 | //
|
---|
38 | // Float_t fConc; // [ratio] concentration ratio: sum of the two highest pixels / fSize
|
---|
39 | // Float_t fConc1; // [ratio] concentration ratio: sum of the highest pixel / fSize
|
---|
40 | //
|
---|
41 | // Float_t fUsedArea; // Area of pixels which survived the image cleaning
|
---|
42 | // Float_t fCoreArea; // Area of core pixels
|
---|
43 | // Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
|
---|
44 | // Short_t fNumCorePixels; // number of core pixels
|
---|
45 | // Short_t fNumHGSaturatedPixels; // number of pixels with saturating hi-gains
|
---|
46 | // Short_t fNumSaturatedPixels; // number of pixels with saturating lo-gains
|
---|
47 | //
|
---|
48 | // Version 2:
|
---|
49 | // ----------
|
---|
50 | // - added fNumSaturatedPixels
|
---|
51 | //
|
---|
52 | // Version 3:
|
---|
53 | // ----------
|
---|
54 | // - added fNumHGSaturatedPixels
|
---|
55 | // - added fInnerLeakage1
|
---|
56 | // - added fInnerLeakage2
|
---|
57 | // - added fInnerSize
|
---|
58 | // - added fUsedArea
|
---|
59 | // - added fCoreArea
|
---|
60 | //
|
---|
61 | // Version 4:
|
---|
62 | // ----------
|
---|
63 | // - moved cleaning/island independant parameters to MImagePar:
|
---|
64 | // + removed fNumHGSaturatedPixels
|
---|
65 | // + removed fNumSaturatedPixels
|
---|
66 | //
|
---|
67 | //
|
---|
68 | /////////////////////////////////////////////////////////////////////////////
|
---|
69 | #include "MNewImagePar.h"
|
---|
70 |
|
---|
71 | #include "MLog.h"
|
---|
72 | #include "MLogManip.h"
|
---|
73 |
|
---|
74 | #include "MHillas.h"
|
---|
75 |
|
---|
76 | #include "MGeomCam.h"
|
---|
77 | #include "MGeomPix.h"
|
---|
78 |
|
---|
79 | #include "MSignalCam.h"
|
---|
80 | #include "MSignalPix.h"
|
---|
81 |
|
---|
82 | ClassImp(MNewImagePar);
|
---|
83 |
|
---|
84 | using namespace std;
|
---|
85 |
|
---|
86 | // --------------------------------------------------------------------------
|
---|
87 | //
|
---|
88 | // Default constructor.
|
---|
89 | //
|
---|
90 | MNewImagePar::MNewImagePar(const char *name, const char *title)
|
---|
91 | {
|
---|
92 | fName = name ? name : "MNewImagePar";
|
---|
93 | fTitle = title ? title : "New image parameters";
|
---|
94 |
|
---|
95 | Reset();
|
---|
96 | }
|
---|
97 |
|
---|
98 | // --------------------------------------------------------------------------
|
---|
99 | //
|
---|
100 | void MNewImagePar::Reset()
|
---|
101 | {
|
---|
102 | fLeakage1 = -1;
|
---|
103 | fLeakage2 = -1;
|
---|
104 |
|
---|
105 | fInnerLeakage1 = -1;
|
---|
106 | fInnerLeakage2 = -1;
|
---|
107 | fInnerSize = -1;
|
---|
108 |
|
---|
109 | fConc = -1;
|
---|
110 | fConc1 = -1;
|
---|
111 |
|
---|
112 | fNumUsedPixels = -1;
|
---|
113 | fNumCorePixels = -1;
|
---|
114 |
|
---|
115 | fUsedArea = -1;
|
---|
116 | fCoreArea = -1;
|
---|
117 | }
|
---|
118 |
|
---|
119 | // --------------------------------------------------------------------------
|
---|
120 | //
|
---|
121 | // Calculation of new image parameters
|
---|
122 | //
|
---|
123 | void MNewImagePar::Calc(const MGeomCam &geom, const MSignalCam &evt,
|
---|
124 | const MHillas &hillas, Int_t island)
|
---|
125 | {
|
---|
126 | fNumUsedPixels = 0;
|
---|
127 | fNumCorePixels = 0;
|
---|
128 |
|
---|
129 | fUsedArea = 0;
|
---|
130 | fCoreArea = 0;
|
---|
131 |
|
---|
132 | fInnerSize = 0;
|
---|
133 |
|
---|
134 | Double_t edgepix1 = 0;
|
---|
135 | Double_t edgepix2 = 0;
|
---|
136 |
|
---|
137 | Double_t edgepixin1 = 0;
|
---|
138 | Double_t edgepixin2 = 0;
|
---|
139 |
|
---|
140 | Float_t maxpix1 = 0; // [#phot]
|
---|
141 | Float_t maxpix2 = 0; // [#phot]
|
---|
142 |
|
---|
143 | /*
|
---|
144 | MSignalPix *pix = 0;
|
---|
145 | TIter Next(evt);
|
---|
146 | while ((pix=(MSignalPix*)Next()))
|
---|
147 | */
|
---|
148 | UInt_t npix = evt.GetNumPixels();
|
---|
149 | for (UInt_t i=0; i<npix; i++)
|
---|
150 | {
|
---|
151 | const MSignalPix &pix = evt[i];
|
---|
152 | if (!pix.IsPixelUsed())
|
---|
153 | continue;
|
---|
154 |
|
---|
155 | // Check for requested islands
|
---|
156 | if (island>=0 && pix.GetIdxIsland()!=island)
|
---|
157 | continue;
|
---|
158 |
|
---|
159 | // Get geometry of pixel
|
---|
160 | //const Int_t pixid = pix->GetPixId();
|
---|
161 | const MGeomPix &gpix = geom[i/*pixid*/];
|
---|
162 |
|
---|
163 | // count used and core pixels
|
---|
164 | if (pix.IsPixelCore())
|
---|
165 | {
|
---|
166 | fNumCorePixels++;
|
---|
167 | fCoreArea += gpix.GetA();
|
---|
168 | }
|
---|
169 |
|
---|
170 | // count used pixels
|
---|
171 | fNumUsedPixels++;
|
---|
172 | fUsedArea += gpix.GetA();
|
---|
173 |
|
---|
174 | Double_t nphot = pix.GetNumPhotons();
|
---|
175 |
|
---|
176 | //
|
---|
177 | // count photons in outer rings of camera
|
---|
178 | //
|
---|
179 | if (gpix.IsInOutermostRing())
|
---|
180 | edgepix1 += nphot;
|
---|
181 | if (gpix.IsInOuterRing())
|
---|
182 | edgepix2 += nphot;
|
---|
183 |
|
---|
184 | //
|
---|
185 | // Now we are working on absolute values of nphot, which
|
---|
186 | // must take pixel size into account
|
---|
187 | //
|
---|
188 | nphot *= geom.GetPixRatio(i/*pixid*/);
|
---|
189 |
|
---|
190 | // count inner pixels: To dependent on MAGIC Camera --> FIXME
|
---|
191 |
|
---|
192 | if (i<397){
|
---|
193 | fInnerSize += nphot;
|
---|
194 | if(i>270){
|
---|
195 | edgepixin2 += nphot;
|
---|
196 | if(i>330)
|
---|
197 | edgepixin1 += nphot;
|
---|
198 | }
|
---|
199 | }
|
---|
200 |
|
---|
201 | // Compute Concentration 1-2
|
---|
202 | if (nphot>maxpix1)
|
---|
203 | {
|
---|
204 | maxpix2 = maxpix1;
|
---|
205 | maxpix1 = nphot; // [1]
|
---|
206 | continue; // [1]
|
---|
207 | }
|
---|
208 |
|
---|
209 | if (nphot>maxpix2)
|
---|
210 | maxpix2 = nphot; // [1]
|
---|
211 | }
|
---|
212 |
|
---|
213 | fInnerLeakage1 = edgepixin1 / fInnerSize;
|
---|
214 | fInnerLeakage2 = edgepixin2 / fInnerSize;
|
---|
215 | fLeakage1 = edgepix1 / hillas.GetSize();
|
---|
216 | fLeakage2 = edgepix2 / hillas.GetSize();
|
---|
217 |
|
---|
218 | fConc = (maxpix1+maxpix2)/hillas.GetSize(); // [ratio]
|
---|
219 | fConc1 = maxpix1/hillas.GetSize(); // [ratio]
|
---|
220 |
|
---|
221 | SetReadyToSave();
|
---|
222 | }
|
---|
223 |
|
---|
224 | // --------------------------------------------------------------------------
|
---|
225 | //
|
---|
226 | void MNewImagePar::Print(Option_t *) const
|
---|
227 | {
|
---|
228 | *fLog << all;
|
---|
229 | *fLog << GetDescriptor() << endl;
|
---|
230 | *fLog << " - Leakage1 [1] = " << fLeakage1 << endl;
|
---|
231 | *fLog << " - Leakage2 [1] = " << fLeakage2 << endl;
|
---|
232 | *fLog << " - InnerLeakage1 [1] = " << fInnerLeakage1 << endl;
|
---|
233 | *fLog << " - InnerLeakage2 [1] = " << fInnerLeakage2 << endl;
|
---|
234 | *fLog << " - InnerSize [#] = " << fInnerSize << " CerPhot" << endl;
|
---|
235 | *fLog << " - Conc [1] = " << fConc << " (ratio)" << endl;
|
---|
236 | *fLog << " - Conc1 [1] = " << fConc1 << " (ratio)" << endl;
|
---|
237 | *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
|
---|
238 | *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
|
---|
239 | *fLog << " - Used Area [mm^2] = " << fUsedArea << endl;
|
---|
240 | *fLog << " - Core Area [mm^2] = " << fCoreArea << endl;
|
---|
241 | }
|
---|
242 |
|
---|
243 | // -------------------------------------------------------------------------
|
---|
244 | //
|
---|
245 | // Print contents of MNewImagePar to *fLog, depending on the geometry in
|
---|
246 | // units of deg.
|
---|
247 | //
|
---|
248 | void MNewImagePar::Print(const MGeomCam &geom) const
|
---|
249 | {
|
---|
250 | *fLog << all;
|
---|
251 | *fLog << GetDescriptor() << endl;
|
---|
252 | *fLog << " - Leakage1 [1] = " << fLeakage1 << endl;
|
---|
253 | *fLog << " - Leakage2 [1] = " << fLeakage2 << endl;
|
---|
254 | *fLog << " - InnerLeakage1 [1] = " << fInnerLeakage1 << endl;
|
---|
255 | *fLog << " - InnerLeakage2 [1] = " << fInnerLeakage2 << endl;
|
---|
256 | *fLog << " - InnerSize [#] = " << fInnerSize << " CerPhot" << endl;
|
---|
257 | *fLog << " - Conc [1] = " << fConc << " (ratio)" << endl;
|
---|
258 | *fLog << " - Conc1 [1] = " << fConc1 << " (ratio)" << endl;
|
---|
259 | *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
|
---|
260 | *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
|
---|
261 | *fLog << " - Used Area [deg^2] = " << fUsedArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl;
|
---|
262 | *fLog << " - Core Area [deg^2] = " << fCoreArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl;
|
---|
263 | }
|
---|