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

Last change on this file since 3669 was 3666, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 6.2 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!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MNewImagePar
28//
29// Storage Container for new image parameters
30//
31// fLeakage1 ratio: (photons in most outer ring of pixels) over fSize
32// fLeakage2 ratio: (photons in the 2 outer rings of pixels) over fSize
33// fNumSaturatedPixels: number of pixels in which at least one slice
34// of the low gain FADC was saturated.
35//
36// Version 2:
37// ----------
38// - added fNumSaturatedPixels
39//
40// Version 3:
41// ----------
42// - added fNumHGSaturatedPixels
43// - added fInnerLeakage1
44// - added fInnerLeakage2
45// - added fInnerSize
46// - added fUsedArea
47// - added fCoreArea
48//
49//
50/////////////////////////////////////////////////////////////////////////////
51#include "MNewImagePar.h"
52
53#include <fstream>
54
55#include "MLog.h"
56#include "MLogManip.h"
57
58#include "MHillas.h"
59
60#include "MGeomCam.h"
61#include "MGeomPix.h"
62
63#include "MCerPhotEvt.h"
64#include "MCerPhotPix.h"
65
66ClassImp(MNewImagePar);
67
68using namespace std;
69
70// --------------------------------------------------------------------------
71//
72// Default constructor.
73//
74MNewImagePar::MNewImagePar(const char *name, const char *title)
75{
76 fName = name ? name : "MNewImagePar";
77 fTitle = title ? title : "New image parameters";
78}
79
80// --------------------------------------------------------------------------
81//
82void MNewImagePar::Reset()
83{
84 fLeakage1 = -1;
85 fLeakage2 = -1;
86
87 fInnerLeakage1 = -1;
88 fInnerLeakage2 = -1;
89 fInnerSize = -1;
90
91 fConc = -1;
92 fConc1 = -1;
93
94 fNumUsedPixels = -1;
95 fNumCorePixels = -1;
96
97 fUsedArea = -1;
98 fCoreArea = -1;
99
100 fNumSaturatedPixels = -1;
101 fNumHGSaturatedPixels = -1;
102}
103
104// --------------------------------------------------------------------------
105//
106// Calculation of new image parameters
107//
108void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
109 const MHillas &hillas)
110{
111 fNumUsedPixels = 0;
112 fNumCorePixels = 0;
113
114 fUsedArea = 0;
115 fCoreArea = 0;
116
117 fNumSaturatedPixels = 0;
118 fNumHGSaturatedPixels = 0;
119
120 fInnerSize = 0;
121
122 const UInt_t npixevt = evt.GetNumPixels();
123
124 Double_t edgepix1 = 0;
125 Double_t edgepix2 = 0;
126
127 Double_t edgepixin1 = 0;
128 Double_t edgepixin2 = 0;
129
130 Float_t maxpix1 = 0; // [#phot]
131 Float_t maxpix2 = 0; // [#phot]
132
133 for (UInt_t i=0; i<npixevt; i++)
134 {
135 const MCerPhotPix &pix = evt[i];
136
137 // count saturated pixels
138 if (pix.IsPixelHGSaturated())
139 fNumHGSaturatedPixels++;
140 if (pix.IsPixelSaturated())
141 fNumSaturatedPixels++;
142
143 // skip unused pixels
144 if (!pix.IsPixelUsed())
145 continue;
146
147 // Get geometry of pixel
148 const Int_t pixid = pix.GetPixId();
149 const MGeomPix &gpix = geom[pixid];
150
151 // count used and core pixels
152 if (pix.IsPixelCore())
153 {
154 fNumCorePixels++;
155 fCoreArea += gpix.GetA();
156 }
157
158 // count used pixels
159 fNumUsedPixels++;
160 fUsedArea += gpix.GetA();
161
162 Double_t nphot = pix.GetNumPhotons();
163
164 //
165 // count photons in outer rings of camera
166 //
167 if (gpix.IsInOutermostRing())
168 edgepix1 += nphot;
169 if (gpix.IsInOuterRing())
170 edgepix2 += nphot;
171
172 //
173 // Now we are working on absolute values of nphot, which
174 // must take pixel size into account
175 //
176 nphot *= geom.GetPixRatio(pixid);
177
178 // count inner pixels: To dependent on MAGIC Camera --> FIXME
179
180 if (pixid<397){
181 fInnerSize += nphot;
182 if(pixid>270){
183 edgepixin2 += nphot;
184 if(pixid>330)
185 edgepixin1 += nphot;
186 }
187 }
188
189 // Compute Concetration 1 -2
190
191 if (nphot>maxpix1)
192 {
193 maxpix2 = maxpix1;
194 maxpix1 = nphot; // [1]
195 continue; // [1]
196 }
197
198 if (nphot>maxpix2)
199 maxpix2 = nphot; // [1]
200 }
201
202 fInnerLeakage1 = edgepixin1 / fInnerSize;
203 fInnerLeakage2 = edgepixin2 / fInnerSize;
204 fLeakage1 = edgepix1 / hillas.GetSize();
205 fLeakage2 = edgepix2 / hillas.GetSize();
206
207 fConc = (maxpix1+maxpix2)/hillas.GetSize(); // [ratio]
208 fConc1 = maxpix1/hillas.GetSize(); // [ratio]
209
210 SetReadyToSave();
211}
212
213// --------------------------------------------------------------------------
214//
215void MNewImagePar::Print(Option_t *) const
216{
217 *fLog << all;
218 *fLog << "New Image Parameters (" << GetName() << ")" << endl;
219 *fLog << " - Leakage1 [1] = " << fLeakage1 << endl;
220 *fLog << " - Leakage2 [1] = " << fLeakage2 << endl;
221 *fLog << " - Conc [1] = " << fConc << " (ratio)" << endl;
222 *fLog << " - Conc1 [1] = " << fConc1 << " (ratio)" << endl;
223 *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
224 *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
225 *fLog << " - Sat. Pixels (HG) [#] = " << fNumHGSaturatedPixels << " Pixels" << endl;
226 *fLog << " - Sat. Pixels (LG) [#] = " << fNumSaturatedPixels << " Pixels" << endl;
227}
Note: See TracBrowser for help on using the repository browser.