Author: [log in to unmask] Date: Wed Oct 29 00:31:20 2014 New Revision: 3402 Log: Update the test to check if the sensors are of type HpsSiSensor. Modified: projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java Modified: projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java ============================================================================= --- projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java (original) +++ projects/lcsim/trunk/detector-framework/src/test/java/org/lcsim/detector/converter/compact/HPSTracker2ConverterTest.java Wed Oct 29 00:31:20 2014 @@ -48,24 +48,31 @@ } } - public void testSVT() { + public void testHPSTracker2Converter() { + + // Test if the correct number of sensors was created. + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Checking if the correct number of sensors were created."); + List<HpsSiSensor> sensors = detector.getSubdetector(SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsSiSensor.class); + assertTrue("The wrong number of sensors were created.", sensors.size() == TOTAL_NUMBER_OF_SENSORS); + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Total number of sensors that were created: " + sensors.size()); + + // Test if the sensors that were created are instances of HpsSiSensor + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Checking if sensor is instance of HpsTestRunSiSensor."); + for(HpsSiSensor sensor : sensors) { + assertTrue("[ " + this.getClass().getSimpleName() + " ]: Sensor is of wrong type: " + sensor.getClass().getSimpleName(), + sensor instanceof HpsSiSensor); + } + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Sensors are all instances of HpsSiSensor."); - 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 correct number of stereo layers were created + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Checking if the correct number of stereo layers were created."); + List<SvtStereoLayer> stereoLayers = ((HpsTracker2) detector.getSubdetector(SUBDETECTOR_NAME).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()); + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Total number of stereo layers created: " + stereoLayers.size()); for(SvtStereoLayer stereoLayer : stereoLayers){ - System.out.println("[ HPSTracker2ConverterTest ]: " + stereoLayer.toString()); + System.out.println("[ " + this.getClass().getSimpleName() + " ]: " + stereoLayer.toString()); // The sensors comprising the stereo layer should belong to the same detector volume assertTrue("Sensors belong to different detector volumes.", @@ -73,6 +80,7 @@ // 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. + System.out.println("[ " + this.getClass().getSimpleName() + " ]: Checking if the layers are oriented correctly."); if(stereoLayer.getAxialSensor().isTopLayer()){ assertTrue("Sensors composing the stereo layer are flipped", stereoLayer.getAxialSensor().getLayerNumber()%2 == 1); } else { ######################################################################## 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