hps-java/src/main/java/org/lcsim/hps/conditions
diff -u -r1.1 -r1.2
--- BadChannelConverter.java 4 Oct 2013 01:43:47 -0000 1.1
+++ BadChannelConverter.java 4 Oct 2013 01:52:16 -0000 1.2
@@ -1,5 +1,8 @@
package org.lcsim.hps.conditions;
+import static org.lcsim.hps.conditions.ConditionsConstants.ECAL_BAD_CHANNELS;
+import static org.lcsim.hps.conditions.ConditionsConstants.SVT_BAD_CHANNELS;
+
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -8,7 +11,7 @@
import org.lcsim.conditions.ConditionsManager;
/**
- * This class creates a list of {@link EcalBadChannel} objects from the conditions database.
+ * This class creates a {@link ChannelCollection} representing bad readout channels.
* @author Jeremy McCormick <[log in to unmask]>
*/
public class BadChannelConverter extends DatabaseConditionsConverter<ChannelCollection> {
@@ -46,10 +49,14 @@
// Get the name of the current database being used.
String database = ConnectionManager.getConnectionParameters().getDatabase();
- // Select the correct field name.
- String idFieldName = "ecal_channel_id";
- if (name == "svt_bad_channels") {
+ // Select the correct field name depending on if SVT or ECAL is being queried.
+ String idFieldName = null;
+ if (name == SVT_BAD_CHANNELS) {
idFieldName = "svt_channel_id";
+ } else if (name == ECAL_BAD_CHANNELS) {
+ idFieldName = "ecal_channel_id";
+ } else {
+ throw new IllegalArgumentException("Unknown conditions key for this converter: " + name);
}
// Query for getting back bad channel records.