java/trunk/conditions/src/main/java/org/hps/conditions/svt
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java 2014-09-11 20:54:57 UTC (rev 1002)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtCalibration.java 2014-09-11 21:00:48 UTC (rev 1003)
@@ -3,12 +3,17 @@
import org.hps.conditions.AbstractConditionsObject;
import org.hps.conditions.ConditionsObjectCollection;
+import static org.hps.conditions.svt.SvtChannel.MAX_NUMBER_OF_SAMPLES;
+
/**
- * This class represents a noise and pedestal measurement for an SVT channel.
+ * This class encapsulates noise and pedestal measurement for an SVT channel.
+ *
* @author Jeremy McCormick <[log in to unmask]>
+ * @author Omar Moreno <[log in to unmask]>
*/
public final class SvtCalibration extends AbstractConditionsObject {
+
public static class SvtCalibrationCollection extends ConditionsObjectCollection<SvtCalibration> {
}
@@ -16,24 +21,30 @@
* Get the channel ID.
* @return The channel ID.
*/
- public int getChannelId() {
- return getFieldValue(Integer.class, "svt_channel_id");
+ public int getChannelID() {
+ return getFieldValue("svt_channel_id");
}
/**
* Get the noise value.
* @return The noise value.
*/
- public double getNoise() {
- return getFieldValue(Double.class, "noise");
+ public double getNoise(int sample) {
+ if(sample < 0 || sample > MAX_NUMBER_OF_SAMPLES){
+ throw new RuntimeException("Sample number is not within range.");
+ }
+ return getFieldValue(Double.class, "noise_" + Integer.toString(sample));
}
/**
* Get the pedestal value.
* @return The pedestal value.
*/
- public double getPedestal() {
- return getFieldValue(Double.class, "pedestal");
+ public double getPedestal(int sample) {
+ if(sample < 0 || sample > MAX_NUMBER_OF_SAMPLES){
+ throw new RuntimeException("Sample number is not within range.");
+ }
+ return getFieldValue(Double.class, "pedestal_" + Integer.toString(sample));
}
/**
@@ -41,6 +52,51 @@
* @return This object converted to a string.
*/
public String toString() {
- return "noise: " + getNoise() + ", pedestal: " + getPedestal();
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Channel ID: " + this.getChannelID());
+ for (int i = 0; i < 115; i++) {
+ buffer.append("-");
+ }
+ buffer.append("Pedestal sample 0:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 1:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 2:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 3:");
+ buffer.append(" ");
+ buffer.append("Pedesdtal sample 4:");
+ buffer.append(" ");
+ buffer.append("Pedestal sample 5:");
+ buffer.append("\n");
+ for (int i = 0; i < 115; i++) {
+ buffer.append("-");
+ }
+ buffer.append("\n");
+ for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
+ buffer.append(this.getPedestal(sample));
+ buffer.append(" ");
+ }
+ buffer.append("Noise sample 0:");
+ buffer.append(" ");
+ buffer.append("Noise sample 1:");
+ buffer.append(" ");
+ buffer.append("Noise sample 2:");
+ buffer.append(" ");
+ buffer.append("Noise sample 3:");
+ buffer.append(" ");
+ buffer.append("Noise sample 4:");
+ buffer.append(" ");
+ buffer.append("Noise sample 5:");
+ buffer.append("\n");
+ for (int i = 0; i < 115; i++) {
+ buffer.append("-");
+ }
+ buffer.append("\n");
+ for(int sample = 0; sample < MAX_NUMBER_OF_SAMPLES; sample++){
+ buffer.append(this.getNoise(sample));
+ buffer.append(" ");
+ }
+ return buffer.toString();
}
}