File indexing completed on 2025-01-30 09:17:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "TGeoManager.h"
0012 #include "TGeoArb8.h"
0013 #include "TGeoVolume.h"
0014 #include "TGeoBoolNode.h"
0015 #include "TGeoCompositeShape.h"
0016 #include <iostream>
0017
0018 void Trap_DDFORHEP_5(int arg=0) {
0019 TGeoManager* mgr = gGeoManager;
0020 if ( !mgr ) mgr = new TGeoManager();
0021
0022 TGeoVolume* world = new TGeoVolume("World",new TGeoBBox(30,30,30),mgr->GetMedium("Air"));
0023 TGeoBBox* box = new TGeoBBox("World",10, 10, 1);
0024 TGeoShape* hole_shape = arg
0025 ? new TGeoTrap(4.2, 0., 0., 2., 4., 3., 0., 2., 4., 3., 0.)
0026
0027 : new TGeoBBox(3, 3, 1.01);
0028
0029 TGeoSubtraction* sub = new TGeoSubtraction(box, hole_shape, gGeoIdentity, gGeoIdentity);
0030 TGeoCompositeShape* comp = new TGeoCompositeShape("composite",sub);
0031 TGeoVolume* vol = new TGeoVolume("Test_composites",comp,mgr->GetMedium("Iron"));
0032
0033 world->AddNode(vol,1);
0034
0035
0036 TGeoVolume* hole_seperate = new TGeoVolume("Hole",hole_shape,mgr->GetMedium("Iron"));
0037 world->AddNode(hole_seperate,2,new TGeoTranslation(20,0,0));
0038
0039 std::cout << "Test subtraction of a " << hole_shape->IsA()->GetName()
0040 << " shape from a box." << std::endl;
0041
0042
0043 mgr->SetTopVolume(world);
0044 mgr->CloseGeometry();
0045 mgr->SetVisLevel(4);
0046 mgr->SetVisOption(1);
0047 mgr->GetTopNode()->Draw("ogl");
0048 }