source: trunk/MagicSoft/Mars/mimage/MNewImagePar.cc@ 5611

Last change on this file since 5611 was 4826, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 8.4 KB
Line 
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 "MCerPhotEvt.h"
80#include "MCerPhotPix.h"
81
82ClassImp(MNewImagePar);
83
84using namespace std;
85
86// --------------------------------------------------------------------------
87//
88// Default constructor.
89//
90MNewImagePar::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//
100void 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//
123void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &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 MCerPhotPix *pix = 0;
144
145 TIter Next(evt);
146 while ((pix=(MCerPhotPix*)Next()))
147 {
148 // Check for requested islands
149 if (island>=0 && pix->GetIdxIsland()!=island)
150 continue;
151
152 // Get geometry of pixel
153 const Int_t pixid = pix->GetPixId();
154 const MGeomPix &gpix = geom[pixid];
155
156 // count used and core pixels
157 if (pix->IsPixelCore())
158 {
159 fNumCorePixels++;
160 fCoreArea += gpix.GetA();
161 }
162
163 // count used pixels
164 fNumUsedPixels++;
165 fUsedArea += gpix.GetA();
166
167 Double_t nphot = pix->GetNumPhotons();
168
169 //
170 // count photons in outer rings of camera
171 //
172 if (gpix.IsInOutermostRing())
173 edgepix1 += nphot;
174 if (gpix.IsInOuterRing())
175 edgepix2 += nphot;
176
177 //
178 // Now we are working on absolute values of nphot, which
179 // must take pixel size into account
180 //
181 nphot *= geom.GetPixRatio(pixid);
182
183 // count inner pixels: To dependent on MAGIC Camera --> FIXME
184
185 if (pixid<397){
186 fInnerSize += nphot;
187 if(pixid>270){
188 edgepixin2 += nphot;
189 if(pixid>330)
190 edgepixin1 += nphot;
191 }
192 }
193
194 // Compute Concentration 1-2
195 if (nphot>maxpix1)
196 {
197 maxpix2 = maxpix1;
198 maxpix1 = nphot; // [1]
199 continue; // [1]
200 }
201
202 if (nphot>maxpix2)
203 maxpix2 = nphot; // [1]
204 }
205
206 fInnerLeakage1 = edgepixin1 / fInnerSize;
207 fInnerLeakage2 = edgepixin2 / fInnerSize;
208 fLeakage1 = edgepix1 / hillas.GetSize();
209 fLeakage2 = edgepix2 / hillas.GetSize();
210
211 fConc = (maxpix1+maxpix2)/hillas.GetSize(); // [ratio]
212 fConc1 = maxpix1/hillas.GetSize(); // [ratio]
213
214 SetReadyToSave();
215}
216
217// --------------------------------------------------------------------------
218//
219void MNewImagePar::Print(Option_t *) const
220{
221 *fLog << all;
222 *fLog << "New Image Parameters (" << GetName() << ")" << endl;
223 *fLog << " - Leakage1 [1] = " << fLeakage1 << endl;
224 *fLog << " - Leakage2 [1] = " << fLeakage2 << endl;
225 *fLog << " - InnerLeakage1 [1] = " << fInnerLeakage1 << endl;
226 *fLog << " - InnerLeakage2 [1] = " << fInnerLeakage2 << endl;
227 *fLog << " - InnerSize [#] = " << fInnerSize << " CerPhot" << endl;
228 *fLog << " - Conc [1] = " << fConc << " (ratio)" << endl;
229 *fLog << " - Conc1 [1] = " << fConc1 << " (ratio)" << endl;
230 *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
231 *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
232 *fLog << " - Used Area [mm^2] = " << fUsedArea << endl;
233 *fLog << " - Core Area [mm^2] = " << fCoreArea << endl;
234}
235
236// -------------------------------------------------------------------------
237//
238// Print contents of MNewImagePar to *fLog, depending on the geometry in
239// units of deg.
240//
241void MNewImagePar::Print(const MGeomCam &geom) const
242{
243 *fLog << all;
244 *fLog << "New Image Parameters (" << GetName() << ")" << endl;
245 *fLog << " - Leakage1 [1] = " << fLeakage1 << endl;
246 *fLog << " - Leakage2 [1] = " << fLeakage2 << endl;
247 *fLog << " - InnerLeakage1 [1] = " << fInnerLeakage1 << endl;
248 *fLog << " - InnerLeakage2 [1] = " << fInnerLeakage2 << endl;
249 *fLog << " - InnerSize [#] = " << fInnerSize << " CerPhot" << endl;
250 *fLog << " - Conc [1] = " << fConc << " (ratio)" << endl;
251 *fLog << " - Conc1 [1] = " << fConc1 << " (ratio)" << endl;
252 *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
253 *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
254 *fLog << " - Used Area [deg^2] = " << fUsedArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl;
255 *fLog << " - Core Area [deg^2] = " << fCoreArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl;
256}
Note: See TracBrowser for help on using the repository browser.