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

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