4 modified files
hps-java/src/main/java/org/lcsim/hps/conditions
diff -u -r1.2 -r1.3
--- ConditionsConstants.java 1 Oct 2013 00:34:29 -0000 1.2
+++ ConditionsConstants.java 1 Oct 2013 01:22:33 -0000 1.3
@@ -21,7 +21,7 @@
/** Table with SVT channel data. */
public static final String SVT_CHANNELS = "svt_channels";
-
+
/** Conditions key for SVT calibration data. */
public static final String SVT_CALIBRATIONS = "svt_calibrations";
}
hps-java/src/main/java/org/lcsim/hps/conditions/ecal
diff -u -r1.1 -r1.2
--- EcalChannelMap.java 25 Sep 2013 22:14:24 -0000 1.1
+++ EcalChannelMap.java 1 Oct 2013 01:22:33 -0000 1.2
@@ -5,8 +5,50 @@
/**
* This class maps ID values from the database to detailed ECal channel information.
* There should really only be one of these data structures per job, as the EcalChannel
- * objects are used as unique identifiers in the EcalConditions class.
+ * objects are used as unique identifiers in the {@link EcalConditions} class.
+ *
+ * FIXME: When adding new channels, there should be data structures setup for lookup using
+ * using x, y or crate, slot, channel. See Sho's bit packing routines in original
+ * EcalConditions class for ideas.
*/
public class EcalChannelMap extends HashMap<Integer, EcalChannel> {
+
EcalChannelMap() {}
-}
+
+ /**
+ * Find a channel by using DAQ information.
+ * @param crate The crate number.
+ * @param slot The slot number.
+ * @param channelNumber The channel number.
+ * @return The matching channel or null if does not exist.
+ *
+ * FIXME: Improve performance of this method from O(N).
+ */
+ public EcalChannel find(int crate, int slot, int channelNumber) {
+ for (EcalChannel channel : values()) {
+ if (channel.getCrate() == crate
+ && channel.getSlot() == slot
+ && channel.getChannel() == channelNumber) {
+ return channel;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Find a channel by using its physical ID information.
+ * @param x The x value.
+ * @param y The y value.
+ * @return The matching channel or null if does not exist.
+ *
+ * FIXME: Improve performance of this method from O(N).
+ */
+ public EcalChannel find(int x, int y) {
+ for (EcalChannel channel : values()) {
+ if (channel.getX() == x && channel.getY()== y) {
+ return channel;
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/conditions/ecal
diff -u -r1.3 -r1.4
--- EcalConditions.java 1 Oct 2013 00:34:29 -0000 1.3
+++ EcalConditions.java 1 Oct 2013 01:22:33 -0000 1.4
@@ -133,7 +133,7 @@
buff.append(channel
+ ", gain: " + (gain == null ? "NONE" : gain)
+ ", pedestal: " + (pedestal == null ? "NONE" : pedestal)
- + ", noise: " + (noise == null ? "NONE" : pedestal)
+ + ", noise: " + (noise == null ? "NONE" : noise)
+ ", badChannel: " + badChannel + '\n');
}
return buff.toString();
hps-java/src/main/java/org/lcsim/hps/conditions/svt
diff -u -r1.10 -r1.11
--- SvtCalibrationConverter.java 24 Sep 2013 23:21:40 -0000 1.10
+++ SvtCalibrationConverter.java 1 Oct 2013 01:22:33 -0000 1.11
@@ -6,6 +6,7 @@
import java.sql.Statement;
import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.hps.conditions.ConditionsConstants;
import org.lcsim.hps.conditions.ConditionsRecord;
import org.lcsim.hps.conditions.ConnectionManager;
import org.lcsim.hps.conditions.DatabaseConditionsConverter;
@@ -14,12 +15,9 @@
* Read SVT calibration data from the conditions database.
* @author Omar Moreno <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: SvtCalibrationConverter.java,v 1.10 2013/09/24 23:21:40 jeremy Exp $
+ * @version $Id: SvtCalibrationConverter.java,v 1.11 2013/10/01 01:22:33 jeremy Exp $
*/
public class SvtCalibrationConverter extends DatabaseConditionsConverter<ChannelConstantsCollection> {
-
- /** The name of the table in the database containing the channel IDs. */
- private static final String CHANNEL_TABLE = "svt_channels";
/**
* Class constructor.
@@ -63,7 +61,7 @@
// Construct the query to find matching calibration records using the ID field.
String query = "SELECT svt_channel_id, fpga, hybrid, channel, noise, pedestal FROM "
+ database + "." + tableName + ", "
- + database + "." + CHANNEL_TABLE
+ + database + "." + ConditionsConstants.SVT_CHANNELS
+ " WHERE "
+ fieldName + " = " + fieldValue
+ " AND svt_channels.id = " + tableName + ".svt_channel_id "
CVSspam 0.2.12