source: tags/Mars-V0.9.4.3/mimage/MNewImagePar2.cc

Last change on this file was 6869, checked in by tbretz, 20 years ago
*** empty log message ***
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 MGeomPix &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 fBorderLinePixel += (nn-used)*gpix.GetL();
109 }
110
111 for (Int_t n=0; idx[n]>=0; n++)
112 {
113 const Int_t l = idx[n];
114
115 const MGeomPix &gpix = geom[l];
116
117 const Int_t nn = gpix.GetNumNeighbors();
118 for (int j=0; j<nn; j++)
119 {
120 const Int_t k = gpix.GetNeighbor(j);
121 if (k<l)
122 continue;
123
124 if (!evt[k].IsPixelUsed())
125 continue;
126
127 if (!evt[k].TestBit(BIT(14)))
128 continue;
129
130 fBorderLineCenter += TMath::Hypot(gpix.GetX()-geom[k].GetX(),
131 gpix.GetY()-geom[k].GetY());
132 }
133 }
134}
135
136// --------------------------------------------------------------------------
137//
138void MNewImagePar2::Print(Option_t *) const
139{
140 *fLog << all;
141 *fLog << GetDescriptor() << endl;
142 *fLog << " - Border L.Pixel [mm] = " << fBorderLinePixel << endl;
143 *fLog << " - Border L.Center [mm] = " << fBorderLineCenter << endl;
144}
145
146// -------------------------------------------------------------------------
147//
148// Print contents of MNewImagePar to *fLog, depending on the geometry in
149// units of deg.
150//
151void MNewImagePar2::Print(const MGeomCam &geom) const
152{
153 *fLog << all;
154 *fLog << GetDescriptor() << endl;
155 *fLog << " - BorderL.Pixel [deg] = " << fBorderLinePixel*geom.GetConvMm2Deg() << endl;
156 *fLog << " - BorderL.Center [deg] = " << fBorderLineCenter*geom.GetConvMm2Deg() << endl;
157}
Note: See TracBrowser for help on using the repository browser.