4 gSystem->Load(
"libGeom");
5 gSystem->Load(
"libRQTGL");
6 gSystem->Load(
"libRQIVTGL");
7 TCanvas *cc =
new TCanvas(
"rootgeom");
8 cc->SetFillColor(kBlack);
9 TGeoManager *geom =
new TGeoManager(
"simple1",
"Simple geometry");
12 TGeoMaterial *matVacuum =
new TGeoMaterial(
"Vacuum", 0,0,0);
13 TGeoMaterial *matAl =
new TGeoMaterial(
"Al", 26.98,13,2.7);
15 TGeoMedium *Vacuum =
new TGeoMedium(
"Vacuum",1, matVacuum);
16 TGeoMedium *Al =
new TGeoMedium(
"Root Material",2, matAl);
19 TGeoTranslation *tr1 =
new TGeoTranslation(20., 0, 0.);
20 TGeoTranslation *tr2 =
new TGeoTranslation(10., 0., 0.);
21 TGeoTranslation *tr3 =
new TGeoTranslation(10., 20., 0.);
22 TGeoTranslation *tr4 =
new TGeoTranslation(5., 10., 0.);
23 TGeoTranslation *tr5 =
new TGeoTranslation(20., 0., 0.);
24 TGeoTranslation *tr6 =
new TGeoTranslation(-5., 0., 0.);
25 TGeoTranslation *tr7 =
new TGeoTranslation(7.5, 7.5, 0.);
26 TGeoRotation *rot1 =
new TGeoRotation(
"rot1", 90., 0., 90., 270., 0., 0.);
27 TGeoCombiTrans *combi1 =
new TGeoCombiTrans(7.5, -7.5, 0., rot1);
28 TGeoTranslation *tr8 =
new TGeoTranslation(7.5, -5., 0.);
29 TGeoTranslation *tr9 =
new TGeoTranslation(7.5, 20., 0.);
30 TGeoTranslation *tr10 =
new TGeoTranslation(85., 0., 0.);
31 TGeoTranslationC *tr11 =
new TGeoTranslationC(35., 0., 0.);
32 TGeoTranslation *tr12 =
new TGeoTranslation(-15., 0., 0.);
33 TGeoTranslation *tr13 =
new TGeoTranslation(-65., 0., 0.);
35 TGeoTranslation *tr14 =
new TGeoTranslation(0,0,-100);
36 TGeoCombiTrans *combi2 =
new TGeoCombiTrans(0,0,100,
37 new TGeoRotation(
"rot2",90,180,90,90,180,0));
38 TGeoCombiTrans *combi3 =
new TGeoCombiTrans(100,0,0,
39 new TGeoRotation(
"rot3",90,270,0,0,90,180));
40 TGeoCombiTrans *combi4 =
new TGeoCombiTrans(-100,0,0,
41 new TGeoRotation(
"rot4",90,90,0,0,90,0));
42 TGeoCombiTrans *combi5 =
new TGeoCombiTrans(0,100,0,
43 new TGeoRotation(
"rot5",0,0,90,180,90,270));
44 TGeoCombiTrans *combi6 =
new TGeoCombiTrans(0,-100,0,
45 new TGeoRotation(
"rot6",180,0,90,180,90,90));
48 Double_t worldx = 110.;
49 Double_t worldy = 50.;
51 TGeoVolume *top = geom->MakeBox(
"TOP", Vacuum, 270., 270., 120.);
52 geom->SetTopVolume(top);
53 TGeoVolume *replica = geom->MakeBox(
"REPLICA", Vacuum,120,120,120);
54 replica->SetVisibility(kFALSE);
55 TGeoVolume *rootbox = geom->MakeBox(
"ROOT", Vacuum, 110., 50., 5.);
56 rootbox->SetVisibility(kFALSE);
59 TGeoVolume *R = geom->MakeBox(
"R", Vacuum, 25., 25., 5.);
60 R->SetVisibility(kFALSE);
61 TGeoVolume *bar1 = geom->MakeBox(
"bar1", Al, 5., 25, 5.);
62 bar1->SetLineColor(kRed);
63 R->AddNode(bar1, 1, tr1);
64 TGeoVolume *bar2 = geom->MakeBox(
"bar2", Al, 5., 5., 5.);
65 bar2->SetLineColor(kRed);
66 R->AddNode(bar2, 1, tr2);
67 R->AddNode(bar2, 2, tr3);
68 TGeoVolume *tub1 = geom->MakeTubs(
"tub1", Al, 5., 15., 5., 90., 270.);
69 tub1->SetLineColor(kRed);
70 R->AddNode(tub1, 1, tr4);
71 TGeoVolume *bar3 = geom->MakeArb8(
"bar3", Al, 5.);
72 bar3->SetLineColor(kRed);
73 TGeoArb8 *arb = (TGeoArb8*)bar3->GetShape();
74 arb->SetVertex(0, 15., -5.);
75 arb->SetVertex(1, 0., -25.);
76 arb->SetVertex(2, -10., -25.);
77 arb->SetVertex(3, 5., -5.);
78 arb->SetVertex(4, 15., -5.);
79 arb->SetVertex(5, 0., -25.);
80 arb->SetVertex(6, -10., -25.);
81 arb->SetVertex(7, 5., -5.);
82 R->AddNode(bar3, 1, gGeoIdentity);
85 TGeoVolume *O = geom->MakeBox(
"O", Vacuum, 25., 25., 5.);
86 O->SetVisibility(kFALSE);
87 TGeoVolume *bar4 = geom->MakeBox(
"bar4", Al, 5., 7.5, 5.);
88 bar4->SetLineColor(kYellow);
89 O->AddNode(bar4, 1, tr5);
90 O->AddNode(bar4, 2, tr6);
91 TGeoVolume *tub2 = geom->MakeTubs(
"tub1", Al, 7.5, 17.5, 5., 0., 180.);
92 tub2->SetLineColor(kYellow);
93 O->AddNode(tub2, 1, tr7);
94 O->AddNode(tub2, 2, combi1);
97 TGeoVolume *T = geom->MakeBox(
"T", Vacuum, 25., 25., 5.);
98 T->SetVisibility(kFALSE);
99 TGeoVolume *bar5 = geom->MakeBox(
"bar5", Al, 5., 20., 5.);
100 bar5->SetLineColor(kBlue);
101 T->AddNode(bar5, 1, tr8);
102 TGeoVolume *bar6 = geom->MakeBox(
"bar6", Al, 17.5, 5., 5.);
103 bar6->SetLineColor(kBlue);
104 T->AddNode(bar6, 1, tr9);
108 rootbox->AddNode(R, 1, tr10);
109 rootbox->AddNode(O, 1, tr11);
110 rootbox->AddNode(O, 2, tr12);
111 rootbox->AddNode(T, 1, tr13);
113 replica->AddNode(rootbox, 1, tr14);
114 replica->AddNode(rootbox, 2, combi2);
115 replica->AddNode(rootbox, 3, combi3);
116 replica->AddNode(rootbox, 4, combi4);
117 replica->AddNode(rootbox, 5, combi5);
118 replica->AddNode(rootbox, 6, combi6);
120 TGeoTranslationC *replica1 =
new TGeoTranslationC(-150, -150, 0);
121 TGeoTranslation *replica2 =
new TGeoTranslation ( 150, -150, 0);
122 TGeoTranslationC *replica3 =
new TGeoTranslationC( 150, 150, 0);
123 TGeoTranslation *replica4 =
new TGeoTranslation (-150, 150, 0);
125 tr11->SetFileName(
"replica3.iv");
126 replica1->SetFileName(
"replica1.iv");
127 replica3->SetFileName(
"replica3.iv");
129 top->AddNode(replica, 1, replica1);
130 top->AddNode(replica, 2, replica2);
131 top->AddNode(replica, 3, replica3);
132 top->AddNode(replica, 4, replica4);
135 geom->CloseGeometry();
143 geom->SetVisLevel(4);
144 gGeoManager->GetTopVolume()->Draw(
"oiv");
145 printf(
"\n\n-----------------------------------------\n");
146 printf(
" With your left mouse button, select menu: \n");
147 printf(
" \"View\" -> \"View3D with\" -> \"Coin3D view\" \n");
148 printf(
"-----------------------------------------\n");