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

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