Commit in hps-java/src on MAIN
main/java/org/lcsim/hps/conditions/ConditionsConstants.java+4-11.3 -> 1.4
main/java/org/lcsim/hps/conditions/svt/SvtUtils.java+628added 1.1
                                      /SvtConditionsLoader.java+3-41.4 -> 1.5
test/java/org/lcsim/hps/conditions/ecal/EcalConditionsLoaderTest.java+1-11.1 -> 1.2
+636-6
1 added + 3 modified, total 4 files
make a copy of SvtUtils class for conditions package and change to use daq map from the db

hps-java/src/main/java/org/lcsim/hps/conditions
ConditionsConstants.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ConditionsConstants.java	1 Oct 2013 01:22:33 -0000	1.3
+++ ConditionsConstants.java	2 Oct 2013 17:57:59 -0000	1.4
@@ -19,8 +19,11 @@
     /** Conditions key for ECal calibration information. */
     public static final String ECAL_CALIBRATIONS = "ecal_calibrations";
     
-    /** Table with SVT channel data. */
+    /** Conditions key for SVT channel data. */
     public static final String SVT_CHANNELS = "svt_channels";
+    
+    /** Conditions key for the SVT DAQ map. */
+    public static final String SVT_DAQ_MAP = "svt_daq_map";
             
     /** Conditions key for SVT calibration data. */ 
     public static final String SVT_CALIBRATIONS = "svt_calibrations";

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtUtils.java added at 1.1
diff -N SvtUtils.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SvtUtils.java	2 Oct 2013 17:57:59 -0000	1.1
@@ -0,0 +1,628 @@
+package org.lcsim.hps.conditions.svt;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+import org.lcsim.detector.tracker.silicon.ChargeCarrier;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
+import org.lcsim.geometry.Detector;
+import org.lcsim.hps.conditions.ConditionsConstants;
+import org.lcsim.hps.conditions.ConnectionManager;
+import org.lcsim.hps.recon.tracking.StereoPair;
+import org.lcsim.hps.util.Pair;
+
+
+/**
+ * A class providing various utilities related to the HPS SVT. 
+ *
+ * @author Omar Moreno <[log in to unmask]>
+ * @version $Id: SvtUtils.java,v 1.1 2013/10/02 17:57:59 jeremy Exp $
+ */
+public class SvtUtils {
+
+    private static SvtUtils INSTANCE = null;
+    // Set of sensors
+    private Set<SiSensor> sensors = new HashSet<SiSensor>();
+    // Set of stereo pairs
+    private Set<StereoPair> stereoPairs = new HashSet<StereoPair>(); 
+    // Map from Sensor to Hybrid/FPGA pair
+    private Map<SiSensor /* sensor */, Pair<Integer /* FPGA */, Integer /* Hybrid */>> sensorToDaqPair = new HashMap<SiSensor, Pair<Integer, Integer>>();
+    // Map from Hybrid/FPGA pair
+    private Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, SiSensor /* Sensor*/> daqPairToSensor = new HashMap<Pair<Integer, Integer>, SiSensor>();
+    // Map from SVT top layer to Hybrid/FPGA pair
+    private Map<Integer /* Layer */, List<Pair<Integer /* FPGA */, Integer /* Hybrid */>>> topLayerDaqMap = new HashMap<Integer, List<Pair<Integer, Integer>>>();
+    // Map from SVT bottom layer to Hybrid/FPGA pair
+    private Map<Integer /* Layer # */, List<Pair<Integer /* FPGA */, Integer /* Hybrid */>>> bottomLayerDaqMap = new HashMap<Integer, List<Pair<Integer, Integer>>>();
+    // Map sensor to an SVT top layer
+    private Map<SiSensor /* Sensor */, Integer /* Layer */> sensorToTopLayer = new HashMap<SiSensor, Integer>();
+    // Map sensor to an SVT bottom layer
+    private Map<SiSensor /* Sensor */, Integer /* Layer */> sensorToBottomLayer = new HashMap<SiSensor, Integer>();
+    // Map sensor to descriptor
+    private Map<SiSensor /* Sensor */, String /* Description */> sensorToDescriptor = new HashMap<SiSensor, String>();
+    // Map layer to top SVT sensor 
+    private Map<Integer /* Layer */, List<SiSensor> /* Sensor */> topLayerToSensor = new HashMap<Integer, List<SiSensor>>();
+    // Map layer to bottom SVT sensor
+    private Map<Integer /* Layer */, List<SiSensor> /* Sensor */> bottomLayerToSensor = new HashMap<Integer, List<SiSensor>>();
+    private SiSensor[][] sensorArray;
+    private IIdentifierHelper helper;
+    String subdetectorName = "Tracker";
+    ConditionsManager manager = ConditionsManager.defaultInstance();
+    int maxModuleNumber = 0;
+    int maxPlaneNumber = 0;
+    private Set<Integer> fpgaNumbers = new HashSet<Integer>();
+    private boolean isSetup = false;
+    boolean debug = true;
+
+    /*
+     * Private ctor to keep user from instantiating 
+     */
+    private SvtUtils() {
+    }
+
+    /**
+     * 
+     */
+    public static SvtUtils getInstance() {
+
+        // Use lazy instantiation
+        if (INSTANCE == null) {
+        	System.out.println("making new SvtUtils instance");
+            INSTANCE = new SvtUtils();
+        }
+        return INSTANCE;
+    }
+
+    /**
+     * @return true if all maps have been loaded, false otherwise
+     */
+    public boolean isSetup() {
+        return isSetup;
+    }
+
+    /**
+     * Get the plane number to which the sensor belongs to. This is does not 
+     * return the SVT layer number.
+     * 
+     * @param sensor
+     * @return The layer number
+     */
+    // TODO: Change the name to clarify that what is being returned is the plane number
+    public int getLayerNumber(SiSensor sensor) {
+        if (sensorToTopLayer.containsKey(sensor)) {
+            return sensorToTopLayer.get(sensor);
+        } else if (sensorToBottomLayer.containsKey(sensor)) {
+            return sensorToBottomLayer.get(sensor);
+        } else {
+            throw new RuntimeException("The sensor " + sensor.getName() 
+            								+ " does not have an associated plane number");
+        }
+    }
+
+    /**
+     * Checks if a sensor is part of the top SVT volume.
+     *
+     * @return true if it is, false if it belongs to the bottom volume
+     */
+    public boolean isTopLayer(SiSensor sensor) {
+        if (sensorToTopLayer.containsKey(sensor)) {
+            return true;
+        } else if (sensorToBottomLayer.containsKey(sensor)) {
+            return false;
+        } else {
+            throw new RuntimeException("There is no layer associated with sensor " + sensor.getName());
+        }
+    }
+
+    /**
+     * Checks if the orientation of the sensor is axial.
+     * 
+     *  @return true if it is, false if it is a stereo sensor
+     */
+    public boolean isAxial(SiSensor sensor) {
+        if (this.isTopLayer(sensor) && this.getLayerNumber(sensor) % 2 == 1) {
+            return true;
+        } else if (!this.isTopLayer(sensor) && this.getLayerNumber(sensor) % 2 == 0) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Get a sensor by its plane and module id.
+     * 
+     *  @param moduleNumber : module id
+     *  @param planeNumber : layer (plane) id
+     *  @return sensor 
+     */
+    public SiSensor getSensor(int moduleNumber, int planeNumber) {
+        if (moduleNumber < 0 || moduleNumber >= maxModuleNumber) {
+            throw new RuntimeException("Module number " + moduleNumber + " is out of range!");
+        } else if (planeNumber <= 0 || planeNumber > maxPlaneNumber) {
+            throw new RuntimeException("Plane number " + planeNumber + " is out of range!");
+        }
+        return sensorArray[moduleNumber][planeNumber];
+    }
+
+    /**
+     * Get a sensor by its FPGA and hybrid number.
+     * 
+     *  @param daqPair : a Pair of the form Pair<FPGA number, hybrid number>
+     *  @return sensor
+     */
+    public SiSensor getSensor(Pair<Integer, Integer> daqPair) {
+        return daqPairToSensor.get(daqPair);
+    }
+
+    /**
+     * Get a sensor from the top SVT volume by its plane number and sensor 
+     * position within a plane.
+     * 
+     *  @param planeNumber
+     *  @param sensorNumber : position within a plane
+     *  @return sensor or null if the sensor doesn't exist in that position
+     */
+    public SiSensor getTopSensor(int planeNumber, int sensorNumber) {
+    	if(topLayerToSensor.get(planeNumber).size() <= sensorNumber) return null;
+        return topLayerToSensor.get(planeNumber).get(sensorNumber);
+    }
+
+    /**
+     * Get a sensor from the bottom SVT volume by its plane number and sensor 
+     * position within a plane.
+     * 
+     *  @param planeNumber
+     *  @param sensorNumber : position within a plane
+     *  @return sensor or null if the sensor doesn't exist in that position
+     */
+    public SiSensor getBottomSensor(int layer, int sensorNumber) {
+    	if(bottomLayerToSensor.get(layer).size() <= sensorNumber) return null;
+        return bottomLayerToSensor.get(layer).get(sensorNumber);
+    }
+
+    /**
+     * Get the Set of all sensors which compose the SVT.
+     * 
+     *  @return set of sensors
+     */
+    public Set<SiSensor> getSensors() {
+        return sensors;
+    }
+
+    /**
+     * Get the Set of all FPGA numbers. 
+     * 
+     * @return set of FPGA numbers
+     */
+    public Set<Integer> getFpgaNumbers() {
+        return fpgaNumbers;
+    }
+
+    /**
+     * Get the FPGA number associated with a sensor.
+     * 
+     * @return FPGA number
+     */
+    public int getFPGA(SiSensor sensor) {
+        return sensorToDaqPair.get(sensor).getFirstElement();
+    }
+
+    /**
+     * Get the hybrid number associated with a sensor.
+     * 
+     * @return hybrid number
+     */
+    public int getHybrid(SiSensor sensor) {
+        return sensorToDaqPair.get(sensor).getSecondElement();
+    }
+
+    public int getFPGACount() {
+        return 0;
+    }
+
+    /**
+     * Get the FPGA and hybrid number associated with a sensor as a pair of
+     * values.
+     * 
+     * @param sensor
+     * @return pair of the form Pair<FPGA, hybrid>
+     */
+    public Pair<Integer, Integer> getDaqPair(SiSensor sensor) {
+        return sensorToDaqPair.get(sensor);
+    }
+
+    /**
+     * Get the IIdentifierHelper associated with the SVT.
+     * 
+     * @return helper
+     */
+    public IIdentifierHelper getHelper() {
+        return helper;
+    }
+
+    /**
+     * Get a string describing a sensor.
+     * 
+     * @param sensor
+     * @return String describing a sensor
+     */
+    public String getDescription(SiSensor sensor) {
+        return this.sensorToDescriptor.get(sensor);
+    }
+
+    /**
+     * Make the cell ID for any channel on a sensor.
+     * 
+     * @param sensor
+     * @param channel : Physical channel number
+     * @return cell ID
+     */
+    public static long makeCellID(SiSensor sensor, int channel) {
+        int sideNumber;
+        if (sensor.hasElectrodesOnSide(ChargeCarrier.HOLE)) {
+            sideNumber = ChargeCarrier.HOLE.charge();
+        } else {
+            sideNumber = ChargeCarrier.ELECTRON.charge();
+        }
+        return sensor.makeStripId(channel, sideNumber).getValue();
+    }
+    
+    /**
+     * Get the set of all stereo pairs which compose the SVT.
+     * 
+     *  @return Set of stereo pairs
+     */
+    Set<StereoPair> getStereoPairs(){
+    	return stereoPairs; 
+    }
+
+    /**
+     * Creates and fill the various utility maps.
+     * 
+     * @param detector : The SVT detector being used
+     */
+    public void setup(Detector detector) {
+
+        this.printDebug("Method: setupMaps: \n\tDetector: " + detector.getDetectorName());
+
+        // Load the DAQ Map from the conditions database
+        //this.
+        loadSvtDaqMap();
+        
+        // Instantiate 'sensorArray' which allows for retrieval of a SiSensor
+        // by module and layer id
+        sensorArray = new SiSensor[maxModuleNumber + 1][maxPlaneNumber];
+
+        // Get all of the sensors composing the SVT and add them to the set of all sensors
+        IDetectorElement detectorElement = detector.getDetectorElement().findDetectorElement(subdetectorName);
+        helper = detectorElement.getIdentifierHelper();
+        sensors.addAll(detectorElement.findDescendants(SiSensor.class));
+        this.printDebug("\tTotal number of sensors: " + sensors.size());
+
+        IIdentifier sensorIdent;
+        SiTrackerIdentifierHelper sensorHelper;
+        String description;
+        // Loop through all of the sensors and fill the maps
+        for (SiSensor sensor : sensors) {
+
+            // Get the sensor identifier
+            sensorIdent = sensor.getIdentifier();
+
+            // Get the sensor identifier helper in order to decode the id fields
+            sensorHelper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
+
+            // Get the sensor layer and module id
+            int layerNumber = sensorHelper.getLayerValue(sensorIdent);
+            int moduleNumber = sensorHelper.getModuleValue(sensorIdent);
+            sensorArray[moduleNumber][layerNumber - 1] = sensor;
+            int listPosition = 0;
+            switch (moduleNumber % 2) {
+                // Top Layer
+            	case 0:
+                	
+                    listPosition = moduleNumber / 2;
+                    sensorToTopLayer.put(sensor, layerNumber);
+                    sensorToDaqPair.put( sensor, topLayerDaqMap.get(layerNumber).get(listPosition));
+                    topLayerToSensor.get(layerNumber).set(listPosition, sensor);
+                    daqPairToSensor.put(topLayerDaqMap.get(layerNumber).get(listPosition), sensor);
+                    description = "Top Layer " + layerNumber + " - Sensor " + listPosition;
+                    this.printDebug("\tDescription: " + description);
+                    sensorToDescriptor.put(sensor, description);
+                    break;
+                // Bottom Layer
+                case 1:
+                
+                	listPosition = (moduleNumber - 1) / 2;
+                    sensorToBottomLayer.put(sensor, layerNumber);
+                    sensorToDaqPair.put(sensor, bottomLayerDaqMap.get(layerNumber).get(listPosition));
+                    bottomLayerToSensor.get(layerNumber).set(listPosition, sensor);
+                    daqPairToSensor.put(bottomLayerDaqMap.get(layerNumber).get(listPosition), sensor);
+                    description = "Bottom Layer " + layerNumber + " - Sensor " + listPosition;
+                    this.printDebug("\tDescription: " + description);
+                    sensorToDescriptor.put(sensor, description);
+                    break;
+                default:
+                    throw new RuntimeException("Invalid module number: " + moduleNumber);
+            }
+        }
+        
+        // Create stereo pairs
+        this.createStereoPairs();
+        
+        isSetup = true;
+    }
+    
+    // FIXME: This logic should go inside a converter as with other conditions classes from db data.
+    private void loadSvtDaqMap(){ 
+    	
+    	// References to database objects.
+        Statement statement = null;
+        ResultSet resultSet = null;
+        Connection connection = null;
+        
+        try {
+            
+            // Get a connection from the manager.
+            connection = ConnectionManager.createConnection();
+            
+            // Get the name of the current database being used.
+            String database = ConnectionManager.getConnectionParameters().getDatabase();
+            
+            String query = "SELECT layer, module, fpga, hybrid FROM "  
+            		+ database  + "." + ConditionsConstants.SVT_DAQ_MAP;
+                                   
+            // Execute the query and get the results.
+            statement = connection.createStatement();
+            resultSet = statement.executeQuery(query);
+            
+            int listPosition = 0;
+            
+            System.out.println("adding SVT DAQ map info:");
+          
+            // Loop over the records.
+            while(resultSet.next()) {
+            	           	
+            	// Parse the line
+                int layer = resultSet.getInt(1);
+                int module = resultSet.getInt(2);
+                int fpga = resultSet.getInt(3);
+                int hybrid = resultSet.getInt(4);
+                
+                System.out.println("layer: " + layer + ", module: " + module + ", fpga: " + fpga + ", hybrid: " + hybrid);
+                
+                // Find the maximum layer number and module number.  This
+                // is used when instantiating 'sensorArray' and when creating
+                // stereo pairs.
+                maxModuleNumber = Math.max(maxModuleNumber, module);
+                maxPlaneNumber = Math.max(maxPlaneNumber, layer);
+               
+                // A pair is used to relate an FPGA value to a hybrid number
+                Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
+                fpgaNumbers.add(fpga);
+                
+                // Load the maps based on module number.
+                //
+                // Module 0 & 2 correspond to sensors which lie in the top SVT volume
+                // Module 1 & 3 correspond to sensors which lie in the bottom SVT volume
+                //
+                // A module number > 1 indicate that the sensor is part of a double layer.
+                // For the test run detector, all module numbers are either 0 or 1.
+                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);
+                }
+            }          
+        } catch (SQLException x) {
+            throw new RuntimeException("Database error.", x);
+        } finally {
+            // Cleanup the SQL statement.
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (Exception xx) {
+                	xx.printStackTrace();
+                }
+            }            
+            // Cleanup the connection.
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (Exception x) {
+                	x.printStackTrace();
+                }
+            }
+        }        
+    }
+
+    /**
+     * Load the SVT DAQ Map from the conditions database
+     * 
+     */
+    /*
+    private void loadSvtDaqMap(){ 
+    	
+    	// Path to file in conditions database
+        String filePath = "daqmap/svt_default.daqmap";
+        BufferedReader daqMapReader = null; 
+        String currentLine = null;
+        try {
+            daqMapReader = new BufferedReader(manager.getRawConditions(filePath).getReader());
+          
+            // Continue to read lines for the DAQ map until the end of file is 
+            // reached. The DAQ map is has the following format
+            //
+            //  layer   module   fpga   hybrid
+            // ---------------------------------
+            while ((currentLine = daqMapReader.readLine()) != null) {
+                
+            	// If the line is a comment,skip it
+                if (currentLine.indexOf("#") != -1) continue;
+               
+                // Split the line into tokens by whitespace
+                StringTokenizer stringTok = new StringTokenizer(currentLine);
+                int listPosition = 0;
+                while (stringTok.hasMoreTokens()) {
+                	
+                	// Parse the line
+                    int layer = Integer.valueOf(stringTok.nextToken());
+                    int module = Integer.valueOf(stringTok.nextToken());
+                    int fpga = Integer.valueOf(stringTok.nextToken());
+                    int hybrid = Integer.valueOf(stringTok.nextToken());
+                    
+                    // Find the maximum layer number and module number.  This
+                    // is used when instantiating 'sensorArray' and when creating
+                    // stereo pairs.
+                    maxModuleNumber = Math.max(maxModuleNumber, module);
+                    maxPlaneNumber = Math.max(maxPlaneNumber, layer);
+                   
+                    // A pair is used to relate an FPGA value to a hybrid number
+                    Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
+                    fpgaNumbers.add(fpga);
+                    
+                    // Load the maps based on module number.
+                    //
+                    // Module 0 & 2 correspond to sensors which lie in the top SVT volume
+                    // Module 1 & 3 correspond to sensors which lie in the bottom SVT volume
+                    //
+                    // A module number > 1 indicate that the sensor is part of a double layer.
+                    // For the test run detector, all module numbers are either 0 or 1.
+                    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);
+                    }
+                }
+            }
+            
+        } catch (IOException exception) {
+            throw new RuntimeException("Unable to load DAQ Map from " + filePath, exception);
+        }
+    }
+    */
+    
+    /**
+     * 
+     */
+    private void createStereoPairs(){
+    	
+    	// Loop through all the sensors in both top and bottom layers and
+    	// create stereo pairs. 
+    	SiSensor firstSensor = null;
+    	SiSensor secondSensor = null;
+    	int trackerLayer = 0; 
+    	
+    	// 
+    	for(int layerNumber = 1; layerNumber <= maxPlaneNumber; layerNumber+=2 ){
+    		for(int sensorNumber = 0; sensorNumber < (maxModuleNumber+1)/2; sensorNumber++){
+    			
+    			firstSensor = this.getTopSensor(layerNumber, sensorNumber);
+    			secondSensor = this.getTopSensor(layerNumber+1, sensorNumber);
+    			
+    			if(firstSensor == null || secondSensor == null) continue;
+    			
+    			trackerLayer = (layerNumber + 1)/2; 
+    			if(this.isAxial(firstSensor)){
+    				stereoPairs.add(new StereoPair(trackerLayer, StereoPair.detectorVolume.Top,  firstSensor, secondSensor));
+    			} else {
+    				stereoPairs.add(new StereoPair(trackerLayer, StereoPair.detectorVolume.Top, secondSensor, firstSensor));
+    			}
+    			
+    			firstSensor = this.getBottomSensor(layerNumber, sensorNumber);
+    			secondSensor = this.getBottomSensor(layerNumber+1, sensorNumber);
+    			
+    			if(firstSensor == null || secondSensor == null) continue;
+    			
+    			if(this.isAxial(firstSensor)){
+    				stereoPairs.add(new StereoPair(trackerLayer, StereoPair.detectorVolume.Bottom, firstSensor, secondSensor));
+    			} else {
+    				stereoPairs.add(new StereoPair(trackerLayer, StereoPair.detectorVolume.Bottom, secondSensor, firstSensor));
+    			}
+    		}
+    	}
+    	
+    	this.printDebug("Total number of stereo pairs created: " + stereoPairs.size());
+    	for(StereoPair stereoPair : stereoPairs){
+    		this.printDebug(stereoPair.toString());
+    	}
+    }
+
+    /**
+     * Print a debug message 
+     * 
+     * @param debugMessage : message to be printed
+     */
+    private void printDebug(String debugMessage) {
+        if (debug) {
+            System.out.println(this.getClass().getSimpleName() + ": " + debugMessage);
+        }
+    }
+}

