source: trunk/Mars/mimage/MNewImagePar2.cc@ 9949

Last change on this file since 9949 was 9369, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 4.4 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MNewImagePar2.cc,v 1.3 2009-03-01 21:48:14 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 MGeom &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 // FIXME: GetT is not the correct value
111 fBorderLinePixel += (nn-used)*gpix.GetT();
112 }
113
114 for (Int_t m=0; idx[m]>=0; m++)
115 {
116 const Int_t l = idx[m];
117
118 const MGeom &gpix = geom[l];
119
120 const Int_t nn = gpix.GetNumNeighbors();
121 for (int j=0; j<nn; j++)
122 {
123 const Int_t k = gpix.GetNeighbor(j);
124 if (k<l)
125 continue;
126
127 if (!evt[k].IsPixelUsed())
128 continue;
129
130 if (!evt[k].TestBit(BIT(14)))
131 continue;
132
133 fBorderLineCenter += TMath::Hypot(gpix.GetX()-geom[k].GetX(),
134 gpix.GetY()-geom[k].GetY());
135 }
136 }
137}
138
139// --------------------------------------------------------------------------
140//
141void MNewImagePar2::Print(Option_t *) const
142{
143 *fLog << all;
144 *fLog << GetDescriptor() << endl;
145 *fLog << " - Border L.Pixel [mm] = " << fBorderLinePixel << endl;
146 *fLog << " - Border L.Center [mm] = " << fBorderLineCenter << endl;
147}
148
149// -------------------------------------------------------------------------
150//
151// Print contents of MNewImagePar to *fLog, depending on the geometry in
152// units of deg.
153//
154void MNewImagePar2::Print(const MGeomCam &geom) const
155{
156 *fLog << all;
157 *fLog << GetDescriptor() << endl;
158 *fLog << " - BorderL.Pixel [deg] = " << fBorderLinePixel*geom.GetConvMm2Deg() << endl;
159 *fLog << " - BorderL.Center [deg] = " << fBorderLineCenter*geom.GetConvMm2Deg() << endl;
160}
Note: See TracBrowser for help on using the repository browser.