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

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