1 package org.lcsim.detector.solids;
2
3 import static org.lcsim.units.clhep.SystemOfUnits.m;
4 import junit.framework.TestCase;
5
6 import org.lcsim.detector.DetectorElement;
7 import org.lcsim.detector.IPhysicalVolume;
8 import org.lcsim.detector.IPhysicalVolumeNavigator;
9 import org.lcsim.detector.LogicalVolume;
10 import org.lcsim.detector.PhysicalVolume;
11 import org.lcsim.detector.PhysicalVolumeNavigatorStore;
12 import org.lcsim.detector.Transform3D;
13 import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
14 import org.lcsim.detector.material.IMaterial;
15 import org.lcsim.detector.material.MaterialElement;
16 import org.lcsim.util.test.TestUtil.TestOutputFile;
17
18
19
20
21
22
23
24
25
26 public class RightRegularPolyhedronHepRepTest extends TestCase
27 {
28 private static IMaterial dummymat = new MaterialElement("dummymat",1,1,1.0);
29 IPhysicalVolumeNavigator nav;
30 IPhysicalVolume world;
31
32 public void testPoly() throws Exception
33 {
34 createGeometry();
35 DetectorElementToHepRepConverter.writeHepRep(new TestOutputFile("RightRegularPolyhedronTest.heprep").getAbsolutePath());
36 }
37
38 public IPhysicalVolume createGeometry()
39 {
40 world = createWorld();
41 nav = PhysicalVolumeNavigatorStore.getInstance().createDefault(world);
42 createSolids(world);
43 return world;
44 }
45
46 public final void createSolids(IPhysicalVolume mom)
47 {
48 RightRegularPolyhedron poly =
49 new RightRegularPolyhedron("TestPolyhedron", 8, 500, 1000, -1000, 1000);
50
51 LogicalVolume lvTest = new LogicalVolume("lvpoly", poly, dummymat);
52 new PhysicalVolume(
53 new Transform3D(),
54 "pvpoly",
55 lvTest,
56 mom.getLogicalVolume(),
57 0);
58 new DetectorElement("depoly",null,"/pvpoly");
59 }
60
61 private IPhysicalVolume createWorld()
62 {
63 Box boxWorld = new Box(
64 "world_box",
65 10.0*m,
66 10.0*m,
67 10.0*m);
68
69 LogicalVolume lvWorld =
70 new LogicalVolume(
71 "world",
72 boxWorld,
73 dummymat);
74
75 IPhysicalVolume pvTop =
76 new PhysicalVolume(
77 null,
78 "world",
79 lvWorld,
80 null,
81 0);
82
83 return pvTop;
84 }
85 }