View Javadoc

1   package org.lcsim.geometry.subdetector;
2   
3   import java.io.InputStream;
4   import junit.framework.TestCase;
5   import junit.framework.TestSuite;
6   
7   import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
8   import org.lcsim.geometry.GeometryReader;
9   import org.lcsim.geometry.compact.Detector;
10  import org.lcsim.util.test.TestUtil.TestOutputFile;
11  
12  /**
13   * This class tests whether the {@link org.lcsim.subdetector.PolyhedraEndcapCalorimeter}
14   * subdetector type loads without errors from a test compact description.
15   * 
16   * @author Jeremy McCormick <jeremym@slac.stanford.edu>
17   */
18  public class PolyhedraEndcapCalorimeterTest extends TestCase
19  {
20      Detector det;
21      PolyhedraEndcapCalorimeter pbc;
22      
23      /** Creates a new instance of ForwardDetectorTest */
24      public PolyhedraEndcapCalorimeterTest()
25      {}
26      
27      protected void setUp() throws java.lang.Exception
28      {                
29          InputStream in = this.getClass().getResourceAsStream("/org/lcsim/geometry/subdetector/PolyhedraEndcapCalorimeterTest.xml");
30          GeometryReader reader = new GeometryReader();
31          det = reader.read(in);
32          
33          assertTrue( det.getSubdetectors().get("PolyhedraEndcapCalorimeter") != null );
34      }
35      
36      public static junit.framework.Test suite()
37      {
38          return new TestSuite(PolyhedraEndcapCalorimeterTest.class);
39      }
40      
41      public void testHepRep() throws Exception
42      {
43      	DetectorElementToHepRepConverter.writeHepRep(new TestOutputFile("PolyhedraEndcapCalorimeterTest.heprep").getAbsolutePath());
44      }
45  }