hps-java/src/test/java/org/lcsim/hps/conditions/svt
diff -u -r1.8 -r1.9
--- SvtConditionsLoaderTest.java 11 Oct 2013 01:56:04 -0000 1.8
+++ SvtConditionsLoaderTest.java 15 Oct 2013 01:35:59 -0000 1.9
@@ -23,7 +23,16 @@
private static final String detectorName = "HPS-conditions-test";
/** The run number of the conditions set in the database. */
- private static final int runNumber = 777;
+ private static final int runNumber = 1351;
+
+ /**
+ * The number of bad channels that should be returned for the run.
+ * One of these is a duplicate so the row count is actually 442 in the database.
+ */
+ private static final int BAD_CHANNELS_ANSWER = 441;
+
+ /** The number of channels where pulse information is all zeroes. */
+ private static final int PULSE_NOT_SET_ANSWER = 4;
/**
* Load SVT conditions data onto the detector and perform basic checks afterwards.
@@ -52,7 +61,8 @@
// Check sensor data.
List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
final int nchannels = sensors.get(0).getNumberOfChannels();
- int deadChannels = 0;
+ int badChannels = 0;
+ int pulseNotSet = 0;
// Loop over sensors.
for (HpsSiSensor sensor : sensors) {
// Loop over channels.
@@ -79,20 +89,25 @@
assertTrue("t0 is zero.", pulse[1] != 0);
assertTrue("tp is zero.", pulse[2] != 0);
assertTrue("chisq is zero.", pulse[3] != 0);
+ } else {
+ pulseNotSet += 1;
}
// Add to bad channel count.
if (sensor.isBadChannel(channel)) {
- ++deadChannels;
+ ++badChannels;
}
}
}
// Check that there were at least some bad channels.
- assertTrue("Number of bad channels was zero.", deadChannels != 0);
+ assertTrue("Number of bad channels was zero.", badChannels != 0);
- // There should be 50 dead channels found for the QA set.
- assertEquals("Wrong number of dead channels found.", 50, deadChannels);
+ // Now check the exact number of bad channels, which should be the QA set plus those for run 1351.
+ assertEquals("Wrong number of dead channels found.", BAD_CHANNELS_ANSWER, badChannels);
+
+ // There should be exactly 4 channels where the pulse parameters are all zeroes.
+ assertEquals("The number of channels for which pulse was not set is wrong.", PULSE_NOT_SET_ANSWER, pulseNotSet);
// Cleanup the database connection.
ConnectionManager.getConnectionManager().disconnect();