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

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