source: branches/AddingGoogleTestEnvironment/mimage/MNewImagePar2.cc@ 19779

Last change on this file since 19779 was 10166, checked in by tbretz, 14 years ago
Removed the old obsolete cvs header line.
File size: 4.2 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): Thomas Bretz 03/2005, <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MNewImagePar2
28//
29// Storage Container for new image parameters
30//
31/////////////////////////////////////////////////////////////////////////////
32#include "MNewImagePar2.h"
33
34#include <TArrayI.h>
35
36#include "MLog.h"
37#include "MLogManip.h"
38
39#include "MGeomCam.h"
40#include "MGeomPix.h"
41
42#include "MSignalCam.h"
43#include "MSignalPix.h"
44
45ClassImp(MNewImagePar2);
46
47using namespace std;
48
49// --------------------------------------------------------------------------
50//
51// Default constructor.
52//
53MNewImagePar2::MNewImagePar2(const char *name, const char *title)
54{
55 fName = name ? name : "MNewImagePar2";
56 fTitle = title ? title : "New image parameters 2";
57
58 Reset();
59}
60
61// --------------------------------------------------------------------------
62//
63void MNewImagePar2::Reset()
64{
65 fBorderLinePixel = 0;
66 fBorderLineCenter = 0;
67}
68
69// --------------------------------------------------------------------------
70//
71// Calculation of new image parameters
72//
73void MNewImagePar2::Calc(const MGeomCam &geom, const MSignalCam &evt, Int_t island)
74{
75 TArrayI idx(evt.GetNumPixels());
76 idx.Reset(-1);
77 Int_t cnt=0;
78
79 Int_t n = evt.GetNumPixels();
80 for (int i=0; i<n; i++)
81 {
82 const MSignalPix &pix = evt[i];
83 if (!pix.IsPixelUsed())
84 continue;
85
86 if (island>=0 && pix.GetIdxIsland()!=island)
87 continue;
88
89 Int_t used=0;
90
91 const MGeom &gpix = geom[i];
92 const Int_t nn = gpix.GetNumNeighbors();
93 for (int j=0; j<nn; j++)
94 {
95 const Int_t k = gpix.GetNeighbor(j);
96 if (evt[k].IsPixelUsed())
97 used++;
98 }
99
100 if (used<nn)
101 {
102 idx[cnt++] = i;
103 evt[i].SetBit(BIT(14));
104 }
105 else
106 evt[i].ResetBit(BIT(14));
107
108 // FIXME: GetT is not the correct value
109 fBorderLinePixel += (nn-used)*gpix.GetL();
110 }
111
112 for (Int_t m=0; idx[m]>=0; m++)
113 {
114 const Int_t l = idx[m];
115
116 const MGeom &gpix = geom[l];
117
118 const Int_t nn = gpix.GetNumNeighbors();
119 for (int j=0; j<nn; j++)
120 {
121 const Int_t k = gpix.GetNeighbor(j);
122 if (k<l)
123 continue;
124
125 if (!evt[k].IsPixelUsed())
126 continue;
127
128 if (!evt[k].TestBit(BIT(14)))
129 continue;
130
131 fBorderLineCenter += TMath::Hypot(gpix.GetX()-geom[k].GetX(),
132 gpix.GetY()-geom[k].GetY());
133 }
134 }
135}
136
137// --------------------------------------------------------------------------
138//
139void MNewImagePar2::Print(Option_t *) const
140{
141 *fLog << all;
142 *fLog << GetDescriptor() << endl;
143 *fLog << " - Border L.Pixel [mm] = " << fBorderLinePixel << endl;
144 *fLog << " - Border L.Center [mm] = " << fBorderLineCenter << endl;
145}
146
147// -------------------------------------------------------------------------
148//
149// Print contents of MNewImagePar to *fLog, depending on the geometry in
150// units of deg.
151//
152void MNewImagePar2::Print(const MGeomCam &geom) const
153{
154 *fLog << all;
155 *fLog << GetDescriptor() << endl;
156 *fLog << " - BorderL.Pixel [deg] = " << fBorderLinePixel*geom.GetConvMm2Deg() << endl;
157 *fLog << " - BorderL.Center [deg] = " << fBorderLineCenter*geom.GetConvMm2Deg() << endl;
158}
Note: See TracBrowser for help on using the repository browser.