Commit in hps-java/src/main/java/org/lcsim/hps on MAIN
conditions/ConditionsRecordConverter.java+5-91.3 -> 1.4
          /ConnectionManager.java+36-271.4 -> 1.5
          /DatabaseConditionsReader.java+5-11.17 -> 1.18
conditions/ecal/EcalConditions.java+51.5 -> 1.6
conditions/svt/SvtConditionsLoader.java+1041.9 -> 1.10
              /SvtChannelMapConverter.java+4-91.3 -> 1.4
              /SvtConditions.java+33-31.8 -> 1.9
              /SvtConditionsConverter.java+7-21.1 -> 1.2
              /SvtDaqMap.java+51-151.1 -> 1.2
              /SvtGainConverter.java+9-181.3 -> 1.4
recon/tracking/gbl/TruthResiduals.java+2-11.4 -> 1.5
+261-85
11 modified files
miscellaneous changes that probably should have been in previous checkins (oops)

hps-java/src/main/java/org/lcsim/hps/conditions
ConditionsRecordConverter.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ConditionsRecordConverter.java	4 Oct 2013 06:02:19 -0000	1.3
+++ ConditionsRecordConverter.java	11 Oct 2013 00:07:24 -0000	1.4
@@ -9,7 +9,7 @@
 /**
  * Read ConditionsRecord objects from the conditions database.  
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ConditionsRecordConverter.java,v 1.3 2013/10/04 06:02:19 jeremy Exp $
+ * @version $Id: ConditionsRecordConverter.java,v 1.4 2013/10/11 00:07:24 jeremy Exp $
  */
 public class ConditionsRecordConverter extends DatabaseConditionsConverter<ConditionsRecordCollection> {
            
@@ -31,19 +31,17 @@
         ConditionsRecordCollection records = new ConditionsRecordCollection();
         
         ConnectionManager connectionManager = this.getConnectionManager();
-        String database = connectionManager.getConnectionParameters().getDatabase();
         String tableName = connectionManager.getConnectionParameters().getConditionsTable();
-        Connection connection = connectionManager.createConnection();
         
         String query = "SELECT * from " 
-                + database + "." + tableName
+                + tableName
                 + " WHERE "
                 + "run_start <= "
                 + manager.getRun()
                 + " AND run_end >= "
                 + manager.getRun();
                
-        ResultSet resultSet = connectionManager.query(connection, query);
+        ResultSet resultSet = connectionManager.query(query);
         
         try {
             while(resultSet.next()) {                  
@@ -53,10 +51,8 @@
             }            
         } catch (SQLException x) {
             throw new RuntimeException("Database error", x);
-        } finally {
-            connectionManager.cleanup(resultSet);
-            connectionManager.cleanup(connection);
-        }
+        } 
+        
         return records;
     }
 

hps-java/src/main/java/org/lcsim/hps/conditions
ConnectionManager.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ConnectionManager.java	4 Oct 2013 06:02:19 -0000	1.4
+++ ConnectionManager.java	11 Oct 2013 00:07:24 -0000	1.5
@@ -11,42 +11,43 @@
 import java.util.Properties;
 
 /**
- * This class provides various database utilities for the conditions system,
- * primarily the converter classes.
+ * This class provides various database utilities for the conditions system, primarily the
+ * converter classes.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public class ConnectionManager {
-    
+
     private ConnectionParameters connectionParameters = new ConnectionParameters();
     private static ConnectionManager instance = null;
-        
+    private Connection connection = null;
+
     /**
      * Class constructor which is private so singleton must be used.
      */
     private ConnectionManager() {
-    	setupFromProperties();
+        setupFromProperties();
     }
-    
+
     /**
      * Get the singleton instance of this class.
      * @return The instance of this class.
      */
     public static ConnectionManager getConnectionManager() {
-    	if (instance == null) {
-    		instance = new ConnectionManager();
-    	}
-    	return instance;
+        if (instance == null) {
+            instance = new ConnectionManager();
+        }
+        return instance;
     }
-        
+
     /**
-     * Set the connection parameters.  
+     * Set the connection parameters.
      * @param connectionParameters The connection parameters.
      */
     void setConnectionParameters(ConnectionParameters connectionParameters) {
         this.connectionParameters = connectionParameters;
     }