hps-java/src/main/java/org/lcsim/hps/conditions/svt
SvtConditionsLoader.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- SvtConditionsLoader.java	25 Sep 2013 22:36:53 -0000	1.4
+++ SvtConditionsLoader.java	2 Oct 2013 17:57:59 -0000	1.5
@@ -1,15 +1,14 @@
 package org.lcsim.hps.conditions.svt;
 
+import static org.lcsim.hps.conditions.ConditionsConstants.SVT_CALIBRATIONS;
+
 import java.util.Map.Entry;
 
 import org.lcsim.conditions.CachedConditions;
 import org.lcsim.conditions.ConditionsManager;
 import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.hps.recon.tracking.SvtUtils;
 import org.lcsim.hps.util.Pair;
 
-import static org.lcsim.hps.conditions.ConditionsConstants.SVT_CALIBRATIONS;
-
 /**
  * This class creates an {@link SvtConditions} object from the conditions database.
  */
@@ -45,7 +44,7 @@
             
             // Find the associated sensor for the FPGA and hybrid numbers.
             Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(channel.getFpga(), channel.getHybrid());
-            SiSensor sensor = util.getSensor(daqPair);
+            SiSensor sensor = util.getSensor(daqPair); 
 
             // Sensor must exist!
             if (sensor == null) {

hps-java/src/test/java/org/lcsim/hps/conditions/ecal
EcalConditionsLoaderTest.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- EcalConditionsLoaderTest.java	25 Sep 2013 22:14:24 -0000	1.1
+++ EcalConditionsLoaderTest.java	2 Oct 2013 17:57:59 -0000	1.2
@@ -5,7 +5,7 @@
 import org.lcsim.conditions.ConditionsManager;
 import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
 import org.lcsim.geometry.Detector;
-import org.lcsim.hps.recon.tracking.SvtUtils;
+import org.lcsim.hps.conditions.svt.SvtUtils;
 import org.lcsim.util.loop.LCSimConditionsManagerImplementation;
 
 public class EcalConditionsLoaderTest extends TestCase {
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