source: trunk/MagicSoft/Mars/mgeom/MGeomPix.cc@ 1978

Last change on this file since 1978 was 1640, checked in by bigongia, 22 years ago
*** empty log message ***
File size: 3.5 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 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
19! Author(s): Harald Kornmayer 1/2001
20!
21! Copyright: MAGIC Software Development, 2000-2002
22!
23!
24\* ======================================================================== */
25
26//////////////////////////////////////////////////////////////////////////////
27//
28// MGeomPix
29//
30// This container stores the geometry (position) information of
31// a single pixel together with the information about next neighbors.
32//
33// The BIT(22) and BIT(23) is used to flag the pixels in the outer
34// and outermost ring. Please don't use this bits in conjuction with
35// MGeomPix.
36//
37////////////////////////////////////////////////////////////////////////////
38
39#include "MGeomPix.h"
40
41#include <math.h>
42
43#include "MLog.h"
44#include "MLogManip.h"
45
46#include "MGeomCam.h"
47
48ClassImp(MGeomPix);
49
50// --------------------------------------------------------------------------
51//
52// Initializes one pixel
53//
54MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r) : fX(x), fY(y), fR(r)
55{
56 // default constructor
57}
58
59// --------------------------------------------------------------------------
60//
61// Return the area of the pixel. A hexagonal shape is assumed.
62//
63Float_t MGeomPix::GetA() const
64{
65 return fR*fR*tan(60/kRad2Deg);
66}
67
68// --------------------------------------------------------------------------
69//
70// Initializes Next Neighbors.
71//
72// WARNING: This function is public, but it is not meant for user access.
73// It should only be used from geometry classes (like MGeomCam)
74//
75void MGeomPix::SetNeighbors(Short_t i0, Short_t i1, Short_t i2,
76 Short_t i3, Short_t i4, Short_t i5)
77{
78 fNeighbors[0] = i0;
79 fNeighbors[1] = i1;
80 fNeighbors[2] = i2;
81 fNeighbors[3] = i3;
82 fNeighbors[4] = i4;
83 fNeighbors[5] = i5;
84
85 int i;
86 for (i=0; i<6; i++)
87 if (fNeighbors[i]<0)
88 break;
89
90 fNumNeighbors = i;
91
92 if (fNumNeighbors<5)
93 SetBit(kIsInOutermostRing);
94}
95
96// --------------------------------------------------------------------------
97//
98// Set the kIsOuterRing flag if this pixel has a outermost pixel
99// as Next Neighbor and don't have the kIsOutermostRing flag itself.
100//
101void MGeomPix::CheckOuterRing(const MGeomCam &cam)
102{
103 if (IsInOutermostRing())
104 return;
105
106 for (int i=0; i<fNumNeighbors; i++)
107 if (cam[fNeighbors[i]].IsInOutermostRing())
108 {
109 SetBit(kIsInOuterRing);
110 return;
111 }
112}
113
114// --------------------------------------------------------------------------
115//
116// Print the geometry information of one pixel.
117//
118void MGeomPix::Print(Option_t *opt) const
119{
120 // information about a pixel
121 *fLog << all << "MPixGeom: x= " << fX
122 << " y= " << fY
123 << " r= " << fR
124 << endl ;
125}
126
Note: See TracBrowser for help on using the repository browser.