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

Last change on this file since 2445 was 2236, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.6 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-2003
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// FIXME: According to an agreement we have to change the name 'Id'
38// to 'idx'
39//
40////////////////////////////////////////////////////////////////////////////
41#include "MGeomPix.h"
42
43#include <math.h>
44
45#include "MLog.h"
46#include "MLogManip.h"
47
48#include "MGeomCam.h"
49
50ClassImp(MGeomPix);
51
52using namespace std;
53
54// --------------------------------------------------------------------------
55//
56// Initializes one pixel
57//
58MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r, UInt_t s) : fX(x), fY(y), fD(r), fSector(s)
59{
60 // default constructor
61}
62
63// --------------------------------------------------------------------------
64//
65// Return the area of the pixel. A hexagonal shape is assumed.
66//
67Float_t MGeomPix::GetA() const
68{
69 return fD*fD*tan(60/kRad2Deg);
70}
71
72// --------------------------------------------------------------------------
73//
74// Initializes Next Neighbors.
75//
76// WARNING: This function is public, but it is not meant for user access.
77// It should only be used from geometry classes (like MGeomCam)
78//
79void MGeomPix::SetNeighbors(Short_t i0, Short_t i1, Short_t i2,
80 Short_t i3, Short_t i4, Short_t i5)
81{
82 fNeighbors[0] = i0;
83 fNeighbors[1] = i1;
84 fNeighbors[2] = i2;
85 fNeighbors[3] = i3;
86 fNeighbors[4] = i4;
87 fNeighbors[5] = i5;
88
89 int i;
90 for (i=0; i<6; i++)
91 if (fNeighbors[i]<0)
92 break;
93
94 fNumNeighbors = i;
95
96 if (fNumNeighbors<5)
97 SetBit(kIsInOutermostRing);
98}
99
100// --------------------------------------------------------------------------
101//
102// Set the kIsOuterRing flag if this pixel has a outermost pixel
103// as Next Neighbor and don't have the kIsOutermostRing flag itself.
104//
105void MGeomPix::CheckOuterRing(const MGeomCam &cam)
106{
107 if (IsInOutermostRing())
108 return;
109
110 for (int i=0; i<fNumNeighbors; i++)
111 if (cam[fNeighbors[i]].IsInOutermostRing())
112 {
113 SetBit(kIsInOuterRing);
114 return;
115 }
116}
117
118// --------------------------------------------------------------------------
119//
120// Print the geometry information of one pixel.
121//
122void MGeomPix::Print(Option_t *opt) const
123{
124 // information about a pixel
125 *fLog << all << "MPixGeom: x= " << fX
126 << " y= " << fY
127 << " d= " << fD
128 << endl ;
129}
130
Note: See TracBrowser for help on using the repository browser.