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

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