19 gSystem->Load(
"libGeom");
20 auto geom =
new TGeoManager(
"Assemblies",
21 "Geometry using assemblies");
24 auto matVacuum =
new TGeoMaterial(
"Vacuum", 0,0,0);
25 auto matAl =
new TGeoMaterial(
"Al", 26.98,13,2.7);
27 auto Vacuum =
new TGeoMedium(
"Vacuum",1, matVacuum);
28 auto Al =
new TGeoMedium(
"Aluminium",2, matAl);
31 auto top = geom->MakeBox(
"TOP", Vacuum, 1000., 1000., 100.);
32 geom->SetTopVolume(top);
35 auto tplate =
new TGeoVolumeAssembly(
"TOOTHPLATE");
41 Double_t ytooth = 0.5*yplate/ntooth;
42 Double_t dshift = 2.*xplate + xtooth;
45 auto plate = geom->MakeBox(
"PLATE", Al, xplate,yplate,1);
46 plate->SetLineColor(kBlue);
47 auto tooth = geom->MakeBox(
"TOOTH", Al, xtooth,ytooth,1);
48 tooth->SetLineColor(kBlue);
49 tplate->AddNode(plate,1);
50 for (i=0; i<ntooth; i++) {
52 yt = -yplate + (4*i+1)*ytooth;
53 tplate->AddNode(tooth, i+1,
new TGeoTranslation(xt,yt,0));
55 yt = -yplate + (4*i+3)*ytooth;
56 tplate->AddNode(tooth, ntooth+i+1,
new TGeoTranslation(xt,yt,0));
59 auto rot1 =
new TGeoRotation();
64 TGeoVolume *cell =
new TGeoVolumeAssembly(
"CELL");
67 Double_t phirad = phi*TMath::DegToRad();
68 Double_t xp = dshift*TMath::Sin(phirad);
69 Double_t yp = -dshift*TMath::Cos(phirad);
70 rot =
new TGeoRotation(*rot1);
72 cell->AddNode(tplate,i+1,
new TGeoCombiTrans(xp,yp,0,rot));
78 auto row =
new TGeoVolumeAssembly(
"ROW");
80 for (i=0; i<ncells; i++) {
81 Double_t ycell = (2*i+1)*(dshift+10);
82 row->AddNode(cell, ncells+i+1,
new TGeoTranslation(0,ycell,0));
83 row->AddNode(cell,ncells-i,
new TGeoTranslation(0,-ycell,0));
86 Double_t dxrow = 3.*(dshift+10.)*TMath::Tan(30.*TMath::DegToRad());
87 Double_t dyrow = dshift+10.;
89 for (i=0; i<nrows; i++) {
90 Double_t xrow = 0.5*(2*i+1)*dxrow;
91 Double_t yrow = 0.5*dyrow;
92 if ((i%2)==0) yrow = -yrow;
93 top->AddNode(row, nrows+i+1,
new TGeoTranslation(xrow,yrow,0));
94 top->AddNode(row, nrows-i,
new TGeoTranslation(-xrow,-yrow,0));
98 geom->CloseGeometry();
100 TEveManager::Create();
102 auto node = gGeoManager->GetTopNode();
103 auto en =
new TEveGeoTopNode(gGeoManager, node);
105 en->GetNode()->GetVolume()->SetVisibility(kFALSE);
107 gEve->AddGlobalElement(en);
109 gEve->Redraw3D(kTRUE);
111 en->ExpandIntoListTreesRecursively();
112 en->Save(
"assembly.root",
"Assembly");