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

Last change on this file since 2041 was 2026, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 4.4 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/////////////////////////////////////////////////////////////////////////////
32#include "MNewImagePar.h"
33
34#include <fstream.h>
35
36#include "MLog.h"
37#include "MLogManip.h"
38
39#include "MHillas.h"
40
41#include "MGeomCam.h"
42#include "MGeomPix.h"
43
44#include "MCerPhotEvt.h"
45#include "MCerPhotPix.h"
46
47
48ClassImp(MNewImagePar);
49
50// --------------------------------------------------------------------------
51//
52// Default constructor.
53//
54MNewImagePar::MNewImagePar(const char *name, const char *title)
55{
56 fName = name ? name : "MNewImagePar";
57 fTitle = title ? title : "New image parameters";
58}
59
60// --------------------------------------------------------------------------
61//
62void MNewImagePar::Reset()
63{
64 fLeakage1 = -1;
65 fLeakage2 = -1;
66
67 fConc = -1;
68 fConc1 = -1;
69
70 fNumUsedPixels = -1;
71 fNumCorePixels = -1;
72}
73
74// --------------------------------------------------------------------------
75//
76// Calculation of new image parameters
77//
78void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
79 const MHillas &hillas)
80{
81 fNumUsedPixels = 0;
82 fNumCorePixels = 0;
83
84 const UInt_t npixevt = evt.GetNumPixels();
85
86 Double_t edgepix1 = 0;
87 Double_t edgepix2 = 0;
88
89 Float_t maxpix1 = 0; // [#phot]
90 Float_t maxpix2 = 0; // [#phot]
91
92 Int_t maxpixid = 0;
93
94
95 for (UInt_t i=0; i<npixevt; i++)
96 {
97 const MCerPhotPix &pix = evt[i];
98 if (!pix.IsPixelUsed())
99 continue;
100
101 const Int_t pixid = pix.GetPixId();
102
103 const MGeomPix &gpix = geom[pixid];
104
105 Double_t nphot = pix.GetNumPhotons();
106
107 //
108 // count photons in outer rings of camera
109 //
110 if (gpix.IsInOutermostRing())
111 edgepix1 += nphot;
112 if (gpix.IsInOuterRing())
113 edgepix2 += nphot;
114
115 //
116 // count used and core pixels
117 //
118 if (pix.IsPixelCore())
119 fNumCorePixels++;
120
121 fNumUsedPixels++;
122
123 //
124 // Now we are working on absolute values of nphot, which
125 // must take pixel size into account
126 //
127 nphot *= geom.GetPixRatio(pixid);
128
129 if (nphot>maxpix1)
130 {
131 maxpix2 = maxpix1;
132 maxpix1 = nphot; // [1]
133 maxpixid = pixid;
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.