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

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