21 TGeoManager *geom =
new TGeoManager(
"geom",
"My first 3D geometry");
24 TGeoMaterial *vacuum =
new TGeoMaterial(
"vacuum",0,0,0);
25 TGeoMaterial *Fe =
new TGeoMaterial(
"Fe",55.845,26,7.87);
28 TGeoMedium *Air =
new TGeoMedium(
"Vacuum",0,vacuum);
29 TGeoMedium *Iron =
new TGeoMedium(
"Iron",1,Fe);
32 TGeoVolume *top = geom->MakeBox(
"top",Air,300,300,300);
33 geom->SetTopVolume(top);
34 geom->SetTopVisible(0);
41 int di[2]; di[0] = 0; di[1] = 30;
45 for(
int i=0;i<20;i++){
46 sprintf(nBlocks,
"f%d_bg%d",f,N++);
47 mBlock = geom->MakeBox(nBlocks, Iron, 0.6,1.8,63);
48 mBlock->SetLineColor(20);
49 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-10.6-(2.6*i),-17.8+(6*k),0));
51 sprintf(nBlocks,
"f%d_bg%d",f,N++);
52 mBlock = geom->MakeBox(nBlocks, Iron, 0.7,1.8,58);
53 mBlock->SetLineColor(12);
54 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-11.9-(2.6*i),-17.8+(6*k),0));
56 sprintf(nBlocks,
"f%d_bg%d",f,N++);
57 mBlock = geom->MakeBox(nBlocks, Iron, 26,1.2,63);
58 mBlock->SetLineColor(20);
59 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-36,-14.8+(6*k),0));
61 sprintf(nBlocks,
"f%d_bg%d",f,N++);
62 mBlock = geom->MakeBox(nBlocks, Iron, 26,2,63);
63 mBlock->SetLineColor(20);
64 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-36,-21.6,0));
67 for(
int i=0;i<20;i++){
68 sprintf(nBlocks,
"f%d_bg%d",f,N++);
69 mBlock = geom->MakeBox(nBlocks, Iron, 0.6,1.8,63);
70 mBlock->SetLineColor(20);
71 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-10.6-(2.6*i),-17.8+(6*k),0));
72 sprintf(nBlocks,
"f%d_bg%d",f,N++);
73 mBlock = geom->MakeBox(nBlocks, Iron, 0.7,1.8,58);
74 mBlock->SetLineColor(12);
75 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-11.9-(2.6*i),-17.8+(6*k),0));
78 sprintf(nBlocks,
"f%d_bg%d",f,N++);
79 mBlock = geom->MakeBox(nBlocks, Iron, 26,1.2,63);
80 mBlock->SetLineColor(20);
81 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-36,-14.8+(6*k),0));
84 sprintf(nBlocks,
"f%d_bg%d",f,N++);
85 mBlock = geom->MakeBox(nBlocks, Iron, 10,22,58);
86 mBlock->SetLineColor(2);
87 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,0,0));
89 sprintf(nBlocks,
"f%d_bg%d",f,N++);
90 mBlock = geom->MakeBox(nBlocks, Iron, 3.5,8,0.1);
91 mBlock->SetLineColor(13);
92 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(4,-14,60));
94 sprintf(nBlocks,
"f%d_bg%d",f,N++);
95 mBlock = geom->MakeBox(nBlocks, Iron, 3.5,8,0.1);
96 mBlock->SetLineColor(13);
97 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-4,-14,60));
99 sprintf(nBlocks,
"f%d_bg%d",f,N++);
100 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
101 mBlock->SetLineColor(1);
102 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,20,60));
104 sprintf(nBlocks,
"f%d_bg%d",f,N++);
105 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
106 mBlock->SetLineColor(1);
107 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,17,60));
109 sprintf(nBlocks,
"f%d_bg%d",f,N++);
110 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
111 mBlock->SetLineColor(1);
112 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,14,60));
114 sprintf(nBlocks,
"f%d_bg%d",f,N++);
115 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
116 mBlock->SetLineColor(1);
117 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,11,60));
119 sprintf(nBlocks,
"f%d_bg%d",f,N++);
120 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
121 mBlock->SetLineColor(1);
122 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,8,60));
124 sprintf(nBlocks,
"f%d_bg%d",f,N++);
125 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
126 mBlock->SetLineColor(1);
127 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,5,60));
129 sprintf(nBlocks,
"f%d_bg%d",f,N++);
130 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.2,0.1);
131 mBlock->SetLineColor(1);
132 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,2,60));
134 for(
int k=0;k<7;k++){
135 for(
int i=0;i<20;i++){
136 sprintf(nBlocks,
"f%d_bg%d",f,N++);
137 mBlock = geom->MakeBox(nBlocks, Iron, 0.6,1.8,63);
138 mBlock->SetLineColor(20);
139 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(10.6+(2.6*i),-17.8+(6*k),0));
140 sprintf(nBlocks,
"f%d_bg%d",f,N++);
141 mBlock = geom->MakeBox(nBlocks, Iron, 0.7,1.8,58);
142 mBlock->SetLineColor(12);
143 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(11.9+(2.6*i),-17.8+(6*k),0));
146 sprintf(nBlocks,
"f%d_bg%d",f,N++);
147 mBlock = geom->MakeBox(nBlocks, Iron, 26,1.2,63);
148 mBlock->SetLineColor(20);
149 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(36,-14.8+(6*k),0));
151 sprintf(nBlocks,
"f%d_bg%d",f,N++);
152 mBlock = geom->MakeBox(nBlocks, Iron, 26,2,63);
153 mBlock->SetLineColor(20);
154 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(36,-21.6,0));
157 sprintf(nBlocks,
"f%d_bg%d",f,N++);
158 mBlock = geom->MakeBox(nBlocks, Iron, 82,2,82);
159 mBlock->SetLineColor(18);
160 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,24,0));
162 sprintf(nBlocks,
"f%d_bg%d",f,N++);
163 mBlock = geom->MakeBox(nBlocks, Iron, 85,0.5,85);
164 mBlock->SetLineColor(18);
165 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,26,0));
167 sprintf(nBlocks,
"f%d_bg%d",f,N++);
168 mBlock = geom->MakeBox(nBlocks, Iron, 88,2,88);
169 mBlock->SetLineColor(18);
170 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-24,0));
173 sprintf(nBlocks,
"f%d_bg%d",f,N++);
174 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 30, 0, 180, 0, 180);
175 mBlock->SetLineColor(32);
176 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,24,0));
178 sprintf(nBlocks,
"ab%d",N++);
179 mBlock = geom->MakeBox(nBlocks,Iron, 0.1,30,0.1);
180 mBlock->SetLineColor(10);
181 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,40,0));
183 sprintf(nBlocks,
"ab%d",N++);
184 mBlock = geom->MakeTubs(nBlocks,Iron, 0,30,4,360,360);
185 mBlock->SetLineColor(10);
186 top->AddNodeOverlap(mBlock,1,
new TGeoCombiTrans(0,27,0,
new TGeoRotation(
"r1",0,90,0)));
188 for(
int i=0;i<8;i++){
189 sprintf(nBlocks,
"ab%d",N++);
190 mBlock = geom->MakeBox(nBlocks,Iron, 2,22,2);
191 mBlock->SetLineColor(18);
192 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-70+(20*i),0,80));
195 for(
int i=0;i<8;i++){
196 sprintf(nBlocks,
"ab%d",N++);
197 mBlock = geom->MakeBox(nBlocks,Iron, 2,22,2);
198 mBlock->SetLineColor(18);
199 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-70+(20*i),0,-80));
202 for(
int i=0;i<7;i++){
203 sprintf(nBlocks,
"ab%d",N++);
204 mBlock = geom->MakeBox(nBlocks,Iron, 2,22,2);
205 mBlock->SetLineColor(18);
206 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-70,0,-80+(23*i)));
209 for(
int i=0;i<7;i++){
210 sprintf(nBlocks,
"ab%d",N++);
211 mBlock = geom->MakeBox(nBlocks,Iron, 2,22,2);
212 mBlock->SetLineColor(18);
213 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(70,0,-80+(23*i)));
216 sprintf(nBlocks,
"f%d_bg%d",f,N++);
217 mBlock = geom->MakeBox(nBlocks, Iron, 100,0.5,160);
218 mBlock->SetLineColor(41);
219 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-26,40));
221 sprintf(nBlocks,
"f%d_bg%d",f,N++);
222 mBlock = geom->MakeBox(nBlocks, Iron, 10,0.01,160);
223 mBlock->SetLineColor(19);
224 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-25,40));
226 sprintf(nBlocks,
"f%d_bg%d",f,N++);
227 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
228 mBlock->SetLineColor(8);
229 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-22,170));
231 sprintf(nBlocks,
"f%d_bg%d",f,N++);
232 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
233 mBlock->SetLineColor(8);
234 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-25,170));
236 sprintf(nBlocks,
"f%d_bg%d",f,N++);
237 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
238 mBlock->SetLineColor(8);
239 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-22,150));
241 sprintf(nBlocks,
"f%d_bg%d",f,N++);
242 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
243 mBlock->SetLineColor(8);
244 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-25,150));
246 sprintf(nBlocks,
"f%d_bg%d",f,N++);
247 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
248 mBlock->SetLineColor(8);
249 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-22,130));
251 sprintf(nBlocks,
"f%d_bg%d",f,N++);
252 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
253 mBlock->SetLineColor(8);
254 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-25,130));
256 sprintf(nBlocks,
"f%d_bg%d",f,N++);
257 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
258 mBlock->SetLineColor(8);
259 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-22,110));
261 sprintf(nBlocks,
"f%d_bg%d",f,N++);
262 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
263 mBlock->SetLineColor(8);
264 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(15,-25,110));
266 sprintf(nBlocks,
"f%d_bg%d",f,N++);
267 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
268 mBlock->SetLineColor(8);
269 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-22,170));
271 sprintf(nBlocks,
"f%d_bg%d",f,N++);
272 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
273 mBlock->SetLineColor(8);
274 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-25,170));
276 sprintf(nBlocks,
"f%d_bg%d",f,N++);
277 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
278 mBlock->SetLineColor(8);
279 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-22,150));
281 sprintf(nBlocks,
"f%d_bg%d",f,N++);
282 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
283 mBlock->SetLineColor(8);
284 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-25,150));
286 sprintf(nBlocks,
"f%d_bg%d",f,N++);
287 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
288 mBlock->SetLineColor(8);
289 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-22,130));
291 sprintf(nBlocks,
"f%d_bg%d",f,N++);
292 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
293 mBlock->SetLineColor(8);
294 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-25,130));
296 sprintf(nBlocks,
"f%d_bg%d",f,N++);
297 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
298 mBlock->SetLineColor(8);
299 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-22,110));
301 sprintf(nBlocks,
"f%d_bg%d",f,N++);
302 mBlock = geom->MakeSphere(nBlocks, Iron, 0, 5, 0, 180, 0, 180);
303 mBlock->SetLineColor(8);
304 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-25,110));
306 sprintf(nBlocks,
"ab%d",N++);
307 mBlock = geom->MakeBox(nBlocks,Iron, 0.1,10,0.1);
308 mBlock->SetLineColor(12);
309 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(20,-15,110));
311 sprintf(nBlocks,
"ab%d",N++);
312 mBlock = geom->MakeBox(nBlocks,Iron, 5,3,0.1);
313 mBlock->SetLineColor(10);
314 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(25,-8,110));
316 sprintf(nBlocks,
"ab%d",N++);
317 mBlock = geom->MakeBox(nBlocks,Iron, 0.1,10,0.1);
318 mBlock->SetLineColor(12);
319 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-20,-15,110));
321 sprintf(nBlocks,
"ab%d",N++);
322 mBlock = geom->MakeBox(nBlocks,Iron, 5,3,0.1);
323 mBlock->SetLineColor(10);
324 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(-15,-8,110));
326 sprintf(nBlocks,
"f%d_bg%d",f,N++);
327 mBlock = geom->MakeBox(nBlocks, Iron, 7,1.5,5);
328 mBlock->SetLineColor(18);
329 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-24,88));
331 sprintf(nBlocks,
"f%d_bg%d",f,N++);
332 mBlock = geom->MakeBox(nBlocks, Iron, 7,1,5);
333 mBlock->SetLineColor(18);
334 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-24,92));
336 sprintf(nBlocks,
"f%d_bg%d",f,N++);
337 mBlock = geom->MakeBox(nBlocks, Iron, 7,0.5,5);
338 mBlock->SetLineColor(18);
339 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-24,96));
341 sprintf(nBlocks,
"f%d_bg%d",f,N++);
342 mBlock = geom->MakeBox(nBlocks, Iron, 7,0.1,5);
343 mBlock->SetLineColor(18);
344 top->AddNodeOverlap(mBlock,1,
new TGeoTranslation(0,-24,100));
346 geom->CloseGeometry();
347 top->SetVisibility(0);