source: trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc@ 715

Last change on this file since 715 was 715, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 7.3 KB
Line 
1#include "MGeomCamCT1.h"
2
3
4#include <math.h> // floor
5#include "TCanvas.h"
6
7#include "MLog.h"
8
9ClassImp(MGeomCamCT1)
10
11MGeomCamCT1::MGeomCamCT1(const char *name) : MGeomCam(127, name, "Geometry information of CT1 camera")
12{
13 CreateCam();
14 CreateNN();
15}
16
17void MGeomCamCT1::Draw( Option_t * )
18{
19 TCanvas *can = new TCanvas("can", "Camera Geometry", 4 ) ;
20
21 can->Range(-175, -175, 175, 175 ) ;
22
23 MGeomCam::Draw();
24}
25
26
27void MGeomCamCT1::CreateNN()
28{
29 const Short_t nn[127][6] = { // Neighbors of #
30 { 1, 2, 3, 4, 5, 6}, // 0
31 { 0, 2, 6, 7, 8, 18},
32 { 0, 1, 3, 8, 9, 10},
33 { 0, 2, 4, 10, 11, 12},
34 { 0, 3, 5, 12, 13, 14},
35 { 0, 4, 6, 14, 15, 16},
36 { 0, 1, 5, 16, 17, 18},
37 { 1, 8, 18, 19, 20, 36},
38 { 1, 2, 7, 9, 20, 21},
39 { 2, 8, 10, 21, 22, 23}, // 10
40 { 2, 3, 9, 11, 23, 24},
41 { 3, 10, 12, 24, 25, 26},
42 { 3, 4, 11, 13, 26, 27},
43 { 4, 12, 14, 27, 28, 29},
44 { 4, 5, 13, 15, 29, 30},
45 { 5, 14, 16, 30, 31, 32},
46 { 5, 6, 15, 17, 32, 33},
47 { 6, 16, 18, 33, 34, 35},
48 { 1, 6, 7, 17, 35, 36},
49 { 7, 20, 36, 37, 38, 60}, // 20
50 { 7, 8, 19, 21, 38, 39},
51 { 8, 9, 20, 22, 39, 40},
52 { 9, 21, 23, 40, 41, 42},
53 { 9, 10, 22, 24, 42, 43},
54 { 10, 11, 23, 25, 43, 44},
55 { 11, 24, 26, 44, 45, 46},
56 { 11, 12, 25, 27, 46, 47},
57 { 12, 13, 26, 28, 47, 48},
58 { 13, 27, 29, 48, 49, 50},
59 { 13, 14, 28, 30, 50, 51}, // 30
60 { 14, 15, 29, 31, 51, 52},
61 { 15, 30, 32, 52, 53, 54},
62 { 15, 16, 31, 33, 54, 55},
63 { 16, 17, 32, 34, 55, 56},
64 { 17, 33, 35, 56, 57, 58},
65 { 17, 18, 34, 36, 58, 59},
66 { 7, 18, 19, 35, 59, 60},
67 { 19, 38, 60, 61, 62, 90},
68 { 19, 20, 37, 39, 62, 63},
69 { 20, 21, 38, 40, 63, 64}, // 40
70 { 21, 22, 39, 41, 64, 65},
71 { 22, 40, 42, 65, 66, 67},
72 { 22, 23, 41, 43, 67, 68},
73 { 23, 24, 42, 44, 68, 69},
74 { 24, 25, 43, 45, 69, 70},
75 { 25, 44, 46, 70, 71, 72},
76 { 25, 26, 45, 47, 72, 73},
77 { 26, 27, 46, 48, 73, 74},
78 { 27, 28, 47, 49, 74, 75},
79 { 28, 48, 50, 75, 76, 77}, // 50
80 { 28, 29, 49, 51, 77, 78},
81 { 29, 30, 50, 52, 78, 79},
82 { 30, 31, 51, 53, 79, 80},
83 { 31, 52, 54, 80, 81, 82},
84 { 31, 32, 53, 55, 82, 83},
85 { 32, 33, 54, 56, 83, 84},
86 { 33, 34, 55, 57, 84, 85},
87 { 34, 56, 58, 85, 86, 87},
88 { 34, 35, 57, 59, 87, 88},
89 { 35, 36, 58, 60, 88, 89}, // 60
90 { 19, 36, 37, 59, 89, 90},
91 { 37, 62, 90, 91, 92, 126},
92 { 37, 38, 61, 63, 92, 93},
93 { 38, 39, 62, 64, 93, 94},
94 { 39, 40, 63, 65, 94, 95},
95 { 40, 41, 64, 66, 95, 96},
96 { 41, 65, 67, 96, 97, 98},
97 { 41, 42, 66, 68, 98, 99},
98 { 42, 43, 67, 69, 99, 100},
99 { 43, 44, 68, 70, 100, 101}, // 70
100 { 44, 45, 69, 71, 101, 102},
101 { 45, 70, 72, 102, 103, 104},
102 { 45, 46, 71, 73, 104, 105},
103 { 46, 47, 72, 74, 105, 106},
104 { 47, 48, 73, 75, 106, 107},
105 { 48, 49, 74, 76, 107, 108},
106 { 49, 75, 77, 108, 109, 110},
107 { 49, 50, 76, 78, 110, 111},
108 { 50, 51, 77, 79, 111, 112},
109 { 51, 52, 78, 80, 112, 113}, // 80
110 { 52, 53, 79, 81, 113, 114},
111 { 53, 80, 82, 114, 115, 116},
112 { 53, 54, 81, 83, 116, 117},
113 { 54, 55, 82, 84, 117, 118},
114 { 55, 56, 83, 85, 118, 119},
115 { 56, 57, 84, 86, 119, 120},
116 { 57, 85, 87, 120, 121, 122},
117 { 57, 58, 86, 88, 122, 123},
118 { 58, 59, 87, 89, 123, 124},
119 { 59, 60, 88, 90, 124, 125}, // 90
120 { 37, 60, 61, 89, 125, 126},
121 { 61, 92, 126, 127, -1, -1},
122 { 61, 62, 91, 93, -1, -1},
123 { 62, 63, 92, 94, -1, -1},
124 { 63, 64, 93, 95, -1, -1},
125 { 64, 65, 94, 96, -1, -1},
126 { 65, 66, 95, 97, -1, -1},
127 { 66, 96, 98, -1, -1, -1},
128 { 66, 67, 97, 99, -1, -1},
129 { 67, 68, 98, 100, -1, -1}, // 100
130 { 68, 69, 99, 101, -1, -1},
131 { 69, 70, 100, 102, -1, -1},
132 { 70, 71, 101, 103, -1, -1},
133 { 71, 102, 104, -1, -1, -1},
134 { 71, 72, 103, 105, -1, -1},
135 { 72, 73, 104, 106, -1, -1},
136 { 73, 74, 105, 107, -1, -1},
137 { 74, 75, 106, 108, -1, -1},
138 { 75, 76, 107, 109, -1, -1},
139 { 76, 108, 110, -1, -1, -1}, // 110
140 { 76, 77, 109, 111, -1, -1},
141 { 77, 78, 110, 112, -1, -1},
142 { 78, 79, 111, 113, -1, -1},
143 { 79, 80, 112, 114, -1, -1},
144 { 80, 81, 113, 115, -1, -1},
145 { 81, 114, 116, -1, -1, -1},
146 { 81, 82, 115, 117, -1, -1},
147 { 82, 83, 116, 118, -1, -1},
148 { 83, 84, 117, 119, -1, -1},
149 { 84, 85, 118, 120, -1, -1}, // 120
150 { 85, 86, 119, 121, -1, -1},
151 { 86, 120, 122, -1, -1, -1},
152 { 86, 87, 121, 123, -1, -1},
153 { 87, 88, 122, 124, -1, -1},
154 { 88, 89, 123, 125, -1, -1},
155 { 89, 90, 124, 126, -1, -1} // 126
156 } ;
157
158 for (Int_t i=0; i<127; i++)
159 (*this)[i].SetNeighbors(nn[i][0], nn[i][1], nn[i][2],
160 nn[i][3], nn[i][4], nn[i][5]);
161}
162
163void MGeomCamCT1::CreateCam()
164{
165 //
166 // fill the geometry class with the coordinates of the CT1 camera
167 //
168 *fLog << " Create CT1 geometry " << endl;
169
170 //
171 // this algorithm is from Martin Kestel originally
172 // it was punt into a root/C++ context by Harald Kornmayer and Thomas Bretz
173
174 const Float_t diameter = 21 ; // units are mm
175 const Float_t kS32 = sqrt(3)/2;
176
177 //
178 // add the first pixel to the list
179 //
180 Int_t pixnum = 0;
181
182 (*this)[pixnum++].Set(0, 0, diameter);
183
184 for (Int_t ring=1; ring<7; ring++)
185 {
186 //
187 // calc. coords for this ring counting from the
188 // starting number to the ending number
189 //
190 for (int i=0; i<ring; i++)
191 (*this)[pixnum++].Set((-ring+i*0.5)*diameter,
192 i*kS32*diameter,
193 diameter);
194
195 for (int i=0; i<ring; i++)
196 (*this)[pixnum++].Set((-ring*0.5+i)*diameter,
197 ring*kS32 * diameter,
198 diameter);
199
200 for (int i=0; i<ring; i++)
201 (*this)[pixnum++].Set((ring+i)*0.5*diameter,
202 (ring-i)*kS32*diameter,
203 diameter);
204
205 for (int i=0; i<ring; i++)
206 (*this)[pixnum++].Set((ring-0.5*i)*diameter,
207 -i*kS32*diameter,
208 diameter);
209
210 for (int i=0; i<ring; i++)
211 (*this)[pixnum++].Set((ring*0.5-i)*diameter,
212 -ring*kS32 * diameter,
213 diameter);
214
215 for (int i=0; i<ring; i++)
216 (*this)[pixnum++].Set((-ring-i)*0.5*diameter,
217 (-ring+i)*kS32*diameter,
218 diameter);
219 }
220}
221
Note: See TracBrowser for help on using the repository browser.