Commit in projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact on MAIN
HPSTracker2ConverterTest.java+473365 -> 3366
Add assertions to HPSTracker2ConverterTest to check that the SVT stereo layers were created correctly.

projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact
HPSTracker2ConverterTest.java 3365 -> 3366
--- projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java	2014-10-14 07:44:56 UTC (rev 3365)
+++ projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java	2014-10-14 07:47:51 UTC (rev 3366)
@@ -1,17 +1,34 @@
 package org.lcsim.detector.converter.compact;
 
 import java.io.InputStream;
+import java.util.List;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.lcsim.detector.converter.compact.subdetector.HpsTracker2;
+import org.lcsim.detector.converter.compact.subdetector.SvtStereoLayer;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.GeometryReader;
 
+/**
+ * Unit test for the HPSTracker2Coverter.
+ * 
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @author Omar Moreno <[log in to unmask]> 
+ */
 public class HPSTracker2ConverterTest extends TestCase {
     
     Detector detector = null;
+   
+    //-----------------//
+    //--- Constants ---//
+    //-----------------//
+    private static final int TOTAL_NUMBER_OF_SENSORS = 20; 
+    private static final int TOTAL_NUMBER_OF_STEREO_LAYERS = 10; 
+    private static final String SUBDETECTOR_NAME = "Tracker";
     
     public static Test suite() {
         return new TestSuite(HPSTracker2ConverterTest.class);
@@ -33,5 +50,35 @@
     
     public void testSVT() {
         
+        System.out.println("[ HPSTracker2ConverterTest ]: Checking if the correct number of sensors were created.");
+        List<HpsSiSensor> sensors = detector.getSubdetector(SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsSiSensor.class);
+        // Check that the correct number of sensors were created
+        assertTrue("The wrong number of sensors were created.", sensors.size() == TOTAL_NUMBER_OF_SENSORS);
+        System.out.println("[ HPSTracker2ConverterTest ]: Total number of sensors that were created: " + sensors.size());
+        
+        System.out.println("[ HPSTracker2ConverterTest ]: Checking if the correct number of stereo layers were created.");
+        
+        // Get the collection of stereo layers created
+        List<SvtStereoLayer> stereoLayers = ((HpsTracker2) detector.getSubdetector("Tracker").getDetectorElement()).getStereoPairs();
+        // Check that the number of stereo layers created is as expected
+        assertTrue("The wrong number of stereo layers were created.", stereoLayers.size() == TOTAL_NUMBER_OF_STEREO_LAYERS);
+        System.out.println("[ HPSTracker2ConverterTest ]: Total number of stereo layers created: " + stereoLayers.size());
+        
+        for(SvtStereoLayer stereoLayer : stereoLayers){
+            System.out.println("[ HPSTracker2ConverterTest ]: " + stereoLayer.toString());
+            
+            // The sensors comprising the stereo layer should belong to the same detector volume
+            assertTrue("Sensors belong to different detector volumes.", 
+                    stereoLayer.getAxialSensor().getModuleNumber() == stereoLayer.getStereoSensor().getModuleNumber());
+            
+            // If the stereo layer is part of the top detector volume, the axial layers have an odd layer number.
+            // If the stereo layer is part of the bottom detector volumen, the axial layers have an even layer number.
+            if(stereoLayer.getAxialSensor().isTopLayer()){
+                assertTrue("Sensors composing the stereo layer are flipped", stereoLayer.getAxialSensor().getLayerNumber()%2 == 1);
+            } else { 
+                assertTrue("Sensors composing the stereo layer are flipped", stereoLayer.getAxialSensor().getLayerNumber()%2 == 0);
+                
+            }
+        }
     }
 }
\ No newline at end of file
SVNspam 0.1


Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1