source: trunk/MagicSoft/Mars/mimage/MNewImagePar2.cc@ 9138

Last change on this file since 9138 was 8106, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.4 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MNewImagePar2.cc,v 1.2 2006-10-17 17:16:00 tbretz Exp $
3! --------------------------------------------------------------------------
4!
5! *
6! * This file is part of MARS, the MAGIC Analysis and Reconstruction
7! * Software. It is distributed to you in the hope that it can be a useful
8! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
9! * It is distributed WITHOUT ANY WARRANTY.
10! *
11! * Permission to use, copy, modify and distribute this software and its
12! * documentation for any purpose is hereby granted without fee,
13! * provided that the above copyright notice appear in all copies and
14! * that both that copyright notice and this permission notice appear
15! * in supporting documentation. It is provided "as is" without express
16! * or implied warranty.
17! *
18!
19!
20! Author(s): Thomas Bretz 03/2005, <mailto:tbretz@astro.uni-wuerzburg.de>
21!
22! Copyright: MAGIC Software Development, 2000-2005
23!
24!
25\* ======================================================================== */
26
27/////////////////////////////////////////////////////////////////////////////
28//
29// MNewImagePar2
30//
31// Storage Container for new image parameters
32//
33/////////////////////////////////////////////////////////////////////////////
34#include "MNewImagePar2.h"
35
36#include <TArrayI.h>
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41#include "MGeomCam.h"
42#include "MGeomPix.h"
43
44#include "MSignalCam.h"
45#include "MSignalPix.h"
46
47ClassImp(MNewImagePar2);
48
49using namespace std;
50
51// --------------------------------------------------------------------------
52//
53// Default constructor.
54//
55MNewImagePar2::MNewImagePar2(const char *name, const char *title)
56{
57 fName = name ? name : "MNewImagePar2";
58 fTitle = title ? title : "New image parameters 2";
59
60 Reset();
61}
62
63// --------------------------------------------------------------------------
64//
65void MNewImagePar2::Reset()
66{
67 fBorderLinePixel = 0;
68 fBorderLineCenter = 0;
69}
70
71// --------------------------------------------------------------------------
72//
73// Calculation of new image parameters
74//
75void MNewImagePar2::Calc(const MGeomCam &geom, const MSignalCam &evt, Int_t island)
76{
77 TArrayI idx(evt.GetNumPixels());
78 idx.Reset(-1);
79 Int_t cnt=0;
80
81 Int_t n = evt.GetNumPixels();
82 for (int i=0; i<n; i++)
83 {
84 const MSignalPix &pix = evt[i];
85 if (!pix.IsPixelUsed())
86 continue;
87
88 if (island>=0 && pix.GetIdxIsland()!=island)
89 continue;
90
91 Int_t used=0;
92
93 const MGeomPix &gpix = geom[i];
94 const Int_t nn = gpix.GetNumNeighbors();
95 for (int j=0; j<nn; j++)
96 {
97 const Int_t k = gpix.GetNeighbor(j);
98 if (evt[k].IsPixelUsed())
99 used++;
100 }
101
102 if (used<nn)
103 {
104 idx[cnt++] = i;
105 evt[i].SetBit(BIT(14));
106 }
107 else
108 evt[i].ResetBit(BIT(14));
109
110 fBorderLinePixel += (nn-used)*gpix.GetL();
111 }
112
113 for (Int_t m=0; idx[m]>=0; m++)
114 {
115 const Int_t l = idx[m];
116
117 const MGeomPix &gpix = geom[l];
118
119 const Int_t nn = gpix.GetNumNeighbors();
120 for (int j=0; j<nn; j++)
121 {
122 const Int_t k = gpix.GetNeighbor(j);
123 if (k<l)
124 continue;
125
126 if (!evt[k].IsPixelUsed())
127 continue;
128
129 if (!evt[k].TestBit(BIT(14)))
130 continue;
131
132 fBorderLineCenter += TMath::Hypot(gpix.GetX()-geom[k].GetX(),
133 gpix.GetY()-geom[k].GetY());
134 }
135 }
136}
137
138// --------------------------------------------------------------------------
139//
140void MNewImagePar2::Print(Option_t *) const
141{
142 *fLog << all;
143 *fLog << GetDescriptor() << endl;
144 *fLog << " - Border L.Pixel [mm] = " << fBorderLinePixel << endl;
145 *fLog << " - Border L.Center [mm] = " << fBorderLineCenter << endl;
146}
147
148// -------------------------------------------------------------------------
149//
150// Print contents of MNewImagePar to *fLog, depending on the geometry in
151// units of deg.
152//
153void MNewImagePar2::Print(const MGeomCam &geom) const
154{
155 *fLog << all;
156 *fLog << GetDescriptor() << endl;
157 *fLog << " - BorderL.Pixel [deg] = " << fBorderLinePixel*geom.GetConvMm2Deg() << endl;
158 *fLog << " - BorderL.Center [deg] = " << fBorderLineCenter*geom.GetConvMm2Deg() << endl;
159}
Note: See TracBrowser for help on using the repository browser.