1
2
3
4
5
6
7 package org.lcsim.geometry.subdetector;
8
9 import java.io.InputStream;
10 import junit.framework.TestCase;
11 import junit.framework.TestSuite;
12
13 import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
14 import org.lcsim.geometry.GeometryReader;
15 import org.lcsim.geometry.compact.Detector;
16 import org.lcsim.util.test.TestUtil.TestOutputFile;
17
18
19
20
21
22 public class PolyhedraBarrelCalorimeterTest extends TestCase
23 {
24 Detector det;
25 PolyhedraBarrelCalorimeter pbc;
26
27
28 public PolyhedraBarrelCalorimeterTest()
29 {}
30
31 protected void setUp() throws java.lang.Exception
32 {
33 InputStream in = this.getClass().getResourceAsStream("/org/lcsim/geometry/subdetector/PolyhedraBarrelCalorimeterTest.xml");
34 GeometryReader reader = new GeometryReader();
35 det = reader.read(in);
36
37 assertTrue( det.getSubdetectors().get("PolyhedraBarrelCalorimeterSubdet") != null );
38
39 try
40 {
41 pbc = (PolyhedraBarrelCalorimeter) det.getSubdetectors().get("PolyhedraBarrelCalorimeterSubdet");
42 }
43 catch ( ClassCastException cce )
44 {
45 throw new RuntimeException("Failed cast to PolyhedraBarrelCalorimeter.");
46 }
47 }
48
49 public static junit.framework.Test suite()
50 {
51 return new TestSuite(PolyhedraBarrelCalorimeterTest.class);
52 }
53
54 public void test_PolyhedraBarrelCalorimeter() throws Exception
55 {
56 DetectorElementToHepRepConverter.writeHepRep(new TestOutputFile("PolyhedraBarrelCalorimeterTest.heprep").getAbsolutePath());
57 }
58 }