Logo ROOT   6.16/01
Reference Guide
lego.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_geom
3/// Drawing a figure, made of lego block, using ROOT geometry class.
4///
5/// Reviewed by Sunman Kim (sunman98@hanmail.net)
6/// Supervisor: Prof. Inkyu Park (icpark@physics.uos.ac.kr)
7///
8/// How to run: `.x lego.C` in ROOT terminal, then use OpenGL
9///
10/// This macro was created for the evaluation of Computational Physics course in 2006.
11/// We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team
12///
13/// \macro_code
14///
15/// \author Soon Gi Kwon(1116won@hanmail.net), Dept. of Physics, Univ. of Seoul
16
17#include "TSystem.h"
18#include "TGeoManager.h"
19
20void lego()
21{
22 TGeoManager *geom = new TGeoManager("geom","My first 3D geometry");
23
24
25 TGeoMaterial *vacuum=new TGeoMaterial("vacuum",0,0,0);
26 TGeoMaterial *Fe=new TGeoMaterial("Fe",55.845,26,7.87);
27
28
29
30 TGeoMedium *Air=new TGeoMedium("Vacuum",0,vacuum);
31 TGeoMedium *Iron=new TGeoMedium("Iron",1,Fe);
32
33
34 // create volume
35 TGeoVolume *top=geom->MakeBox("top",Air,100,100,100);
36 geom->SetTopVolume(top);
37 geom->SetTopVisible(0);
38 // If you want to see the boundary, please input the number, 1 instead of 0.
39 // Like this, geom->SetTopVisible(1);
40
41//----------------------------------------------------------------------
42
43 TGeoVolume *ha1=geom->MakeSphere("ha1",Iron,0,10,80,90,0,360);
44 ha1->SetLineColor(41);
45 top->AddNodeOverlap(ha1,1,new TGeoCombiTrans(0,0,4,new TGeoRotation("ha1",0,0,0)));
46
47 TGeoVolume *ha2=geom->MakeSphere("ha2",Iron,0,7,90,180,0,360);
48 ha2->SetLineColor(41);
49 top->AddNodeOverlap(ha2,1,new TGeoCombiTrans(0,0,4,new TGeoRotation("ha2",0,180,0)));
50
51 TGeoVolume *ha3=geom->MakeSphere("ha3",Iron,0,7.3,80,90,0,360);
52 ha3->SetLineColor(2);
53 top->AddNodeOverlap(ha3,1,new TGeoCombiTrans(0,0,4.8,new TGeoRotation("ha3",0,0,0)));
54
55
56 TGeoVolume *h1=geom->MakeTubs("h1",Iron,0,6,4.5,0,0);
57 h1->SetLineColor(5);
58 top->AddNodeOverlap(h1,1,new TGeoCombiTrans(0,0,0,new TGeoRotation("h1",0,0,0)));
59
60 TGeoVolume *h2=geom->MakeSphere("h2",Iron,0,7.5,0,52.5,0,360);
61 h2->SetLineColor(5);
62 top->AddNodeOverlap(h2,1,new TGeoCombiTrans(0,0,0,new TGeoRotation("h2",0,0,0)));
63
64 TGeoVolume *h3=geom->MakeSphere("h3",Iron,0,7.5,0,52.5,0,360);
65 h3->SetLineColor(5);
66 top->AddNodeOverlap(h3,1,new TGeoCombiTrans(0,0,0,new TGeoRotation("h3",180,180,0)));
67
68 TGeoVolume *h4=geom->MakeTubs("h4",Iron,2.5,3.5,1.5,0,0);
69 h4->SetLineColor(5);
70 top->AddNodeOverlap(h4,1,new TGeoCombiTrans(0,0,7.5,new TGeoRotation("h4",0,0,0)));
71
72
73
74 TGeoVolume *t1_1=geom->MakeTubs("t1_1",Iron,0,0.8,1,0,360);
75 t1_1->SetLineColor(12);
76 top->AddNodeOverlap(t1_1,1,new TGeoCombiTrans(-5,2,1.5,new TGeoRotation("t1_1",-90,90,0)));
77
78 TGeoVolume *t2_1=geom->MakeTubs("t2_1",Iron,0,0.8,1,0,360);
79 t2_1->SetLineColor(12);
80 top->AddNodeOverlap(t2_1,1,new TGeoCombiTrans(-5,-2,1.5,new TGeoRotation("t2_1",-90,90,0)));
81
82 TGeoVolume *fb1=geom->MakeTubs("fb1",Iron,2,2.3,1,100,260);
83 fb1->SetLineColor(12);
84 top->AddNodeOverlap(fb1,1,new TGeoCombiTrans(-5,0,-1,new TGeoRotation("fb1",90,90,90)));
85
86
87
88 TGeoVolume *m1=geom->MakeBox("m1",Iron,7,8,4);
89 m1->SetLineColor(2);
90 top->AddNodeOverlap(m1,1,new TGeoCombiTrans(0,0,-17,new TGeoRotation("m1",90,90,0)));
91
92 TGeoVolume *m2=geom->MakeTubs("m2",Iron,0,1,7,90,180);
93 m2->SetLineColor(2);
94 top->AddNodeOverlap(m2,1,new TGeoCombiTrans(-3,0,-9,new TGeoRotation("m2",0,90,0)));
95
96 TGeoVolume *m3=geom->MakeTubs("m3",Iron,0,1,7,0,90);
97 m3->SetLineColor(2);
98 top->AddNodeOverlap(m3,1,new TGeoCombiTrans(3,0,-9,new TGeoRotation("m3",0,90,0)));
99
100 TGeoVolume *m4=geom->MakeBox("m4",Iron,3,7,0.5);
101 m4->SetLineColor(2);
102 top->AddNodeOverlap(m4,1,new TGeoCombiTrans(0,0,-8.5,new TGeoRotation("m4",90,0,90)));
103
104 TGeoVolume *m5=geom->MakeTubs("m5",Iron,0,1.5,1.2,0,0);
105 m5->SetLineColor(5);
106 top->AddNodeOverlap(m5,1,new TGeoCombiTrans(0,0,-7.8,new TGeoRotation("m5",0,0,0)));
107
108 TGeoVolume *m6=geom->MakeTrd2("m6",Iron,4,4,0,2,8);
109 m6->SetLineColor(2);
110 top->AddNodeOverlap(m6,1,new TGeoCombiTrans(0,-7,-17,new TGeoRotation("m6",0,180,0)));
111
112 TGeoVolume *m7=geom->MakeTrd2("m7",Iron,4,4,0,2,8);
113 m7->SetLineColor(2);
114 top->AddNodeOverlap(m7,1,new TGeoCombiTrans(0,7,-17,new TGeoRotation("m7",0,180,0)));
115
116
117 TGeoVolume *md1=geom->MakeBox("md1",Iron,4,8.5,0.7);
118 md1->SetLineColor(37);
119 top->AddNodeOverlap(md1,1,new TGeoCombiTrans(0,0,-25.5,new TGeoRotation("md1",0,0,0)));
120
121 TGeoVolume *md2=geom->MakeBox("md2",Iron,3,0.4,2);
122 md2->SetLineColor(37);
123 top->AddNodeOverlap(md2,1,new TGeoCombiTrans(0,0,-28,new TGeoRotation("md2",0,0,0)));
124
125 TGeoVolume *d1=geom->MakeTrd2("d1",Iron,3,4,4,4,7);
126 d1->SetLineColor(37);
127 top->AddNodeOverlap(d1,1,new TGeoCombiTrans(-4.8,4.5,-35,new TGeoRotation("d1",90,45,-90)));
128
129 TGeoVolume *d2=geom->MakeTrd2("d2",Iron,3,4,4,4,7);
130 d2->SetLineColor(37);
131 top->AddNodeOverlap(d2,1,new TGeoCombiTrans(0,-4.5,-37,new TGeoRotation("d2",0,0,0)));
132
133 TGeoVolume *d3=geom->MakeTubs("d3",Iron,0,4,3.98,0,180);
134 d3->SetLineColor(37);
135 top->AddNodeOverlap(d3,1,new TGeoCombiTrans(0,4.5,-30.2,new TGeoRotation("d3",0,90,-45)));
136
137 TGeoVolume *d4=geom->MakeTubs("d4",Iron,0,4,3.98,0,180);
138 d4->SetLineColor(37);
139 top->AddNodeOverlap(d4,1,new TGeoCombiTrans(0,-4.5,-30,new TGeoRotation("d4",0,90,0)));
140
141 TGeoVolume *d5=geom->MakeBox("d5",Iron,4,4,1);
142 d5->SetLineColor(37);
143 top->AddNodeOverlap(d5,1,new TGeoCombiTrans(-10.2,4.5,-39,new TGeoRotation("d5",90,45,-90)));
144
145 TGeoVolume *d6=geom->MakeBox("d6",Iron,4,4,1);
146 d6->SetLineColor(37);
147 top->AddNodeOverlap(d6,1,new TGeoCombiTrans(-1,-4.5,-43.4,new TGeoRotation("d6",0,0,0)));
148
149
150
151 TGeoVolume *a1=geom->MakeTubs("a1",Iron,0,1.5,4,0,0);
152 a1->SetLineColor(1);
153 top->AddNodeOverlap(a1,1,new TGeoCombiTrans(0,10,-15.1,new TGeoRotation("a1",0,20,45)));
154
155 TGeoVolume *a2=geom->MakeSphere("a2",Iron,0,1.48,0,180,0,200);
156 a2->SetLineColor(1);
157 top->AddNodeOverlap(a2,1,new TGeoCombiTrans(0,8.6,-11.5,new TGeoRotation("a2",120,80,20)));
158
159 TGeoVolume *a3=geom->MakeTubs("a3",Iron,0,1.5,2.2,0,0);
160 a3->SetLineColor(1);
161 top->AddNodeOverlap(a3,1,new TGeoCombiTrans(0,11.3,-20.6,new TGeoRotation("a3",300,0,40)));
162
163 TGeoVolume *a4=geom->MakeTubs("a4",Iron,0,1,1,0,0);
164 a4->SetLineColor(5);
165 top->AddNodeOverlap(a4,1,new TGeoCombiTrans(0,11.3,-23.8,new TGeoRotation("a4",75,0,30)));
166
167 TGeoVolume *a5=geom->MakeTubs("a5",Iron,1.5,2.5,2,0,270);
168 a5->SetLineColor(5);
169 top->AddNodeOverlap(a5,1,new TGeoCombiTrans(0,11.3,-26.5,new TGeoRotation("a5",-90,90,00)));
170
171
172
173
174 TGeoVolume *a1_1=geom->MakeTubs("a1_1",Iron,0,1.5,4,0,0);
175 a1_1->SetLineColor(1);
176 top->AddNodeOverlap(a1_1,1,new TGeoCombiTrans(0,-10,-15.1,new TGeoRotation("a1_1",0,-20,-45)));
177
178 TGeoVolume *a2_1=geom->MakeSphere("a2_1",Iron,0,1.48,0,180,0,200);
179 a2_1->SetLineColor(1);
180 top->AddNodeOverlap(a2_1,1,new TGeoCombiTrans(0,-8.6,-11.5,new TGeoRotation("a2_1",120,80,-20)));
181
182 TGeoVolume *a3_1=geom->MakeTubs("a3_1",Iron,0,1.5,2.2,0,0);
183 a3_1->SetLineColor(1);
184 top->AddNodeOverlap(a3_1,1,new TGeoCombiTrans(0,-11.3,-20.6,new TGeoRotation("a3_1",-300,0,-40)));
185
186 TGeoVolume *a4_1=geom->MakeTubs("a4_1",Iron,0,1,1,0,0);
187 a4_1->SetLineColor(5);
188 top->AddNodeOverlap(a4_1,1,new TGeoCombiTrans(0,-11.3,-23.8,new TGeoRotation("a4_1",-75,0,-30)));
189
190 a5=geom->MakeTubs("a5_1",Iron,1.5,2.5,2,0,270);
191 a5->SetLineColor(5);
192 top->AddNodeOverlap(a5,1,new TGeoCombiTrans(0,-11.3,-26.5,new TGeoRotation("a5",90,90,00)));
193
194
195 //**********************************NO,2******************
196
197
198 TGeoVolume *ha_1=geom->MakeSphere("ha_1",Iron,0,10,80,90,0,360);
199 ha_1->SetLineColor(6);
200 top->AddNodeOverlap(ha_1,1,new TGeoCombiTrans(0,36,4,new TGeoRotation("ha_1",0,0,0)));
201
202 TGeoVolume *ha_2=geom->MakeTubs("ha_2",Iron,0,6,5,0,0);
203 ha_2->SetLineColor(6);
204 top->AddNodeOverlap(ha_2,1,new TGeoCombiTrans(0,36,10,new TGeoRotation("ha_2",0,180,0)));
205
206 TGeoVolume *ha_3=geom->MakeTubs("ha_3",Iron,0,1,12,0,0);
207 ha_3->SetLineColor(28);
208 top->AddNodeOverlap(ha_3,1,new TGeoCombiTrans(0,36,8,new TGeoRotation("ha_3",0,90,0)));
209
210 TGeoVolume *ha_4=geom->MakeTubs("ha_4",Iron,0,1,3,0,0);
211 ha_4->SetLineColor(28);
212 top->AddNodeOverlap(ha_4,1,new TGeoCombiTrans(0,22,10,new TGeoRotation("ha_4",0,0,0)));
213
214 TGeoVolume *ha_5=geom->MakeTubs("ha_5",Iron,0,1,3,0,0);
215 ha_5->SetLineColor(28);
216 top->AddNodeOverlap(ha_5,1,new TGeoCombiTrans(0,46,10,new TGeoRotation("ha_5",0,0,0)));
217
218 TGeoVolume *ha_6=geom->MakeTubs("ha_6",Iron,0,1,3,0,0);
219 ha_6->SetLineColor(28);
220 top->AddNodeOverlap(ha_6,1,new TGeoCombiTrans(0,24,10,new TGeoRotation("ha_6",0,0,0)));
221
222 TGeoVolume *ha_7=geom->MakeTubs("ha_7",Iron,0,1,3,0,0);
223 ha_7->SetLineColor(28);
224 top->AddNodeOverlap(ha_7,1,new TGeoCombiTrans(0,48,10,new TGeoRotation("ha_7",0,0,0)));
225
226 TGeoVolume *ha_8=geom->MakeBox("ha_8",Iron,2,0.5,2);
227 ha_8->SetLineColor(19);
228 top->AddNodeOverlap(ha_8,1,new TGeoCombiTrans(-4.2,36,9,new TGeoRotation("ha_8",0,45,0)));
229
230
231 TGeoVolume *ha_9=geom->MakeBox("ha_9",Iron,2,0.5,2);
232 ha_9->SetLineColor(19);
233 top->AddNodeOverlap(ha_9,1,new TGeoCombiTrans(-4.2,36,9,new TGeoRotation("ha_9",0,135,0)));
234
235
236
237 TGeoVolume *h_1=geom->MakeTubs("h_1",Iron,0,6,4.5,0,0);
238 h_1->SetLineColor(5);
239 top->AddNodeOverlap(h_1,1,new TGeoCombiTrans(0,36,0,new TGeoRotation("h_1",0,0,0)));
240
241 TGeoVolume *h_2=geom->MakeSphere("h_2",Iron,0,7.5,0,52.5,0,360);
242 h_2->SetLineColor(5);
243 top->AddNodeOverlap(h_2,1,new TGeoCombiTrans(0,36,0,new TGeoRotation("h_2",0,0,0)));
244
245 TGeoVolume *h_3=geom->MakeSphere("h_3",Iron,0,7.5,0,52.5,0,360);
246 h_3->SetLineColor(5);
247 top->AddNodeOverlap(h_3,1,new TGeoCombiTrans(0,36,0,new TGeoRotation("h_3",180,180,0)));
248
249 TGeoVolume *h_4=geom->MakeTubs("h_4",Iron,2.5,3.5,1.5,0,0);
250 h_4->SetLineColor(5);
251 top->AddNodeOverlap(h_4,1,new TGeoCombiTrans(0,36,7.5,new TGeoRotation("h_4",0,0,0)));
252
253
254 TGeoVolume *fa1=geom->MakeTubs("fa1",Iron,0,0.5,1,0,360);
255 fa1->SetLineColor(12);
256 top->AddNodeOverlap(fa1,1,new TGeoCombiTrans(-5,38,1.5,new TGeoRotation("fa1",-90,90,0)));
257
258 TGeoVolume *fa2=geom->MakeTubs("fa2",Iron,0,0.5,1,0,360);
259 fa2->SetLineColor(12);
260 top->AddNodeOverlap(fa2,1,new TGeoCombiTrans(-5,34,1.5,new TGeoRotation("fa2",-90,90,0)));
261
262 TGeoVolume *fa1_1=geom->MakeTubs("fa1_1",Iron,1,1.2,1,0,360);
263 fa1_1->SetLineColor(12);
264 top->AddNodeOverlap(fa1_1,1,new TGeoCombiTrans(-5,38,1.5,new TGeoRotation("fa1_1",-90,90,0)));
265
266 TGeoVolume *fa2_1=geom->MakeTubs("fa2_1",Iron,1,1.2,1,0,360);
267 fa2_1->SetLineColor(12);
268 top->AddNodeOverlap(fa2_1,1,new TGeoCombiTrans(-5,34,1.5,new TGeoRotation("fa2_1",-90,90,0)));
269
270 TGeoVolume *fa3=geom->MakeTubs("fa3",Iron,2,2.3,1,90,270);
271 fa3->SetLineColor(12);
272 top->AddNodeOverlap(fa3,1,new TGeoCombiTrans(-5,36,-1,new TGeoRotation("fa3",90,90,90)));
273
274
275
276 TGeoVolume *m_1=geom->MakeBox("m_1",Iron,7,8,4);
277 m_1->SetLineColor(25);
278 top->AddNodeOverlap(m_1,1,new TGeoCombiTrans(0,36,-17,new TGeoRotation("m_1",90,90,0)));
279
280 TGeoVolume *m_2=geom->MakeTubs("m_2",Iron,0,1,7,90,180);
281 m_2->SetLineColor(25);
282 top->AddNodeOverlap(m_2,1,new TGeoCombiTrans(-3,36,-9,new TGeoRotation("m_2",0,90,0)));
283
284 TGeoVolume *m_3=geom->MakeTubs("m_3",Iron,0,1,7,0,90);
285 m_3->SetLineColor(25);
286 top->AddNodeOverlap(m_3,1,new TGeoCombiTrans(3,36,-9,new TGeoRotation("m_3",0,90,0)));
287
288 TGeoVolume *m_4=geom->MakeBox("m_4",Iron,3,7,0.5);
289 m_4->SetLineColor(25);
290 top->AddNodeOverlap(m_4,1,new TGeoCombiTrans(0,36,-8.5,new TGeoRotation("m_4",90,0,90)));
291
292 TGeoVolume *m_5=geom->MakeTubs("m_5",Iron,0,1.5,1.2,0,0);
293 m_5->SetLineColor(5);
294 top->AddNodeOverlap(m_5,1,new TGeoCombiTrans(0,36,-7.8,new TGeoRotation("m_5",0,0,0)));
295
296 TGeoVolume *m_6=geom->MakeTrd2("m_6",Iron,4,4,0,2,8);
297 m_6->SetLineColor(25);
298 top->AddNodeOverlap(m_6,1,new TGeoCombiTrans(0,29,-17,new TGeoRotation("m_6",0,180,0)));
299
300 TGeoVolume *m_7=geom->MakeTrd2("m_7",Iron,4,4,0,2,8);
301 m_7->SetLineColor(25);
302 top->AddNodeOverlap(m_7,1,new TGeoCombiTrans(0,43,-17,new TGeoRotation("m_7",0,180,0)));
303
304
305 TGeoVolume *md_1=geom->MakeBox("md_1",Iron,4,8.5,0.7);
306 md_1->SetLineColor(48);
307 top->AddNodeOverlap(md_1,1,new TGeoCombiTrans(0,36,-25.5,new TGeoRotation("md_1",0,0,0)));
308
309 TGeoVolume *md_2=geom->MakeBox("md_2",Iron,3,0.4,2);
310 md_2->SetLineColor(48);
311 top->AddNodeOverlap(md_2,1,new TGeoCombiTrans(0,36,-28,new TGeoRotation("md_2",0,0,0)));
312
313 TGeoVolume *d_1=geom->MakeTrd2("d_1",Iron,3,4,4,4,7);
314 d_1->SetLineColor(48);
315 top->AddNodeOverlap(d_1,1,new TGeoCombiTrans(0,40.5,-37.2,new TGeoRotation("d_1",0,0,0)));
316
317 TGeoVolume *d_2=geom->MakeTrd2("d_2",Iron,3,4,4,4,7);
318 d_2->SetLineColor(48);
319 top->AddNodeOverlap(d_2,1,new TGeoCombiTrans(0,31.5,-37.2,new TGeoRotation("d_2",0,0,0)));
320
321 TGeoVolume *d_3=geom->MakeTubs("d_3",Iron,0,4,3.98,0,180);
322 d_3->SetLineColor(48);
323 top->AddNodeOverlap(d_3,1,new TGeoCombiTrans(0,40.5,-30.2,new TGeoRotation("d_3",0,90,0)));
324
325 TGeoVolume *d_4=geom->MakeTubs("d_4",Iron,0,4,3.98,0,180);
326 d_4->SetLineColor(48);
327 top->AddNodeOverlap(d_4,1,new TGeoCombiTrans(0,31.5,-30.2,new TGeoRotation("d_4",0,90,0)));
328
329 TGeoVolume *d_5=geom->MakeBox("d_5",Iron,4,4,1);
330 d_5->SetLineColor(48);
331 top->AddNodeOverlap(d_5,1,new TGeoCombiTrans(-1,40.5,-43.7,new TGeoRotation("d_5",0,0,0)));
332
333 TGeoVolume *d_6=geom->MakeBox("d_6",Iron,4,4,1);
334 d_6->SetLineColor(48);
335 top->AddNodeOverlap(d_6,1,new TGeoCombiTrans(-1,31.5,-43.7,new TGeoRotation("d_6",0,0,0)));
336
337
338 TGeoVolume *a_1=geom->MakeTubs("a_1",Iron,0,1.5,4,0,0);
339 a_1->SetLineColor(45);
340 top->AddNodeOverlap(a_1,1,new TGeoCombiTrans(0,46,-15.1,new TGeoRotation("a_1",0,20,45)));
341
342 TGeoVolume *a_2=geom->MakeSphere("a_2",Iron,0,1.48,0,180,0,200);
343 a_2->SetLineColor(45);
344 top->AddNodeOverlap(a_2,1,new TGeoCombiTrans(0,44.6,-11.5,new TGeoRotation("a_2",120,80,20)));
345
346 TGeoVolume *a_3=geom->MakeTubs("a_3",Iron,0,1.5,2.2,0,0);
347 a_3->SetLineColor(45);
348 top->AddNodeOverlap(a_3,1,new TGeoCombiTrans(0,47.3,-20.6,new TGeoRotation("a_3",300,0,40)));
349
350 TGeoVolume *a_4=geom->MakeTubs("a_4",Iron,0,1,1,0,0);
351 a_4->SetLineColor(12);
352 top->AddNodeOverlap(a_4,1,new TGeoCombiTrans(0,47.3,-23.8,new TGeoRotation("a_4",75,0,30)));
353
354 TGeoVolume *a_5=geom->MakeTubs("a_5",Iron,1.5,2.5,2,0,270);
355 a_5->SetLineColor(12);
356 top->AddNodeOverlap(a_5,1,new TGeoCombiTrans(0,47.3,-26.5,new TGeoRotation("a_5",-90,90,0)));
357
358
359
360
361 TGeoVolume *Aa1=geom->MakeTubs("Aa1",Iron,0,1.5,4,0,0);
362 Aa1->SetLineColor(45);
363 top->AddNodeOverlap(Aa1,1,new TGeoCombiTrans(0,26,-15.1,new TGeoRotation("Aa1",0,-20,-45)));
364
365 TGeoVolume *Aa2=geom->MakeSphere("Aa2",Iron,0,1.48,0,180,0,200);
366 Aa2->SetLineColor(45);
367 top->AddNodeOverlap(Aa2,1,new TGeoCombiTrans(0,27.4,-11.5,new TGeoRotation("Aa2",120,80,-20)));
368
369 TGeoVolume *Aa3=geom->MakeTubs("Aa3",Iron,0,1.5,2.2,0,0);
370 Aa3->SetLineColor(45);
371 top->AddNodeOverlap(Aa3,1,new TGeoCombiTrans(0,24.7,-20.6,new TGeoRotation("Aa3",-300,0,-40)));
372
373 TGeoVolume *Aa4=geom->MakeTubs("Aa4",Iron,0,1,1,0,0);
374 Aa4->SetLineColor(12);
375 top->AddNodeOverlap(Aa4,1,new TGeoCombiTrans(0,24.7,-23.8,new TGeoRotation("Aa4",-75,0,-30)));
376
377 TGeoVolume *Aa5=geom->MakeTubs("Aa5",Iron,1.5,2.5,2,0,270);
378 Aa5->SetLineColor(12);
379 top->AddNodeOverlap(Aa5,1,new TGeoCombiTrans(0,24.7,-26.5,new TGeoRotation("Aa5",90,90,00)));
380
381
382
383 TGeoVolume *bag1=geom->MakeBox("bag1",Iron,10,4,6);
384 bag1->SetLineColor(19);
385 top->AddNodeOverlap(bag1,1,new TGeoCombiTrans(0,48,-36,new TGeoRotation("bag1",0,0,0)));
386
387 TGeoVolume *bag2=geom->MakeTubs("bag2",Iron,3,4,1,180,360);
388 bag2->SetLineColor(19);
389 top->AddNodeOverlap(bag2,1,new TGeoCombiTrans(0,48,-30,new TGeoRotation("bag2",0,270,0)));
390
391
392 TGeoVolume *well=geom->MakeBox("well",Iron,5,10,3);
393 well->SetLineColor(18);
394 top->AddNodeOverlap(well,1,new TGeoCombiTrans(-26.5,-17,-42,new TGeoRotation("well",0,0,0)));
395
396
397 TGeoVolume *K5=geom->MakeTubs("K5",Iron,0,3,3,0,0);
398 K5->SetLineColor(18);
399 top->AddNodeOverlap(K5,1,new TGeoCombiTrans(-27,-12.5,-39,new TGeoRotation("K5",0,0,0)));
400
401 TGeoVolume *K4=geom->MakeTubs("K4",Iron,0,3,3,0,0);
402 K4->SetLineColor(18);
403 top->AddNodeOverlap(K4,1,new TGeoCombiTrans(-27,-21.5,-39,new TGeoRotation("K4",0,0,0)));
404
405
406
407 //==============Board=========
408 char nB[100];
409 int Z=0,Y=0;
410 TGeoVolume *bo1;
411
412 while(Y<6){
413 while(Z<10){
414 sprintf(nB,"B%d_Y%d",Z,Y);
415 bo1=geom->MakeTubs(nB,Iron,0,3,3,0,0);
416 bo1->SetLineColor(8);
417 top->AddNodeOverlap(bo1,1,new TGeoCombiTrans(-27+(Y*9),-21.5+(Z*9),-45,new TGeoRotation("bo1",0,0,0)));
418 Z++;
419 }
420 Y++; Z=0;
421 }
422
423
424 TGeoVolume *bo2=geom->MakeBox("bo2",Iron,27,45,3);
425 bo2->SetLineColor(8);
426 top->AddNodeOverlap(bo2,1,new TGeoCombiTrans(-4.5,18,-48,new TGeoRotation("bo2",0,0,0)));
427
428
429 top->SetVisibility(0);
430 geom->CloseGeometry();
431
432 top->Draw("ogl");
433}
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
Class describing rotation + translation.
Definition: TGeoMatrix.h:292
The manager class for any TGeo geometry.
Definition: TGeoManager.h:39
void CloseGeometry(Option_t *option="d")
Closing geometry implies checking the geometry validity, fixing shapes with negative parameters (run-...
TGeoVolume * MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
TGeoVolume * MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin=0, Double_t themax=180, Double_t phimin=0, Double_t phimax=360)
Make in one step a volume pointing to a sphere shape with given medium.
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
void SetTopVisible(Bool_t vis=kTRUE)
make top volume visible on screen
TGeoVolume * MakeTubs(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a tube segment shape with given medium.
Base class describing materials.
Definition: TGeoMaterial.h:31
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:24
Class describing rotations.
Definition: TGeoMatrix.h:175
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:53
virtual void SetVisibility(Bool_t vis=kTRUE)
set visibility of this volume
virtual void AddNodeOverlap(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
virtual void Draw(Option_t *option="")
draw top volume according to option
virtual void SetLineColor(Color_t lcolor)
Set the line color.
TH1F * h1
Definition: legend1.C:5
static constexpr double m2
static constexpr double m3