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

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