-    
+
     /**
      * Get the connection parameters.
      * @return The connection parameters.
@@ -54,16 +55,21 @@
     public ConnectionParameters getConnectionParameters() {
         return connectionParameters;
     }
-    
+
     /**
      * Create a connection to the database.
      * @return The database connection.
      */
-    public Connection createConnection() {
-    	Connection newConnection = connectionParameters.createConnection();
-    	return newConnection;
+    Connection createConnection() {
+        Connection newConnection = connectionParameters.createConnection();
+        try {
+            newConnection.createStatement().execute("USE " + connectionParameters.getDatabase());
+        } catch (SQLException e) {
+            throw new RuntimeException("Failed to connect to database.", e);
+        }
+        return newConnection;
     }
-    
+
     /**
      * Cleanup a connection.
      * @param connection The Connection to cleanup.
@@ -80,7 +86,7 @@
             }
         }
     }
-    
+
     /**
      * Cleanup a result set, or the Statement connected to it.
      * @param resultSet The ResultSet to cleanup.
@@ -90,7 +96,7 @@
             try {
                 // This should close the ResultSet itself, too.
                 Statement statement = resultSet.getStatement();
-                if (statement != null) 
+                if (statement != null)
                     if (!statement.isClosed())
                         statement.close();
                     else
@@ -102,14 +108,13 @@
     }
 
     /**
-     * This method can be used to perform a database query.
-     * Caller should then execute the methods {@link #cleanup(ResultSet)}
-     * and {@link #cleanup(Connection)} to cleanly close down the 
-     * statement and connection after results are processed.
+     * This method can be used to perform a database query. 
      * @param query The SQL query string.
      * @return The ResultSet from the query or null.
      */
-    public ResultSet query(Connection connection, String query) {
+    public ResultSet query(String query) {
+        if (connection == null)
+            connection = createConnection();
         ResultSet result = null;
         try {
             Statement statement = connection.createStatement();
@@ -119,11 +124,15 @@
         }
         return result;
     }
-        
+    
+    public void disconnect() {
+        cleanup(connection);
+    }
+
     /**
      * Setup the object from a properties file.
      */
-    private void setupFromProperties() {        
+    private void setupFromProperties() {
         Object obj = System.getProperties().get("hps.conditions.db.configuration");
         if (obj != null) {
             String config = obj.toString();

hps-java/src/main/java/org/lcsim/hps/conditions
DatabaseConditionsReader.java 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- DatabaseConditionsReader.java	9 Oct 2013 22:31:53 -0000	1.17
+++ DatabaseConditionsReader.java	11 Oct 2013 00:07:24 -0000	1.18
@@ -20,6 +20,7 @@
 import org.lcsim.hps.conditions.svt.SvtCalibrationConverter;
 import org.lcsim.hps.conditions.svt.SvtChannelMapConverter;
 import org.lcsim.hps.conditions.svt.SvtConditionsConverter;
+import org.lcsim.hps.conditions.svt.SvtDaqMapConverter;
 import org.lcsim.hps.conditions.svt.SvtGainConverter;
 
 /**
@@ -47,7 +48,7 @@
  * </p>
  * 
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: DatabaseConditionsReader.java,v 1.17 2013/10/09 22:31:53 jeremy Exp $ 
+ * @version $Id: DatabaseConditionsReader.java,v 1.18 2013/10/11 00:07:24 jeremy Exp $ 
  */
 public class DatabaseConditionsReader extends ConditionsReader {
         
@@ -214,6 +215,9 @@
         // SVT channel map.
         manager.registerConditionsConverter(new SvtChannelMapConverter());
         
+        // SVT DAQ map.
+        manager.registerConditionsConverter(new SvtDaqMapConverter());
+        
         // SVT calibrations.
         manager.registerConditionsConverter(new SvtCalibrationConverter());
         

hps-java/src/main/java/org/lcsim/hps/conditions/ecal
EcalConditions.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- EcalConditions.java	4 Oct 2013 01:43:47 -0000	1.5
+++ EcalConditions.java	11 Oct 2013 00:07:24 -0000	1.6
@@ -66,6 +66,11 @@
     public String toString() {
         StringBuffer buff = new StringBuffer();
         
+        buff.append('\n');
+        buff.append("Printing ECAL conditions ...");
+        buff.append('\n');
+        buff.append('\n');
+        
         // Table header:
         buff.append("id");
         buff.append("    ");

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtConditionsLoader.java 1.9 -> 1.10
diff -N SvtConditionsLoader.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SvtConditionsLoader.java	11 Oct 2013 00:07:24 -0000	1.10
@@ -0,0 +1,104 @@
+package org.lcsim.hps.conditions.svt;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
+import org.lcsim.geometry.Detector;
+import org.lcsim.hps.util.Pair;
+
+/**
+ * Load {@link SvtConditions} data onto a detector.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class SvtConditionsLoader {
+    
+    /**
+     * Load conditions data onto a detector object.
+     * This method is analogous to {@link org.lcsim.hps.recon.tracking.SvtUtils#setup(Detector)}.
+     * @param detector The detector object.
+     * @param conditions The conditions object.
+     */
+    public void load(Detector detector, SvtConditions conditions) {
+        List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
+        SvtChannelMap channelMap = conditions.getChannelMap();
+        
+        // Loop over sensors.
+        for (HpsSiSensor sensor : sensors) {
+        
+            // Get the sensor identifier helper in order to decode the id fields
+            SiTrackerIdentifierHelper sensorHelper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
+
+            // Get the sensor identifier
+            IIdentifier sensorId = sensor.getIdentifier();
+            
+            // Get the sensor layer and module id
+            int layerNumber = sensorHelper.getLayerValue(sensorId);
+            int moduleNumber = sensorHelper.getModuleValue(sensorId);
+                    
+            // Set the top or bottom flag on sensor.
+            setSensorTopBottom(sensor, moduleNumber);
+            
+            if (sensor.isTopLayer()) {
+                
+            } else {
+                
+            }
+        
+            // TODO: Load additional conditions onto Detector here. (Omar)
+            
+            //
+            // From SvtUtils:
+            //
+            /*
+            switch (module % 2) {
+            case 0:
+                listPosition = module / 2;
+                // If the top layer DAQ map doesn't contain the layer, add it
+                if (!topLayerDaqMap.containsKey(layer)) {
+                    topLayerDaqMap.put(layer, new ArrayList<Pair<Integer, Integer>>());
+                }
+                this.printDebug("\tAdding FPGA: " + daqPair.getFirstElement() + ", Hybrid: " + daqPair.getSecondElement() + " to position: " + listPosition);
+                // Add the DAQ pair to the corresponding layer
+                topLayerDaqMap.get(layer).add(listPosition, daqPair);
+                
+                // If the top layer sensor map doesn't contain the layer, add it
+                if (!topLayerToSensor.containsKey(layer)) {
+                    topLayerToSensor.put(layer, new ArrayList<SiSensor>());
+                }
+                // Create room within the sensor map for the sensor
+                topLayerToSensor.get(layer).add(null);
+                break;
+            case 1:
+                listPosition = (module - 1) / 2;
+                if (!bottomLayerDaqMap.containsKey(layer)) {
+                    bottomLayerDaqMap.put(layer, new ArrayList<Pair<Integer, Integer>>());
+                }
+                this.printDebug("\tAdding FPGA: " + daqPair.getFirstElement() + ", Hybrid: " + daqPair.getSecondElement() + " to position: " + listPosition);
+                bottomLayerDaqMap.get(layer).add(listPosition, daqPair);
+                if (!bottomLayerToSensor.containsKey(layer)) {
+                    bottomLayerToSensor.put(layer, new ArrayList<SiSensor>());
+                }
+                bottomLayerToSensor.get(layer).add(null);
+                break;
+            default:
+                throw new RuntimeException("Invalid module number: " + module);
+                */                    
+        }
+    }
+
+    private static void setSensorTopBottom(HpsSiSensor sensor, int moduleNumber) {
+        // Module 0 & 2 correspond to sensors which lie in the top SVT volume            
+        if (moduleNumber == 0 || moduleNumber == 2) {
+            sensor.setTopLayer(true);
+        // Module 1 & 3 correspond to sensors which lie in the bottom SVT volume
+        } else if (moduleNumber == 1 || moduleNumber == 3) {
+            sensor.setTopLayer(false);
+        } else {
+            throw new RuntimeException("Invalid module number <" + moduleNumber + "> for sensor <" + sensor.getName() + ">");
+        }
+    }
+}

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtChannelMapConverter.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- SvtChannelMapConverter.java	4 Oct 2013 06:02:19 -0000	1.3
+++ SvtChannelMapConverter.java	11 Oct 2013 00:07:24 -0000	1.4
@@ -26,20 +26,18 @@
         // Objects for building the return value.
         SvtChannelMap channels = new SvtChannelMap();
 
+        // Get the connection manager.
         ConnectionManager connectionManager = getConnectionManager();
-        Connection connection = connectionManager.createConnection();
-
-        String database = connectionManager.getConnectionParameters().getDatabase();
 
         // Assign default key name for channel data if none given.
         if (name == null)
             name = SVT_CHANNELS;
 
         // Construct the query to get the channel data.
-        String query = "SELECT id, fpga, hybrid, channel FROM " + database + "." + name;
+        String query = "SELECT id, fpga, hybrid, channel FROM " + name;
 
         // Execute the query and get the results.
-        ResultSet resultSet = connectionManager.query(connection, query);
+        ResultSet resultSet = connectionManager.query(query);
 
         try {
             // Loop over records.
@@ -54,10 +52,7 @@
             }
         } catch (SQLException x) {
             throw new RuntimeException("Database error.", x);
-        } finally {
-            connectionManager.cleanup(resultSet);
-            connectionManager.cleanup(connection);
-        }
+        } 
         return channels;
     }
 

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtConditions.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- SvtConditions.java	4 Oct 2013 01:43:48 -0000	1.8
+++ SvtConditions.java	11 Oct 2013 00:07:24 -0000	1.9
@@ -11,12 +11,13 @@
  * 
  * @author Omar Moreno <[log in to unmask]>
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: SvtConditions.java,v 1.8 2013/10/04 01:43:48 jeremy Exp $
+ * @version $Id: SvtConditions.java,v 1.9 2013/10/11 00:07:24 jeremy Exp $
  */
 public class SvtConditions {
     
     private Map<SvtChannel, ChannelConstants> channelData = new HashMap<SvtChannel, ChannelConstants>();
     private SvtChannelMap channelMap = null;
+    private SvtDaqMap daqMap = null;
     
     /**
      * Class constructor, which takes a channel map.
@@ -53,14 +54,36 @@
     public SvtChannelMap getChannelMap() {
         return channelMap;
     }
+    
+    /**
+     * Get the {@link SvtDaqMap} associated with these conditions.
+     * @return The SVT DAQ map.
+     */
+    public SvtDaqMap getDaqMap() {
+        return daqMap;
+    }
+    
+    /**
+     * Set the {@link SvtDaqMap} associated with these conditions.
+     * @param daqMap The SVT DAQ map.
+     */
+    void setDaqMap(SvtDaqMap daqMap) {
+        this.daqMap = daqMap;
+    }
             
     /**
      * Convert this object to a human readable string.  This method prints a formatted table 
-     * independently of how its member objects implement their string conversion.
-     * @return This object converted to a string.
+     * independently of how its member objects implement their string conversion. 
+     * @return This object converted to a string, without the DAQ map.
      */
     public String toString() {
         StringBuffer buff = new StringBuffer();
+        
+        buff.append('\n');
+        buff.append("Printing SVTConditions ...");
+        buff.append('\n');
+        buff.append('\n');
+        
         // Table header:
         buff.append("id");
         buff.append("     ");
@@ -118,6 +141,13 @@
             
             buff.append('\n');                                  
         }
+        
+        buff.append('\n');
+        buff.append("Printing SVT DAQ Map...");
+        buff.append('\n');
+        buff.append('\n');
+        buff.append(getDaqMap());
+        
         return buff.toString();
     }
 }

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtConditionsConverter.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SvtConditionsConverter.java	9 Oct 2013 21:00:30 -0000	1.1
+++ SvtConditionsConverter.java	11 Oct 2013 00:07:24 -0000	1.2
@@ -5,6 +5,7 @@
 import static org.lcsim.hps.conditions.ConditionsConstants.SVT_CHANNELS;
 import static org.lcsim.hps.conditions.ConditionsConstants.SVT_GAINS;
 import static org.lcsim.hps.conditions.ConditionsConstants.SVT_PULSE_PARAMETERS;
+import static org.lcsim.hps.conditions.ConditionsConstants.SVT_DAQ_MAP;
 
 import java.util.Map.Entry;
 
@@ -19,7 +20,7 @@
 public class SvtConditionsConverter extends DatabaseConditionsConverter<SvtConditions> {
                      
     /**
-     * Load and return the composite SVT conditions object.  
+     * Create and return the SVT conditions object.  
      * @param manager The current conditions manager.
      * @param name The conditions key, which is ignored for now.
      */
@@ -28,8 +29,12 @@
         // Get the SVT channel map.
         SvtChannelMap channels = manager.getCachedConditions(SvtChannelMap.class, SVT_CHANNELS).getCachedData();
         
-        // Reset the conditions object.
+        // Create the conditions object.
         SvtConditions conditions = new SvtConditions(channels);
+        
+        // Create the DAQ map.
+        SvtDaqMap daqMap = manager.getCachedConditions(SvtDaqMap.class, SVT_DAQ_MAP).getCachedData();
+        conditions.setDaqMap(daqMap);
                                                
         // Add calibrations by channel.
         SvtCalibrationCollection calibrations = manager.getCachedConditions(SvtCalibrationCollection.class, SVT_CALIBRATIONS).getCachedData();

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtDaqMap.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SvtDaqMap.java	10 Oct 2013 21:41:10 -0000	1.1
+++ SvtDaqMap.java	11 Oct 2013 00:07:24 -0000	1.2
@@ -1,6 +1,7 @@
 package org.lcsim.hps.conditions.svt;
 
 import java.util.HashMap;
+import java.util.Map;
 
 import org.lcsim.hps.util.Pair;
 
@@ -13,46 +14,81 @@
 public class SvtDaqMap {
 
     /**
-     * Flag for top or bottom half of detector.
+     * Flag values for top or bottom half.
+     * FIXME: This should probably be an enum but it is simpler to use int values for now.  
      */
-    enum Half {
-        TOP,
-        BOTTOM
-    }
-  
+    static final int TOP = 0;
+    static final int BOTTOM = 1;    
+      
     /**
      * This is the data structure used for the mapping of layer numbers to DAQ pair by top or bottom half.
+     * The mapping is the following: half => layer => pair(fpga, hybrid)
      */
-    static private class LayerMap extends HashMap<Half,HashMap<Integer,Pair<Integer,Integer>>> {        
+    @SuppressWarnings("serial")
+    static private class LayerMap extends HashMap<Integer,HashMap<Integer,Pair<Integer,Integer>>> {        
     }
-            
+     
+    /**
+     * Object that holds the DAQ map data.
+     */
     LayerMap layerMap = new LayerMap();
     
     /**
      * Class constructor.
      */
     SvtDaqMap() {
-        layerMap.put(Half.TOP, new HashMap<Integer,Pair<Integer,Integer>>());
-        layerMap.put(Half.BOTTOM, new HashMap<Integer,Pair<Integer,Integer>>());
+        layerMap.put(TOP, new HashMap<Integer,Pair<Integer,Integer>>());
+        layerMap.put(BOTTOM, new HashMap<Integer,Pair<Integer,Integer>>());
     }
      
     /**
      * Add a record to the DAQ map.
-     * @param half The value for top or bottom.
+     * @param half The value indicating top or bottom half of the detector.
      * @param layerNumber The layer number.
      */
-    void add(Half half, int layerNumber, Pair<Integer,Integer> pair) {
+    void add(int half, int layerNumber, Pair<Integer,Integer> pair) {
         layerMap.get(half).put(layerNumber, pair);
     }
     
     /**
      * Get a DAQ pair (FPGA, hybrid) by layer number.
-     * @param half Value indicating top or bottom half.
+     * @param half Value indicating top or bottom half of detector.
      * @param layerNumber The layer number.
-     * @return The DAQ pair or null if does not exist.
+     * @return The DAQ pair for the half and layer number or null if does not exist.
      */
-    Pair<Integer,Integer> get(Half half, int layerNumber) {
+    Pair<Integer,Integer> get(int half, int layerNumber) {
         return layerMap.get(half).get(layerNumber);
     }    
     
+    /**
+     * Convert this object to a string.
+     * @return This object converted to a string.
+     */
+    public String toString() {
+        StringBuffer buff = new StringBuffer();
+        buff.append("half");
+        buff.append(" ");
+        buff.append("layer");
+        buff.append(" ");
+        buff.append("fpga");
+        buff.append(" ");
+        buff.append("hybrid");
+        buff.append('\n');
+        buff.append("----------------------");
+        buff.append('\n');
+        for (int half : layerMap.keySet()) {
+            Map<Integer,Pair<Integer,Integer>> map = layerMap.get(half);
+            for (Map.Entry<Integer, Pair<Integer,Integer>> entry : map.entrySet()) {
+                buff.append(half);
+                buff.append("    ");
+                buff.append(String.format("%-2d", entry.getKey()));
+                buff.append("    ");                
+                buff.append(entry.getValue().getFirstElement());
+                buff.append("    ");
+                buff.append(entry.getValue().getSecondElement());
+                buff.append('\n');
+            }
+        }        
+        return buff.toString();
+    }    
 }

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtGainConverter.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- SvtGainConverter.java	4 Oct 2013 06:02:19 -0000	1.3
+++ SvtGainConverter.java	11 Oct 2013 00:07:24 -0000	1.4
@@ -1,6 +1,5 @@
 package org.lcsim.hps.conditions.svt;
 
-import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
@@ -12,7 +11,7 @@
 /**
  * This class creates a {@link SvtGainCollection} from the conditions database.
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: SvtGainConverter.java,v 1.3 2013/10/04 06:02:19 jeremy Exp $
+ * @version $Id: SvtGainConverter.java,v 1.4 2013/10/11 00:07:24 jeremy Exp $
  */
 public class SvtGainConverter extends DatabaseConditionsConverter<SvtGainCollection> {
     
@@ -31,7 +30,7 @@
     public SvtGainCollection getData(ConditionsManager manager, String name) {
         
         // Get the ConditionsRecord with the meta-data, which will use the current run number from the manager.
-        ConditionsRecord record = ConditionsRecord.find(manager, name);
+        ConditionsRecord record = ConditionsRecord.find(manager, name).get(0);
                
         // Get the table name, field name, and field value defining the applicable conditions.
         String tableName = record.getTableName();
@@ -41,25 +40,19 @@
         // Objects for building the return value.
         SvtGainCollection collection = new SvtGainCollection();
         
-        // Get a connection from the manager.
+        // Get the connection manager.
         ConnectionManager connectionManager = ConnectionManager.getConnectionManager();
-        Connection connection = connectionManager.createConnection();
-                                                            
-        // Get the name of the current database being used.
-        String database = connectionManager.getConnectionParameters().getDatabase();
-                                
+                                                                                            
         // Construct the query to find matching calibration records using the ID field.
         String query = "SELECT svt_channel_id, gain, offset FROM "
-                + database + "." + tableName 
-                + " WHERE "
-                + fieldName + " = " + fieldValue
+                + tableName + " WHERE " + fieldName + " = " + fieldValue
                 + " ORDER BY svt_channel_id ASC";
             
         // Execute the query and get the results.
-        ResultSet resultSet = connectionManager.query(connection, query);
-       
+        ResultSet resultSet = connectionManager.query(query);
+               
         try {
-            // Loop over the gain records.
+            // Loop over the gain records.            
             while(resultSet.next()) {                                 
                 // Create the object with this channel's gain parameters.
                 int channelId = resultSet.getInt(1);
@@ -69,10 +62,8 @@
             }            
         } catch (SQLException x) {
             throw new RuntimeException("Database error.", x);
-        } finally {
-            connectionManager.cleanup(resultSet);
-            connectionManager.cleanup(connection);
         }
+        
         // Return collection of gain objects to caller.
         return collection;
     }

hps-java/src/main/java/org/lcsim/hps/recon/tracking/gbl
TruthResiduals.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- TruthResiduals.java	10 Oct 2013 23:43:46 -0000	1.4
+++ TruthResiduals.java	11 Oct 2013 00:07:24 -0000	1.5
@@ -138,7 +138,8 @@
                     
                     
                     
-                    SvtTrackExtrapolator extrapol = new SvtTrackExtrapolator(htfTruth.parameters());
+                    SvtTrackExtrapolator extrapol = null; 
+                    //= new SvtTrackExtrapolator(htfTruth.parameters());
                     Hep3Vector trkposExtraPolator = extrapol.extrapolateTrack(simHitPosTracking.x());
                     //System.out.printf("trkposextrapol (det) %s\n",trkposExtraPolator.toString());
                     
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