source: trunk/MagicSoft/Mars/mhft/MGeomCamMagicXT.cc@ 8649

Last change on this file since 8649 was 5691, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 6.0 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): Christoph Kolodziejski, 12/2004 <mailto:>
19! Author(s): Thomas Bretz, 12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2004-2005
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MGeomCamMagicXT
29//
30// This class stores the geometry information of the 'extended' Magic
31// camera. The extended geometry has also small pixels in the outer region.
32// To convert MCerPhotEvt from MGeomCamMagic to MGeomCamMagicXT use
33// MGeomCamMagicExtend.
34//
35////////////////////////////////////////////////////////////////////////////
36#include "MGeomCamMagicXT.h"
37
38#include "MGeomPix.h"
39
40ClassImp(MGeomCamMagicXT);
41
42// --------------------------------------------------------------------------
43//
44// Magic camera has 577 pixels. For geometry and Next Neighbor info see
45// CreateCam and CreateNN
46//
47MGeomCamMagicXT::MGeomCamMagicXT(const char *name)
48 : MGeomCam(1141, 17, name, "Geometry information of Magic Camera")
49{
50 CreateCam();
51 CreateNN();
52 InitGeometry();
53}
54
55// --------------------------------------------------------------------------
56//
57// This fills the geometry information from a table into the pixel objects.
58//
59void MGeomCamMagicXT::CreateCam()
60{
61 //
62 // fill the geometry class with the coordinates of the CT1 camera
63 //
64 //*fLog << inf << " Create CT1 geometry " << endl;
65
66 //
67 // this algorithm is from Martin Kestel originally
68 // it was punt into a root/C++ context by Harald Kornmayer and Thomas Bretz
69
70 const Float_t diameter = 30; // units are mm
71 const Float_t kS32 = sqrt(3)/2;
72
73 //
74 // add the first pixel to the list
75 //
76 Int_t pixnum = 0;
77
78 (*this)[pixnum++].Set(0, 0, diameter);
79
80 for (Int_t ring=1; ring<20; ring++)
81 {
82 //
83 // calc. coords for this ring counting from the
84 // starting number to the ending number
85 //
86 for (int i=0; i<ring; i++)
87 (*this)[pixnum++].Set((ring-i*0.5)*diameter,
88 i*kS32*diameter,
89 diameter);
90
91 for (int i=0; i<ring; i++)
92 (*this)[pixnum++].Set((ring*0.5-i)*diameter,
93 ring*kS32 * diameter,
94 diameter);
95
96 for (int i=0; i<ring; i++)
97 (*this)[pixnum++].Set(-(ring+i)*0.5*diameter,
98 (ring-i)*kS32*diameter,
99 diameter);
100
101 for (int i=0; i<ring; i++)
102 (*this)[pixnum++].Set((0.5*i-ring)*diameter,
103 -i*kS32*diameter,
104 diameter);
105
106 for (int i=0; i<ring; i++)
107 (*this)[pixnum++].Set((i-ring*0.5)*diameter,
108 -ring*kS32 * diameter,
109 diameter);
110
111 for (int i=0; i<ring; i++)
112 (*this)[pixnum++].Set((ring+i)*0.5*diameter,
113 (-ring+i)*kS32*diameter,
114 diameter);
115 }
116}
117
118// --------------------------------------------------------------------------
119//
120// This fills the next neighbor information from a table into the pixel
121// objects.
122//
123void MGeomCamMagicXT::CreateNN()
124{
125 Int_t pos = 0;
126
127 const Short_t nn[7][6] = { // Neighbors of #
128 { 1, 2, 3, 4, 5, 6}, // 0
129 { 0, 2, 6, 7, 8, 18},
130 { 0, 1, 3, 8, 9, 10},
131 { 0, 2, 4, 10, 11, 12},
132 { 0, 3, 5, 12, 13, 14},
133 { 0, 4, 6, 14, 15, 16},
134 { 0, 1, 5, 16, 17, 18}
135 };
136
137 for (Int_t i=0; i<7; i++)
138 (*this)[pos++].SetNeighbors(nn[i][0], nn[i][1], nn[i][2],
139 nn[i][3], nn[i][4], nn[i][5]);
140
141 for (Int_t ring=2; ring<20; ring++)
142 {
143 for (Int_t s=0; s<6; s++)
144 {
145 for (int i=pos; i<ring+pos; i++)
146 {
147 Int_t n[6], idx[6];
148
149 n[0] = i==pos&&s==0 ? i+6*ring : i-1; // vor
150 n[1] = i==ring+pos-1&&s==5 ? i-12*(ring-1)-5 : i+1; // danach
151 n[2] = i==pos ? i+6*ring-1+s : i-6*(ring-1)-s; // ring- groesser
152 n[3] = i==pos ? i-6*(ring-1)-s : i-6*(ring-1)-1-s; // ring- kleiner
153 n[4] = i==pos&&s==0 ? i+12*ring+5 : i+6*ring+s; // ring+ kleiner
154 n[5] = i+6*ring+1+s; // ring+ groesser
155
156 if (n[0]>1140)
157 n[0] = -1;
158 if (n[1]>1140)
159 n[1] = -1;
160 if (n[2]>1140)
161 n[2] = -1;
162 if (n[3]>1140)
163 n[3] = -1;
164 if (n[4]>1140)
165 n[4] = -1;
166 if (n[5]>1140)
167 n[5] = -1;
168
169 TMath::Sort(6, n, idx);
170
171 (*this)[i].SetNeighbors(n[idx[0]],
172 n[idx[1]],
173 n[idx[2]],
174 n[idx[3]],
175 n[idx[4]],
176 n[idx[5]]);
177 }
178
179 pos += ring;
180 }
181 }
182}
Note: See TracBrowser for help on using the repository browser.