Commit in projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon on MAIN | |||
HpsSiSensor.java | +75 | -68 | 3312 -> 3313 |
HpsTestRunSiSensor.java | +4 | -4 | 3312 -> 3313 |
+79 | -72 |
Update HpsSiSensor to use new SVT DAQ map. This will temporarily break hps-java.
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java 2014-09-05 22:37:43 UTC (rev 3312) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java 2014-09-06 00:09:00 UTC (rev 3313) @@ -11,27 +11,29 @@
import org.lcsim.detector.identifier.IIdentifierHelper; /**
- * This class extends {@link SiSensor} with information specific to HPS SVT sensors, - * including FPGA and hybrid numbers, as well as time variant conditions data per channel - * such as gain, noise, etc.
+ * This class extends {@link SiSensor} with conditions specific to HPS SVT half-modules + * (sensors) used during the engineering run and beyond. Each half-module is uniquely + * identified by a FEB ID/Hybrid ID pair which is then related to calibration conditions + * such as baseline, noise, gain etc.
* @author Jeremy McCormick <[log in to unmask]>
+ * @author Omar Moreno <[log in to unmask]>
*/ public class HpsSiSensor extends SiSensor {
- /** Hardware setup information. */ - protected int fpga; - protected int hybrid; - public final static int DEFAULT_CHANNELS = 640; - protected int nchannels = DEFAULT_CHANNELS; - - /** Time variant conditions data. */ - Map<Integer,Double> pedestalMap = new HashMap<Integer,Double>(); - Map<Integer,Double> noiseMap = new HashMap<Integer,Double>(); - Map<Integer,Double> offsetMap = new HashMap<Integer,Double>(); - Map<Integer,Double> gainMap = new HashMap<Integer,Double>(); - Map<Integer,double[]> pulseParameterMap = new HashMap<Integer,double[]>();
+ public final static int STRIPS_PER_SENSOR = 639; + public final static int NUMBER_OF_SAMPLES = 6; + + protected int febID; + protected int febHybridID; + + // Conditions maps + Map<Integer, double[]> pedestalMap = new HashMap<Integer, double[]>(); + Map<Integer, double[]> noiseMap = new HashMap<Integer, double[]>(); + Map<Integer, Double> offsetMap = new HashMap<Integer, Double>(); + Map<Integer, Double> gainMap = new HashMap<Integer, Double>(); + Map<Integer, double[]> shapeFitParametersMap = new HashMap<Integer, double[]>();
Set<Integer> badChannels = new HashSet<Integer>();
- double timeShift = Double.NaN;
+ double t0Shift = 0;
/** * This class constructor matches the signature of <code>SiSensor</code>.
@@ -99,21 +101,27 @@
} /**
- * Get the pedestal for the given channel.
+ * Get the pedestal for the given channel and sample number.
* @param channel The channel number.
- * @return The pedestal value for the channel or null if not set.
+ * @param sample The sample number. + * @return The pedestal value for the given channel and sample or null if not set.
*/
- public Double getPedestal(int channel) { - return pedestalMap.get(channel);
+ public Double getPedestal(int channel, int sample) { + if(sample >= NUMBER_OF_SAMPLES) + throw new RuntimeException("The sample number must be less than " + NUMBER_OF_SAMPLES); + return pedestalMap.get(channel)[sample];
} /**
- * Get the noise for the given channel.
+ * Get the noise for the given channel and sample number.
* @param channel The channel number.
- * @return The noise value for the channel or null if not set.
+ * @param sample The sample number. + * @return The noise value for the given channel and sample or null if not set.
*/
- public Double getNoise(int channel) { - return noiseMap.get(channel);
+ public Double getNoise(int channel, int sample) { + if(sample >= NUMBER_OF_SAMPLES) + throw new RuntimeException("The sample number must be less than " + NUMBER_OF_SAMPLES); + return noiseMap.get(channel)[sample];
} /**
@@ -136,14 +144,15 @@
} /**
- * Get the pulse parameters for the given channel.
+ * Get the shape fit results (t0, amplitude, chi2 prob. and errors) + * associated with a given channel.
* @param channel The channel number.
- * @return The pulse parameters for the channel.
+ * @return The shape fit results for the channel.
*/
- public double[] getPulseParameters(int channel) { - return pulseParameterMap.get(channel);
+ public double[] getShapeFitParameters(int channel) { + return shapeFitParametersMap.get(channel);
}
-
+
/** * Get whether the given channel is bad or not. * @param channel The channel number.
@@ -158,7 +167,7 @@
* @return The total number of channels in the sensor. */ public int getNumberOfChannels() {
- return nchannels;
+ return STRIPS_PER_SENSOR;
} /**
@@ -167,23 +176,23 @@
* @return True if channel number is valid; false if not. */ public boolean isValidChannel(int channel) {
- return channel >= 0 && channel < nchannels;
+ return STRIPS_PER_SENSOR >= 0 && channel < STRIPS_PER_SENSOR;
} /** * Get the FPGA number of the sensor. * @return The FPGA number of the sensor. */
- public int getFpgaNumber() { - return fpga;
+ public int getFebID() { + return febID;
} /** * Get the hybrid number of the sensor. * @return The hybrid number of the sensor. */
- public int getHybridNumber() { - return hybrid;
+ public int getFebHybridID() { + return febHybridID;
} /**
@@ -195,11 +204,11 @@
} /**
- * Get the time shift for this sensor. - * @param ts The time shift for this sensor.
+ * Get the t0 shift for this sensor. + * @return The t0 shift for this sensor.
*/
- public double getTimeShift() { - return timeShift;
+ public double getT0Shift() { + return t0Shift;
} /**
@@ -217,20 +226,24 @@
} /**
- * Set the pedestal value for the given channel.
+ * Set the pedestal value for all samples for a given channel.
* @param channel The channel number.
- * @param pedestal The pedestal value.
+ * @param pedestal The pedestal values for all samples.
*/
- public void setPedestal(int channel, double pedestal) {
+ public void setPedestal(int channel, double[] pedestal) {
+ if(pedestal.length > NUMBER_OF_SAMPLES)
+ throw new RuntimeException("The number of pedestal samples must be equal to" + NUMBER_OF_SAMPLES);
pedestalMap.put(channel, pedestal); } /** * Set the noise value for the given channel. * @param channel The channel number.
- * @param noise The noise value.
+ * @param noise The noise values for all samples.
*/
- public void setNoise(int channel, double noise) {
+ public void setNoise(int channel, double[] noise) {
+ if(noise.length > NUMBER_OF_SAMPLES)
+ throw new RuntimeException("The number of pedestal samples must be equal to" + NUMBER_OF_SAMPLES);
noiseMap.put(channel, noise); }
@@ -253,14 +266,14 @@
} /**
- * Set the pulse parameters for the given channel.
+ * Set the shape fit results for the given channel.
* @param channel The channel number.
- * @param pulseParameters The pulse parameters array (should be length 4).
+ * @param shapeFitParameters The shape fit results array (should be length 4).
*/
- public void setPulseParameters(int channel, double[] pulseParameters) { - if (pulseParameters.length != 4) - throw new IllegalArgumentException("PulseParameters is wrong length: " + pulseParameters.length); - pulseParameterMap.put(channel, pulseParameters);
+ public void setShapeFitParameters(int channel, double[] shapeFitParameters) { + if (shapeFitParameters.length != 4) + throw new IllegalArgumentException("Number of shape fit parameters is incorrect: " + shapeFitParameters.length); + shapeFitParametersMap.put(channel, shapeFitParameters);
} /**
@@ -272,35 +285,28 @@
} /**
- * Set the number of channels in this sensor. - * @param nchannels The number of channels in the sensor. - */ - public void setNumberOfChannels(int nchannels) { - this.nchannels = nchannels; - } - - /** - * Set the FPGA number of the sensor.
+ * Set the FEB ID of the sensor.
* @param fpga The FPGA number. */
- public void setFpgaNumber(int fpga) { - this.fpga = fpga;
+ public void setFebID(int febID) { + this.febID = febID;
} /** * Set the hybrid number of the sensor. * @param hybrid The hybrid number. */
- public void setHybridNumber(int hybrid) { - this.hybrid = hybrid;
+ public void setFebHybridID(int febHybridID) { + this.febHybridID = febHybridID;
}
+
/**
- * Get the time shift for this sensor. - * @param ts The time shift for this sensor.
+ * Get the t0 shift for this sensor. + * @param t0Shift The t0 shift for this sensor.
*/
- public void setTimeShift(double timeShift) { - this.timeShift = timeShift;
+ public void setT0Shift(double t0Shift) { + this.t0Shift = t0Shift;
} /**
@@ -312,8 +318,9 @@
pedestalMap.clear(); noiseMap.clear(); offsetMap.clear();
- pulseParameterMap.clear();
+ shapeFitParametersMap.clear();
badChannels.clear(); gainMap.clear();
+ t0Shift = 0;
} }
\ No newline at end of file
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java 2014-09-05 22:37:43 UTC (rev 3312) +++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/tracker/silicon/HpsTestRunSiSensor.java 2014-09-06 00:09:00 UTC (rev 3313) @@ -191,13 +191,13 @@
} /**
- * Get the time shift for this sensor. - * @param ts The time shift for this sensor.
+ * Get the t0 shift for this sensor. + * @return The t0 shift for this sensor.
*/
- public double getTimeShift() {
+ public double getT0Shift() {
return t0Shift; }
-
+
/** * Create an identifier for a channel. * @param channel The channel number.
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1