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 | ////////////////////////////////////////////////////////////////////////////
|
---|
34 |
|
---|
35 | #include "MGeomPix.h"
|
---|
36 |
|
---|
37 | #include <math.h>
|
---|
38 |
|
---|
39 | #include "MLog.h"
|
---|
40 | #include "MLogManip.h"
|
---|
41 |
|
---|
42 | #include "MGeomCam.h"
|
---|
43 |
|
---|
44 | ClassImp(MGeomPix);
|
---|
45 |
|
---|
46 | // --------------------------------------------------------------------------
|
---|
47 | //
|
---|
48 | // Initialiyes one pixel
|
---|
49 | //
|
---|
50 | MGeomPix::MGeomPix(Float_t x, Float_t y, Float_t r) : fX(x), fY(y), fR(r)
|
---|
51 | {
|
---|
52 | // default constructor
|
---|
53 | }
|
---|
54 |
|
---|
55 | // --------------------------------------------------------------------------
|
---|
56 | //
|
---|
57 | // Return the area of the pixel. A hegagonal shape is assumed.
|
---|
58 | //
|
---|
59 | Float_t MGeomPix::GetA() const
|
---|
60 | {
|
---|
61 | return fR*fR*tan(60/kRad2Deg);
|
---|
62 | }
|
---|
63 |
|
---|
64 | // --------------------------------------------------------------------------
|
---|
65 | //
|
---|
66 | // Initialiyes Next Neighbors.
|
---|
67 | //
|
---|
68 | // WARNING: This function is public, but it is not ment for user access.
|
---|
69 | // It should only be used from geometry classes (like MGeomCam)
|
---|
70 | //
|
---|
71 | void MGeomPix::SetNeighbors(Short_t i0, Short_t i1, Short_t i2,
|
---|
72 | Short_t i3, Short_t i4, Short_t i5)
|
---|
73 | {
|
---|
74 | fNeighbors[0] = i0;
|
---|
75 | fNeighbors[1] = i1;
|
---|
76 | fNeighbors[2] = i2;
|
---|
77 | fNeighbors[3] = i3;
|
---|
78 | fNeighbors[4] = i4;
|
---|
79 | fNeighbors[5] = i5;
|
---|
80 |
|
---|
81 | int i;
|
---|
82 | for (i=0; i<6; i++)
|
---|
83 | if (fNeighbors[i]<0)
|
---|
84 | break;
|
---|
85 |
|
---|
86 | fNumNeighbors = i;
|
---|
87 |
|
---|
88 | if (fNumNeighbors<5)
|
---|
89 | SetBit(kIsInOutermostRing);
|
---|
90 | }
|
---|
91 |
|
---|
92 | // --------------------------------------------------------------------------
|
---|
93 | //
|
---|
94 | // Set the kIsOuterRing flag if this pixel has a outermost pixel
|
---|
95 | // as Next Neighbor and don't have the kIsOutermostRing flag itself.
|
---|
96 | //
|
---|
97 | void MGeomPix::CheckOuterRing(const MGeomCam &cam)
|
---|
98 | {
|
---|
99 | if (IsInOutermostRing())
|
---|
100 | return;
|
---|
101 |
|
---|
102 | for (int i=0; i<fNumNeighbors; i++)
|
---|
103 | if (cam[fNeighbors[i]].IsInOutermostRing())
|
---|
104 | {
|
---|
105 | SetBit(kIsInOuterRing);
|
---|
106 | return;
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | // --------------------------------------------------------------------------
|
---|
111 | //
|
---|
112 | // Print the geometry information of one pixel.
|
---|
113 | //
|
---|
114 | void MGeomPix::Print(Option_t *opt) const
|
---|
115 | {
|
---|
116 | // information about a pixel
|
---|
117 | *fLog << all << "MPixGeom: x= " << fX
|
---|
118 | << " y= " << fY
|
---|
119 | << " r= " << fR
|
---|
120 | << endl ;
|
---|
121 | }
|
---|
122 |
|
---|