1 package org.lcsim.geometry.compact;
2
3 import junit.framework.Test;
4 import junit.framework.TestCase;
5 import junit.framework.TestSuite;
6
7 import org.lcsim.util.test.OneTimeDetectorSetup;
8
9
10
11
12
13 public class CompactReaderTest extends TestCase
14 {
15 Detector det = null;
16 static final String detLoc = "/org/lcsim/geometry/compact/sdjan03_compact.xml";
17
18 public CompactReaderTest(String testName)
19 {
20 super(testName);
21 }
22
23 public static Test suite()
24 {
25 TestSuite ts = new TestSuite();
26 ts.addTestSuite(CompactReaderTest.class);
27 return new OneTimeDetectorSetup(ts, detLoc);
28 }
29
30 protected void setUp()
31 {
32 if (det == null)
33 det = OneTimeDetectorSetup.getDetector();
34 }
35
36
37
38
39 public void testDetectorCount()
40 {
41 assertEquals(12, det.getSubdetectors().size());
42 }
43
44
45
46
47 public void testLimits()
48 {
49 LimitSet limitset = det.getLimitSet("MyLimits");
50 assertTrue(limitset != null);
51
52 Limit limit = limitset.getLimit("step_length_max");
53 assertTrue(limit != null);
54
55 assertEquals(limit.getValue(), 1.0);
56 assertEquals(limit.getUnit(), "mm");
57 assertEquals(limit.getParticles(), "*");
58 }
59
60
61
62
63 public void testRegions()
64 {
65 Region region = det.getRegion("MyRegion");
66 assertTrue(region != null);
67 }
68
69
70
71
72 public void testMultiSubdetectorReadout()
73 {
74 assertTrue( det.getSubdetector("HADBarrel").getReadout().getName().compareTo("HcalBarrHits") == 0 );
75 assertTrue( det.getSubdetector("HADBarrel2").getReadout().getName().compareTo("HcalBarrHits") == 0 );
76 }
77 }