Author: [log in to unmask] Date: Wed Oct 29 23:38:17 2014 New Revision: 1339 Log: Update SvtT0Shift so it extends AbstractT0Shift and implements the getT0Shift method. The detector setup classes were updated to reflect changes made to the t0 shift classes. Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java ============================================================================= --- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java (original) +++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java Wed Oct 29 23:38:17 2014 @@ -98,7 +98,7 @@ } // Set the t0 shift for the sensor. - SvtT0Shift sensorT0Shift = t0Shifts.find(daqPair).get(0); + SvtT0Shift sensorT0Shift = t0Shifts.getT0Shift(daqPair); sensor.setT0Shift(sensorT0Shift.getT0Shift()); } } Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java ============================================================================= --- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java (original) +++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtT0Shift.java Wed Oct 29 23:38:17 2014 @@ -12,48 +12,39 @@ * @author Jeremy McCormick <[log in to unmask]> * @author Omar Moreno <[log in to unmask]> */ -public final class SvtT0Shift extends AbstractConditionsObject { +public final class SvtT0Shift extends AbstractSvtT0Shift { - public static class SvtT0ShiftCollection extends ConditionsObjectCollection<SvtT0Shift> { + public static class SvtT0ShiftCollection + extends AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<SvtT0Shift> { - SvtT0ShiftCollection find(Pair<Integer, Integer> pair) { - SvtT0ShiftCollection t0Shifts = new SvtT0ShiftCollection(); + @Override + public SvtT0Shift getT0Shift(Pair<Integer, Integer> pair) { int febID = pair.getFirstElement(); int febHybridID = pair.getSecondElement(); - for (SvtT0Shift timeShift : getObjects()) { - if (timeShift.getFebID() == febID && timeShift.getFebHybridID() == febHybridID) { - try { - t0Shifts.add(timeShift); - } catch (ConditionsObjectException e) { - throw new RuntimeException(e); - } + for (SvtT0Shift t0Shift : this.getObjects()) { + if (t0Shift.getFebID() == febID && t0Shift.getFebHybridID() == febHybridID) { + return t0Shift; } } - return t0Shifts; + return null; } } /** - * Get the FPGA number. - * @return The FPGA number. + * Get the FEB ID. + * + * @return The FEB ID. */ int getFebID() { return getFieldValue("feb_id"); } /** - * Get the hybrid number. - * @return The hybrid number. + * Get the FEB hybrid ID. + * + * @return The FEB hybrid ID. */ int getFebHybridID() { return getFieldValue("feb_hybrid_id"); } - - /** - * Get the time shift. - * @return The time shift. - */ - double getT0Shift() { - return getFieldValue("t0_shift"); - } } Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java ============================================================================= --- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java (original) +++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtDetectorSetup.java Wed Oct 29 23:38:17 2014 @@ -30,16 +30,12 @@ // Find sensor objects. List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class); - System.out.println("Total sensors found: " + sensors.size()); - TestRunSvtChannelCollection channelMap = conditions.getChannelMap(); TestRunSvtDaqMappingCollection daqMap = conditions.getDaqMap(); SvtT0ShiftCollection t0Shifts = conditions.getT0Shifts(); // Loop over sensors. for(HpsSiSensor sensor : sensors){ - - HpsTestRunSiSensor testRunSensor = (HpsTestRunSiSensor) sensor; // Reset possible existing conditions data on sensor. sensor.reset(); @@ -51,10 +47,10 @@ } // Set the FPGA ID of the sensor - testRunSensor.setFpgaID(daqPair.getFirstElement()); + ((HpsTestRunSiSensor) sensor).setFpgaID(daqPair.getFirstElement()); // Set the hybrid ID of the sensor - testRunSensor.setHybridID(daqPair.getSecondElement()); + ((HpsTestRunSiSensor) sensor).setHybridID(daqPair.getSecondElement()); // Set the orientation of the sensor String orientation = daqMap.getOrientation(daqPair); @@ -74,7 +70,6 @@ // Get conditions data for this channel. ChannelConstants constants = conditions.getChannelConstants(channel); int channelNumber = channel.getChannel(); - // // Set conditions data for this channel on the sensor object: @@ -105,7 +100,7 @@ } // Set the t0 shift for the sensor. - SvtT0Shift sensorT0Shift = t0Shifts.find(daqPair).get(0); + SvtT0Shift sensorT0Shift = t0Shifts.getT0Shift(daqPair); sensor.setT0Shift(sensorT0Shift.getT0Shift()); } }