Commit in hps-java/src/main/java/org/lcsim/hps/conditions on MAIN
ecal/EcalBadChannelConverter.java+701.2 -> 1.3
svt/SvtBadChannelCollection.java+121.2 -> 1.3
   /SvtBadChannelConverter.java+701.2 -> 1.3
+152
3 modified files
add back separate bad channel converters

hps-java/src/main/java/org/lcsim/hps/conditions/ecal
EcalBadChannelConverter.java 1.2 -> 1.3
diff -N EcalBadChannelConverter.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EcalBadChannelConverter.java	15 Oct 2013 00:56:09 -0000	1.3
@@ -0,0 +1,70 @@
+package org.lcsim.hps.conditions.ecal;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.hps.conditions.ChannelCollection;
+import org.lcsim.hps.conditions.ConditionsRecord;
+import org.lcsim.hps.conditions.ConditionsRecordCollection;
+import org.lcsim.hps.conditions.ConnectionManager;
+import org.lcsim.hps.conditions.DatabaseConditionsConverter;
+
+/**
+ * This class creates a {@link ChannelCollection} representing bad readout channels.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class EcalBadChannelConverter extends DatabaseConditionsConverter<EcalBadChannelCollection> {
+
+    /**
+     * Create the collection from the conditions database. 
+     * @param manager The conditions manager.
+     * @param name The name of the conditions set.
+     */
+    public EcalBadChannelCollection getData(ConditionsManager manager, String name) {
+
+        // Collection to be returned to caller.
+        EcalBadChannelCollection badChannels = new EcalBadChannelCollection();
+
+        // Get the ConditionsRecord with the meta-data, which will use the
+        // current run number from the manager.
+        ConditionsRecordCollection records = ConditionsRecord.find(manager, name);
+
+        // Loop over ConditionsRecords.  For this particular type of condition, multiple
+        // sets of bad channels are possible.
+        for (ConditionsRecord record : records) {
+        
+            // Get the table name, field name, and field value defining the
+            // applicable conditions.
+            String tableName = record.getTableName();
+            String fieldName = record.getFieldName();
+            int fieldValue = record.getFieldValue();
+
+            // Query for getting back bad channel records.
+            String query = "SELECT svt_channel_id FROM " + tableName + " WHERE " 
+                    + fieldName + " = " + fieldValue + " ORDER BY id ASC";
+            ResultSet resultSet = ConnectionManager.getConnectionManager().query(query);
+            
+            // Loop over the records.
+            try {
+                while (resultSet.next()) {
+                    int channelId = resultSet.getInt(1);
+                    badChannels.add(channelId);
+                }
+            } catch (SQLException x) {
+                throw new RuntimeException(x);
+            } 
+        }
+               
+        return badChannels;
+    }
+
+    /**
+     * Get the type handled by this converter.
+     * 
+     * @return The type handled by this converter.
+     */
+    public Class<EcalBadChannelCollection> getType() {
+        return EcalBadChannelCollection.class;
+    }
+}

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtBadChannelCollection.java 1.2 -> 1.3
diff -N SvtBadChannelCollection.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SvtBadChannelCollection.java	15 Oct 2013 00:56:09 -0000	1.3
@@ -0,0 +1,12 @@
+package org.lcsim.hps.conditions.svt;
+
+import java.util.HashSet;
+
+/**
+ * This class represents a set of bad channels in the ECAL by their channel IDs
+ * from the conditions database.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class SvtBadChannelCollection extends HashSet<Integer> {
+
+}

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtBadChannelConverter.java 1.2 -> 1.3
diff -N SvtBadChannelConverter.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SvtBadChannelConverter.java	15 Oct 2013 00:56:09 -0000	1.3
@@ -0,0 +1,70 @@
+package org.lcsim.hps.conditions.svt;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.hps.conditions.ChannelCollection;
+import org.lcsim.hps.conditions.ConditionsRecord;
+import org.lcsim.hps.conditions.ConditionsRecordCollection;
+import org.lcsim.hps.conditions.ConnectionManager;
+import org.lcsim.hps.conditions.DatabaseConditionsConverter;
+
+/**
+ * This class creates a {@link ChannelCollection} representing bad readout channels.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class SvtBadChannelConverter extends DatabaseConditionsConverter<SvtBadChannelCollection> {
+
+    /**
+     * Create the collection from the conditions database. 
+     * @param manager The conditions manager.
+     * @param name The name of the conditions set.
+     */
+    public SvtBadChannelCollection getData(ConditionsManager manager, String name) {
+
+        // Collection to be returned to caller.
+        SvtBadChannelCollection badChannels = new SvtBadChannelCollection();
+
+        // Get the ConditionsRecord with the meta-data, which will use the
+        // current run number from the manager.
+        ConditionsRecordCollection records = ConditionsRecord.find(manager, name);
+
+        // Loop over ConditionsRecords.  For this particular type of condition, multiple
+        // sets of bad channels are possible.
+        for (ConditionsRecord record : records) {
+        
+            // Get the table name, field name, and field value defining the
+            // applicable conditions.
+            String tableName = record.getTableName();
+            String fieldName = record.getFieldName();
+            int fieldValue = record.getFieldValue();
+
+            // Query for getting back bad channel records.
+            String query = "SELECT svt_channel_id FROM " + tableName + " WHERE " 
+                    + fieldName + " = " + fieldValue + " ORDER BY id ASC";
+            ResultSet resultSet = ConnectionManager.getConnectionManager().query(query);
+            
+            // Loop over the records.
+            try {
+                while (resultSet.next()) {
+                    int channelId = resultSet.getInt(1);
+                    badChannels.add(channelId);
+                }
+            } catch (SQLException x) {
+                throw new RuntimeException(x);
+            } 
+        }
+               
+        return badChannels;
+    }
+
+    /**
+     * Get the type handled by this converter.
+     * 
+     * @return The type handled by this converter.
+     */
+    public Class<SvtBadChannelCollection> getType() {
+        return SvtBadChannelCollection.class;
+    }
+}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

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